20 , _e2m(
Math::sq(1 - _f))
23 , _maxrad(2 * _a / numeric_limits<real>::epsilon())
25 if (!(isfinite(_a) && _a > 0))
27 if (!(isfinite(_f) && _f < 1))
38 real M[dim2_])
const {
39 real sphi, cphi, slam, clam;
43 Z = (_e2m * n + h) * sphi;
48 Rotation(sphi, cphi, slam, clam, M);
53 real M[dim2_])
const {
56 slam = R != 0 ? Y / R : 0,
57 clam = R != 0 ? X / R : 1;
68 slam = R != 0 ? (Y/2) / R : 0;
69 clam = R != 0 ? (X/2) / R : 1;
70 real H = hypot(Z/2, R);
73 }
else if (_e4a == 0) {
77 real H = hypot(h == 0 ? 1 : Z, R);
78 sphi = (h == 0 ? 1 : Z) / H;
87 r = (p + q - _e4a) / 6;
88 if (_f < 0)
swap(p, q);
89 if ( !(_e4a * q == 0 && r <= 0) ) {
96 disc = S * (2 * r3 + S);
103 T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc);
107 u += T + (T != 0 ? r2 / T : 0);
110 real ang = atan2(sqrt(-disc), -(S + r3));
113 u += 2 * r * cos(ang / 3);
119 uv = u < 0 ? _e4a * q / (v - u) : u + v,
121 w = fmax(
real(0), _e2a * (uv - q) / (2 * v)),
124 k = uv / (sqrt(uv +
Math::sq(w)) + w),
125 k1 = _f >= 0 ? k : k - _e2,
126 k2 = _f >= 0 ? k + _e2 : k,
128 H = hypot(Z/k1, R/k2);
131 h = (1 - _e2m/k1) * hypot(d, Z);
140 zz = sqrt((_f >= 0 ? _e4a - p : p) / _e2m),
141 xx = sqrt( _f < 0 ? _e4a - p : p ),
145 if (Z < 0) sphi = -sphi;
146 h = - _a * (_f >= 0 ? _e2m : 1) * H / _e2a;
152 Rotation(sphi, cphi, slam, clam, M);
165 M[0] = -slam; M[3] = clam; M[6] = 0;
167 M[1] = -clam * sphi; M[4] = -slam * sphi; M[7] = cphi;
169 M[2] = clam * cphi; M[5] = slam * cphi; M[8] = sphi;
Header for GeographicLib::Geocentric class.
GeographicLib::Math::real real
static const Geocentric & WGS84()
Exception handling for GeographicLib.
Mathematical functions needed by GeographicLib.
static void sincosd(T x, T &sinx, T &cosx)
static T atan2d(T y, T x)
Namespace for GeographicLib.
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)