GeographicLib 1.52
Loading...
Searching...
No Matches
Ellipsoid.cpp
Go to the documentation of this file.
1/**
2 * \file Ellipsoid.cpp
3 * \brief Implementation for GeographicLib::Ellipsoid class
4 *
5 * Copyright (c) Charles Karney (2012-2020) <charles@karney.com> and licensed
6 * under the MIT/X11 License. For more information, see
7 * https://geographiclib.sourceforge.io/
8 **********************************************************************/
9
11
12namespace GeographicLib {
13
14 using namespace std;
15
16 Ellipsoid::Ellipsoid(real a, real f)
17 : stol_(real(0.01) * sqrt(numeric_limits<real>::epsilon()))
18 , _a(a)
19 , _f(f)
20 , _f1(1 - _f)
21 , _f12(Math::sq(_f1))
22 , _e2(_f * (2 - _f))
23 , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2)))
24 , _e12(_e2 / (1 - _e2))
25 , _n(_f / (2 - _f))
26 , _b(_a * _f1)
27 , _tm(_a, _f, real(1))
28 , _ell(-_e12)
29 , _au(_a, _f, real(0), real(1), real(0), real(1), real(1))
30 {}
31
33 static const Ellipsoid wgs84(Constants::WGS84_a(), Constants::WGS84_f());
34 return wgs84;
35 }
36
38 { return _b * _ell.E(); }
39
41 return 4 * Math::pi() *
42 ((Math::sq(_a) + Math::sq(_b) *
43 (_e2 == 0 ? 1 :
44 (_e2 > 0 ? atanh(sqrt(_e2)) : atan(sqrt(-_e2))) /
45 sqrt(abs(_e2))))/2);
46 }
47
49 { return Math::atand(_f1 * Math::tand(Math::LatFix(phi))); }
50
52 { return Math::atand(Math::tand(Math::LatFix(beta)) / _f1); }
53
55 { return Math::atand(_f12 * Math::tand(Math::LatFix(phi))); }
56
58 { return Math::atand(Math::tand(Math::LatFix(theta)) / _f12); }
59
61 return abs(phi) == 90 ? phi:
63 }
64
66 if (abs(mu) == 90)
67 return mu;
68 return InverseParametricLatitude(_ell.Einv(mu * _ell.E() / 90) /
69 Math::degree());
70 }
71
73 { return Math::atand(_au.txif(Math::tand(Math::LatFix(phi)))); }
74
76 { return Math::atand(_au.tphif(Math::tand(Math::LatFix(xi)))); }
77
79 { return Math::atand(Math::taupf(Math::tand(Math::LatFix(phi)), _es)); }
80
82 { return Math::atand(Math::tauf(Math::tand(Math::LatFix(chi)), _es)); }
83
85 { return asinh(Math::taupf(Math::tand(Math::LatFix(phi)), _es)) /
86 Math::degree(); }
87
89 { return Math::atand(Math::tauf(sinh(psi * Math::degree()), _es)); }
90
92 return abs(phi) == 90 ? 0 :
93 // a * cos(beta)
94 _a / hypot(real(1), _f1 * Math::tand(Math::LatFix(phi)));
95 }
96
98 real tbeta = _f1 * Math::tand(phi);
99 // b * sin(beta)
100 return _b * tbeta / hypot(real(1),
101 _f1 * Math::tand(Math::LatFix(phi)));
102 }
103
105 { return _b * _ell.Ed( ParametricLatitude(phi) ); }
106
108 real v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi)));
109 return _a * (1 - _e2) / (v * sqrt(v));
110 }
111
113 real v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi)));
114 return _a / sqrt(v);
115 }
116
118 real calp, salp,
119 v = 1 - _e2 * Math::sq(Math::sind(Math::LatFix(phi)));
120 Math::sincosd(azi, salp, calp);
121 return _a / (sqrt(v) * (Math::sq(calp) * v / (1 - _e2) + Math::sq(salp)));
122 }
123
124} // namespace GeographicLib
Header for GeographicLib::Ellipsoid class.
Properties of an ellipsoid.
Definition: Ellipsoid.hpp:39
Math::real Area() const
Definition: Ellipsoid.cpp:40
Math::real RectifyingLatitude(real phi) const
Definition: Ellipsoid.cpp:60
Math::real IsometricLatitude(real phi) const
Definition: Ellipsoid.cpp:84
Math::real CircleHeight(real phi) const
Definition: Ellipsoid.cpp:97
Math::real AuthalicLatitude(real phi) const
Definition: Ellipsoid.cpp:72
Math::real NormalCurvatureRadius(real phi, real azi) const
Definition: Ellipsoid.cpp:117
Math::real QuarterMeridian() const
Definition: Ellipsoid.cpp:37
Ellipsoid(real a, real f)
Definition: Ellipsoid.cpp:16
Math::real CircleRadius(real phi) const
Definition: Ellipsoid.cpp:91
Math::real ConformalLatitude(real phi) const
Definition: Ellipsoid.cpp:78
Math::real InverseIsometricLatitude(real psi) const
Definition: Ellipsoid.cpp:88
Math::real InverseParametricLatitude(real beta) const
Definition: Ellipsoid.cpp:51
Math::real InverseRectifyingLatitude(real mu) const
Definition: Ellipsoid.cpp:65
static const Ellipsoid & WGS84()
Definition: Ellipsoid.cpp:32
Math::real MeridionalCurvatureRadius(real phi) const
Definition: Ellipsoid.cpp:107
Math::real InverseAuthalicLatitude(real xi) const
Definition: Ellipsoid.cpp:75
Math::real InverseConformalLatitude(real chi) const
Definition: Ellipsoid.cpp:81
Math::real TransverseCurvatureRadius(real phi) const
Definition: Ellipsoid.cpp:112
Math::real ParametricLatitude(real phi) const
Definition: Ellipsoid.cpp:48
Math::real GeocentricLatitude(real phi) const
Definition: Ellipsoid.cpp:54
Math::real MeridianDistance(real phi) const
Definition: Ellipsoid.cpp:104
Math::real InverseGeocentricLatitude(real theta) const
Definition: Ellipsoid.cpp:57
Math::real Einv(real x) const
Math::real Ed(real ang) const
Mathematical functions needed by GeographicLib.
Definition: Math.hpp:76
static T degree()
Definition: Math.hpp:159
static T tand(T x)
Definition: Math.cpp:173
static T LatFix(T x)
Definition: Math.hpp:433
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.cpp:126
static T sq(T x)
Definition: Math.hpp:171
static T sind(T x)
Definition: Math.cpp:148
static T tauf(T taup, T es)
Definition: Math.cpp:224
static T atand(T x)
Definition: Math.cpp:205
static T taupf(T tau, T es)
Definition: Math.cpp:213
static T pi()
Definition: Math.hpp:149
Namespace for GeographicLib.
Definition: Accumulator.cpp:12