Geodesic.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_GEODESIC_HPP)
11 #define GEOGRAPHICLIB_GEODESIC_HPP 1
12 
14 
15 #if !defined(GEOGRAPHICLIB_GEODESIC_ORDER)
16 
20 # define GEOGRAPHICLIB_GEODESIC_ORDER \
21  (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \
22  (GEOGRAPHICLIB_PRECISION == 1 ? 3 : \
23  (GEOGRAPHICLIB_PRECISION == 3 ? 7 : 8)))
24 #endif
25 
26 namespace GeographicLib {
27 
28  class GeodesicLine;
29 
173  private:
174  typedef Math::real real;
175  friend class GeodesicLine;
176  static const int nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
177  static const int nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
178  static const int nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER;
179  static const int nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
180  static const int nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
181  static const int nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
182  static const int nA3x_ = nA3_;
183  static const int nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
184  static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2;
185  static const int nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER;
186  static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2;
187  // Size for temporary array
188  // nC = max(max(nC1_, nC1p_, nC2_) + 1, max(nC3_, nC4_))
189  static const int nC_ = GEOGRAPHICLIB_GEODESIC_ORDER + 1;
190  static const unsigned maxit1_ = 20;
191  unsigned maxit2_;
192  real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_;
193 
194  enum captype {
195  CAP_NONE = 0U,
196  CAP_C1 = 1U<<0,
197  CAP_C1p = 1U<<1,
198  CAP_C2 = 1U<<2,
199  CAP_C3 = 1U<<3,
200  CAP_C4 = 1U<<4,
201  CAP_ALL = 0x1FU,
202  CAP_MASK = CAP_ALL,
203  OUT_ALL = 0x7F80U,
204  OUT_MASK = 0xFF80U, // Includes LONG_UNROLL
205  };
206 
207  static real SinCosSeries(bool sinp,
208  real sinx, real cosx, const real c[], int n);
209  static real Astroid(real x, real y);
210 
211  real _a, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2;
212  real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_];
213 
214  void Lengths(real eps, real sig12,
215  real ssig1, real csig1, real dn1,
216  real ssig2, real csig2, real dn2,
217  real cbet1, real cbet2, unsigned outmask,
218  real& s12s, real& m12a, real& m0,
219  real& M12, real& M21, real Ca[]) const;
220  real InverseStart(real sbet1, real cbet1, real dn1,
221  real sbet2, real cbet2, real dn2,
222  real lam12, real slam12, real clam12,
223  real& salp1, real& calp1,
224  real& salp2, real& calp2, real& dnm,
225  real Ca[]) const;
226  real Lambda12(real sbet1, real cbet1, real dn1,
227  real sbet2, real cbet2, real dn2,
228  real salp1, real calp1, real slam120, real clam120,
229  real& salp2, real& calp2, real& sig12,
230  real& ssig1, real& csig1, real& ssig2, real& csig2,
231  real& eps, real& domg12,
232  bool diffp, real& dlam12, real Ca[]) const;
233  real GenInverse(real lat1, real lon1, real lat2, real lon2,
234  unsigned outmask, real& s12,
235  real& salp1, real& calp1, real& salp2, real& calp2,
236  real& m12, real& M12, real& M21, real& S12) const;
237 
238  // These are Maxima generated functions to provide series approximations to
239  // the integrals for the ellipsoidal geodesic.
240  static real A1m1f(real eps);
241  static void C1f(real eps, real c[]);
242  static void C1pf(real eps, real c[]);
243  static real A2m1f(real eps);
244  static void C2f(real eps, real c[]);
245 
246  void A3coeff();
247  real A3f(real eps) const;
248  void C3coeff();
249  void C3f(real eps, real c[]) const;
250  void C4coeff();
251  void C4f(real k2, real c[]) const;
252 
253  public:
254 
263  enum mask {
268  NONE = 0U,
274  LATITUDE = 1U<<7 | CAP_NONE,
279  LONGITUDE = 1U<<8 | CAP_C3,
286  AZIMUTH = 1U<<9 | CAP_NONE,
291  DISTANCE = 1U<<10 | CAP_C1,
297  DISTANCE_IN = 1U<<11 | CAP_C1 | CAP_C1p,
302  REDUCEDLENGTH = 1U<<12 | CAP_C1 | CAP_C2,
307  GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2,
312  AREA = 1U<<14 | CAP_C4,
317  LONG_UNROLL = 1U<<15,
323  ALL = OUT_ALL| CAP_ALL,
324  };
325 
328 
338  Geodesic(real a, real f);
340 
343 
379  Math::real Direct(real lat1, real lon1, real azi1, real s12,
380  real& lat2, real& lon2, real& azi2,
381  real& m12, real& M12, real& M21, real& S12)
382  const {
383  real t;
384  return GenDirect(lat1, lon1, azi1, false, s12,
385  LATITUDE | LONGITUDE | AZIMUTH |
386  REDUCEDLENGTH | GEODESICSCALE | AREA,
387  lat2, lon2, azi2, t, m12, M12, M21, S12);
388  }
389 
393  Math::real Direct(real lat1, real lon1, real azi1, real s12,
394  real& lat2, real& lon2)
395  const {
396  real t;
397  return GenDirect(lat1, lon1, azi1, false, s12,
398  LATITUDE | LONGITUDE,
399  lat2, lon2, t, t, t, t, t, t);
400  }
401 
405  Math::real Direct(real lat1, real lon1, real azi1, real s12,
406  real& lat2, real& lon2, real& azi2)
407  const {
408  real t;
409  return GenDirect(lat1, lon1, azi1, false, s12,
410  LATITUDE | LONGITUDE | AZIMUTH,
411  lat2, lon2, azi2, t, t, t, t, t);
412  }
413 
417  Math::real Direct(real lat1, real lon1, real azi1, real s12,
418  real& lat2, real& lon2, real& azi2, real& m12)
419  const {
420  real t;
421  return GenDirect(lat1, lon1, azi1, false, s12,
422  LATITUDE | LONGITUDE | AZIMUTH | REDUCEDLENGTH,
423  lat2, lon2, azi2, t, m12, t, t, t);
424  }
425 
429  Math::real Direct(real lat1, real lon1, real azi1, real s12,
430  real& lat2, real& lon2, real& azi2,
431  real& M12, real& M21)
432  const {
433  real t;
434  return GenDirect(lat1, lon1, azi1, false, s12,
435  LATITUDE | LONGITUDE | AZIMUTH | GEODESICSCALE,
436  lat2, lon2, azi2, t, t, M12, M21, t);
437  }
438 
442  Math::real Direct(real lat1, real lon1, real azi1, real s12,
443  real& lat2, real& lon2, real& azi2,
444  real& m12, real& M12, real& M21)
445  const {
446  real t;
447  return GenDirect(lat1, lon1, azi1, false, s12,
448  LATITUDE | LONGITUDE | AZIMUTH |
449  REDUCEDLENGTH | GEODESICSCALE,
450  lat2, lon2, azi2, t, m12, M12, M21, t);
451  }
453 
456 
491  void ArcDirect(real lat1, real lon1, real azi1, real a12,
492  real& lat2, real& lon2, real& azi2, real& s12,
493  real& m12, real& M12, real& M21, real& S12)
494  const {
495  GenDirect(lat1, lon1, azi1, true, a12,
496  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
497  REDUCEDLENGTH | GEODESICSCALE | AREA,
498  lat2, lon2, azi2, s12, m12, M12, M21, S12);
499  }
500 
504  void ArcDirect(real lat1, real lon1, real azi1, real a12,
505  real& lat2, real& lon2) const {
506  real t;
507  GenDirect(lat1, lon1, azi1, true, a12,
508  LATITUDE | LONGITUDE,
509  lat2, lon2, t, t, t, t, t, t);
510  }
511 
515  void ArcDirect(real lat1, real lon1, real azi1, real a12,
516  real& lat2, real& lon2, real& azi2) const {
517  real t;
518  GenDirect(lat1, lon1, azi1, true, a12,
519  LATITUDE | LONGITUDE | AZIMUTH,
520  lat2, lon2, azi2, t, t, t, t, t);
521  }
522 
526  void ArcDirect(real lat1, real lon1, real azi1, real a12,
527  real& lat2, real& lon2, real& azi2, real& s12)
528  const {
529  real t;
530  GenDirect(lat1, lon1, azi1, true, a12,
531  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
532  lat2, lon2, azi2, s12, t, t, t, t);
533  }
534 
538  void ArcDirect(real lat1, real lon1, real azi1, real a12,
539  real& lat2, real& lon2, real& azi2,
540  real& s12, real& m12) const {
541  real t;
542  GenDirect(lat1, lon1, azi1, true, a12,
543  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
544  REDUCEDLENGTH,
545  lat2, lon2, azi2, s12, m12, t, t, t);
546  }
547 
551  void ArcDirect(real lat1, real lon1, real azi1, real a12,
552  real& lat2, real& lon2, real& azi2, real& s12,
553  real& M12, real& M21) const {
554  real t;
555  GenDirect(lat1, lon1, azi1, true, a12,
556  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
557  GEODESICSCALE,
558  lat2, lon2, azi2, s12, t, M12, M21, t);
559  }
560 
564  void ArcDirect(real lat1, real lon1, real azi1, real a12,
565  real& lat2, real& lon2, real& azi2, real& s12,
566  real& m12, real& M12, real& M21) const {
567  real t;
568  GenDirect(lat1, lon1, azi1, true, a12,
569  LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
570  REDUCEDLENGTH | GEODESICSCALE,
571  lat2, lon2, azi2, s12, m12, M12, M21, t);
572  }
574 
577 
629  Math::real GenDirect(real lat1, real lon1, real azi1,
630  bool arcmode, real s12_a12, unsigned outmask,
631  real& lat2, real& lon2, real& azi2,
632  real& s12, real& m12, real& M12, real& M21,
633  real& S12) const;
635 
638 
674  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
675  real& s12, real& azi1, real& azi2, real& m12,
676  real& M12, real& M21, real& S12) const {
677  return GenInverse(lat1, lon1, lat2, lon2,
678  DISTANCE | AZIMUTH |
679  REDUCEDLENGTH | GEODESICSCALE | AREA,
680  s12, azi1, azi2, m12, M12, M21, S12);
681  }
682 
686  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
687  real& s12) const {
688  real t;
689  return GenInverse(lat1, lon1, lat2, lon2,
690  DISTANCE,
691  s12, t, t, t, t, t, t);
692  }
693 
697  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
698  real& azi1, real& azi2) const {
699  real t;
700  return GenInverse(lat1, lon1, lat2, lon2,
701  AZIMUTH,
702  t, azi1, azi2, t, t, t, t);
703  }
704 
708  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
709  real& s12, real& azi1, real& azi2)
710  const {
711  real t;
712  return GenInverse(lat1, lon1, lat2, lon2,
713  DISTANCE | AZIMUTH,
714  s12, azi1, azi2, t, t, t, t);
715  }
716 
720  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
721  real& s12, real& azi1, real& azi2, real& m12)
722  const {
723  real t;
724  return GenInverse(lat1, lon1, lat2, lon2,
725  DISTANCE | AZIMUTH | REDUCEDLENGTH,
726  s12, azi1, azi2, m12, t, t, t);
727  }
728 
732  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
733  real& s12, real& azi1, real& azi2,
734  real& M12, real& M21) const {
735  real t;
736  return GenInverse(lat1, lon1, lat2, lon2,
737  DISTANCE | AZIMUTH | GEODESICSCALE,
738  s12, azi1, azi2, t, M12, M21, t);
739  }
740 
744  Math::real Inverse(real lat1, real lon1, real lat2, real lon2,
745  real& s12, real& azi1, real& azi2, real& m12,
746  real& M12, real& M21) const {
747  real t;
748  return GenInverse(lat1, lon1, lat2, lon2,
749  DISTANCE | AZIMUTH |
750  REDUCEDLENGTH | GEODESICSCALE,
751  s12, azi1, azi2, m12, M12, M21, t);
752  }
754 
757 
791  Math::real GenInverse(real lat1, real lon1, real lat2, real lon2,
792  unsigned outmask,
793  real& s12, real& azi1, real& azi2,
794  real& m12, real& M12, real& M21, real& S12) const;
796 
799 
837  GeodesicLine Line(real lat1, real lon1, real azi1, unsigned caps = ALL)
838  const;
839 
858  GeodesicLine InverseLine(real lat1, real lon1, real lat2, real lon2,
859  unsigned caps = ALL) const;
860 
881  GeodesicLine DirectLine(real lat1, real lon1, real azi1, real s12,
882  unsigned caps = ALL) const;
883 
904  GeodesicLine ArcDirectLine(real lat1, real lon1, real azi1, real a12,
905  unsigned caps = ALL) const;
906 
930  GeodesicLine GenDirectLine(real lat1, real lon1, real azi1,
931  bool arcmode, real s12_a12,
932  unsigned caps = ALL) const;
934 
937 
943  Math::real MajorRadius() const { return _a; }
944 
949  Math::real Flattening() const { return _f; }
950 
958  { return 4 * Math::pi() * _c2; }
960 
965  static const Geodesic& WGS84();
966 
967  };
968 
969 } // namespace GeographicLib
970 
971 #endif // GEOGRAPHICLIB_GEODESIC_HPP
GeographicLib::Geodesic::ArcDirect
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const
Definition: Geodesic.hpp:538
GeographicLib::Geodesic::xthresh_
real xthresh_
Definition: Geodesic.hpp:192
GeographicLib::Geodesic::Flattening
Math::real Flattening() const
Definition: Geodesic.hpp:949
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const
Definition: Geodesic.hpp:697
GeographicLib::Geodesic::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const
Definition: Geodesic.hpp:393
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const
Definition: Geodesic.hpp:744
GeographicLib::GeodesicLine
A geodesic line.
Definition: GeodesicLine.hpp:71
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
GeographicLib::Geodesic::ArcDirect
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const
Definition: Geodesic.hpp:504
GeographicLib::Geodesic::_n
real _n
Definition: Geodesic.hpp:211
x
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
Definition: gnuplot_common_settings.hh:12
GeographicLib::Geodesic::Inverse
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
Definition: Geodesic.hpp:674
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const
Definition: Geodesic.hpp:708
GeographicLib::Geodesic::ArcDirect
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
Definition: Geodesic.hpp:491
m0
static const DiscreteKey m0(M(0), 2)
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
GeographicLib::Geodesic::Direct
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
Definition: Geodesic.hpp:379
n
int n
Definition: BiCGSTAB_simple.cpp:1
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::Geodesic::mask
mask
Definition: Geodesic.hpp:263
GeographicLib::Geodesic::ArcDirect
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
Definition: Geodesic.hpp:564
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12) const
Definition: Geodesic.hpp:686
GeographicLib::Geodesic::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const
Definition: Geodesic.hpp:405
GeographicLib::Geodesic::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const
Definition: Geodesic.hpp:429
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const
Definition: Geodesic.hpp:732
GEOGRAPHICLIB_GEODESIC_ORDER
#define GEOGRAPHICLIB_GEODESIC_ORDER
Definition: Geodesic.hpp:20
GeographicLib::Geodesic::real
Math::real real
Definition: Geodesic.hpp:174
Constants.hpp
Header for GeographicLib::Constants class.
GeographicLib::Geodesic::EllipsoidArea
Math::real EllipsoidArea() const
Definition: Geodesic.hpp:957
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
GeographicLib::Geodesic::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const
Definition: Geodesic.hpp:417
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
GeographicLib::Geodesic::ArcDirect
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const
Definition: Geodesic.hpp:515
GeographicLib::Geodesic::captype
captype
Definition: Geodesic.hpp:194
GeographicLib::Math::pi
static T pi()
Definition: Math.hpp:202
GeographicLib::Geodesic::maxit2_
unsigned maxit2_
Definition: Geodesic.hpp:191
GeographicLib::Geodesic::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const
Definition: Geodesic.hpp:720
GeographicLib::Geodesic::ArcDirect
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const
Definition: Geodesic.hpp:551
GeographicLib::Geodesic::ArcDirect
void ArcDirect(real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const
Definition: Geodesic.hpp:526
GeographicLib::Geodesic::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const
Definition: Geodesic.hpp:442
U
@ U
Definition: testDecisionTree.cpp:349
GeographicLib::Geodesic::MajorRadius
Math::real MajorRadius() const
Definition: Geodesic.hpp:943
align_3::t
Point2 t(10, 10)
real
Definition: main.h:100
GeographicLib::Geodesic
Geodesic calculations
Definition: Geodesic.hpp:172


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:21