14 # pragma warning (disable: 4127)
22 : tol_(real(0.1)*sqrt(numeric_limits<real>::epsilon()))
24 , _f(f <= 1 ? f : 1/f)
28 , _Cx(exp(eatanhe(real(1))))
29 , _c( (1 - _f) * _Cx )
69 real& x, real& y, real& gamma, real& k)
71 lat *= northp ? 1 : -1;
74 tau = lat != -90 ? tanx(phi) : -overflow(),
76 sig = sinh( eatanhe(tau / secphi) ),
77 taup =
Math::hypot(real(1), sig) * tau - sig * secphi,
79 rho = taup >= 0 ? (lat != 90 ? 1/rho : 0) : rho;
80 rho *= 2 * _k0 * _a / _c;
81 k = lat != 90 ? (rho / _a) * secphi * sqrt(_e2m + _e2 /
Math::sq(secphi)) :
86 x = rho * (lon == -180 ? 0 : sin(lam));
87 y = (northp ? -rho : rho) * (abs(lon) == 90 ? 0 : cos(lam));
88 gamma = northp ? lon : -lon;
92 real& lat, real& lon, real& gamma, real& k)
96 t = rho / (2 * _k0 * _a / _c),
97 taup = (1 / t - t) / 2,
99 stol = tol_ * max(real(1), abs(taup));
100 if (abs(tau) < overflow()) {
105 sig = sinh( eatanhe( tau / tau1 ) ),
106 taupa =
Math::hypot(real(1), sig) * tau - sig * tau1,
107 dtau = (taup - taupa) * (1 + _e2m *
Math::sq(tau)) /
110 if (!(abs(dtau) >= stol))
117 k = rho ? (rho / _a) * secphi * sqrt(_e2m + _e2 /
Math::sq(secphi)) : _k0;
118 lat = (northp ? 1 : -1) * (rho ? phi /
Math::degree() : 90);
120 gamma = northp ? lon : -lon;
126 if (!(-90 < lat && lat <= 90))
128 real x, y, gamma, kold;
130 Forward(
true, lat, 0, x, y, gamma, kold);
static T AngNormalize(T x)
static bool isfinite(T x)
void Forward(bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const
PolarStereographic(real a, real f, real k0)
void Reverse(bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const
static const PolarStereographic & UPS()
void SetScale(real lat, real k=real(1))
Namespace for GeographicLib.
Polar stereographic projection.
Exception handling for GeographicLib.
Header for GeographicLib::PolarStereographic class.
#define GEOGRAPHICLIB_PANIC