GeographicLib  1.51
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-2020) <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; using std::asinh;
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 * 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  using std::asinh; using std::hypot;
141  real d = x - y,
142  hx = hypot(real(1), x), hy = hypot(real(1), y);
143  return d != 0 ?
144  asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : x*hy - y*hx) / d :
145  1 / hx;
146  }
147  static real Dgd(real x, real y) {
148  using std::sinh;
149  return Datan(sinh(x), sinh(y)) * Dsinh(x, y);
150  }
151  // N.B., x and y are the tangents of the angles
152  static real Dgdinv(real x, real y)
153  { return Dasinh(x, y) / Datan(x, y); }
154  // Copied from LambertConformalConic...
155  // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y)
156  real Deatanhe(real x, real y) const {
157  real t = x - y, d = 1 - _ell._e2 * x * y;
158  return t != 0 ? Math::eatanhe(t / d, _ell._es) / t : _ell._e2 / d;
159  }
160  // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd kind
161  real DE(real x, real y) const;
162  // (mux - muy) / (phix - phiy) using elliptic integrals
163  real DRectifying(real latx, real laty) const;
164  // (psix - psiy) / (phix - phiy)
165  real DIsometric(real latx, real laty) const;
166 
167  // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y)
168  static real SinCosSeries(bool sinp,
169  real x, real y, const real c[], int n);
170  // (mux - muy) / (chix - chiy) using Krueger's series
171  real DConformalToRectifying(real chix, real chiy) const;
172  // (chix - chiy) / (mux - muy) using Krueger's series
173  real DRectifyingToConformal(real mux, real muy) const;
174 
175  // (mux - muy) / (psix - psiy)
176  // N.B., psix and psiy are in degrees
177  real DIsometricToRectifying(real psix, real psiy) const;
178  // (psix - psiy) / (mux - muy)
179  real DRectifyingToIsometric(real mux, real muy) const;
180 
181  real MeanSinXi(real psi1, real psi2) const;
182 
183  // The following two functions (with lots of ignored arguments) mimic the
184  // interface to the corresponding Geodesic function. These are needed by
185  // PolygonAreaT.
186  void GenDirect(real lat1, real lon1, real azi12,
187  bool, real s12, unsigned outmask,
188  real& lat2, real& lon2, real&, real&, real&, real&, real&,
189  real& S12) const {
190  GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12);
191  }
192  void GenInverse(real lat1, real lon1, real lat2, real lon2,
193  unsigned outmask, real& s12, real& azi12,
194  real&, real& , real& , real& , real& S12) const {
195  GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12);
196  }
197  public:
198 
199  /**
200  * Bit masks for what calculations to do. They specify which results to
201  * return in the general routines Rhumb::GenDirect and Rhumb::GenInverse
202  * routines. RhumbLine::mask is a duplication of this enum.
203  **********************************************************************/
204  enum mask {
205  /**
206  * No output.
207  * @hideinitializer
208  **********************************************************************/
209  NONE = 0U,
210  /**
211  * Calculate latitude \e lat2.
212  * @hideinitializer
213  **********************************************************************/
214  LATITUDE = 1U<<7,
215  /**
216  * Calculate longitude \e lon2.
217  * @hideinitializer
218  **********************************************************************/
219  LONGITUDE = 1U<<8,
220  /**
221  * Calculate azimuth \e azi12.
222  * @hideinitializer
223  **********************************************************************/
224  AZIMUTH = 1U<<9,
225  /**
226  * Calculate distance \e s12.
227  * @hideinitializer
228  **********************************************************************/
229  DISTANCE = 1U<<10,
230  /**
231  * Calculate area \e S12.
232  * @hideinitializer
233  **********************************************************************/
234  AREA = 1U<<14,
235  /**
236  * Unroll \e lon2 in the direct calculation.
237  * @hideinitializer
238  **********************************************************************/
239  LONG_UNROLL = 1U<<15,
240  /**
241  * Calculate everything. (LONG_UNROLL is not included in this mask.)
242  * @hideinitializer
243  **********************************************************************/
244  ALL = 0x7F80U,
245  };
246 
247  /**
248  * Constructor for a ellipsoid with
249  *
250  * @param[in] a equatorial radius (meters).
251  * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
252  * Negative \e f gives a prolate ellipsoid.
253  * @param[in] exact if true (the default) use an addition theorem for
254  * elliptic integrals to compute divided differences; otherwise use
255  * series expansion (accurate for |<i>f</i>| < 0.01).
256  * @exception GeographicErr if \e a or (1 &minus; \e f) \e a is not
257  * positive.
258  *
259  * See \ref rhumb, for a detailed description of the \e exact parameter.
260  **********************************************************************/
261  Rhumb(real a, real f, bool exact = true);
262 
263  /**
264  * Solve the direct rhumb problem returning also the area.
265  *
266  * @param[in] lat1 latitude of point 1 (degrees).
267  * @param[in] lon1 longitude of point 1 (degrees).
268  * @param[in] azi12 azimuth of the rhumb line (degrees).
269  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
270  * negative.
271  * @param[out] lat2 latitude of point 2 (degrees).
272  * @param[out] lon2 longitude of point 2 (degrees).
273  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
274  *
275  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]. The value of
276  * \e lon2 returned is in the range [&minus;180&deg;, 180&deg;].
277  *
278  * If point 1 is a pole, the cosine of its latitude is taken to be
279  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
280  * position, which is extremely close to the actual pole, allows the
281  * calculation to be carried out in finite terms. If \e s12 is large
282  * enough that the rhumb line crosses a pole, the longitude of point 2
283  * is indeterminate (a NaN is returned for \e lon2 and \e S12).
284  **********************************************************************/
285  void Direct(real lat1, real lon1, real azi12, real s12,
286  real& lat2, real& lon2, real& S12) const {
287  GenDirect(lat1, lon1, azi12, s12,
288  LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
289  }
290 
291  /**
292  * Solve the direct rhumb problem without the area.
293  **********************************************************************/
294  void Direct(real lat1, real lon1, real azi12, real s12,
295  real& lat2, real& lon2) const {
296  real t;
297  GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t);
298  }
299 
300  /**
301  * The general direct rhumb problem. Rhumb::Direct is defined in terms
302  * of this function.
303  *
304  * @param[in] lat1 latitude of point 1 (degrees).
305  * @param[in] lon1 longitude of point 1 (degrees).
306  * @param[in] azi12 azimuth of the rhumb line (degrees).
307  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
308  * negative.
309  * @param[in] outmask a bitor'ed combination of Rhumb::mask values
310  * specifying which of the following parameters should be set.
311  * @param[out] lat2 latitude of point 2 (degrees).
312  * @param[out] lon2 longitude of point 2 (degrees).
313  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
314  *
315  * The Rhumb::mask values possible for \e outmask are
316  * - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2;
317  * - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2;
318  * - \e outmask |= Rhumb::AREA for the area \e S12;
319  * - \e outmask |= Rhumb::ALL for all of the above;
320  * - \e outmask |= Rhumb::LONG_UNROLL to unroll \e lon2 instead of wrapping
321  * it into the range [&minus;180&deg;, 180&deg;].
322  * .
323  * With the Rhumb::LONG_UNROLL bit set, the quantity \e lon2 &minus;
324  * \e lon1 indicates how many times and in what sense the rhumb line
325  * encircles the ellipsoid.
326  **********************************************************************/
327  void GenDirect(real lat1, real lon1, real azi12, real s12,
328  unsigned outmask, real& lat2, real& lon2, real& S12) const;
329 
330  /**
331  * Solve the inverse rhumb problem returning also the area.
332  *
333  * @param[in] lat1 latitude of point 1 (degrees).
334  * @param[in] lon1 longitude of point 1 (degrees).
335  * @param[in] lat2 latitude of point 2 (degrees).
336  * @param[in] lon2 longitude of point 2 (degrees).
337  * @param[out] s12 rhumb distance between point 1 and point 2 (meters).
338  * @param[out] azi12 azimuth of the rhumb line (degrees).
339  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
340  *
341  * The shortest rhumb line is found. If the end points are on opposite
342  * meridians, there are two shortest rhumb lines and the east-going one is
343  * chosen. \e lat1 and \e lat2 should be in the range [&minus;90&deg;,
344  * 90&deg;]. The value of \e azi12 returned is in the range
345  * [&minus;180&deg;, 180&deg;].
346  *
347  * If either point is a pole, the cosine of its latitude is taken to be
348  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
349  * position, which is extremely close to the actual pole, allows the
350  * calculation to be carried out in finite terms.
351  **********************************************************************/
352  void Inverse(real lat1, real lon1, real lat2, real lon2,
353  real& s12, real& azi12, real& S12) const {
354  GenInverse(lat1, lon1, lat2, lon2,
355  DISTANCE | AZIMUTH | AREA, s12, azi12, S12);
356  }
357 
358  /**
359  * Solve the inverse rhumb problem without the area.
360  **********************************************************************/
361  void Inverse(real lat1, real lon1, real lat2, real lon2,
362  real& s12, real& azi12) const {
363  real t;
364  GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t);
365  }
366 
367  /**
368  * The general inverse rhumb problem. Rhumb::Inverse is defined in terms
369  * of this function.
370  *
371  * @param[in] lat1 latitude of point 1 (degrees).
372  * @param[in] lon1 longitude of point 1 (degrees).
373  * @param[in] lat2 latitude of point 2 (degrees).
374  * @param[in] lon2 longitude of point 2 (degrees).
375  * @param[in] outmask a bitor'ed combination of Rhumb::mask values
376  * specifying which of the following parameters should be set.
377  * @param[out] s12 rhumb distance between point 1 and point 2 (meters).
378  * @param[out] azi12 azimuth of the rhumb line (degrees).
379  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
380  *
381  * The Rhumb::mask values possible for \e outmask are
382  * - \e outmask |= Rhumb::DISTANCE for the latitude \e s12;
383  * - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12;
384  * - \e outmask |= Rhumb::AREA for the area \e S12;
385  * - \e outmask |= Rhumb::ALL for all of the above;
386  **********************************************************************/
387  void GenInverse(real lat1, real lon1, real lat2, real lon2,
388  unsigned outmask,
389  real& s12, real& azi12, real& S12) const;
390 
391  /**
392  * Set up to compute several points on a single rhumb line.
393  *
394  * @param[in] lat1 latitude of point 1 (degrees).
395  * @param[in] lon1 longitude of point 1 (degrees).
396  * @param[in] azi12 azimuth of the rhumb line (degrees).
397  * @return a RhumbLine object.
398  *
399  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
400  *
401  * If point 1 is a pole, the cosine of its latitude is taken to be
402  * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
403  * position, which is extremely close to the actual pole, allows the
404  * calculation to be carried out in finite terms.
405  **********************************************************************/
406  RhumbLine Line(real lat1, real lon1, real azi12) const;
407 
408  /** \name Inspector functions.
409  **********************************************************************/
410  ///@{
411 
412  /**
413  * @return \e a the equatorial radius of the ellipsoid (meters). This is
414  * the value used in the constructor.
415  **********************************************************************/
416  Math::real EquatorialRadius() const { return _ell.EquatorialRadius(); }
417 
418  /**
419  * @return \e f the flattening of the ellipsoid. This is the
420  * value used in the constructor.
421  **********************************************************************/
422  Math::real Flattening() const { return _ell.Flattening(); }
423 
424  /**
425  * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
426  * polygon encircling a pole can be found by adding
427  * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
428  * polygon.
429  **********************************************************************/
430  Math::real EllipsoidArea() const { return _ell.Area(); }
431 
432  /**
433  * \deprecated An old name for EquatorialRadius().
434  **********************************************************************/
435  GEOGRAPHICLIB_DEPRECATED("Use EquatorialRadius()")
436  Math::real MajorRadius() const { return EquatorialRadius(); }
437  ///@}
438 
439  /**
440  * A global instantiation of Rhumb with the parameters for the WGS84
441  * ellipsoid.
442  **********************************************************************/
443  static const Rhumb& WGS84();
444  };
445 
446  /**
447  * \brief Find a sequence of points on a single rhumb line.
448  *
449  * RhumbLine facilitates the determination of a series of points on a single
450  * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e
451  * azi12 are specified in the call to Rhumb::Line which returns a RhumbLine
452  * object. RhumbLine.Position returns the location of point 2 (and,
453  * optionally, the corresponding area, \e S12) a distance \e s12 along the
454  * rhumb line.
455  *
456  * There is no public constructor for this class. (Use Rhumb::Line to create
457  * an instance.) The Rhumb object used to create a RhumbLine must stay in
458  * scope as long as the RhumbLine.
459  *
460  * Example of use:
461  * \include example-RhumbLine.cpp
462  **********************************************************************/
463 
465  private:
466  typedef Math::real real;
467  friend class Rhumb;
468  const Rhumb& _rh;
469  bool _exact;
470  real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
471  RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed
472  RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12,
473  bool exact);
474  public:
475 
476  /**
477  * This is a duplication of Rhumb::mask.
478  **********************************************************************/
479  enum mask {
480  /**
481  * No output.
482  * @hideinitializer
483  **********************************************************************/
484  NONE = Rhumb::NONE,
485  /**
486  * Calculate latitude \e lat2.
487  * @hideinitializer
488  **********************************************************************/
489  LATITUDE = Rhumb::LATITUDE,
490  /**
491  * Calculate longitude \e lon2.
492  * @hideinitializer
493  **********************************************************************/
494  LONGITUDE = Rhumb::LONGITUDE,
495  /**
496  * Calculate azimuth \e azi12.
497  * @hideinitializer
498  **********************************************************************/
499  AZIMUTH = Rhumb::AZIMUTH,
500  /**
501  * Calculate distance \e s12.
502  * @hideinitializer
503  **********************************************************************/
504  DISTANCE = Rhumb::DISTANCE,
505  /**
506  * Calculate area \e S12.
507  * @hideinitializer
508  **********************************************************************/
509  AREA = Rhumb::AREA,
510  /**
511  * Unroll \e lon2 in the direct calculation.
512  * @hideinitializer
513  **********************************************************************/
514  LONG_UNROLL = Rhumb::LONG_UNROLL,
515  /**
516  * Calculate everything. (LONG_UNROLL is not included in this mask.)
517  * @hideinitializer
518  **********************************************************************/
519  ALL = Rhumb::ALL,
520  };
521 
522  /**
523  * Compute the position of point 2 which is a distance \e s12 (meters) from
524  * point 1. The area is also computed.
525  *
526  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
527  * negative.
528  * @param[out] lat2 latitude of point 2 (degrees).
529  * @param[out] lon2 longitude of point 2 (degrees).
530  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
531  *
532  * The value of \e lon2 returned is in the range [&minus;180&deg;,
533  * 180&deg;].
534  *
535  * If \e s12 is large enough that the rhumb line crosses a pole, the
536  * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and
537  * \e S12).
538  **********************************************************************/
539  void Position(real s12, real& lat2, real& lon2, real& S12) const {
540  GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
541  }
542 
543  /**
544  * Compute the position of point 2 which is a distance \e s12 (meters) from
545  * point 1. The area is not computed.
546  **********************************************************************/
547  void Position(real s12, real& lat2, real& lon2) const {
548  real t;
549  GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t);
550  }
551 
552  /**
553  * The general position routine. RhumbLine::Position is defined in term so
554  * this function.
555  *
556  * @param[in] s12 distance between point 1 and point 2 (meters); it can be
557  * negative.
558  * @param[in] outmask a bitor'ed combination of RhumbLine::mask values
559  * specifying which of the following parameters should be set.
560  * @param[out] lat2 latitude of point 2 (degrees).
561  * @param[out] lon2 longitude of point 2 (degrees).
562  * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
563  *
564  * The RhumbLine::mask values possible for \e outmask are
565  * - \e outmask |= RhumbLine::LATITUDE for the latitude \e lat2;
566  * - \e outmask |= RhumbLine::LONGITUDE for the latitude \e lon2;
567  * - \e outmask |= RhumbLine::AREA for the area \e S12;
568  * - \e outmask |= RhumbLine::ALL for all of the above;
569  * - \e outmask |= RhumbLine::LONG_UNROLL to unroll \e lon2 instead of
570  * wrapping it into the range [&minus;180&deg;, 180&deg;].
571  * .
572  * With the RhumbLine::LONG_UNROLL bit set, the quantity \e lon2 &minus; \e
573  * lon1 indicates how many times and in what sense the rhumb line encircles
574  * the ellipsoid.
575  *
576  * If \e s12 is large enough that the rhumb line crosses a pole, the
577  * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and
578  * \e S12).
579  **********************************************************************/
580  void GenPosition(real s12, unsigned outmask,
581  real& lat2, real& lon2, real& S12) const;
582 
583  /** \name Inspector functions
584  **********************************************************************/
585  ///@{
586 
587  /**
588  * @return \e lat1 the latitude of point 1 (degrees).
589  **********************************************************************/
590  Math::real Latitude() const { return _lat1; }
591 
592  /**
593  * @return \e lon1 the longitude of point 1 (degrees).
594  **********************************************************************/
595  Math::real Longitude() const { return _lon1; }
596 
597  /**
598  * @return \e azi12 the azimuth of the rhumb line (degrees).
599  **********************************************************************/
600  Math::real Azimuth() const { return _azi12; }
601 
602  /**
603  * @return \e a the equatorial radius of the ellipsoid (meters). This is
604  * the value inherited from the Rhumb object used in the constructor.
605  **********************************************************************/
606  Math::real EquatorialRadius() const { return _rh.EquatorialRadius(); }
607 
608  /**
609  * @return \e f the flattening of the ellipsoid. This is the value
610  * inherited from the Rhumb object used in the constructor.
611  **********************************************************************/
612  Math::real Flattening() const { return _rh.Flattening(); }
613  };
614 
615 } // namespace GeographicLib
616 
617 #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:294
GeographicLib::Rhumb::EllipsoidArea
Math::real EllipsoidArea() const
Definition: Rhumb.hpp:430
GEOGRAPHICLIB_RHUMBAREA_ORDER
#define GEOGRAPHICLIB_RHUMBAREA_ORDER
Definition: Rhumb.hpp:21
GeographicLib::Rhumb::mask
mask
Definition: Rhumb.hpp:204
GeographicLib
Namespace for GeographicLib.
Definition: Accumulator.cpp:12
GeographicLib::Rhumb::ALL
@ ALL
Definition: Rhumb.hpp:244
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:182
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:66
GeographicLib::Rhumb::Inverse
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const
Definition: Rhumb.hpp:352
GeographicLib::Rhumb::Direct
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:285
GeographicLib::Rhumb::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Rhumb.hpp:416
GeographicLib::Math::real
double real
Definition: Math.hpp:99
GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER
#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER
Definition: TransverseMercator.hpp:20
GeographicLib::Math
Mathematical functions needed by GeographicLib.
Definition: Math.hpp:76
GeographicLib::PolygonAreaT
Polygon areas.
Definition: PolygonArea.hpp:69
GeographicLib::Rhumb::AREA
@ AREA
Definition: Rhumb.hpp:234
GeographicLib::Ellipsoid::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Ellipsoid.hpp:80
GeographicLib::RhumbLine::Flattening
Math::real Flattening() const
Definition: Rhumb.hpp:612
GeographicLib::Rhumb::NONE
@ NONE
Definition: Rhumb.hpp:209
GeographicLib::Rhumb::Inverse
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12) const
Definition: Rhumb.hpp:361
GeographicLib::Rhumb::LATITUDE
@ LATITUDE
Definition: Rhumb.hpp:214
GeographicLib::RhumbLine::mask
mask
Definition: Rhumb.hpp:479
GEOGRAPHICLIB_DEPRECATED
#define GEOGRAPHICLIB_DEPRECATED(msg)
Definition: Constants.hpp:81
GeographicLib::Rhumb::AZIMUTH
@ AZIMUTH
Definition: Rhumb.hpp:224
GeographicLib::RhumbLine::Latitude
Math::real Latitude() const
Definition: Rhumb.hpp:590
Constants.hpp
Header for GeographicLib::Constants class.
GeographicLib::RhumbLine
Find a sequence of points on a single rhumb line.
Definition: Rhumb.hpp:464
GeographicLib::Rhumb::LONGITUDE
@ LONGITUDE
Definition: Rhumb.hpp:219
GeographicLib::RhumbLine::Position
void Position(real s12, real &lat2, real &lon2) const
Definition: Rhumb.hpp:547
GeographicLib::Rhumb::DISTANCE
@ DISTANCE
Definition: Rhumb.hpp:229
GeographicLib::RhumbLine::Longitude
Math::real Longitude() const
Definition: Rhumb.hpp:595
Ellipsoid.hpp
Header for GeographicLib::Ellipsoid class.
GeographicLib::Rhumb::Flattening
Math::real Flattening() const
Definition: Rhumb.hpp:422
GeographicLib::RhumbLine::EquatorialRadius
Math::real EquatorialRadius() const
Definition: Rhumb.hpp:606
GeographicLib::RhumbLine::Position
void Position(real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:539
GeographicLib::Rhumb::LONG_UNROLL
@ LONG_UNROLL
Definition: Rhumb.hpp:239
GeographicLib::Math::eatanhe
static T eatanhe(T x, T es)
Definition: Math.cpp:216
GeographicLib::Ellipsoid
Properties of an ellipsoid.
Definition: Ellipsoid.hpp:39
GeographicLib::Ellipsoid::Area
Math::real Area() const
Definition: Ellipsoid.cpp:40
GeographicLib::RhumbLine::Azimuth
Math::real Azimuth() const
Definition: Rhumb.hpp:600