23#if !defined(AUXLATITUDE_UNOPT)
26#define AUXLATITUDE_UNOPT 0
29#if !defined(AUXLATITUDE_NATIVE_ELLIPTIC)
32#define AUXLATITUDE_NATIVE_ELLIPTIC 1
37#if !AUXLATITUDE_NATIVE_ELLIPTIC
44# pragma warning (disable: 4127)
53 return AuxAngle(std::numeric_limits<real>::quiet_NaN(),
54 std::numeric_limits<real>::quiet_NaN());
59 if ( isnan( tan() ) ||
60 (fabs(_y) > std::numeric_limits<real>::max()/2 &&
61 fabs(_x) > std::numeric_limits<real>::max()/2) )
65 real r = hypot(_y, _x),
68 if (isnan(y)) y = copysign(
real(1), _y);
69 if (isnan(x)) x = copysign(
real(1), _x);
75 return AuxAngle(copysign(y(), p.
y()), copysign(x(), p.
x()));
82 real x = _x * p._x - _y * p._y;
83 _y = _y * p._x + _x * p._y;
91 : tol_( sqrt(numeric_limits<
real>::epsilon()) )
93 , bmin_( numeric_limits<
real>::min() )
94 , bmax_( numeric_limits<
real>::max() )
96 , bmin_( log2(numeric_limits<
real>::min()) )
97 , bmax_( log2(numeric_limits<
real>::max()) )
101 , _e2( _f * (2 - _f) )
102 , _e2m1( _fm1 * _fm1 )
103 , _e12( _e2/(1 - _e2) )
104 , _e12p1( 1 / _e2m1 )
106 , _e( sqrt(fabs(_e2)) )
107 , _e1( sqrt(fabs(_e12)) )
110 , _q( _e12p1 + (_f == 0 ? 1 : (_f > 0 ? asinh(_e1) : atan(_e)) / _e) )
112 , _q( _e12p1 + (_f == 0 ? 1 : (_f > 0 ? atanh(_e) : atan(_e)) / _e) )
115 if (!(isfinite(_f) && _f < 1 &&
116 isfinite(_n) && fabs(_n) < 1))
119 numeric_limits<real>::quiet_NaN());
124 : tol_( sqrt(numeric_limits<
real>::epsilon()) )
126 , bmin_( numeric_limits<
real>::min() )
127 , bmax_( numeric_limits<
real>::max() )
129 , bmin_( log2(numeric_limits<
real>::min()) )
130 , bmax_( log2(numeric_limits<
real>::max()) )
134 , _e2( ((a - b) * (a + b)) / (a * a) )
135 , _e2m1( (b * b) / (a * a) )
136 , _e12( ((a - b) * (a + b)) / (b * b) )
137 , _e12p1( (a * a) / (b * b) )
138 , _n( (a - b) / (a + b) )
139 , _e( sqrt(fabs(a - b) * (a + b)) / a )
140 , _e1( sqrt(fabs(a - b) * (a + b)) / b )
143 , _q( _e12p1 + (_f == 0 ? 1 : (_f > 0 ? asinh(_e1) : atan(_e)) / _e) )
145 , _q( _e12p1 + (_f == 0 ? 1 : (_f > 0 ? atanh(_e) : atan(_e)) / _e) )
148 if (!(isfinite(_f) && _f < 1 &&
149 isfinite(_n) && fabs(_n) < 1))
152 numeric_limits<real>::quiet_NaN());
157 if (diff) *diff = _fm1;
158 return angle(phi.y() * _fm1, phi.x());
162 AuxAngle<T> AuxLatitude<T>::Geocentric(
const angle& phi,
real* diff)
const {
163 if (diff) *diff = _e2m1;
164 return angle(phi.y() * _e2m1, phi.x());
168 AuxAngle<T> AuxLatitude<T>::Rectifying(
const angle& phi,
real* diff)
const {
169 angle beta(Parametric(phi).normalized());
170 real sbeta = fabs(beta.y()), cbeta = fabs(beta.x());
171 real a = 1, b = _fm1, ka = _e2, kb = -_e12, ka1 = _e2m1, kb1 = _e12p1,
186 da2 = ka1 + ka * sb2,
188 sa = b * sbeta * ( RF(cb2, db2, 1) - kb * sb2 * RD(cb2, db2, 1) / 3 ),
190 sb = a * cbeta * ( ka1 * RF(sb2, da2, 1)
191 + ka * ka1 * cb2 * RD(sb2, 1, da2) / 3
192 + ka * sbeta / sqrt(da2) );
195 mr = (2 * (sa + sb)) / Math::pi<real>();
198 if (_f < 0) {
swap(smu, cmu);
swap(a, b); }
200 angle mu(angle(smu, cmu).copyquadrant(phi));
202 real cphi = phi.normalized().x(), tphi = phi.tan();
203 if (isfinite(tphi) || isnan(tphi)) {
204 cmu = mu.x(); cbeta = beta.x();
205 *diff = _fm1 * b/mr *
Math::sq(cbeta / cmu) * (cbeta / cphi);
213 AuxAngle<T> AuxLatitude<T>::Conformal(
const angle& phi,
real* diff)
const {
214 real tphi = fabs(phi.tan()), tchi = tphi;
215 if ( !( !isfinite(tphi) || tphi == 0 || _f == 0 ) ) {
216 real scphi = sc(tphi),
217 sig = sinh(_e2 * atanhee(tphi) ),
220 tchi = tphi * scsig - sig * scphi;
223 tchi = tphi * scsig - sig * scphi;
231 real sigtphi = sig / tphi, tphimsig;
233 tphimsig = tphi - sig;
245 em1 = _e2m1 / (1 + _e),
246 atanhs = asinh(tphi),
247 scbeta = sc(_fm1 * tphi),
248 scphibeta = sc(tphi) / scbeta,
249 atanhes = asinh(_e * tphi / scbeta),
250 t1 = (atanhs - _e * atanhes)/2,
251 t2 = asinh(em1 * (tphi * scphibeta)) / em1,
252 Dg = cosh((atanhs + _e * atanhes)/2) * (sinh(t1) / t1)
253 * ((atanhs + atanhes)/2 + (1 + _e)/2 * t2);
256 tchi = tphimsig * (1 + sigtphi) / (scsig + sigtphi * scphi);
260 angle chi(angle(tchi).copyquadrant(phi));
262 if (isfinite(tphi) || isnan(tphi)) {
263 real cchi = chi.normalized().x(),
264 cphi = phi.normalized().x(),
265 cbeta = Parametric(phi).normalized().x();
266 *diff = _e2m1 * (cbeta / cchi) * (cbeta / cphi);
269 real ss = _f > 0 ? sinh(_e * asinh(_e1)) : sinh(-_e * atan(_e));
270 *diff = _f > 0 ? 1/( sc(ss) + ss ) : sc(ss) - ss;
272 real ss = _f > 0 ? sinh(_e * atanh(_e)) : sinh(-_e * atan(_e));
281 AuxAngle<T> AuxLatitude<T>::Authalic(
const angle& phi,
real* diff)
const {
282 real tphi = fabs(phi.tan());
283 angle xi(phi), phin(phi.normalized());
284 if ( !( !isfinite(tphi) || tphi == 0 || _f == 0 ) ) {
287 Dqm = (_q + qv) / (1 + fabs(phin.y()));
288 xi = angle( copysign(qv, phi.y()), phin.x() * sqrt(Dqp * Dqm) );
291 if (isfinite(tphi) || isnan(tphi)) {
293 cbeta = Parametric(phi).normalized().x(),
294 cxi = xi.normalized().x();
296 (2/_q) *
Math::sq(cbeta / cxi) * (cbeta / cxi) * (cbeta / phin.x());
298 *diff = _e2m1 * sqrt(_q/2);
307 case GEOGRAPHIC:
if (diff) *diff = 1;
return phi;
break;
308 case PARAMETRIC:
return Parametric(phi, diff);
break;
309 case GEOCENTRIC:
return Geocentric(phi, diff);
break;
310 case RECTIFYING:
return Rectifying(phi, diff);
break;
311 case CONFORMAL :
return Conformal (phi, diff);
break;
312 case AUTHALIC :
return Authalic (phi, diff);
break;
314 if (diff) *diff = numeric_limits<real>::quiet_NaN();
323 int n = 0;
if (niter) *niter = n;
326 case GEOGRAPHIC:
return zeta;
break;
328 case PARAMETRIC:
return angle(zeta.
y() / _fm1, zeta.
x());
break;
330 case GEOCENTRIC:
return angle(zeta.
y() / _e2m1, zeta.
x());
break;
331 case RECTIFYING: tphi *= sqrt(_fm1);
break;
332 case CONFORMAL : tphi *= _fm1 ;
break;
333 case AUTHALIC : tphi *= cbrt(_fm1);
break;
334 default:
return angle::NaN();
break;
340 if (!isfinite(tzeta))
return zeta;
342 real bmin = fmin(tphi, bmin_), bmax = fmax(tphi, bmax_);
343 for (
int sign = 0, osign = 0, ntrip = 0; n < numit_;) {
346 angle zeta1(ToAuxiliary(auxin,
angle(tphi), &diff));
351 else if (tzeta1 > tzeta) {
358 real dtphi = -(tzeta1 - tzeta) / diff;
360 if (!(fabs(dtphi) >= tol_ * tphi))
363 if (
false && ((sign * osign < 0 && n - ntrip > 2) ||
364 tphi >= bmax || tphi <= bmin)) {
366 tphi = sqrt(bmin * bmax);
370 real tzeta = fabs(zeta.
tan()), ltzeta = log2(tzeta);
371 if (!isfinite(ltzeta))
return zeta;
373 real ltphi = log2(tphi),
374 bmin = fmin(ltphi, bmin_), bmax = fmax(ltphi, bmax_);
375 for (
int sign = 0, osign = 0, ntrip = 0; n < numit_;) {
378 angle zeta1(ToAuxiliary(auxin,
angle(tphi), &diff));
379 real tzeta1 = zeta1.
tan(), ltzeta1 = log2(tzeta1);
386 else if (tzeta1 > tzeta) {
393 real dltphi = -(ltzeta1 - ltzeta) / diff;
396 if (!(fabs(dltphi) >= tol_)) {
399 zeta1 = ToAuxiliary(auxin,
angle(tphi), &diff);
400 tphi -= (zeta1.
tan() - tzeta) / diff;
403 if ((sign * osign < 0 && n - ntrip > 2) ||
404 ltphi >= bmax || ltphi <= bmin) {
406 ltphi = (bmin + bmax) / 2;
411 if (niter) *niter = n;
418 int k = ind(auxout, auxin);
419 if (k < 0)
return angle::NaN();
420 if (auxin == auxout)
return zeta;
422 if ( isnan(_c[Lmax * k]) ) fillcoeff(auxin, auxout, k);
424 real d = Clenshaw(zetan.
y(), zetan.
x(), _c + Lmax * k, Lmax);
425 zetan += angle::radians(d);
428 if (auxin < 3 && auxout < 3)
429 return angle(zeta.
y() * pow(_fm1, auxout - auxin), zeta.
x());
431 return ToAuxiliary(auxout, FromAuxiliary(auxin, zeta));
437#if AUXLATITUDE_NATIVE_ELLIPTIC
440 tolRD = pow(
real(0.2) * (numeric_limits<real>::epsilon() *
real(0.01)),
443 A0 = (x + y + 3*z)/5,
445 Q = fmax(fmax(fabs(A0-x), fabs(A0-y)), fabs(A0-z)) / tolRD,
451 while (Q >= mul * fabs(An)) {
453 real lam = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0);
454 s += 1/(mul * sqrt(z0) * (z0 + lam));
462 X = (A0 - x) / (mul * An),
463 Y = (A0 - y) / (mul * An),
466 E3 = (3*X*Y - 8*Z*Z)*Z,
467 E4 = 3 * (X*Y - Z*Z) * Z*Z,
474 return ((471240 - 540540 * E2) * E5 +
475 (612612 * E2 - 540540 * E3 - 556920) * E4 +
476 E3 * (306306 * E3 + E2 * (675675 * E2 - 706860) + 680680) +
477 E2 * ((417690 - 255255 * E2) * E2 - 875160) + 4084080) /
478 (4084080 * mul * An * sqrt(An)) + 3 * s;
487#if AUXLATITUDE_NATIVE_ELLIPTIC
489 static const real tolRF =
490 pow(3 * numeric_limits<real>::epsilon() *
real(0.01), 1/
real(8));
494 Q = fmax(fmax(fabs(A0-x), fabs(A0-y)), fabs(A0-z)) / tolRF,
499 while (Q >= mul * fabs(An)) {
501 real lam = sqrt(x0)*sqrt(y0) + sqrt(y0)*sqrt(z0) + sqrt(z0)*sqrt(x0);
509 X = (A0 - x) / (mul * An),
510 Y = (A0 - y) / (mul * An),
519 return (E3 * (6930 * E3 + E2 * (15015 * E2 - 16380) + 17160) +
520 E2 * ((10010 - 5775 * E2) * E2 - 24024) + 240240) /
531 real sphi = sn(tphi);
532 return _f == 0 ? sphi :
533 (_f < 0 ? atan( _e * sphi ) : atanh( _e * sphi )) / _e;
535 real s = _f <= 0 ? sn(tphi) : sn(_fm1 * tphi);
538 (_f < 0 ? atan( _e * s ) : asinh( _e1 * s )) / _e;
545 real sphi = sn(tphi);
546 return atanhee(tphi) + sphi / (1 - _e2 * sphi*sphi);
548 real scbeta = sc(_fm1 * tphi);
549 return atanhee(tphi) + (tphi / scbeta) * (sc(tphi) / scbeta);
556 real sphi = sn(tphi), d = 1 - sphi;
559 return (_q - q(tphi)) / d;
563 return (_f == 0 ? 1 / (1 - _e2 * sphi) :
564 (_f < 0 ? atan(_e * d / (1 - _e2 * sphi)) / (_e * d) :
565 atanh(_e * d / (1 - _e2 * sphi)) / (_e * d) )) +
566 (1 + _e2 * sphi) / ((1 - _e2 * sphi*sphi) * _e2m1);
568 real scphi = sc(tphi), sphi = sn(tphi),
570 d = tphi > 0 ? 1 / (scphi * scphi * (1 + sphi)) : 1 - sphi;
573 return (_q - q(tphi)) / d;
583 real scbeta = sc(_fm1 * tphi);
584 return (_f == 0 ? 1 :
585 (_f > 0 ? asinh(_e1 * d * scphi / scbeta) :
586 atan(_e * d / (1 - _e2 * sphi))) / (_e * d) ) +
588 ((scphi + _e2 * tphi) / (_e2m1 * scbeta)) * (scphi / scbeta) :
589 (1 + _e2 * sphi) / ((1 - _e2 * sphi*sphi) * _e2m1) );
595 void AuxLatitude<T>::fillcoeff(
int auxin,
int auxout,
int k)
const {
596#if GEOGRAPHICLIB_AUXLATITUDE_ORDER == 4
597 static const real coeffs[] = {
701 -40457/
real(2419200),
746 -2917/
real(56700), 4463/
real(90720),
747 331799/
real(7257600),
755 static const int ptrs[] = {
756 0, 0, 6, 12, 18, 28, 38, 44, 44, 50, 56, 66, 76, 82, 88, 88, 94, 104,
757 114, 120, 126, 132, 132, 142, 152, 162, 172, 182, 192, 192, 202, 212,
758 222, 232, 242, 252, 252,
760#elif GEOGRAPHICLIB_AUXLATITUDE_ORDER == 6
761 static const real coeffs[] = {
792 28112932/
real(212837625), 60136/
real(467775), -2582/
real(14175),
794 251310128/
real(638512875), -21016/
real(51975), -11966/
real(14175),
796 -8797648/
real(10945935), -94388/
real(66825), 3802/
real(14175),
798 -1472637812/
real(638512875), 41072/
real(93555), 6059/
real(4725),
799 455935736/
real(638512875), 768272/
real(467775),
800 4210684958LL/
real(1915538625),
831 7947332/
real(212837625), 11824/
real(467775), -1082/
real(14175),
833 39946703/
real(638512875), -16672/
real(155925), -338/
real(2025),
835 -255454/
real(1563705), -101069/
real(467775), 1102/
real(14175),
837 -189032762/
real(638512875), 1786/
real(18711), 3161/
real(18900),
838 80274086/
real(638512875), 88868/
real(467775),
839 880980241/
real(3831077250LL),
870 216932/
real(2627625), 109042/
real(467775), -2102/
real(14175),
872 117952358/
real(638512875), -7256/
real(155925), 934/
real(14175),
874 -7391576/
real(54729675), -25286/
real(66825), 922/
real(14175),
876 -67048172/
real(638512875), 268/
real(18711), 719/
real(4725),
877 46774256/
real(638512875), 14354/
real(467775),
878 253129538/
real(1915538625),
907 6601661/
real(7257600), -179/
real(168), 49561/
real(161280),
908 -3418889/
real(1995840), 34729/
real(80640),
909 212378941/
real(319334400),
911 12674323/
real(851350500), -384229/
real(14968800), -1609/
real(28350),
913 -31621753811LL/
real(1307674368000LL), -431/
real(17325),
915 -32844781/
real(1751349600), 3746047/
real(119750400), 449/
real(28350),
917 10650637121LL/
real(326918592000LL), 629/
real(53460),
918 -40457/
real(2419200),
919 205072597/
real(20432412000LL), -1800439/
real(119750400),
920 -59109051671LL/
real(3923023104000LL),
949 108847/
real(3991680), -4583/
real(161280),
950 -20648693/
real(638668800),
953 -55271278/
real(212837625), 27128/
real(93555), -2312/
real(14175),
955 106691108/
real(638512875), -65864/
real(155925), 6079/
real(14175),
957 5921152/
real(54729675), -14246/
real(467775), 772/
real(14175),
959 75594328/
real(638512875), -5312/
real(467775), -167/
real(9450),
960 2837636/
real(638512875), -248/
real(13365),
961 -34761247/
real(1915538625),
965 -12467764/
real(212837625), -37192/
real(467775), -2482/
real(14175),
967 100320856/
real(1915538625), 54968/
real(467775), -898/
real(14175),
969 -5884124/
real(70945875), 24496/
real(467775), 6007/
real(14175),
970 -839792/
real(19348875), -23356/
real(66825),
971 570284222/
real(1915538625),
977 -661844/
real(1915538625), 7052/
real(467775), 2/
real(14175),
979 1425778/
real(212837625), 934/
real(467775), -797/
real(56700),
980 390088/
real(212837625), -3673/
real(467775),
981 -18623681/
real(3831077250LL),
983 -4286228/
real(42567525), -193082/
real(467775), 778/
real(4725),
985 -61623938/
real(70945875), 92696/
real(467775), 12338/
real(14175),
987 427003576/
real(1915538625), 612536/
real(467775), -1618/
real(14175),
989 427770788/
real(212837625), -8324/
real(66825), -5933/
real(14175),
990 -9153184/
real(70945875), -320044/
real(467775),
991 -1978771378/
real(1915538625),
993 -9292991/
real(302702400), 7764059/
real(239500800), 1297/
real(18900),
995 36019108271LL/
real(871782912000LL), 35474/
real(467775),
997 3026004511LL/
real(30648618000LL), -4306823/
real(59875200),
998 -2917/
real(56700), 4463/
real(90720),
999 -368661577/
real(4036032000LL), -102293/
real(1871100),
1000 331799/
real(7257600),
1001 -875457073/
real(13621608000LL), 11744233/
real(239500800),
1002 453002260127LL/
real(7846046208000LL),
1004 2706758/
real(42567525), -55222/
real(93555), 2458/
real(4725),
1006 -340492279/
real(212837625), 516944/
real(467775), 3413/
real(14175),
1008 4430783356LL/
real(1915538625), 206834/
real(467775), -15958/
real(14175),
1010 62016436/
real(70945875), -832976/
real(467775), 16049/
real(28350),
1011 -651151712/
real(212837625), 15602/
real(18711),
1012 2561772812LL/
real(1915538625),
1015 static const int ptrs[] = {
1016 0, 0, 12, 24, 36, 57, 78, 90, 90, 102, 114, 135, 156, 168, 180, 180, 192,
1017 213, 234, 246, 258, 270, 270, 291, 312, 333, 354, 375, 396, 396, 417,
1018 438, 459, 480, 501, 522, 522,
1020#elif GEOGRAPHICLIB_AUXLATITUDE_ORDER == 8
1021 static const real coeffs[] = {
1045 2514467/
real(245760), -15543/
real(2560), 1097/
real(512),
1046 -69119/
real(6144), 8011/
real(2560),
1047 -5962461/
real(286720), 293393/
real(61440),
1048 6459601/
real(860160),
1049 332287993/
real(27525120),
1055 -2363828/
real(31185), 98738/
real(14175), 73814/
real(2835),
1057 14416399/
real(935550), 11763988/
real(155925), -399572/
real(14175),
1059 258316372/
real(1216215), -2046082/
real(31185), -144838/
real(6237),
1061 -2155215124LL/
real(14189175), -115444544/
real(2027025),
1063 -170079376/
real(1216215), 38341552/
real(675675),
1064 1383243703/
real(11351340),
1066 -1683291094/
real(37574026875LL), 22947844/
real(1915538625),
1067 28112932/
real(212837625), 60136/
real(467775), -2582/
real(14175),
1069 -14351220203LL/
real(488462349375LL), 1228352/
real(3007125),
1070 251310128/
real(638512875), -21016/
real(51975), -11966/
real(14175),
1072 505559334506LL/
real(488462349375LL), 138128272/
real(147349125),
1073 -8797648/
real(10945935), -94388/
real(66825), 3802/
real(14175),
1075 973080708361LL/
real(488462349375LL), -45079184/
real(29469825),
1076 -1472637812/
real(638512875), 41072/
real(93555), 6059/
real(4725),
1077 -1385645336626LL/
real(488462349375LL), -550000184/
real(147349125),
1078 455935736/
real(638512875), 768272/
real(467775),
1079 -2939205114427LL/
real(488462349375LL), 443810768/
real(383107725),
1080 4210684958LL/
real(1915538625),
1081 101885255158LL/
real(54273594375LL), 387227992/
real(127702575),
1082 1392441148867LL/
real(325641566250LL),
1106 1082857/
real(737280), -2391/
real(2560), 539/
real(1536),
1107 -28223/
real(18432), 3467/
real(7680),
1108 -733437/
real(286720), 38081/
real(61440),
1109 459485/
real(516096),
1110 109167851/
real(82575360),
1118 -637699/
real(85050), 2454416/
real(155925), -49877/
real(14175),
1120 48124558/
real(1216215), -20989/
real(2835), -28244/
real(4455),
1122 -16969807/
real(1091475), -2471888/
real(184275), 797222/
real(155925),
1123 -1238578/
real(42525), 2199332/
real(225225),
1124 87600385/
real(4540536),
1126 -5946082372LL/
real(488462349375LL), 9708931/
real(1915538625),
1127 7947332/
real(212837625), 11824/
real(467775), -1082/
real(14175),
1129 190673521/
real(69780335625LL), 164328266/
real(1915538625),
1130 39946703/
real(638512875), -16672/
real(155925), -338/
real(2025),
1132 86402898356LL/
real(488462349375LL), 236067184/
real(1915538625),
1133 -255454/
real(1563705), -101069/
real(467775), 1102/
real(14175),
1135 110123070361LL/
real(488462349375LL), -98401826/
real(383107725),
1136 -189032762/
real(638512875), 1786/
real(18711), 3161/
real(18900),
1137 -200020620676LL/
real(488462349375LL), -802887278/
real(1915538625),
1138 80274086/
real(638512875), 88868/
real(467775),
1139 -296107325077LL/
real(488462349375LL), 66263486/
real(383107725),
1140 880980241/
real(3831077250LL),
1141 4433064236LL/
real(18091198125LL), 37151038/
real(127702575),
1142 495248998393LL/
real(1302566265000LL),
1166 1155049/
real(737280), -4037/
real(7680), 283/
real(1536),
1167 -19465/
real(18432), 1301/
real(7680),
1168 -442269/
real(286720), 17089/
real(61440),
1169 198115/
real(516096),
1170 48689387/
real(82575360),
1181 -48965632/
real(4729725), -548752/
real(96525), 335882/
real(155925),
1182 -197456/
real(15795), 51368/
real(12285),
1183 1461335/
real(174636),
1185 -230886326/
real(6343666875LL), -189115382/
real(1915538625),
1186 216932/
real(2627625), 109042/
real(467775), -2102/
real(14175),
1188 -11696145869LL/
real(69780335625LL), 288456008/
real(1915538625),
1189 117952358/
real(638512875), -7256/
real(155925), 934/
real(14175),
1191 91546732346LL/
real(488462349375LL), 478700902/
real(1915538625),
1192 -7391576/
real(54729675), -25286/
real(66825), 922/
real(14175),
1194 218929662961LL/
real(488462349375LL), -67330724/
real(383107725),
1195 -67048172/
real(638512875), 268/
real(18711), 719/
real(4725),
1196 -129039188386LL/
real(488462349375LL), -117954842/
real(273648375),
1197 46774256/
real(638512875), 14354/
real(467775),
1198 -178084928947LL/
real(488462349375LL), 2114368/
real(34827975),
1199 253129538/
real(1915538625),
1200 6489189398LL/
real(54273594375LL), 13805944/
real(127702575),
1201 59983985827LL/
real(325641566250LL),
1210 109395/
real(262144),
1226 16617/
real(4096), -6037/
real(6144),
1228 -490925/
real(262144),
1231 -18975107/
real(50803200), 72161/
real(387072), 7891/
real(37800),
1233 148003883/
real(174182400), 13769/
real(28800), -1983433/
real(1935360),
1235 79682431/
real(79833600), -67102379/
real(29030400), 167603/
real(181440),
1237 -40176129013LL/
real(7664025600LL), 97445/
real(49896),
1238 6601661/
real(7257600), -179/
real(168), 49561/
real(161280),
1239 2605413599LL/
real(622702080), 14644087/
real(9123840),
1240 -3418889/
real(1995840), 34729/
real(80640),
1241 175214326799LL/
real(58118860800LL), -30705481/
real(10378368),
1242 212378941/
real(319334400),
1243 -16759934899LL/
real(3113510400LL), 1522256789/
real(1383782400),
1244 1424729850961LL/
real(743921418240LL),
1246 -375027460897LL/
real(125046361440000LL),
1247 7183403063LL/
real(560431872000LL), 12674323/
real(851350500),
1250 30410873385097LL/
real(2000741783040000LL),
1251 1117820213/
real(122594472000LL), -31621753811LL/
real(1307674368000LL),
1253 151567502183LL/
real(17863765920000LL),
1254 -116359346641LL/
real(3923023104000LL), -32844781/
real(1751349600),
1255 3746047/
real(119750400), 449/
real(28350), -1003/
real(45360),
1256 -317251099510901LL/
real(8002967132160000LL), -13060303/
real(766215450),
1257 10650637121LL/
real(326918592000LL), 629/
real(53460),
1258 -40457/
real(2419200),
1259 -2105440822861LL/
real(125046361440000LL),
1260 146875240637LL/
real(3923023104000LL), 205072597/
real(20432412000LL),
1261 -1800439/
real(119750400),
1262 91496147778023LL/
real(2000741783040000LL), 228253559/
real(24518894400LL),
1263 -59109051671LL/
real(3923023104000LL),
1264 126430355893LL/
real(13894040160000LL),
1265 -4255034947LL/
real(261534873600LL),
1266 -791820407649841LL/
real(42682491371520000LL),
1274 -1097407/
real(187110), 1077964/
real(155925), -24832/
real(14175),
1276 -12870194/
real(1216215), 1040/
real(567), 109598/
real(31185),
1278 -126463/
real(72765), -941912/
real(184275), 444337/
real(155925),
1279 3463678/
real(467775), -2405834/
real(675675),
1280 256663081/
real(56756700),
1291 210152/
real(4729725), -31232/
real(2027025), 149/
real(311850),
1292 30208/
real(6081075), -499/
real(225225),
1293 -68251/
real(113513400),
1304 40458083/
real(14189175), -299444/
real(675675), -90263/
real(155925),
1305 -3818498/
real(6081075), -8962/
real(12285),
1306 -4259027/
real(4365900),
1308 -7944359/
real(67737600), 5406467/
real(38707200), -96199/
real(604800),
1310 -24749483/
real(348364800), -51841/
real(1209600), 1118711/
real(3870720),
1312 6457463/
real(17740800), -9261899/
real(58060800), -5569/
real(90720),
1314 -324154477/
real(7664025600LL), -466511/
real(2494800),
1315 830251/
real(7257600), 11/
real(504), -4397/
real(161280),
1316 -22894433/
real(124540416), 8005831/
real(63866880), 108847/
real(3991680),
1318 2204645983LL/
real(12915302400LL), 16363163/
real(518918400),
1319 -20648693/
real(638668800),
1320 497323811/
real(12454041600LL), -219941297/
real(5535129600LL),
1321 -191773887257LL/
real(3719607091200LL),
1324 -17451293242LL/
real(488462349375LL), 308365186/
real(1915538625),
1325 -55271278/
real(212837625), 27128/
real(93555), -2312/
real(14175),
1327 -101520127208LL/
real(488462349375LL), 149984636/
real(1915538625),
1328 106691108/
real(638512875), -65864/
real(155925), 6079/
real(14175),
1330 10010741462LL/
real(37574026875LL), -99534832/
real(383107725),
1331 5921152/
real(54729675), -14246/
real(467775), 772/
real(14175),
1333 1615002539/
real(75148053750LL), -35573728/
real(273648375),
1334 75594328/
real(638512875), -5312/
real(467775), -167/
real(9450),
1335 -3358119706LL/
real(488462349375LL), 130601488/
real(1915538625),
1336 2837636/
real(638512875), -248/
real(13365),
1337 46771947158LL/
real(488462349375LL), -3196/
real(3553875),
1338 -34761247/
real(1915538625),
1339 -18696014/
real(18091198125LL), -2530364/
real(127702575),
1340 -14744861191LL/
real(651283132500LL),
1342 -88002076/
real(13956067125LL), -86728/
real(16372125),
1345 -2641983469LL/
real(488462349375LL), -895712/
real(147349125),
1346 -12467764/
real(212837625), -37192/
real(467775), -2482/
real(14175),
1348 8457703444LL/
real(488462349375LL), 240616/
real(4209975),
1349 100320856/
real(1915538625), 54968/
real(467775), -898/
real(14175),
1351 -4910552477LL/
real(97692469875LL), -4832848/
real(147349125),
1352 -5884124/
real(70945875), 24496/
real(467775), 6007/
real(14175),
1353 9393713176LL/
real(488462349375LL), 816824/
real(13395375),
1354 -839792/
real(19348875), -23356/
real(66825),
1355 -4532926649LL/
real(97692469875LL), 1980656/
real(54729675),
1356 570284222/
real(1915538625),
1357 -14848113968LL/
real(488462349375LL), -496894276/
real(1915538625),
1358 224557742191LL/
real(976924698750LL),
1360 29232878/
real(97692469875LL), -18484/
real(4343625), -70496/
real(8513505),
1362 -324943819/
real(488462349375LL), -4160804/
real(1915538625),
1365 -168643106/
real(488462349375LL), 237052/
real(383107725),
1366 -661844/
real(1915538625), 7052/
real(467775), 2/
real(14175),
1368 113042383/
real(97692469875LL), -2915326/
real(1915538625),
1369 1425778/
real(212837625), 934/
real(467775), -797/
real(56700),
1370 -558526274/
real(488462349375LL), 6064888/
real(1915538625),
1371 390088/
real(212837625), -3673/
real(467775),
1372 155665021/
real(97692469875LL), 41288/
real(29469825),
1373 -18623681/
real(3831077250LL),
1374 504234982/
real(488462349375LL), -6205669/
real(1915538625),
1375 -8913001661LL/
real(3907698795000LL),
1377 182466964/
real(8881133625LL), 53702182/
real(212837625),
1378 -4286228/
real(42567525), -193082/
real(467775), 778/
real(4725),
1380 367082779691LL/
real(488462349375LL), -32500616/
real(273648375),
1381 -61623938/
real(70945875), 92696/
real(467775), 12338/
real(14175),
1383 -42668482796LL/
real(488462349375LL), -663111728/
real(383107725),
1384 427003576/
real(1915538625), 612536/
real(467775), -1618/
real(14175),
1386 -327791986997LL/
real(97692469875LL), 421877252/
real(1915538625),
1387 427770788/
real(212837625), -8324/
real(66825), -5933/
real(14175),
1388 74612072536LL/
real(488462349375LL), 6024982024LL/
real(1915538625),
1389 -9153184/
real(70945875), -320044/
real(467775),
1390 489898512247LL/
real(97692469875LL), -46140784/
real(383107725),
1391 -1978771378/
real(1915538625),
1392 -42056042768LL/
real(488462349375LL), -2926201612LL/
real(1915538625),
1393 -2209250801969LL/
real(976924698750LL),
1395 39534358147LL/
real(2858202547200LL),
1396 -25359310709LL/
real(1743565824000LL), -9292991/
real(302702400),
1399 -13216941177599LL/
real(571640509440000LL),
1400 -14814966289LL/
real(245188944000LL), 36019108271LL/
real(871782912000LL),
1402 -27782109847927LL/
real(250092722880000LL),
1403 99871724539LL/
real(1569209241600LL), 3026004511LL/
real(30648618000LL),
1404 -4306823/
real(59875200), -2917/
real(56700), 4463/
real(90720),
1405 168979300892599LL/
real(1600593426432000LL),
1406 2123926699/
real(15324309000LL), -368661577/
real(4036032000LL),
1407 -102293/
real(1871100), 331799/
real(7257600),
1408 1959350112697LL/
real(9618950880000LL),
1409 -493031379277LL/
real(3923023104000LL), -875457073/
real(13621608000LL),
1410 11744233/
real(239500800),
1411 -145659994071373LL/
real(800296713216000LL),
1412 -793693009/
real(9807557760LL), 453002260127LL/
real(7846046208000LL),
1413 -53583096419057LL/
real(500185445760000LL),
1414 103558761539LL/
real(1426553856000LL),
1415 12272105438887727LL/
real(128047474114560000LL),
1417 -64724382148LL/
real(97692469875LL), 16676974/
real(30405375),
1418 2706758/
real(42567525), -55222/
real(93555), 2458/
real(4725),
1420 85904355287LL/
real(37574026875LL), 158999572/
real(1915538625),
1421 -340492279/
real(212837625), 516944/
real(467775), 3413/
real(14175),
1423 2986003168LL/
real(37574026875LL), -7597644214LL/
real(1915538625),
1424 4430783356LL/
real(1915538625), 206834/
real(467775), -15958/
real(14175),
1426 -375566203/
real(39037950), 851209552/
real(174139875),
1427 62016436/
real(70945875), -832976/
real(467775), 16049/
real(28350),
1428 5106181018156LL/
real(488462349375LL), 3475643362LL/
real(1915538625),
1429 -651151712/
real(212837625), 15602/
real(18711),
1430 34581190223LL/
real(8881133625LL), -10656173804LL/
real(1915538625),
1431 2561772812LL/
real(1915538625),
1432 -5150169424688LL/
real(488462349375LL), 873037408/
real(383107725),
1433 7939103697617LL/
real(1953849397500LL),
1436 static const int ptrs[] = {
1437 0, 0, 20, 40, 60, 96, 132, 152, 152, 172, 192, 228, 264, 284, 304, 304,
1438 324, 360, 396, 416, 436, 456, 456, 492, 528, 564, 600, 636, 672, 672,
1439 708, 744, 780, 816, 852, 888, 888,
1442#error "Unsupported value for GEOGRAPHICLIB_AUXLATITUDE_ORDER"
1445 static_assert(
sizeof(ptrs) /
sizeof(
int) == AUXNUMBER*AUXNUMBER+1,
1446 "Mismatch in size of ptrs array");
1447 static_assert(
sizeof(coeffs) /
sizeof(
real) ==
1448 (RECTIFYING+1)*RECTIFYING *
1449 (Lmax * (Lmax + 3) - 2*(Lmax/2))/4
1450 + (AUXNUMBER*(AUXNUMBER-1) - (RECTIFYING+1)*RECTIFYING) *
1451 (Lmax * (Lmax + 1))/2,
1452 "Mismatch in size of coeffs array");
1455 if (auxout == auxin)
1456 fill(_c + Lmax * k, _c + Lmax * (k + 1), 0);
1460 if (auxin <= RECTIFYING && auxout <= RECTIFYING) {
1461 for (
int l = 0; l < Lmax; ++l) {
1462 int m = (Lmax - l - 1) / 2;
1468 for (
int l = 0; l < Lmax; ++l) {
1469 int m = (Lmax - l - 1);
1479 template<
typename T>
1481 AuxLatitude<T>::Clenshaw(
real szeta,
real czeta,
1482 const real c[],
int K,
bool alt) {
1489 if (alt && 2*fabs(szeta) < 1) {
1490 real X = -4 * szeta * szeta,
1493 d0 = X * u0 + d0 + c[--k];
1496 }
else if (alt && 2*fabs(czeta) < 1) {
1497 real X = 4 * czeta * czeta,
1500 d0 = X * u0 - d0 + c[--k];
1504 real X = 2 * (czeta - szeta) * (czeta + szeta),
1507 real t = X * u0 - u1 + c[--k];
1511 return 2 * szeta * czeta * u0;
1514 template class AuxAngle<Math::real>;
1515 template class AuxLatitude<Math::real>;
1516#if GEOGRAPHICLIB_PRECISION != 2
1517 template class AuxAngle<double>;
1518 template class AuxLatitude<double>;
Header for the GeographicLib::AuxLatitude and GeographicLib::AuxAngle classes.
Header for GeographicLib::EllipticFunction class.
GeographicLib::Math::real real
An accurate representation of angles.
AuxAngle & operator+=(const AuxAngle &p)
AuxAngle copyquadrant(const AuxAngle &p) const
AuxAngle normalized() const
Conversions between auxiliary latitudes.
angle FromAuxiliary(int auxin, const angle &zeta, int *niter=nullptr) const
angle ToAuxiliary(int auxout, const angle &phi, real *diff=nullptr) const
angle Convert(int auxin, int auxout, const angle &zeta, bool series=false) const
static real RD(real x, real y, real z)
static real RF(real x, real y, real z)
Exception handling for GeographicLib.
static T polyval(int N, const T p[], T x)
Namespace for GeographicLib.
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)