23# pragma warning (disable: 4127)
38 real tphi1 = phi1.
tan(), tmu1 = mu1.
tan();
40 isfinite(tphi1) ? d *
Math::sq(base::sc(tphi1)/base::sc(tmu1)) : 1/d;
46 real dEdbet = DE(bet1, bet2), dbetdphi =
DParametric(phi1, phi2);
54 real tx = phi1.
tan(), ty = phi2.
tan(), r;
60 r = (atan(base::_fm1 * ty) - atan(base::_fm1 * tx)) /
61 (atan(ty) - atan(tx));
65 r = base::_fm1 * (1 + tx) / (1 + base::_e2m1 * tx);
68 r = base::_fm1 * (1 + tx) / (base::_e2m1 + tx);
72 r = atan2(base::_fm1 * (ty - tx), 1 + base::_e2m1 * tx * ty)
73 / atan2( ty - tx , 1 + tx * ty);
76 r = atan2(base::_fm1 * (ty - tx), base::_e2m1 + tx * ty)
77 / atan2( ty - tx , 1 + tx * ty);
95 Xn.y() = fabs(Xn.y()); Yn.y() = fabs(Yn.y());
96 real x = Xn.radians(), y = Yn.radians(), d = y - x,
97 sx = Xn.y(), sy = Yn.y(), cx = Xn.x(), cy = Yn.x(),
100 if (
false && base::_f < 0) {
117 real Dt = Dsin(x, y) * (sx + sy) /
118 ((cx + cy) * (sx * sqrt(1 - k2 * sy*sy) + sy * sqrt(1 - k2 * sx*sx))),
119 t = d * Dt, Dsz = 2 * Dt / (1 + t*t),
120 sz = d * Dsz, cz = (1 - t) * (1 + t) / (1 + t*t),
121 sz2 = sz*sz, cz2 = cz*cz, dz2 = 1 - k2 * sz2,
125 return (Ezbsz - k2 * sx * sy) * Dsz;
130 real sc1 = base::sc(x);
131 if (x == y)
return 1 / (sc1 * (1 + x*x));
132 real sc2 = base::sc(y), sn1 = base::sn(x), sn2 = base::sn(y);
134 (sn1/sc2 + sn2/sc1) / ((sn1 + sn2) * sc1 * sc2) :
135 (sn2 - sn1) / (y - x);
139 real d = y - x, xy = x*y;
140 return x == y ? 1 / (1 + xy) :
141 (isinf(xy) && xy > 0 ? 0 :
142 (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(y) - atan(x)) / d);
146 real d = y - x, xy = x*y, hx = base::sc(x), hy = base::sc(y);
149 return x == y ? 1 / hx :
151 (xy > 0 ? asinh(d * (x*y < 1 ? (x + y) / (x*hy + y*hx) :
152 (1/x + 1/y) / (hy/y + hx/x))) :
153 asinh(y) - asinh(x)) / d);
156 using std::isnan;
using std::isinf;
160 return copysign(1/
real(2), x);
162 return copysign(1/
real(2), y);
163 real sx = base::sn(x), sy = base::sn(y), d = sx*x + sy*y;
167 return (h(y) - h(x)) / (y - x);
168 real scx = base::sc(x), scy = base::sc(y);
169 return ((x + y) / (2 * d)) *
180 return base::_f < 0 ?
181 Datan(base::_e * base::sn(x), base::_e * base::sn(y)) * Dsn(x, y) :
182 Dasinh(base::_e1 * base::sn(base::_fm1 * x),
183 base::_e1 * base::sn(base::_fm1 * y)) *
184 Dsn(base::_fm1 * x, base::_fm1 * y);
192 using std::isnan;
using std::isinf;
193 real tphi1 = phi1.
tan(), tphi2 = phi2.
tan();
194 return isnan(tphi1) || isnan(tphi2) ? numeric_limits<real>::quiet_NaN() :
195 (isinf(tphi1) || isinf(tphi2) ? numeric_limits<real>::infinity() :
196 (Dasinh(tphi1, tphi2) - base::_e2 * Datanhee(tphi1, tphi2)) /
197 Datan(tphi1, tphi2));
205 int k = base::ind(auxout, auxin);
206 if (k < 0)
return numeric_limits<real>::quiet_NaN();
207 if (auxin == auxout)
return 1;
208 if ( isnan(base::_c[
base::Lmax * (k + 1) - 1]) )
209 base::fillcoeff(auxin, auxout, k);
212 zeta1n.y(), zeta1n.x(), zeta2n.
y(), zeta2n.
x(),
217 real szeta1, real czeta1,
218 real szeta2, real czeta2,
219 const real c[],
int K) {
234 real D2 = Delta * Delta,
235 czetap = czeta2 * czeta1 - szeta2 * szeta1,
236 szetap = szeta2 * czeta1 + czeta2 * szeta1,
237 czetam = czeta2 * czeta1 + szeta2 * szeta1,
239 szetamd = (Delta == 1 ? szeta2 * czeta1 - czeta2 * szeta1 :
240 (Delta != 0 ? sin(Delta) / Delta : 1)),
241 Xa = 2 * czetap * czetam,
242 Xb = -2 * szetap * szetamd,
243 u0a = 0, u0b = 0, u1a = 0, u1b = 0;
244 for (--k; k >= 0; --k) {
246 real ta = Xa * u0a + D2 * Xb * u0b - u1a + c[k],
247 tb = Xb * u0a + Xa * u0b - u1b;
263 real F0a = (sinp ? szetap : czetap) * czetam,
264 F0b = (sinp ? czetap : -szetap) * szetamd,
268 return 2 * (F0a * u0b + F0b * u0a - Fm1a * u1b);
Header for the GeographicLib::DAuxLatitude class.
Header for GeographicLib::EllipticFunction class.
GeographicLib::Math::real real
An accurate representation of angles.
Math::real radians() const
AuxAngle normalized() const
Math::real RectifyingRadius(bool exact=false) const
AuxAngle Parametric(const AuxAngle &phi, real *diff=nullptr) const
AuxAngle Rectifying(const AuxAngle &phi, real *diff=nullptr) const
Math::real DParametric(const AuxAngle &phi1, const AuxAngle &phi2) const
Math::real DConvert(int auxin, int auxout, const AuxAngle &zeta1, const AuxAngle &zeta2) const
Math::real DIsometric(const AuxAngle &phi1, const AuxAngle &phi2) const
static Math::real DClenshaw(bool sinp, real Delta, real szeta1, real czeta1, real szeta2, real czeta2, const real c[], int K)
Math::real DRectifying(const AuxAngle &phi1, const AuxAngle &phi2) const
static real RD(real x, real y, real z)
static real RF(real x, real y, real z)
Namespace for GeographicLib.
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)