GeographicLib  1.50.1
Rhumb.hpp
Go to the documentation of this file.
1 /**
2  * \file Rhumb.hpp
3  * \brief Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes
4  *
5  * Copyright (c) Charles Karney (2014-2019) <charles@karney.com> and licensed
6  * under the MIT/X11 License. For more information, see
7  * https://geographiclib.sourceforge.io/
8  **********************************************************************/
9 
10 #if !defined(GEOGRAPHICLIB_RHUMB_HPP)
11 #define GEOGRAPHICLIB_RHUMB_HPP 1
12 
15 
16 #if !defined(GEOGRAPHICLIB_RHUMBAREA_ORDER)
17 /**
18  * The order of the series approximation used in rhumb area calculations.
19  * GEOGRAPHICLIB_RHUMBAREA_ORDER can be set to any integer in [4, 8].
20  **********************************************************************/
21 # define GEOGRAPHICLIB_RHUMBAREA_ORDER \
22  (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \
23  (GEOGRAPHICLIB_PRECISION == 1 ? 4 : 8))
24 #endif
25 
26 namespace GeographicLib {
27 
28  class RhumbLine;
29  template <class T> class PolygonAreaT;
30 
31  /**
32  * \brief Solve of the direct and inverse rhumb problems.
33  *
34  * The path of constant azimuth between two points on a ellipsoid at (\e
35  * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also
36  * called the loxodrome). Its length is \e s12 and its azimuth is \e azi12.
37  * (The azimuth is the heading measured clockwise from north.)
38  *
39  * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2,
40  * and \e lon2. This is the \e direct rhumb problem and its solution is
41  * given by the function Rhumb::Direct.
42  *
43  * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi12
44  * and \e s12. This is the \e inverse rhumb problem, whose solution is given
45  * by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the one
46  * that wraps no more than half way around the earth. If the end points are
47  * on opposite meridians, there are two shortest rhumb lines and the
48  * east-going one is chosen.
49  *
50  * These routines also optionally calculate the area under the rhumb line, \e
51  * S12. This is the area, measured counter-clockwise, of the rhumb line
52  * quadrilateral with corners (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>),
53  * (0,<i>lon2</i>), and (<i>lat2</i>,<i>lon2</i>).
54  *
55  * Note that rhumb lines may be appreciably longer (up to 50%) than the
56  * corresponding Geodesic. For example the distance between London Heathrow
57  * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer than
58  * the geodesic distance 9600 km.
59  *
60  * For more information on rhumb lines see \ref rhumb.
61  *
62  * Example of use:
63  * \include example-Rhumb.cpp
64  **********************************************************************/
65 
67  private:
68  typedef Math::real real;
69  friend class RhumbLine;
70  template <class T> friend class PolygonAreaT;
71  Ellipsoid _ell;
72  bool _exact;
73  real _c2;
74  static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER;
75  static const int maxpow_ = GEOGRAPHICLIB_RHUMBAREA_ORDER;
76  // _R[0] unused
77  real _R[maxpow_ + 1];
78  static real gd(real x)
79  { using std::atan; using std::sinh; return atan(sinh(x)); }
80 
81  // Use divided differences to determine (mu2 - mu1) / (psi2 - psi1)
82  // accurately
83  //
84  // Definition: Df(x,y,d) = (f(x) - f(y)) / (x - y)
85  // See:
86  // W. M. Kahan and R. J. Fateman,
87  // Symbolic computation of divided differences,
88  // SIGSAM Bull. 33(3), 7-28 (1999)
89  // https://doi.org/10.1145/334714.334716
90  // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
91 
92  static real Dlog(real x, real y) {
93  using std::sqrt;
94  real t = x - y;
95  // Change
96  //
97  // atanh(t / (x + y))
98  //
99  // to
100  //
101  // asinh(t / (2 * sqrt(x*y)))
102  //
103  // to avoid taking atanh(1) when x is large and y is 1. N.B., this
104  // routine is invoked with positive x and y, so no need to guard against
105  // taking the sqrt of a negative quantity. This fixes bogus results for
106  // the area being returning when an endpoint is at a pole.
107  return t != 0 ? 2 * Math::asinh(t / (2 * sqrt(x*y))) / t : 1 / x;
108  }
109  // N.B., x and y are in degrees
110  static real Dtan(real x, real y) {
111  real d = x - y, tx = Math::tand(x), ty = Math::tand(y), txy = tx * ty;
112  return d != 0 ?
113  (2 * txy > -1 ? (1 + txy) * Math::tand(d) : tx - ty) /
114  (d * Math::degree()) :
115  1 + txy;
116  }
117  static real Datan(real x, real y) {
118  using std::atan;
119  real d = x - y, xy = x * y;
120  return d != 0 ?
121  (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d :
122  1 / (1 + xy);
123  }
124  static real Dsin(real x, real y) {
125  using std::sin; using std::cos;
126  real d = (x - y) / 2;
127  return cos((x + y)/2) * (d != 0 ? sin(d) / d : 1);
128  }
129  static real Dsinh(real x, real y) {
130  using std::sinh; using std::cosh;
131  real d = (x - y) / 2;
132  return cosh((x + y) / 2) * (d != 0 ? sinh(d) / d : 1);
133  }
134  static real Dcosh(real x, real y) {
135  using std::sinh;
136  real d = (x - y) / 2;
137  return sinh((x + y) / 2) * (d != 0 ? sinh(d) / d : 1);
138  }
139  static real Dasinh(real x, real y) {
140  real d = x - y,
141  hx = Math::hypot(real(1), x), hy = Math::hypot(real(1), y);
142  return d != 0 ?
143  Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : x*hy - y*hx) / d :
144  1 / hx;
145  }
146  static real Dgd(real x, real y) {
147  using std::sinh;
148  return Datan(sinh(x), sinh(y)) * Dsinh(x, y);
149  }
150  // N.B., x and y are the tangents of the angles
151  static real Dgdinv(real x, real y)
152  { return Dasinh(x, y) / Datan(x, y); }
153  // Copied from LambertConformalConic...
154  // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y)
155  real Deatanhe(real x, real y) const {
156  real t = x - y, d = 1 - _ell._e2 * x * y;
157  return t != 0 ? Math::eatanhe(t / d, _ell._es) / t : _ell._e2 / d;
158  }
159  // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd kind
160  real DE(real x, real y) const;
161  // (mux - muy) / (phix - phiy) using elliptic integrals
162  real DRectifying(real latx, real laty) const;
163  // (psix - psiy) / (phix - phiy)
164  real DIsometric(real latx, real laty) const;
165 
166  // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y)
167  static real SinCosSeries(bool sinp,
168  real x, real y, const real c[], int n);
169  // (mux - muy) / (chix - chiy) using Krueger's series
170  real DConformalToRectifying(real chix, real chiy) const;
171  // (chix - chiy) / (mux - muy) using Krueger's series
172  real DRectifyingToConformal(real mux, real muy) const;
173 
174  // (mux - muy) / (psix - psiy)
175  // N.B., psix and psiy are in degrees
176  real DIsometricToRectifying(real psix, real psiy) const;
177  // (psix - psiy) / (mux - muy)
178  real DRectifyingToIsometric(real mux, real muy) const;
179 
180  real MeanSinXi(real psi1, real psi2) const;
181 
182  // The following two functions (with lots of ignored arguments) mimic the
183  // interface to the corresponding Geodesic function. These are needed by
184  // PolygonAreaT.
185  void GenDirect(real lat1, real lon1, real azi12,
186  bool, real s12, unsigned outmask,
187  real& lat2, real& lon2, real&, real&, real&, real&, real&,
188  real& S12) const {
189  GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12);
190  }
191  void GenInverse(real lat1, real lon1, real lat2, real lon2,
192  unsigned outmask, real& s12, real& azi12,
193  real&, real& , real& , real& , real& S12) const {
194  GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12);
195  }
196  public:
197 
198  /**
199  * Bit masks for what calculations to do. They specify which results to
200  * return in the general routines Rhumb::GenDirect and Rhumb::GenInverse
201  * routines. RhumbLine::mask is a duplication of this enum.
202  **********************************************************************/
203  enum mask {
204  /**
205  * No output.
206  * @hideinitializer
207  **********************************************************************/
208  NONE = 0U,
209  /**
210  * Calculate latitude \e lat2.
211  * @hideinitializer
212  **********************************************************************/
213  LATITUDE = 1U<<7,
214  /**
215  * Calculate longitude \e lon2.
216  * @hideinitializer
217  **********************************************************************/
218  LONGITUDE = 1U<<8,
219  /**
220  * Calculate azimuth \e azi12.
221  * @hideinitializer
222  **********************************************************************/
223  AZIMUTH = 1U<<9,
224  /**
225  * Calculate distance \e s12.
226  * @hideinitializer
227  **********************************************************************/
228  DISTANCE = 1U<<10,
229  /**
230  * Calculate area \e S12.
231  * @hideinitializer
232  **********************************************************************/
233  AREA = 1U<<14,
234  /**
235  * Unroll \e lon2 in the direct calculation.
236  * @hideinitializer
237  **********************************************************************/
238  LONG_UNROLL = 1U<<15,
239  /**
240  * Calculate everything. (LONG_UNROLL is not included in this mask.)
241  * @hideinitializer
242  **********************************************************************/
243  ALL = 0x7F80U,
244  };
245 
246  /**
247  * Constructor for a ellipsoid with
248  *
249  * @param[in] a equatorial radius (meters).
250  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
251  * Negative \e f gives a prolate ellipsoid.
252  * @param[in] exact if true (the default) use an addition theorem for
253  * elliptic integrals to compute divided differences; otherwise use
254  * series expansion (accurate for |<i>f</i>| < 0.01).
255  * @exception GeographicErr if \e a or (1 &minus; \e f) \e a is not
256  * positive.
257  *
258  * See \ref rhumb, for a detailed description of the \e exact parameter.
259  **********************************************************************/
260  Rhumb(real a, real f, bool exact = true);
261 
262  /**
263  * Solve the direct rhumb problem returning also the area.
264  *
265  * @param[in] lat1 latitude of point 1 (degrees).
266  * @param[in] lon1 longitude of point 1 (degrees).
267  * @param[in] azi12 azimuth of the rhumb line (degrees).
268  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
269  * negative.
270  * @param[out] lat2 latitude of point 2 (degrees).
271  * @param[out] lon2 longitude of point 2 (degrees).
272  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
273  *
274  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]. The value of
275  * \e lon2 returned is in the range [&minus;180&deg;, 180&deg;].
276  *
277  * If point 1 is a pole, the cosine of its latitude is taken to be
278  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
279  * position, which is extremely close to the actual pole, allows the
280  * calculation to be carried out in finite terms. If \e s12 is large
281  * enough that the rhumb line crosses a pole, the longitude of point 2
282  * is indeterminate (a NaN is returned for \e lon2 and \e S12).
283  **********************************************************************/
284  void Direct(real lat1, real lon1, real azi12, real s12,
285  real& lat2, real& lon2, real& S12) const {
286  GenDirect(lat1, lon1, azi12, s12,
287  LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
288  }
289 
290  /**
291  * Solve the direct rhumb problem without the area.
292  **********************************************************************/
293  void Direct(real lat1, real lon1, real azi12, real s12,
294  real& lat2, real& lon2) const {
295  real t;
296  GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t);
297  }
298 
299  /**
300  * The general direct rhumb problem. Rhumb::Direct is defined in terms
301  * of this function.
302  *
303  * @param[in] lat1 latitude of point 1 (degrees).
304  * @param[in] lon1 longitude of point 1 (degrees).
305  * @param[in] azi12 azimuth of the rhumb line (degrees).
306  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
307  * negative.
308  * @param[in] outmask a bitor'ed combination of Rhumb::mask values
309  * specifying which of the following parameters should be set.
310  * @param[out] lat2 latitude of point 2 (degrees).
311  * @param[out] lon2 longitude of point 2 (degrees).
312  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
313  *
314  * The Rhumb::mask values possible for \e outmask are
315  * - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2;
316  * - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2;
317  * - \e outmask |= Rhumb::AREA for the area \e S12;
318  * - \e outmask |= Rhumb::ALL for all of the above;
319  * - \e outmask |= Rhumb::LONG_UNROLL to unroll \e lon2 instead of wrapping
320  * it into the range [&minus;180&deg;, 180&deg;].
321  * .
322  * With the Rhumb::LONG_UNROLL bit set, the quantity \e lon2 &minus;
323  * \e lon1 indicates how many times and in what sense the rhumb line
324  * encircles the ellipsoid.
325  **********************************************************************/
326  void GenDirect(real lat1, real lon1, real azi12, real s12,
327  unsigned outmask, real& lat2, real& lon2, real& S12) const;
328 
329  /**
330  * Solve the inverse rhumb problem returning also the area.
331  *
332  * @param[in] lat1 latitude of point 1 (degrees).
333  * @param[in] lon1 longitude of point 1 (degrees).
334  * @param[in] lat2 latitude of point 2 (degrees).
335  * @param[in] lon2 longitude of point 2 (degrees).
336  * @param[out] s12 rhumb distance between point 1 and point 2 (meters).
337  * @param[out] azi12 azimuth of the rhumb line (degrees).
338  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
339  *
340  * The shortest rhumb line is found. If the end points are on opposite
341  * meridians, there are two shortest rhumb lines and the east-going one is
342  * chosen. \e lat1 and \e lat2 should be in the range [&minus;90&deg;,
343  * 90&deg;]. The value of \e azi12 returned is in the range
344  * [&minus;180&deg;, 180&deg;].
345  *
346  * If either point is a pole, the cosine of its latitude is taken to be
347  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
348  * position, which is extremely close to the actual pole, allows the
349  * calculation to be carried out in finite terms.
350  **********************************************************************/
351  void Inverse(real lat1, real lon1, real lat2, real lon2,
352  real& s12, real& azi12, real& S12) const {
353  GenInverse(lat1, lon1, lat2, lon2,
354  DISTANCE | AZIMUTH | AREA, s12, azi12, S12);
355  }
356 
357  /**
358  * Solve the inverse rhumb problem without the area.
359  **********************************************************************/
360  void Inverse(real lat1, real lon1, real lat2, real lon2,
361  real& s12, real& azi12) const {
362  real t;
363  GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t);
364  }
365 
366  /**
367  * The general inverse rhumb problem. Rhumb::Inverse is defined in terms
368  * of this function.
369  *
370  * @param[in] lat1 latitude of point 1 (degrees).
371  * @param[in] lon1 longitude of point 1 (degrees).
372  * @param[in] lat2 latitude of point 2 (degrees).
373  * @param[in] lon2 longitude of point 2 (degrees).
374  * @param[in] outmask a bitor'ed combination of Rhumb::mask values
375  * specifying which of the following parameters should be set.
376  * @param[out] s12 rhumb distance between point 1 and point 2 (meters).
377  * @param[out] azi12 azimuth of the rhumb line (degrees).
378  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
379  *
380  * The Rhumb::mask values possible for \e outmask are
381  * - \e outmask |= Rhumb::DISTANCE for the latitude \e s12;
382  * - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12;
383  * - \e outmask |= Rhumb::AREA for the area \e S12;
384  * - \e outmask |= Rhumb::ALL for all of the above;
385  **********************************************************************/
386  void GenInverse(real lat1, real lon1, real lat2, real lon2,
387  unsigned outmask,
388  real& s12, real& azi12, real& S12) const;
389 
390  /**
391  * Set up to compute several points on a single rhumb line.
392  *
393  * @param[in] lat1 latitude of point 1 (degrees).
394  * @param[in] lon1 longitude of point 1 (degrees).
395  * @param[in] azi12 azimuth of the rhumb line (degrees).
396  * @return a RhumbLine object.
397  *
398  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
399  *
400  * If point 1 is a pole, the cosine of its latitude is taken to be
401  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
402  * position, which is extremely close to the actual pole, allows the
403  * calculation to be carried out in finite terms.
404  **********************************************************************/
405  RhumbLine Line(real lat1, real lon1, real azi12) const;
406 
407  /** \name Inspector functions.
408  **********************************************************************/
409  ///@{
410 
411  /**
412  * @return \e a the equatorial radius of the ellipsoid (meters). This is
413  * the value used in the constructor.
414  **********************************************************************/
415  Math::real EquatorialRadius() const { return _ell.EquatorialRadius(); }
416 
417  /**
418  * @return \e f the flattening of the ellipsoid. This is the
419  * value used in the constructor.
420  **********************************************************************/
421  Math::real Flattening() const { return _ell.Flattening(); }
422 
423  /**
424  * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
425  * polygon encircling a pole can be found by adding
426  * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
427  * polygon.
428  **********************************************************************/
429  Math::real EllipsoidArea() const { return _ell.Area(); }
430 
431  /**
432  * \deprecated An old name for EquatorialRadius().
433  **********************************************************************/
434  // GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()")
435  Math::real MajorRadius() const { return EquatorialRadius(); }
436  ///@}
437 
438  /**
439  * A global instantiation of Rhumb with the parameters for the WGS84
440  * ellipsoid.
441  **********************************************************************/
442  static const Rhumb& WGS84();
443  };
444 
445  /**
446  * \brief Find a sequence of points on a single rhumb line.
447  *
448  * RhumbLine facilitates the determination of a series of points on a single
449  * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e
450  * azi12 are specified in the call to Rhumb::Line which returns a RhumbLine
451  * object. RhumbLine.Position returns the location of point 2 (and,
452  * optionally, the corresponding area, \e S12) a distance \e s12 along the
453  * rhumb line.
454  *
455  * There is no public constructor for this class. (Use Rhumb::Line to create
456  * an instance.) The Rhumb object used to create a RhumbLine must stay in
457  * scope as long as the RhumbLine.
458  *
459  * Example of use:
460  * \include example-RhumbLine.cpp
461  **********************************************************************/
462 
464  private:
465  typedef Math::real real;
466  friend class Rhumb;
467  const Rhumb& _rh;
468  bool _exact;
469  real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
470  RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed
471  RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12,
472  bool exact);
473  public:
474 
475  /**
476  * This is a duplication of Rhumb::mask.
477  **********************************************************************/
478  enum mask {
479  /**
480  * No output.
481  * @hideinitializer
482  **********************************************************************/
483  NONE = Rhumb::NONE,
484  /**
485  * Calculate latitude \e lat2.
486  * @hideinitializer
487  **********************************************************************/
488  LATITUDE = Rhumb::LATITUDE,
489  /**
490  * Calculate longitude \e lon2.
491  * @hideinitializer
492  **********************************************************************/
493  LONGITUDE = Rhumb::LONGITUDE,
494  /**
495  * Calculate azimuth \e azi12.
496  * @hideinitializer
497  **********************************************************************/
498  AZIMUTH = Rhumb::AZIMUTH,
499  /**
500  * Calculate distance \e s12.
501  * @hideinitializer
502  **********************************************************************/
503  DISTANCE = Rhumb::DISTANCE,
504  /**
505  * Calculate area \e S12.
506  * @hideinitializer
507  **********************************************************************/
508  AREA = Rhumb::AREA,
509  /**
510  * Unroll \e lon2 in the direct calculation.
511  * @hideinitializer
512  **********************************************************************/
513  LONG_UNROLL = Rhumb::LONG_UNROLL,
514  /**
515  * Calculate everything. (LONG_UNROLL is not included in this mask.)
516  * @hideinitializer
517  **********************************************************************/
518  ALL = Rhumb::ALL,
519  };
520 
521  /**
522  * Compute the position of point 2 which is a distance \e s12 (meters) from
523  * point 1. The area is also computed.
524  *
525  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
526  * negative.
527  * @param[out] lat2 latitude of point 2 (degrees).
528  * @param[out] lon2 longitude of point 2 (degrees).
529  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
530  *
531  * The value of \e lon2 returned is in the range [&minus;180&deg;,
532  * 180&deg;].
533  *
534  * If \e s12 is large enough that the rhumb line crosses a pole, the
535  * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and
536  * \e S12).
537  **********************************************************************/
538  void Position(real s12, real& lat2, real& lon2, real& S12) const {
539  GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
540  }
541 
542  /**
543  * Compute the position of point 2 which is a distance \e s12 (meters) from
544  * point 1. The area is not computed.
545  **********************************************************************/
546  void Position(real s12, real& lat2, real& lon2) const {
547  real t;
548  GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t);
549  }
550 
551  /**
552  * The general position routine. RhumbLine::Position is defined in term so
553  * this function.
554  *
555  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
556  * negative.
557  * @param[in] outmask a bitor'ed combination of RhumbLine::mask values
558  * specifying which of the following parameters should be set.
559  * @param[out] lat2 latitude of point 2 (degrees).
560  * @param[out] lon2 longitude of point 2 (degrees).
561  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
562  *
563  * The RhumbLine::mask values possible for \e outmask are
564  * - \e outmask |= RhumbLine::LATITUDE for the latitude \e lat2;
565  * - \e outmask |= RhumbLine::LONGITUDE for the latitude \e lon2;
566  * - \e outmask |= RhumbLine::AREA for the area \e S12;
567  * - \e outmask |= RhumbLine::ALL for all of the above;
568  * - \e outmask |= RhumbLine::LONG_UNROLL to unroll \e lon2 instead of
569  * wrapping it into the range [&minus;180&deg;, 180&deg;].
570  * .
571  * With the RhumbLine::LONG_UNROLL bit set, the quantity \e lon2 &minus; \e
572  * lon1 indicates how many times and in what sense the rhumb line encircles
573  * the ellipsoid.
574  *
575  * If \e s12 is large enough that the rhumb line crosses a pole, the
576  * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and
577  * \e S12).
578  **********************************************************************/
579  void GenPosition(real s12, unsigned outmask,
580  real& lat2, real& lon2, real& S12) const;
581 
582  /** \name Inspector functions
583  **********************************************************************/
584  ///@{
585 
586  /**
587  * @return \e lat1 the latitude of point 1 (degrees).
588  **********************************************************************/
589  Math::real Latitude() const { return _lat1; }
590 
591  /**
592  * @return \e lon1 the longitude of point 1 (degrees).
593  **********************************************************************/
594  Math::real Longitude() const { return _lon1; }
595 
596  /**
597  * @return \e azi12 the azimuth of the rhumb line (degrees).
598  **********************************************************************/
599  Math::real Azimuth() const { return _azi12; }
600 
601  /**
602  * @return \e a the equatorial radius of the ellipsoid (meters). This is
603  * the value inherited from the Rhumb object used in the constructor.
604  **********************************************************************/
605  Math::real EquatorialRadius() const { return _rh.EquatorialRadius(); }
606 
607  /**
608  * @return \e f the flattening of the ellipsoid. This is the value
609  * inherited from the Rhumb object used in the constructor.
610  **********************************************************************/
611  Math::real Flattening() const { return _rh.Flattening(); }
612  };
613 
614 } // namespace GeographicLib
615 
616 #endif // GEOGRAPHICLIB_RHUMB_HPP
real
GeographicLib::Math::real real
Definition: GeodSolve.cpp:31
GeographicLib::Rhumb::Direct
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2) const
Definition: Rhumb.hpp:293
GeographicLib::Rhumb::EllipsoidArea
Math::real EllipsoidArea() const
Definition: Rhumb.hpp:429
GeographicLib::Rhumb::MajorRadius
Math::real MajorRadius() const
Definition: Rhumb.hpp:435
GEOGRAPHICLIB_RHUMBAREA_ORDER
#define GEOGRAPHICLIB_RHUMBAREA_ORDER
Definition: Rhumb.hpp:21
GeographicLib::Rhumb::mask
mask
Definition: Rhumb.hpp:203
GeographicLib
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
GeographicLib::Rhumb::ALL
Definition: Rhumb.hpp:243
GeographicLib::Ellipsoid::Flattening
Math::real Flattening() const
Definition: Ellipsoid.hpp:126
GeographicLib::Rhumb
Solve of the direct and inverse rhumb problems.
Definition: Rhumb.hpp:66
GeographicLib::Math::tand
static T tand(T x)
Definition: Math.cpp:303
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:92
GeographicLib::Rhumb::Inverse
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const
Definition: Rhumb.hpp:351
GeographicLib::Rhumb::Direct
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:284
GeographicLib::Rhumb::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Rhumb.hpp:415
GeographicLib::Math::real
double real
Definition: Math.hpp:121
GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER
#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER
Definition: TransverseMercator.hpp:20
GeographicLib::PolygonAreaT
Polygon areas.
Definition: PolygonArea.hpp:69
GeographicLib::Rhumb::AREA
Definition: Rhumb.hpp:233
GeographicLib::Ellipsoid::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Ellipsoid.hpp:80
GeographicLib::RhumbLine::Flattening
Math::real Flattening() const
Definition: Rhumb.hpp:611
GeographicLib::Rhumb::NONE
Definition: Rhumb.hpp:208
GeographicLib::Rhumb::Inverse
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12) const
Definition: Rhumb.hpp:360
GeographicLib::Rhumb::LATITUDE
Definition: Rhumb.hpp:213
GeographicLib::Math::hypot
static T hypot(T x, T y)
Definition: Math.cpp:58
GeographicLib::RhumbLine::mask
mask
Definition: Rhumb.hpp:478
GeographicLib::Rhumb::AZIMUTH
Definition: Rhumb.hpp:223
GeographicLib::RhumbLine::Latitude
Math::real Latitude() const
Definition: Rhumb.hpp:589
Constants.hpp
Header for GeographicLib::Constants class.
GeographicLib::RhumbLine
Find a sequence of points on a single rhumb line.
Definition: Rhumb.hpp:463
GeographicLib::Rhumb::LONGITUDE
Definition: Rhumb.hpp:218
GeographicLib::RhumbLine::Position
void Position(real s12, real &lat2, real &lon2) const
Definition: Rhumb.hpp:546
GeographicLib::Rhumb::DISTANCE
Definition: Rhumb.hpp:228
GeographicLib::RhumbLine::Longitude
Math::real Longitude() const
Definition: Rhumb.hpp:594
Ellipsoid.hpp
Header for GeographicLib::Ellipsoid class.
GeographicLib::Rhumb::Flattening
Math::real Flattening() const
Definition: Rhumb.hpp:421
GeographicLib::RhumbLine::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Rhumb.hpp:605
GeographicLib::RhumbLine::Position
void Position(real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:538
GeographicLib::Rhumb::LONG_UNROLL
Definition: Rhumb.hpp:238
GeographicLib::Math::eatanhe
static T eatanhe(T x, T es)
Definition: Math.cpp:337
GeographicLib::Ellipsoid
Properties of an ellipsoid.
Definition: Ellipsoid.hpp:39
GeographicLib::Ellipsoid::Area
Math::real Area() const
Definition: Ellipsoid.cpp:40
GeographicLib::Math::asinh
static T asinh(T x)
Definition: Math.cpp:102
GeographicLib::RhumbLine::Azimuth
Math::real Azimuth() const
Definition: Rhumb.hpp:599