12 namespace GeographicLib {
17 real(0.1)*sqrt(numeric_limits<real>::epsilon());
19 const Math::real PolarStereographic::overflow_ =
20 1 /
Math::sq(numeric_limits<real>::epsilon());
24 , _f(f <= 1 ? f : 1/f)
28 , _Cx(exp(eatanhe(real(1))))
29 , _c( (1 - _f) * _Cx )
42 Constants::WGS84_f<real>(),
43 Constants::UPS_k0<real>());
67 real& x, real& y, real& gamma, real& k)
69 lat *= northp ? 1 : -1;
71 phi = lat * Math::degree<real>(),
72 tau = lat != -90 ? tanx(phi) : -overflow_,
74 sig = sinh( eatanhe(tau / secphi) ),
77 rho = taup >= 0 ? (lat != 90 ? 1/rho : 0) : rho;
78 rho *= 2 * _k0 * _a / _c;
79 k = lat != 90 ? (rho / _a) * secphi * sqrt(_e2m + _e2 /
Math::sq(secphi)) :
83 lam = lon * Math::degree<real>();
84 x = rho * (lon == -180 ? 0 : sin(lam));
85 y = (northp ? -rho : rho) * (abs(lon) == 90 ? 0 : cos(lam));
86 gamma = northp ? lon : -lon;
90 real& lat, real& lon, real& gamma, real& k)
94 t = rho / (2 * _k0 * _a / _c),
95 taup = (1 / t - t) / 2,
97 stol = tol_ * max(
real(1), abs(taup));
98 if (abs(tau) < overflow_) {
100 for (
int i = 0; i < numit_; ++i) {
103 sig = sinh( eatanhe( tau / tau1 ) ),
105 dtau = (taup - taupa) * (1 + _e2m *
Math::sq(tau)) /
108 if (!(abs(dtau) >= stol))
116 (rho / _a) * secphi * sqrt(_e2m + _e2 /
Math::sq(secphi)) : _k0;
117 lat = (northp ? 1 : -1) * (rho != 0 ? phi / Math::degree<real>() : 90);
118 lon = -atan2( -x, northp ? -y : y ) / Math::degree<real>();
119 gamma = northp ? lon : -lon;
125 if (!(-90 < lat && lat <= 90))
127 real x, y, gamma, kold;
129 Forward(
true, lat, 0, x, y, gamma, kold);
static T AngNormalize(T x)
GeographicLib::Math::real real
static bool isfinite(T x)
static const PolarStereographic UPS
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
void SetScale(real lat, real k=real(1))
Polar stereographic projection.
Exception handling for GeographicLib.
Header for GeographicLib::PolarStereographic class.