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