GeodesicExact.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_GEODESICEXACT_HPP)
11 #define GEOGRAPHICLIB_GEODESICEXACT_HPP 1
12 
15 
16 #if !defined(GEOGRAPHICLIB_GEODESICEXACT_ORDER)
17 
20 # define GEOGRAPHICLIB_GEODESICEXACT_ORDER 30
21 #endif
22 
23 namespace GeographicLib {
24 
25  class GeodesicLineExact;
26 
81  private:
82  typedef Math::real real;
83  friend class GeodesicLineExact;
84  static const int nC4_ = GEOGRAPHICLIB_GEODESICEXACT_ORDER;
85  static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2;
86  static const unsigned maxit1_ = 20;
87  unsigned maxit2_;
88  real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_;
89 
90  enum captype {
91  CAP_NONE = 0U,
92  CAP_E = 1U<<0,
93  // Skip 1U<<1 for compatibility with Geodesic (not required)
94  CAP_D = 1U<<2,
95  CAP_H = 1U<<3,
96  CAP_C4 = 1U<<4,
97  CAP_ALL = 0x1FU,
98  CAP_MASK = CAP_ALL,
99  OUT_ALL = 0x7F80U,
100  OUT_MASK = 0xFF80U, // Includes LONG_UNROLL
101  };
102 
103  static real CosSeries(real sinx, real cosx, const real c[], int n);
104  static real Astroid(real x, real y);
105 
106  real _a, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2;
107  real _C4x[nC4x_];
108 
109  void Lengths(const EllipticFunction& E,
110  real sig12,
111  real ssig1, real csig1, real dn1,
112  real ssig2, real csig2, real dn2,
113  real cbet1, real cbet2, unsigned outmask,
114  real& s12s, real& m12a, real& m0,
115  real& M12, real& M21) const;
116  real InverseStart(EllipticFunction& E,
117  real sbet1, real cbet1, real dn1,
118  real sbet2, real cbet2, real dn2,
119  real lam12, real slam12, real clam12,
120  real& salp1, real& calp1,
121  real& salp2, real& calp2, real& dnm) const;
122  real Lambda12(real sbet1, real cbet1, real dn1,
123  real sbet2, real cbet2, real dn2,
124  real salp1, real calp1, real slam120, real clam120,
125  real& salp2, real& calp2, real& sig12,
126  real& ssig1, real& csig1, real& ssig2, real& csig2,
128  real& domg12, bool diffp, real& dlam12) const;
129  real GenInverse(real lat1, real lon1, real lat2, real lon2,
130  unsigned outmask, real& s12,
131  real& salp1, real& calp1, real& salp2, real& calp2,
132  real& m12, real& M12, real& M21, real& S12) const;
133 
134  // These are Maxima generated functions to provide series approximations to
135  // the integrals for the area.
136  void C4coeff();
137  void C4f(real k2, real c[]) const;
138  // Large coefficients are split so that lo contains the low 52 bits and hi
139  // the rest. This choice avoids double rounding with doubles and higher
140  // precision types. float coefficients will suffer double rounding;
141  // however the accuracy is already lousy for floats.
142  static Math::real reale(long long hi, long long lo) {
143  using std::ldexp;
144  return ldexp(real(hi), 52) + lo;
145  }
146 
147  public:
148 
158  enum mask {
163  NONE = 0U,
169  LATITUDE = 1U<<7 | CAP_NONE,
174  LONGITUDE = 1U<<8 | CAP_H,
181  AZIMUTH = 1U<<9 | CAP_NONE,
186  DISTANCE = 1U<<10 | CAP_E,
192  DISTANCE_IN = 1U<<11 | CAP_E,
197  REDUCEDLENGTH = 1U<<12 | CAP_D,
202  GEODESICSCALE = 1U<<13 | CAP_D,
207  AREA = 1U<<14 | CAP_C4,
212  LONG_UNROLL = 1U<<15,
218  ALL = OUT_ALL| CAP_ALL,
219  };
220 
223 
233  GeodesicExact(real a, real f);
235 
238 
274  Math::real Direct(real lat1, real lon1, real azi1, real s12,
275  real& lat2, real& lon2, real& azi2,
276  real& m12, real& M12, real& M21, real& S12)
277  const {
278  real t;
279  return GenDirect(lat1, lon1, azi1, false, s12,
280  LATITUDE | LONGITUDE | AZIMUTH |
281  REDUCEDLENGTH | GEODESICSCALE | AREA,
282  lat2, lon2, azi2, t, m12, M12, M21, S12);
283  }
284 
288  Math::real Direct(real lat1, real lon1, real azi1, real s12,
289  real& lat2, real& lon2)
290  const {
291  real t;
292  return GenDirect(lat1, lon1, azi1, false, s12,
293  LATITUDE | LONGITUDE,
294  lat2, lon2, t, t, t, t, t, t);
295  }
296 
300  Math::real Direct(real lat1, real lon1, real azi1, real s12,
301  real& lat2, real& lon2, real& azi2)
302  const {
303  real t;
304  return GenDirect(lat1, lon1, azi1, false, s12,
305  LATITUDE | LONGITUDE | AZIMUTH,
306  lat2, lon2, azi2, t, t, t, t, t);
307  }
308 
312  Math::real Direct(real lat1, real lon1, real azi1, real s12,
313  real& lat2, real& lon2, real& azi2, real& m12)
314  const {
315  real t;
316  return GenDirect(lat1, lon1, azi1, false, s12,
317  LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH,
318  lat2, lon2, azi2, t, m12, t, t, t);
319  }
320 
324  Math::real Direct(real lat1, real lon1, real azi1, real s12,
325  real& lat2, real& lon2, real& azi2,
326  real& M12, real& M21)
327  const {
328  real t;
329  return GenDirect(lat1, lon1, azi1, false, s12,
330  LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE,
331  lat2, lon2, azi2, t, t, M12, M21, t);
332  }
333 
337  Math::real Direct(real lat1, real lon1, real azi1, real s12,
338  real& lat2, real& lon2, real& azi2,
339  real& m12, real& M12, real& M21)
340  const {
341  real t;
342  return GenDirect(lat1, lon1, azi1, false, s12,
343  LATITUDE | LONGITUDE | AZIMUTH |
344  REDUCEDLENGTH | GEODESICSCALE,
345  lat2, lon2, azi2, t, m12, M12, M21, t);
346  }
348 
351 
386  void ArcDirect(real lat1, real lon1, real azi1, real a12,
387  real& lat2, real& lon2, real& azi2, real& s12,
388  real& m12, real& M12, real& M21, real& S12)
389  const {
390  GenDirect(lat1, lon1, azi1, true, a12,
391  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
392  REDUCEDLENGTH | GEODESICSCALE | AREA,
393  lat2, lon2, azi2, s12, m12, M12, M21, S12);
394  }
395 
399  void ArcDirect(real lat1, real lon1, real azi1, real a12,
400  real& lat2, real& lon2) const {
401  real t;
402  GenDirect(lat1, lon1, azi1, true, a12,
403  LATITUDE | LONGITUDE,
404  lat2, lon2, t, t, t, t, t, t);
405  }
406 
410  void ArcDirect(real lat1, real lon1, real azi1, real a12,
411  real& lat2, real& lon2, real& azi2) const {
412  real t;
413  GenDirect(lat1, lon1, azi1, true, a12,
414  LATITUDE | LONGITUDE | AZIMUTH,
415  lat2, lon2, azi2, t, t, t, t, t);
416  }
417 
421  void ArcDirect(real lat1, real lon1, real azi1, real a12,
422  real& lat2, real& lon2, real& azi2, real& s12)
423  const {
424  real t;
425  GenDirect(lat1, lon1, azi1, true, a12,
426  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
427  lat2, lon2, azi2, s12, t, t, t, t);
428  }
429 
433  void ArcDirect(real lat1, real lon1, real azi1, real a12,
434  real& lat2, real& lon2, real& azi2,
435  real& s12, real& m12) const {
436  real t;
437  GenDirect(lat1, lon1, azi1, true, a12,
438  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
439  REDUCEDLENGTH,
440  lat2, lon2, azi2, s12, m12, t, t, t);
441  }
442 
446  void ArcDirect(real lat1, real lon1, real azi1, real a12,
447  real& lat2, real& lon2, real& azi2, real& s12,
448  real& M12, real& M21) const {
449  real t;
450  GenDirect(lat1, lon1, azi1, true, a12,
451  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
452  GEODESICSCALE,
453  lat2, lon2, azi2, s12, t, M12, M21, t);
454  }
455 
459  void ArcDirect(real lat1, real lon1, real azi1, real a12,
460  real& lat2, real& lon2, real& azi2, real& s12,
461  real& m12, real& M12, real& M21) const {
462  real t;
463  GenDirect(lat1, lon1, azi1, true, a12,
464  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
465  REDUCEDLENGTH | GEODESICSCALE,
466  lat2, lon2, azi2, s12, m12, M12, M21, t);
467  }
469 
472 
524  Math::real GenDirect(real lat1, real lon1, real azi1,
525  bool arcmode, real s12_a12, unsigned outmask,
526  real& lat2, real& lon2, real& azi2,
527  real& s12, real& m12, real& M12, real& M21,
528  real& S12) const;
530 
533 
565  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
566  real& s12, real& azi1, real& azi2, real& m12,
567  real& M12, real& M21, real& S12) const {
568  return GenInverse(lat1, lon1, lat2, lon2,
569  DISTANCE | AZIMUTH |
570  REDUCEDLENGTH | GEODESICSCALE | AREA,
571  s12, azi1, azi2, m12, M12, M21, S12);
572  }
573 
577  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
578  real& s12) const {
579  real t;
580  return GenInverse(lat1, lon1, lat2, lon2,
581  DISTANCE,
582  s12, t, t, t, t, t, t);
583  }
584 
588  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
589  real& azi1, real& azi2) const {
590  real t;
591  return GenInverse(lat1, lon1, lat2, lon2,
592  AZIMUTH,
593  t, azi1, azi2, t, t, t, t);
594  }
595 
599  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
600  real& s12, real& azi1, real& azi2)
601  const {
602  real t;
603  return GenInverse(lat1, lon1, lat2, lon2,
604  DISTANCE | AZIMUTH,
605  s12, azi1, azi2, t, t, t, t);
606  }
607 
611  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
612  real& s12, real& azi1, real& azi2, real& m12)
613  const {
614  real t;
615  return GenInverse(lat1, lon1, lat2, lon2,
616  DISTANCE | AZIMUTH | REDUCEDLENGTH,
617  s12, azi1, azi2, m12, t, t, t);
618  }
619 
623  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
624  real& s12, real& azi1, real& azi2,
625  real& M12, real& M21) const {
626  real t;
627  return GenInverse(lat1, lon1, lat2, lon2,
628  DISTANCE | AZIMUTH | GEODESICSCALE,
629  s12, azi1, azi2, t, M12, M21, t);
630  }
631 
635  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
636  real& s12, real& azi1, real& azi2, real& m12,
637  real& M12, real& M21) const {
638  real t;
639  return GenInverse(lat1, lon1, lat2, lon2,
640  DISTANCE | AZIMUTH |
641  REDUCEDLENGTH | GEODESICSCALE,
642  s12, azi1, azi2, m12, M12, M21, t);
643  }
645 
648 
682  Math::real GenInverse(real lat1, real lon1, real lat2, real lon2,
683  unsigned outmask,
684  real& s12, real& azi1, real& azi2,
685  real& m12, real& M12, real& M21, real& S12) const;
687 
690 
729  GeodesicLineExact Line(real lat1, real lon1, real azi1,
730  unsigned caps = ALL) const;
731 
750  GeodesicLineExact InverseLine(real lat1, real lon1, real lat2, real lon2,
751  unsigned caps = ALL) const;
752 
773  GeodesicLineExact DirectLine(real lat1, real lon1, real azi1, real s12,
774  unsigned caps = ALL) const;
775 
796  GeodesicLineExact ArcDirectLine(real lat1, real lon1, real azi1, real a12,
797  unsigned caps = ALL) const;
798 
822  GeodesicLineExact GenDirectLine(real lat1, real lon1, real azi1,
823  bool arcmode, real s12_a12,
824  unsigned caps = ALL) const;
826 
829 
835  Math::real MajorRadius() const { return _a; }
836 
841  Math::real Flattening() const { return _f; }
842 
850  { return 4 * Math::pi() * _c2; }
852 
857  static const GeodesicExact& WGS84();
858 
859  };
860 
861 } // namespace GeographicLib
862 
863 #endif // GEOGRAPHICLIB_GEODESICEXACT_HPP
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
static T pi()
Definition: Math.hpp:202
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
Key E(std::uint64_t j)
Math::real Flattening() const
float real
Definition: datatypes.h:10
Scalar * y
Math::real EllipsoidArea() const
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const
const mpreal ldexp(const mpreal &v, mp_exp_t exp)
Definition: mpreal.h:2020
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const
int n
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const
Elliptic integrals and functions.
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const
Array33i a
#define GEOGRAPHICLIB_GEODESICEXACT_ORDER
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const
Namespace for GeographicLib.
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12) const
Header for GeographicLib::EllipticFunction class.
Exact geodesic calculations.
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const
Header for GeographicLib::Constants class.
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const
Math::real MajorRadius() const
static Math::real reale(long long hi, long long lo)
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Point2 t(10, 10)


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:08