25# pragma warning (disable: 4127)
40 real tphi1 = phi1.
tan(), tmu1 = mu1.
tan();
42 isfinite(tphi1) ? d *
Math::sq(base::sc(tphi1)/base::sc(tmu1)) : 1/d;
48 real dEdbet = DE(bet1, bet2), dbetdphi =
DParametric(phi1, phi2);
56 real tx = phi1.
tan(), ty = phi2.
tan(), r;
62 r = (atan(base::_fm1 * ty) - atan(base::_fm1 * tx)) /
63 (atan(ty) - atan(tx));
67 r = base::_fm1 * (1 + tx) / (1 + base::_e2m1 * tx);
70 r = base::_fm1 * (1 + tx) / (base::_e2m1 + tx);
74 r = atan2(base::_fm1 * (ty - tx), 1 + base::_e2m1 * tx * ty)
75 / atan2( ty - tx , 1 + tx * ty);
78 r = atan2(base::_fm1 * (ty - tx), base::_e2m1 + tx * ty)
79 / atan2( ty - tx , 1 + tx * ty);
97 Xn.y() = fabs(Xn.y()); Yn.y() = fabs(Yn.y());
98 real x = Xn.radians(), y = Yn.radians(), d = y - x,
99 sx = Xn.y(), sy = Yn.y(), cx = Xn.x(), cy = Yn.x(),
102 if (
false && base::_f < 0) {
119 real Dt = Dsin(x, y) * (sx + sy) /
120 ((cx + cy) * (sx * sqrt(1 - k2 * sy*sy) + sy * sqrt(1 - k2 * sx*sx))),
121 t = d * Dt, Dsz = 2 * Dt / (1 + t*t),
122 sz = d * Dsz, cz = (1 - t) * (1 + t) / (1 + t*t),
123 sz2 = sz*sz, cz2 = cz*cz, dz2 = 1 - k2 * sz2,
127 return (Ezbsz - k2 * sx * sy) * Dsz;
132 real sc1 = base::sc(x);
133 if (x == y)
return 1 / (sc1 * (1 + x*x));
134 real sc2 = base::sc(y), sn1 = base::sn(x), sn2 = base::sn(y);
136 (sn1/sc2 + sn2/sc1) / ((sn1 + sn2) * sc1 * sc2) :
137 (sn2 - sn1) / (y - x);
141 real d = y - x, xy = x*y;
142 return x == y ? 1 / (1 + xy) :
143 (isinf(xy) && xy > 0 ? 0 :
144 (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(y) - atan(x)) / d);
148 real d = y - x, xy = x*y, hx = base::sc(x), hy = base::sc(y);
151 return x == y ? 1 / hx :
153 (xy > 0 ? asinh(d * (x*y < 1 ? (x + y) / (x*hy + y*hx) :
154 (1/x + 1/y) / (hy/y + hx/x))) :
155 asinh(y) - asinh(x)) / d);
158 using std::isnan;
using std::isinf;
162 return copysign(1/
real(2), x);
164 return copysign(1/
real(2), y);
165 real sx = base::sn(x), sy = base::sn(y), d = sx*x + sy*y;
169 return (h(y) - h(x)) / (y - x);
170 real scx = base::sc(x), scy = base::sc(y);
171 return ((x + y) / (2 * d)) *
182 return base::_f < 0 ?
183 Datan(base::_e * base::sn(x), base::_e * base::sn(y)) * Dsn(x, y) :
184 Dasinh(base::_e1 * base::sn(base::_fm1 * x),
185 base::_e1 * base::sn(base::_fm1 * y)) *
186 Dsn(base::_fm1 * x, base::_fm1 * y);
194 using std::isnan;
using std::isinf;
195 real tphi1 = phi1.
tan(), tphi2 = phi2.
tan();
196 return isnan(tphi1) || isnan(tphi2) ? numeric_limits<real>::quiet_NaN() :
197 (isinf(tphi1) || isinf(tphi2) ? numeric_limits<real>::infinity() :
198 (Dasinh(tphi1, tphi2) - base::_e2 * Datanhee(tphi1, tphi2)) /
199 Datan(tphi1, tphi2));
207 int k = base::ind(auxout, auxin);
208 if (k < 0)
return numeric_limits<real>::quiet_NaN();
209 if (auxin == auxout)
return 1;
210 if ( isnan(base::_c[
base::Lmax * (k + 1) - 1]) )
211 base::fillcoeff(auxin, auxout, k);
214 zeta1n.y(), zeta1n.x(), zeta2n.
y(), zeta2n.
x(),
219 real szeta1, real czeta1,
220 real szeta2, real czeta2,
221 const real c[],
int K) {
236 real D2 = Delta * Delta,
237 czetap = czeta2 * czeta1 - szeta2 * szeta1,
238 szetap = szeta2 * czeta1 + czeta2 * szeta1,
239 czetam = czeta2 * czeta1 + szeta2 * szeta1,
241 szetamd = (Delta == 1 ? szeta2 * czeta1 - czeta2 * szeta1 :
242 (Delta != 0 ? sin(Delta) / Delta : 1)),
243 Xa = 2 * czetap * czetam,
244 Xb = -2 * szetap * szetamd,
245 u0a = 0, u0b = 0, u1a = 0, u1b = 0;
246 for (--k; k >= 0; --k) {
248 real ta = Xa * u0a + D2 * Xb * u0b - u1a + c[k],
249 tb = Xb * u0a + Xa * u0b - u1b;
265 real F0a = (sinp ? szetap : czetap) * czetam,
266 F0b = (sinp ? czetap : -szetap) * szetamd,
270 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)