12 namespace GeographicLib {
18 , _f(f <= 1 ? f : 1/f)
20 , _e2m(
Math::sq(1 - _f))
23 , _maxrad(2 * _a / numeric_limits<real>::epsilon())
32 Constants::WGS84_f<real>());
36 real M[dim2_])
const throw() {
39 phi = lat * Math::degree<real>(),
40 lam = lon * Math::degree<real>(),
42 cphi = abs(lat) == 90 ? 0 : cos(phi),
43 n = _a/sqrt(1 - _e2 *
Math::sq(sphi)),
44 slam = lon == -180 ? 0 : sin(lam),
45 clam = abs(lon) == 90 ? 0 : cos(lam);
46 Z = ( _e2m * n + h) * sphi;
51 Rotation(sphi, cphi, slam, clam, M);
56 real M[dim2_])
const throw() {
71 slam = R ? (Y/2) / R : 0;
72 clam = R ? (X/2) / R : 1;
76 }
else if (_e4a == 0) {
81 sphi = (h == 0 ? 1 : Z) / H;
90 r = (p + q - _e4a) / 6;
91 if (_f < 0) swap(p, q);
92 if ( !(_e4a * q == 0 && r <= 0) ) {
99 disc = S * (2 * r3 + S);
106 T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc);
110 u += T + (T != 0 ? r2 / T : 0);
113 real ang = atan2(sqrt(-disc), -(S + r3));
116 u += 2 * r * cos(ang / 3);
122 uv = u < 0 ? _e4a * q / (v - u) : u + v,
124 w = max(
real(0), _e2a * (uv - q) / (2 * v)),
127 k = uv / (sqrt(uv +
Math::sq(w)) + w),
128 k1 = _f >= 0 ? k : k - _e2,
129 k2 = _f >= 0 ? k + _e2 : k,
143 zz = sqrt((_f >= 0 ? _e4a - p : p) / _e2m),
144 xx = sqrt( _f < 0 ? _e4a - p : p ),
148 if (Z < 0) sphi = -sphi;
149 h = - _a * (_f >= 0 ? _e2m : 1) * H / _e2a;
152 lat = atan2(sphi, cphi) / Math::degree<real>();
154 lon = -atan2(-slam, clam) / Math::degree<real>();
156 Rotation(sphi, cphi, slam, clam, M);
160 real M[dim2_])
throw() {
169 M[0] = -slam; M[3] = clam; M[6] = 0;
171 M[1] = -clam * sphi; M[4] = -slam * sphi; M[7] = cphi;
173 M[2] = clam * cphi; M[5] = slam * cphi; M[8] = sphi;
static T AngNormalize(T x)
GeographicLib::Math::real real
static bool isfinite(T x)
Mathematical functions needed by GeographicLib.
static const Geocentric WGS84
Header for GeographicLib::Geocentric class.
Exception handling for GeographicLib.