14 # pragma warning (disable: 4127) 23 , epsx_(
Math::sq(eps_))
24 , epsx2_(
Math::sq(epsx_))
33 , _qZ(1 + _e2m * atanhee(
real(1)))
34 , _qx(_qZ / ( 2 * _e2m ))
42 if (!(
abs(stdlat) <= 90))
46 Init(sphi, cphi, sphi, cphi, k0);
71 if (!(
abs(stdlat1) <= 90))
72 throw GeographicErr(
"Standard latitude 1 not in [-90d, 90d]");
73 if (!(
abs(stdlat2) <= 90))
74 throw GeographicErr(
"Standard latitude 2 not in [-90d, 90d]");
75 real sphi1, cphi1, sphi2, cphi2;
78 Init(sphi1, cphi1, sphi2, cphi2, k1);
106 throw GeographicErr(
"Standard latitude 1 not in [-90d, 90d]");
108 throw GeographicErr(
"Standard latitude 2 not in [-90d, 90d]");
109 if (!(
abs(sinlat1) <= 1 && coslat1 <= 1) || (coslat1 == 0 && sinlat1 == 0))
110 throw GeographicErr(
"Bad sine/cosine of standard latitude 1");
111 if (!(
abs(sinlat2) <= 1 && coslat2 <= 1) || (coslat2 == 0 && sinlat2 == 0))
112 throw GeographicErr(
"Bad sine/cosine of standard latitude 2");
113 if (coslat1 == 0 && coslat2 == 0 && sinlat1 * sinlat2 <= 0)
115 (
"Standard latitudes cannot be opposite poles");
116 Init(sinlat1, coslat1, sinlat2, coslat2, k1);
124 sphi1 /= r; cphi1 /= r;
126 sphi2 /= r; cphi2 /= r;
128 bool polar = (cphi1 == 0);
132 _sign = sphi1 + sphi2 >= 0 ? 1 : -1;
136 swap(sphi1, sphi2);
swap(cphi1, cphi2);
139 tphi1 = sphi1/cphi1, tphi2 = sphi2/cphi2;
164 if (polar || tphi1 == tphi2) {
169 tbet1 =
_fm * tphi1, scbet12 = 1 +
Math::sq(tbet1),
170 tbet2 =
_fm * tphi2, scbet22 = 1 +
Math::sq(tbet2),
171 txi1 =
txif(tphi1), cxi1 = 1/
hyp(txi1), sxi1 = txi1 * cxi1,
172 txi2 =
txif(tphi2), cxi2 = 1/
hyp(txi2), sxi2 = txi2 * cxi2,
173 dtbet2 =
_fm * (tbet1 + tbet2),
180 dsxi = ( (1 +
_e2 * sphi1 * sphi2) / (es2 * es1) +
181 Datanhee(sphi2, sphi1) ) *
Dsn(tphi2, tphi1, sphi2, sphi1) /
183 den = (sxi2 + sxi1) * dtbet2 + (scbet22 + scbet12) * dsxi,
185 s = 2 * dtbet2 / den,
190 sm1 = -
Dsn(tphi2, tphi1, sphi2, sphi1) *
191 ( -( ((sphi2 <= 0 ? (1 - sxi2) / (1 - sphi2) :
192 Math::sq(cxi2/cphi2) * (1 + sphi2) / (1 + sxi2)) +
193 (sphi1 <= 0 ? (1 - sxi1) / (1 - sphi1) :
194 Math::sq(cxi1/cphi1) * (1 + sphi1) / (1 + sxi1))) ) *
195 (1 +
_e2 * (sphi1 + sphi2 + sphi1 * sphi2)) /
196 (1 + (sphi1 + sphi2 + sphi1 * sphi2)) +
197 (scbet22 * (sphi2 <= 0 ? 1 - sphi2 :
199 scbet12 * (sphi1 <= 0 ? 1 - sphi1 :
Math::sq(cphi1) / ( 1 + sphi1)))
200 * (
_e2 * (1 + sphi1 + sphi2 +
_e2 * sphi1 * sphi2)/(es1 * es2)
203 C = den / (2 * scbet12 * scbet22 * dsxi);
204 tphi0 = (tphi2 + tphi1)/2;
242 sphi0 = tphi0 / scphi0, sphi0m = 1/(scphi0 * (tphi0 + scphi0)),
247 D = sphi0m * (1 -
_e2*(1 + 2*sphi0*(1+sphi0))) / (
_e2m * (1+sphi0)),
249 dD = -2 * (1 -
_e2*
Math::sq(sphi0) * (2*sphi0+3)) /
253 B = (sphi0m *
_e2m / (1 -
_e2*sphi0) *
259 u = sm1 *
g -
s/
_qZ * (
D -
g * (
A +
B) ),
261 du = sm1 * dg -
s/
_qZ * (dD - dg * (
A +
B) -
g * dAB),
262 dtu = -u/du * (scphi0 * scphi02);
264 if (!(
abs(dtu) >= stol))
281 return cylindricalequalarea;
288 return azimuthalequalareanorth;
295 return azimuthalequalareasouth;
309 int s = tphi < 0 ? -1 : 1;
313 sphi = tphi *
sqrt(cphi2),
315 es2m1 = 1 - es1 * sphi,
317 es1m1 = (1 - es1) * sp1,
318 es2m1a =
_e2m * es2m1,
319 es1p1 = sp1 / (1 + es1);
320 return s * ( sphi / es2m1 +
atanhee(sphi) ) /
321 sqrt( ( cphi2 / (es1p1 * es2m1a) +
atanhee(cphi2 / es1m1) ) *
322 ( es1m1 / es2m1a +
atanhee(es1p1) ) );
336 scterm = scphi2/(1 +
Math::sq(txia)),
337 dtphi = (txi - txia) * scterm *
sqrt(scterm) *
340 if (!(
abs(dtphi) >= stol))
369 real os = -1,
z = 1, k = 1,
t = 0,
c = 0, en = 1;
372 t = y *
t +
z;
c +=
t; z *=
x;
373 t = y *
t +
z;
c +=
t; z *=
x;
395 tphi = sphi/cphi, txi =
txif(tphi), sxi = txi/
hyp(txi),
403 (ctheta < 0 ? 1 - ctheta :
Math::sq(stheta)/(1 + ctheta)) /
_n0 :
405 - drho * ctheta) /
_k0;
436 if (!(
abs(lat) < 90))
437 throw GeographicErr(
"Latitude for SetScale not in (-90d, 90d)");
439 Forward(0, lat, 0, x, y, gamma, kold);
static T AngNormalize(T x)
static real Dsn(real x, real y, real sx, real sy)
void Reverse(real lon0, real x, real y, real &lat, real &lon, real &gamma, real &k) const
AlbersEqualArea(real a, real f, real stdlat, real k0)
static bool isfinite(T x)
static const AlbersEqualArea & CylindricalEqualArea()
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Mathematical functions needed by GeographicLib.
static void sincosd(T x, T &sinx, T &cosx)
static T AngDiff(T x, T y, T &e)
real DDatanhee(real x, real y) const
Matrix< SCALARB, Dynamic, Dynamic > B
void g(const string &key, int i)
Header for GeographicLib::AlbersEqualArea class.
Albers equal area conic projection.
EIGEN_DEVICE_FUNC const CosReturnType cos() const
real txif(real tphi) const
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
const mpreal gamma(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
static const AlbersEqualArea & AzimuthalEqualAreaNorth()
EIGEN_DEVICE_FUNC const AtanReturnType atan() const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
Jet< T, N > atan2(const Jet< T, N > &g, const Jet< T, N > &f)
Matrix< Scalar, Dynamic, Dynamic > C
void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1)
real Datanhee(real x, real y) const
Exception handling for GeographicLib.
ofstream os("timeSchurFactors.csv")
void Forward(real lon0, real lat, real lon, real &x, real &y, real &gamma, real &k) const
static const AlbersEqualArea & AzimuthalEqualAreaSouth()
static real atanhxm1(real x)
EIGEN_DEVICE_FUNC const SinReturnType sin() const
real tphif(real txi) const
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
real atanhee(real x) const
#define GEOGRAPHICLIB_PANIC
void SetScale(real lat, real k=real(1))