GeographicLib  2.1.2
GeodesicLineExact.hpp
Go to the documentation of this file.
1 /**
2  * \file GeodesicLineExact.hpp
3  * \brief Header for GeographicLib::GeodesicLineExact class
4  *
5  * Copyright (c) Charles Karney (2012-2022) <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_GEODESICLINEEXACT_HPP)
11 #define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1
12 
16 
17 #include <vector>
18 
19 namespace GeographicLib {
20 
21  /**
22  * \brief An exact geodesic line
23  *
24  * GeodesicLineExact facilitates the determination of a series of points on a
25  * single geodesic. This is a companion to the GeodesicExact class. For
26  * additional information on this class see the documentation on the
27  * GeodesicLine class.
28  *
29  * Example of use:
30  * \include example-GeodesicLineExact.cpp
31  *
32  * <a href="GeodSolve.1.html">GeodSolve</a> is a command-line utility
33  * providing access to the functionality of GeodesicExact and
34  * GeodesicLineExact (via the -E option).
35  **********************************************************************/
36 
38  private:
39  typedef Math::real real;
40  friend class GeodesicExact;
41  int _nC4;
42 
43  real tiny_;
44  real _lat1, _lon1, _azi1;
45  real _a, _f, _b, _c2, _f1, _e2, _salp0, _calp0, _k2,
46  _salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1,
47  _somg1, _comg1, _cchi1,
48  _aA4, _eE0, _dD0, _hH0, _eE1, _dD1, _hH1;
49  real _a13, _s13;
50  real _bB41;
51  std::vector<real> _cC4a;
52  EllipticFunction _eE;
53  unsigned _caps;
54 
55  void LineInit(const GeodesicExact& g,
56  real lat1, real lon1,
57  real azi1, real salp1, real calp1,
58  unsigned caps);
60  real lat1, real lon1,
61  real azi1, real salp1, real calp1,
62  unsigned caps, bool arcmode, real s13_a13);
63 
64  enum captype {
65  CAP_NONE = GeodesicExact::CAP_NONE,
66  CAP_E = GeodesicExact::CAP_E,
67  CAP_D = GeodesicExact::CAP_D,
68  CAP_H = GeodesicExact::CAP_H,
69  CAP_C4 = GeodesicExact::CAP_C4,
70  CAP_ALL = GeodesicExact::CAP_ALL,
71  CAP_MASK = GeodesicExact::CAP_MASK,
72  OUT_ALL = GeodesicExact::OUT_ALL,
73  OUT_MASK = GeodesicExact::OUT_MASK,
74  };
75  public:
76 
77  /**
78  * Bit masks for what calculations to do. They signify to the
79  * GeodesicLineExact::GeodesicLineExact constructor and to
80  * GeodesicExact::Line what capabilities should be included in the
81  * GeodesicLineExact object. This is merely a duplication of
82  * GeodesicExact::mask.
83  **********************************************************************/
84  enum mask {
85  /**
86  * No capabilities, no output.
87  * @hideinitializer
88  **********************************************************************/
90  /**
91  * Calculate latitude \e lat2. (It's not necessary to include this as a
92  * capability to GeodesicLineExact because this is included by default.)
93  * @hideinitializer
94  **********************************************************************/
96  /**
97  * Calculate longitude \e lon2.
98  * @hideinitializer
99  **********************************************************************/
101  /**
102  * Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
103  * include this as a capability to GeodesicLineExact because this is
104  * included by default.)
105  * @hideinitializer
106  **********************************************************************/
108  /**
109  * Calculate distance \e s12.
110  * @hideinitializer
111  **********************************************************************/
113  /**
114  * A combination of the common capabilities: GeodesicLineExact::LATITUDE,
115  * GeodesicLineExact::LONGITUDE, GeodesicLineExact::AZIMUTH,
116  * GeodesicLineExact::DISTANCE.
117  * @hideinitializer
118  **********************************************************************/
120  /**
121  * Allow distance \e s12 to be used as input in the direct geodesic
122  * problem.
123  * @hideinitializer
124  **********************************************************************/
126  /**
127  * Calculate reduced length \e m12.
128  * @hideinitializer
129  **********************************************************************/
131  /**
132  * Calculate geodesic scales \e M12 and \e M21.
133  * @hideinitializer
134  **********************************************************************/
136  /**
137  * Calculate area \e S12.
138  * @hideinitializer
139  **********************************************************************/
141  /**
142  * Unroll \e lon2 in the direct calculation.
143  * @hideinitializer
144  **********************************************************************/
146  /**
147  * All capabilities, calculate everything. (LONG_UNROLL is not
148  * included in this mask.)
149  * @hideinitializer
150  **********************************************************************/
152  };
153 
154  /** \name Constructors
155  **********************************************************************/
156  ///@{
157 
158  /**
159  * Constructor for a geodesic line staring at latitude \e lat1, longitude
160  * \e lon1, and azimuth \e azi1 (all in degrees).
161  *
162  * @param[in] g A GeodesicExact object used to compute the necessary
163  * information about the GeodesicLineExact.
164  * @param[in] lat1 latitude of point 1 (degrees).
165  * @param[in] lon1 longitude of point 1 (degrees).
166  * @param[in] azi1 azimuth at point 1 (degrees).
167  * @param[in] caps bitor'ed combination of GeodesicLineExact::mask values
168  * specifying the capabilities the GeodesicLineExact object should
169  * possess, i.e., which quantities can be returned in calls to
170  * GeodesicLine::Position.
171  *
172  * \e lat1 should be in the range [&minus;90&deg;, 90&deg;].
173  *
174  * The GeodesicLineExact::mask values are
175  * - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this
176  * is added automatically;
177  * - \e caps |= GeodesicLineExact::LONGITUDE for the latitude \e lon2;
178  * - \e caps |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; this
179  * is added automatically;
180  * - \e caps |= GeodesicLineExact::DISTANCE for the distance \e s12;
181  * - \e caps |= GeodesicLineExact::REDUCEDLENGTH for the reduced length \e
182  * m12;
183  * - \e caps |= GeodesicLineExact::GEODESICSCALE for the geodesic scales \e
184  * M12 and \e M21;
185  * - \e caps |= GeodesicLineExact::AREA for the area \e S12;
186  * - \e caps |= GeodesicLineExact::DISTANCE_IN permits the length of the
187  * geodesic to be given in terms of \e s12; without this capability the
188  * length can only be specified in terms of arc length;
189  * - \e caps |= GeodesicLineExact::ALL for all of the above.
190  * .
191  * The default value of \e caps is GeodesicLineExact::ALL.
192  *
193  * If the point is at a pole, the azimuth is defined by keeping \e lon1
194  * fixed, writing \e lat1 = &plusmn;(90&deg; &minus; &epsilon;), and taking
195  * the limit &epsilon; &rarr; 0+.
196  **********************************************************************/
198  GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1,
199  unsigned caps = ALL);
200 
201  /**
202  * A default constructor. If GeodesicLineExact::Position is called on the
203  * resulting object, it returns immediately (without doing any
204  * calculations). The object can be set with a call to
205  * GeodesicExact::Line. Use Init() to test whether object is still in this
206  * uninitialized state.
207  **********************************************************************/
209  ///@}
210 
211  /** \name Position in terms of distance
212  **********************************************************************/
213  ///@{
214 
215  /**
216  * Compute the position of point 2 which is a distance \e s12 (meters)
217  * from point 1.
218  *
219  * @param[in] s12 distance from point 1 to point 2 (meters); it can be
220  * signed.
221  * @param[out] lat2 latitude of point 2 (degrees).
222  * @param[out] lon2 longitude of point 2 (degrees); requires that the
223  * GeodesicLineExact object was constructed with \e caps |=
224  * GeodesicLineExact::LONGITUDE.
225  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
226  * @param[out] m12 reduced length of geodesic (meters); requires that the
227  * GeodesicLineExact object was constructed with \e caps |=
228  * GeodesicLineExact::REDUCEDLENGTH.
229  * @param[out] M12 geodesic scale of point 2 relative to point 1
230  * (dimensionless); requires that the GeodesicLineExact object was
231  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
232  * @param[out] M21 geodesic scale of point 1 relative to point 2
233  * (dimensionless); requires that the GeodesicLineExact object was
234  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
235  * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
236  * that the GeodesicLineExact object was constructed with \e caps |=
237  * GeodesicLineExact::AREA.
238  * @return \e a12 arc length from point 1 to point 2 (degrees).
239  *
240  * The values of \e lon2 and \e azi2 returned are in the range
241  * [&minus;180&deg;, 180&deg;].
242  *
243  * The GeodesicLineExact object \e must have been constructed with \e caps
244  * |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and
245  * no parameters are set. Requesting a value which the GeodesicLineExact
246  * object is not capable of computing is not an error; the corresponding
247  * argument will not be altered.
248  *
249  * The following functions are overloaded versions of
250  * GeodesicLineExact::Position which omit some of the output parameters.
251  * Note, however, that the arc length is always computed and returned as
252  * the function value.
253  **********************************************************************/
254  Math::real GEOGRAPHICLIB_EXPORT Position(real s12, real& lat2, real& lon2,
255  real& azi2,
256  real& m12, real& M12, real& M21,
257  real& S12) const {
258  real t;
259  return GenPosition(false, s12,
262  lat2, lon2, azi2, t, m12, M12, M21, S12);
263  }
264 
265  /**
266  * See the documentation for GeodesicLineExact::Position.
267  **********************************************************************/
268  Math::real GEOGRAPHICLIB_EXPORT Position(real s12, real& lat2, real& lon2)
269  const {
270  real t;
271  return GenPosition(false, s12,
273  lat2, lon2, t, t, t, t, t, t);
274  }
275 
276  /**
277  * See the documentation for GeodesicLineExact::Position.
278  **********************************************************************/
279  Math::real GEOGRAPHICLIB_EXPORT Position(real s12, real& lat2, real& lon2,
280  real& azi2) const {
281  real t;
282  return GenPosition(false, s12,
284  lat2, lon2, azi2, t, t, t, t, t);
285  }
286 
287  /**
288  * See the documentation for GeodesicLineExact::Position.
289  **********************************************************************/
290  Math::real GEOGRAPHICLIB_EXPORT Position(real s12, real& lat2, real& lon2,
291  real& azi2, real& m12) const {
292  real t;
293  return GenPosition(false, s12,
294  LATITUDE | LONGITUDE |
296  lat2, lon2, azi2, t, m12, t, t, t);
297  }
298 
299  /**
300  * See the documentation for GeodesicLineExact::Position.
301  **********************************************************************/
302  Math::real GEOGRAPHICLIB_EXPORT Position(real s12, real& lat2, real& lon2,
303  real& azi2, real& M12, real& M21)
304  const {
305  real t;
306  return GenPosition(false, s12,
307  LATITUDE | LONGITUDE |
309  lat2, lon2, azi2, t, t, M12, M21, t);
310  }
311 
312  /**
313  * See the documentation for GeodesicLineExact::Position.
314  **********************************************************************/
316  real& lat2, real& lon2, real& azi2,
317  real& m12, real& M12, real& M21)
318  const {
319  real t;
320  return GenPosition(false, s12,
323  lat2, lon2, azi2, t, m12, M12, M21, t);
324  }
325  ///@}
326 
327  /** \name Position in terms of arc length
328  **********************************************************************/
329  ///@{
330 
331  /**
332  * Compute the position of point 2 which is an arc length \e a12 (degrees)
333  * from point 1.
334  *
335  * @param[in] a12 arc length from point 1 to point 2 (degrees); it can
336  * be signed.
337  * @param[out] lat2 latitude of point 2 (degrees).
338  * @param[out] lon2 longitude of point 2 (degrees); requires that the
339  * GeodesicLineExact object was constructed with \e caps |=
340  * GeodesicLineExact::LONGITUDE.
341  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
342  * @param[out] s12 distance from point 1 to point 2 (meters); requires
343  * that the GeodesicLineExact object was constructed with \e caps |=
344  * GeodesicLineExact::DISTANCE.
345  * @param[out] m12 reduced length of geodesic (meters); requires that the
346  * GeodesicLineExact object was constructed with \e caps |=
347  * GeodesicLineExact::REDUCEDLENGTH.
348  * @param[out] M12 geodesic scale of point 2 relative to point 1
349  * (dimensionless); requires that the GeodesicLineExact object was
350  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
351  * @param[out] M21 geodesic scale of point 1 relative to point 2
352  * (dimensionless); requires that the GeodesicLineExact object was
353  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
354  * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
355  * that the GeodesicLineExact object was constructed with \e caps |=
356  * GeodesicLineExact::AREA.
357  *
358  * The values of \e lon2 and \e azi2 returned are in the range
359  * [&minus;180&deg;, 180&deg;].
360  *
361  * Requesting a value which the GeodesicLineExact object is not capable of
362  * computing is not an error; the corresponding argument will not be
363  * altered.
364  *
365  * The following functions are overloaded versions of
366  * GeodesicLineExact::ArcPosition which omit some of the output parameters.
367  **********************************************************************/
369  ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
370  real& s12, real& m12, real& M12, real& M21,
371  real& S12) const {
372  GenPosition(true, a12,
375  lat2, lon2, azi2, s12, m12, M12, M21, S12);
376  }
377 
378  /**
379  * See the documentation for GeodesicLineExact::ArcPosition.
380  **********************************************************************/
381  void GEOGRAPHICLIB_EXPORT ArcPosition(real a12, real& lat2, real& lon2)
382  const {
383  real t;
384  GenPosition(true, a12,
386  lat2, lon2, t, t, t, t, t, t);
387  }
388 
389  /**
390  * See the documentation for GeodesicLineExact::ArcPosition.
391  **********************************************************************/
393  real& lat2, real& lon2, real& azi2)
394  const {
395  real t;
396  GenPosition(true, a12,
398  lat2, lon2, azi2, t, t, t, t, t);
399  }
400 
401  /**
402  * See the documentation for GeodesicLineExact::ArcPosition.
403  **********************************************************************/
405  real& lat2, real& lon2, real& azi2,
406  real& s12) const {
407  real t;
408  GenPosition(true, a12,
410  lat2, lon2, azi2, s12, t, t, t, t);
411  }
412 
413  /**
414  * See the documentation for GeodesicLineExact::ArcPosition.
415  **********************************************************************/
417  real& lat2, real& lon2, real& azi2,
418  real& s12, real& m12) const {
419  real t;
420  GenPosition(true, a12,
423  lat2, lon2, azi2, s12, m12, t, t, t);
424  }
425 
426  /**
427  * See the documentation for GeodesicLineExact::ArcPosition.
428  **********************************************************************/
430  real& lat2, real& lon2, real& azi2,
431  real& s12, real& M12, real& M21)
432  const {
433  real t;
434  GenPosition(true, a12,
437  lat2, lon2, azi2, s12, t, M12, M21, t);
438  }
439 
440  /**
441  * See the documentation for GeodesicLineExact::ArcPosition.
442  **********************************************************************/
444  ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
445  real& s12, real& m12, real& M12, real& M21)
446  const {
447  real t;
448  GenPosition(true, a12,
451  lat2, lon2, azi2, s12, m12, M12, M21, t);
452  }
453  ///@}
454 
455  /** \name The general position function.
456  **********************************************************************/
457  ///@{
458 
459  /**
460  * The general position function. GeodesicLineExact::Position and
461  * GeodesicLineExact::ArcPosition are defined in terms of this function.
462  *
463  * @param[in] arcmode boolean flag determining the meaning of the second
464  * parameter; if \e arcmode is false, then the GeodesicLineExact object
465  * must have been constructed with \e caps |=
466  * GeodesicLineExact::DISTANCE_IN.
467  * @param[in] s12_a12 if \e arcmode is false, this is the distance between
468  * point 1 and point 2 (meters); otherwise it is the arc length between
469  * point 1 and point 2 (degrees); it can be signed.
470  * @param[in] outmask a bitor'ed combination of GeodesicLineExact::mask
471  * values specifying which of the following parameters should be set.
472  * @param[out] lat2 latitude of point 2 (degrees).
473  * @param[out] lon2 longitude of point 2 (degrees); requires that the
474  * GeodesicLineExact object was constructed with \e caps |=
475  * GeodesicLineExact::LONGITUDE.
476  * @param[out] azi2 (forward) azimuth at point 2 (degrees).
477  * @param[out] s12 distance from point 1 to point 2 (meters); requires
478  * that the GeodesicLineExact object was constructed with \e caps |=
479  * GeodesicLineExact::DISTANCE.
480  * @param[out] m12 reduced length of geodesic (meters); requires that the
481  * GeodesicLineExact object was constructed with \e caps |=
482  * GeodesicLineExact::REDUCEDLENGTH.
483  * @param[out] M12 geodesic scale of point 2 relative to point 1
484  * (dimensionless); requires that the GeodesicLineExact object was
485  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
486  * @param[out] M21 geodesic scale of point 1 relative to point 2
487  * (dimensionless); requires that the GeodesicLineExact object was
488  * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
489  * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
490  * that the GeodesicLineExact object was constructed with \e caps |=
491  * GeodesicLineExact::AREA.
492  * @return \e a12 arc length from point 1 to point 2 (degrees).
493  *
494  * The GeodesicLineExact::mask values possible for \e outmask are
495  * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2;
496  * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon2;
497  * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2;
498  * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12;
499  * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced length
500  * \e m12;
501  * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic scales
502  * \e M12 and \e M21;
503  * - \e outmask |= GeodesicLineExact::AREA for the area \e S12;
504  * - \e outmask |= GeodesicLineExact::ALL for all of the above;
505  * - \e outmask |= GeodesicLineExact::LONG_UNROLL to unroll \e lon2 instead
506  * of wrapping it into the range [&minus;180&deg;, 180&deg;].
507  * .
508  * Requesting a value which the GeodesicLineExact object is not capable of
509  * computing is not an error; the corresponding argument will not be
510  * altered. Note, however, that the arc length is always computed and
511  * returned as the function value.
512  *
513  * With the GeodesicLineExact::LONG_UNROLL bit set, the quantity \e lon2
514  * &minus; \e lon1 indicates how many times and in what sense the geodesic
515  * encircles the ellipsoid.
516  **********************************************************************/
518  GenPosition(bool arcmode, real s12_a12, unsigned outmask,
519  real& lat2, real& lon2, real& azi2,
520  real& s12, real& m12, real& M12, real& M21, real& S12) const;
521  ///@}
522 
523  /** \name Setting point 3
524  **********************************************************************/
525  ///@{
526 
527  /**
528  * Specify position of point 3 in terms of distance.
529  *
530  * @param[in] s13 the distance from point 1 to point 3 (meters); it
531  * can be negative.
532  *
533  * This is only useful if the GeodesicLineExact object has been constructed
534  * with \e caps |= GeodesicLineExact::DISTANCE_IN.
535  **********************************************************************/
537 
538  /**
539  * Specify position of point 3 in terms of arc length.
540  *
541  * @param[in] a13 the arc length from point 1 to point 3 (degrees); it
542  * can be negative.
543  *
544  * The distance \e s13 is only set if the GeodesicLineExact object has been
545  * constructed with \e caps |= GeodesicLineExact::DISTANCE.
546  **********************************************************************/
547  void GEOGRAPHICLIB_EXPORT SetArc(real a13);
548 
549  /**
550  * Specify position of point 3 in terms of either distance or arc length.
551  *
552  * @param[in] arcmode boolean flag determining the meaning of the second
553  * parameter; if \e arcmode is false, then the GeodesicLineExact object
554  * must have been constructed with \e caps |=
555  * GeodesicLineExact::DISTANCE_IN.
556  * @param[in] s13_a13 if \e arcmode is false, this is the distance from
557  * point 1 to point 3 (meters); otherwise it is the arc length from
558  * point 1 to point 3 (degrees); it can be negative.
559  **********************************************************************/
560  void GEOGRAPHICLIB_EXPORT GenSetDistance(bool arcmode, real s13_a13);
561 
562  /** \name Inspector functions
563  **********************************************************************/
564  ///@{
565 
566  /**
567  * @return true if the object has been initialized.
568  **********************************************************************/
569  bool GEOGRAPHICLIB_EXPORT Init() const { return _caps != 0U; }
570 
571  /**
572  * @return \e lat1 the latitude of point 1 (degrees).
573  **********************************************************************/
575  { return Init() ? _lat1 : Math::NaN(); }
576 
577  /**
578  * @return \e lon1 the longitude of point 1 (degrees).
579  **********************************************************************/
581  { return Init() ? _lon1 : Math::NaN(); }
582 
583  /**
584  * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
585  **********************************************************************/
587  { return Init() ? _azi1 : Math::NaN(); }
588 
589  /**
590  * The sine and cosine of \e azi1.
591  *
592  * @param[out] sazi1 the sine of \e azi1.
593  * @param[out] cazi1 the cosine of \e azi1.
594  **********************************************************************/
595  void GEOGRAPHICLIB_EXPORT Azimuth(real& sazi1, real& cazi1) const
596  { if (Init()) { sazi1 = _salp1; cazi1 = _calp1; } }
597 
598  /**
599  * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
600  * the equator in a northward direction.
601  *
602  * The result lies in [&minus;90&deg;, 90&deg;].
603  **********************************************************************/
605  { return Init() ? Math::atan2d(_salp0, _calp0) : Math::NaN(); }
606 
607  /**
608  * The sine and cosine of \e azi0.
609  *
610  * @param[out] sazi0 the sine of \e azi0.
611  * @param[out] cazi0 the cosine of \e azi0.
612  **********************************************************************/
613  void GEOGRAPHICLIB_EXPORT EquatorialAzimuth(real& sazi0, real& cazi0) const
614  { if (Init()) { sazi0 = _salp0; cazi0 = _calp0; } }
615 
616  /**
617  * @return \e a1 the arc length (degrees) between the northward equatorial
618  * crossing and point 1.
619  *
620  * The result lies in [&minus;180&deg;, 180&deg;].
621  **********************************************************************/
623  using std::atan2;
624  return Init() ? atan2(_ssig1, _csig1) / Math::degree() : Math::NaN();
625  }
626 
627  /**
628  * @return \e a the equatorial radius of the ellipsoid (meters). This is
629  * the value inherited from the GeodesicExact object used in the
630  * constructor.
631  **********************************************************************/
633  { return Init() ? _a : Math::NaN(); }
634 
635  /**
636  * @return \e f the flattening of the ellipsoid. This is the value
637  * inherited from the GeodesicExact object used in the constructor.
638  **********************************************************************/
640  { return Init() ? _f : Math::NaN(); }
641 
642  /**
643  * @return \e caps the computational capabilities that this object was
644  * constructed with. LATITUDE and AZIMUTH are always included.
645  **********************************************************************/
646  unsigned GEOGRAPHICLIB_EXPORT Capabilities() const { return _caps; }
647 
648  /**
649  * Test what capabilities are available.
650  *
651  * @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values.
652  * @return true if the GeodesicLineExact object has all these capabilities.
653  **********************************************************************/
654  bool GEOGRAPHICLIB_EXPORT Capabilities(unsigned testcaps) const {
655  testcaps &= OUT_ALL;
656  return (_caps & testcaps) == testcaps;
657  }
658 
659  /**
660  * The distance or arc length to point 3.
661  *
662  * @param[in] arcmode boolean flag determining the meaning of returned
663  * value.
664  * @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true.
665  **********************************************************************/
667  { return Init() ? (arcmode ? _a13 : _s13) : Math::NaN(); }
668 
669  /**
670  * @return \e s13, the distance to point 3 (meters).
671  **********************************************************************/
673  { return GenDistance(false); }
674 
675  /**
676  * @return \e a13, the arc length to point 3 (degrees).
677  **********************************************************************/
678  Math::real GEOGRAPHICLIB_EXPORT Arc() const { return GenDistance(true); }
679  ///@}
680 
681  };
682 
683 } // namespace GeographicLib
684 
685 #endif // GEOGRAPHICLIB_GEODESICLINEEXACT_HPP
Header for GeographicLib::Constants class.
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:67
Header for GeographicLib::EllipticFunction class.
GeographicLib::Math::real real
Definition: GeodSolve.cpp:31
Header for GeographicLib::GeodesicExact class.
Elliptic integrals and functions.
Exact geodesic calculations.
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2) const
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12) const
void EquatorialAzimuth(real &sazi0, real &cazi0) const
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const
void ArcPosition(real a12, real &lat2, real &lon2) const
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const
Math::real GenDistance(bool arcmode) const
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const
Math::real Position(real s12, real &lat2, real &lon2) const
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const
void GenSetDistance(bool arcmode, real s13_a13)
bool Capabilities(unsigned testcaps) const
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const
void Azimuth(real &sazi1, real &cazi1) const
Math::real Position(real s12, real &lat2, real &lon2, real &azi2) const
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &m12) const
static T degree()
Definition: Math.hpp:200
static T atan2d(T y, T x)
Definition: Math.cpp:183
static T NaN()
Definition: Math.cpp:250
Namespace for GeographicLib.
Definition: Accumulator.cpp:12