35 # pragma warning (disable: 4701 4127)
43 : maxit2_(maxit1_ +
Math::digits() + 10)
47 , tiny_(sqrt(numeric_limits<real>::min()))
48 , tol0_(numeric_limits<real>::epsilon())
54 , tolb_(tol0_ * tol2_)
55 , xthresh_(1000 * tol2_)
57 , _f(f <= 1 ? f : 1/f)
60 , _ep2(_e2 /
Math::sq(_f1))
65 Math::eatanhe(real(1), (_f < 0 ? -1 : 1) * sqrt(abs(_e2))) / _e2))
77 , _etol2(0.1 * tol2_ /
78 sqrt( max(real(0.001), abs(_f)) * min(real(1), 1 - _f/2) / 2 ))
96 const real c[],
int n) {
104 ar = 2 * (cosx - sinx) * (cosx + sinx),
105 y0 = n & 1 ? *--c : 0, y1 = 0;
110 y1 = ar * y0 - y1 + *--c;
111 y0 = ar * y1 - y0 + *--c;
114 ? 2 * sinx * cosx * y0
124 bool arcmode, real s12_a12,
unsigned outmask,
125 real& lat2, real& lon2, real& azi2,
126 real& s12, real& m12, real& M12, real& M21,
132 GenPosition(arcmode, s12_a12, outmask,
133 lat2, lon2, azi2, s12, m12, M12, M21, S12);
138 real& s12, real& azi1, real& azi2,
139 real& m12, real& M12, real& M21, real& S12)
148 int lonsign = lon12 >= 0 ? 1 : -1;
155 int swapp = abs(lat1) < abs(lat2) ? -1 : 1;
161 int latsign = lat1 < 0 ? 1 : -1;
176 real sbet1, cbet1, sbet2, cbet2, s12x, m12x;
181 Math::norm(sbet1, cbet1); cbet1 = max(tiny_, cbet1);
185 Math::norm(sbet2, cbet2); cbet2 = max(tiny_, cbet2);
195 if (cbet1 < -sbet1) {
197 sbet2 = sbet2 < 0 ? sbet1 : -sbet1;
199 if (abs(sbet2) == -sbet1)
204 dn1 = sqrt(1 + _ep2 *
Math::sq(sbet1)),
205 dn2 = sqrt(1 + _ep2 *
Math::sq(sbet2));
212 real a12, sig12, calp1, salp1, calp2 = 0, salp2 = 0;
216 bool meridian = lat1 == -90 || slam12 == 0;
223 calp1 = clam12; salp1 = slam12;
224 calp2 = 1; salp2 = 0;
228 ssig1 = sbet1, csig1 = calp1 * cbet1,
229 ssig2 = sbet2, csig2 = calp2 * cbet2;
232 sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2),
233 csig1 * csig2 + ssig1 * ssig2);
236 Lengths(_n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2,
238 s12x, m12x, dummy, M12, M21, Ca);
247 if (sig12 < 1 || m12x >= 0) {
249 if (sig12 < 3 * tiny_)
250 sig12 = m12x = s12x = 0;
266 calp1 = calp2 = 0; salp1 = salp2 = 1;
268 sig12 = omg12 = lam12 / _f1;
269 m12x = _b * sin(sig12);
271 M12 = M21 = cos(sig12);
274 }
else if (!meridian) {
281 sig12 = InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2,
283 salp1, calp1, salp2, calp2, dnm,
288 s12x = sig12 * _b * dnm;
289 m12x =
Math::sq(dnm) * _b * sin(sig12 / dnm);
291 M12 = M21 = cos(sig12 / dnm);
293 omg12 = lam12 / (_f1 * dnm);
309 real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0;
312 real salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1;
313 for (
bool tripn =
false, tripb =
false;
319 real v = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
320 salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
321 eps, omg12, numit < maxit1_, dv, Ca)
325 if (tripb || !(abs(v) >= (tripn ? 8 : 2) * tol0_))
break;
327 if (v > 0 && (numit > maxit1_ || calp1/salp1 > calp1b/salp1b))
328 { salp1b = salp1; calp1b = calp1; }
329 else if (v < 0 && (numit > maxit1_ || calp1/salp1 < calp1a/salp1a))
330 { salp1a = salp1; calp1a = calp1; }
331 if (numit < maxit1_ && dv > 0) {
335 sdalp1 = sin(dalp1), cdalp1 = cos(dalp1),
336 nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
337 if (nsalp1 > 0 && abs(dalp1) <
Math::pi()) {
338 calp1 = calp1 * cdalp1 - salp1 * sdalp1;
344 tripn = abs(v) <= 16 * tol0_;
356 salp1 = (salp1a + salp1b)/2;
357 calp1 = (calp1a + calp1b)/2;
360 tripb = (abs(salp1a - salp1) + (calp1a - calp1) < tolb_ ||
361 abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_);
367 unsigned lengthmask = outmask |
369 Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
370 cbet1, cbet2, lengthmask, s12x, m12x, dummy, M12, M21, Ca);
375 omg12 = lam12 - omg12;
385 if (outmask &
AREA) {
388 salp0 = salp1 * cbet1,
391 if (calp0 != 0 && salp0 != 0) {
394 ssig1 = sbet1, csig1 = calp1 * cbet1,
395 ssig2 = sbet2, csig2 = calp2 * cbet2,
397 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2),
399 A4 =
Math::sq(_a) * calp0 * salp0 * _e2;
404 B41 = SinCosSeries(
false, ssig1, csig1, Ca, nC4_),
405 B42 = SinCosSeries(
false, ssig2, csig2, Ca, nC4_);
406 S12 = A4 * (B42 - B41);
413 sbet2 - sbet1 < real(1.75)) {
418 somg12 = sin(omg12), domg12 = 1 + cos(omg12),
419 dbet1 = 1 + cbet1, dbet2 = 1 + cbet2;
420 alp12 = 2 * atan2( somg12 * ( sbet1 * dbet2 + sbet2 * dbet1 ),
421 domg12 * ( sbet1 * sbet2 + dbet1 * dbet2 ) );
425 salp12 = salp2 * calp1 - calp2 * salp1,
426 calp12 = calp2 * calp1 + salp2 * salp1;
431 if (salp12 == 0 && calp12 < 0) {
432 salp12 = tiny_ * calp1;
435 alp12 = atan2(salp12, calp12);
438 S12 *= swapp * lonsign * latsign;
451 salp1 *= swapp * lonsign; calp1 *= swapp * latsign;
452 salp2 *= swapp * lonsign; calp2 *= swapp * latsign;
463 void Geodesic::Lengths(
real eps,
real sig12,
466 real cbet1,
real cbet2,
unsigned outmask,
478 real m0x = 0, J12 = 0, A1 = 0, A2 = 0;
492 real B1 = SinCosSeries(
true, ssig2, csig2, Ca, nC1_) -
493 SinCosSeries(
true, ssig1, csig1, Ca, nC1_);
495 s12b = A1 * (sig12 + B1);
497 real B2 = SinCosSeries(
true, ssig2, csig2, Cb, nC2_) -
498 SinCosSeries(
true, ssig1, csig1, Cb, nC2_);
499 J12 = m0x * sig12 + (A1 * B1 - A2 * B2);
503 for (
int l = 1; l <= nC2_; ++l)
504 Cb[l] = A1 * Ca[l] - A2 * Cb[l];
505 J12 = m0x * sig12 + (SinCosSeries(
true, ssig2, csig2, Cb, nC2_) -
506 SinCosSeries(
true, ssig1, csig1, Cb, nC2_));
513 m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) -
517 real csig12 = csig1 * csig2 + ssig1 * ssig2;
518 real t = _ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
519 M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
520 M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
532 if ( !(q == 0 && r <= 0) ) {
541 disc = S * (S + 2 * r3);
548 T3 += T3 < 0 ? -sqrt(disc) : sqrt(disc);
552 u += T + (T ? r2 / T : 0);
555 real ang = atan2(sqrt(-disc), -(S + r3));
558 u += 2 * r * cos(ang / 3);
563 uv = u < 0 ? q / (v - u) : u + v,
564 w = (uv - q) / (2 * v);
567 k = uv / (sqrt(uv +
Math::sq(w)) + w);
592 sbet12 = sbet2 * cbet1 - cbet2 * sbet1,
593 cbet12 = cbet2 * cbet1 + sbet2 * sbet1;
594 #if defined(__GNUC__) && __GNUC__ == 4 && \
595 (__GNUC_MINOR__ < 6 || defined(__MINGW32__))
609 real sbet12a = sbet2 * cbet1 + cbet2 * sbet1;
611 bool shortline = cbet12 >= 0 && sbet12 <
real(0.5) &&
612 cbet2 * lam12 <
real(0.5);
618 sbetm2 /= sbetm2 +
Math::sq(cbet1 + cbet2);
619 dnm = sqrt(1 + _ep2 * sbetm2);
622 real somg12 = sin(omg12), comg12 = cos(omg12);
624 salp1 = cbet2 * somg12;
625 calp1 = comg12 >= 0 ?
626 sbet12 + cbet2 * sbet1 *
Math::sq(somg12) / (1 + comg12) :
627 sbet12a - cbet2 * sbet1 *
Math::sq(somg12) / (1 - comg12);
631 csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
633 if (shortline && ssig12 < _etol2) {
635 salp2 = cbet1 * somg12;
636 calp2 = sbet12 - cbet1 * sbet2 *
637 (comg12 >= 0 ?
Math::sq(somg12) / (1 + comg12) : 1 - comg12);
640 sig12 = atan2(ssig12, csig12);
641 }
else if (abs(_n) >
real(0.1) ||
648 real y, lamscale, betscale;
658 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2);
659 lamscale = _f * cbet1 * A3f(eps) *
Math::pi();
661 betscale = lamscale * cbet1;
663 x = (lam12 -
Math::pi()) / lamscale;
664 y = sbet12a / betscale;
668 cbet12a = cbet2 * cbet1 - sbet2 * sbet1,
669 bet12a = atan2(sbet12a, cbet12a);
670 real m12b, m0, dummy;
674 sbet1, -cbet1, dn1, sbet2, cbet2, dn2,
675 cbet1, cbet2, REDUCEDLENGTH, dummy, m12b, m0, dummy, dummy, Ca);
676 x = -1 + m12b / (cbet1 * cbet2 * m0 *
Math::pi());
677 betscale = x < -
real(0.01) ? sbet12a / x :
679 lamscale = betscale / cbet1;
680 y = (lam12 -
Math::pi()) / lamscale;
683 if (y > -tol1_ && x > -1 - xthresh_) {
689 calp1 = max(
real(x > -tol1_ ? 0 : -1),
real(x));
727 real k = Astroid(x, y);
729 omg12a = lamscale * ( _f >= 0 ? -x * k/(1 + k) : -y * (1 + k)/k );
730 somg12 = sin(omg12a); comg12 = -cos(omg12a);
732 salp1 = cbet2 * somg12;
733 calp1 = sbet12a - cbet2 * sbet1 *
Math::sq(somg12) / (1 - comg12);
740 salp1 = 1; calp1 = 0;
753 bool diffp,
real& dlam12,
757 if (sbet1 == 0 && calp1 == 0)
764 salp0 = salp1 * cbet1,
767 real somg1, comg1, somg2, comg2, omg12, lam12;
770 ssig1 = sbet1; somg1 = salp0 * sbet1;
771 csig1 = comg1 = calp1 * cbet1;
779 salp2 = cbet2 != cbet1 ? salp0 / cbet2 : salp1;
784 calp2 = cbet2 != cbet1 || abs(sbet2) != -sbet1 ?
787 (cbet2 - cbet1) * (cbet1 + cbet2) :
788 (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 :
792 ssig2 = sbet2; somg2 = salp0 * sbet2;
793 csig2 = comg2 = calp2 * cbet2;
798 sig12 = atan2(max(
real(0), csig1 * ssig2 - ssig1 * csig2),
799 csig1 * csig2 + ssig1 * ssig2);
802 omg12 = atan2(max(
real(0), comg1 * somg2 - somg1 * comg2),
803 comg1 * comg2 + somg1 * somg2);
806 eps = k2 / (2 * (1 + sqrt(1 + k2)) + k2);
808 B312 = (SinCosSeries(
true, ssig2, csig2, Ca, nC3_-1) -
809 SinCosSeries(
true, ssig1, csig1, Ca, nC3_-1));
811 domg12 = salp0 * h0 * (sig12 + B312);
812 lam12 = omg12 + domg12;
816 dlam12 = - 2 * _f1 * dn1 / sbet1;
819 Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
820 cbet1, cbet2, REDUCEDLENGTH,
821 dummy, dlam12, dummy, dummy, dummy, Ca);
822 dlam12 *= _f1 / (calp2 * cbet2);
834 void Geodesic::C3f(
real eps,
real c[])
const {
839 for (
int l = 1; l < nC3_; ++l) {
840 int m = nC3_ - l - 1;
848 void Geodesic::C4f(
real eps,
real c[])
const {
853 for (
int l = 0; l < nC4_; ++l) {
854 int m = nC4_ - l - 1;
888 #if GEOGRAPHICLIB_GEODESIC_ORDER/2 == 1
889 static const real coeff[] = {
893 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 2
894 static const real coeff[] = {
898 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 3
899 static const real coeff[] = {
903 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 4
904 static const real coeff[] = {
906 25, 64, 256, 4096, 0, 16384,
909 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
911 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) == nA1_/2 + 2,
912 "Coefficient array size mismatch in A1m1f");
915 return (t + eps) / (1 - eps);
919 void Geodesic::C1f(
real eps,
real c[]) {
921 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
922 static const real coeff[] = {
930 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
931 static const real coeff[] = {
941 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
942 static const real coeff[] = {
954 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
955 static const real coeff[] = {
969 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
970 static const real coeff[] = {
972 19, -64, 384, -1024, 2048,
986 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
987 static const real coeff[] = {
989 19, -64, 384, -1024, 2048,
991 7, -18, 128, -256, 4096,
995 -11, 96, -160, 16384,
1006 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1008 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1009 (nC1_*nC1_ + 7*nC1_ - 2*(nC1_/2)) / 4,
1010 "Coefficient array size mismatch in C1f");
1015 for (
int l = 1; l <= nC1_; ++l) {
1016 int m = (nC1_ - l) / 2;
1017 c[l] = d *
Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1];
1025 void Geodesic::C1pf(
real eps,
real c[]) {
1027 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
1028 static const real coeff[] = {
1036 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
1037 static const real coeff[] = {
1047 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
1048 static const real coeff[] = {
1050 205, -432, 768, 1536,
1060 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
1061 static const real coeff[] = {
1063 205, -432, 768, 1536,
1065 4005, -4736, 3840, 12288,
1075 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
1076 static const real coeff[] = {
1078 -4879, 9840, -20736, 36864, 73728,
1080 4005, -4736, 3840, 12288,
1082 8703, -7200, 3712, 12288,
1086 -141115, 41604, 92160,
1092 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
1093 static const real coeff[] = {
1095 -4879, 9840, -20736, 36864, 73728,
1097 -86171, 120150, -142080, 115200, 368640,
1099 8703, -7200, 3712, 12288,
1101 1082857, -688608, 258720, 737280,
1103 -141115, 41604, 92160,
1105 -2200311, 533134, 860160,
1109 109167851, 82575360,
1112 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1114 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1115 (nC1p_*nC1p_ + 7*nC1p_ - 2*(nC1p_/2)) / 4,
1116 "Coefficient array size mismatch in C1pf");
1121 for (
int l = 1; l <= nC1p_; ++l) {
1122 int m = (nC1p_ - l) / 2;
1123 c[l] = d *
Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1];
1133 #if GEOGRAPHICLIB_GEODESIC_ORDER/2 == 1
1134 static const real coeff[] = {
1138 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 2
1139 static const real coeff[] = {
1143 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 3
1144 static const real coeff[] = {
1146 -11, -28, -192, 0, 256,
1148 #elif GEOGRAPHICLIB_GEODESIC_ORDER/2 == 4
1149 static const real coeff[] = {
1151 -375, -704, -1792, -12288, 0, 16384,
1154 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1156 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) == nA2_/2 + 2,
1157 "Coefficient array size mismatch in A2m1f");
1160 return (t - eps) / (1 + eps);
1164 void Geodesic::C2f(
real eps,
real c[]) {
1166 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
1167 static const real coeff[] = {
1175 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
1176 static const real coeff[] = {
1186 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
1187 static const real coeff[] = {
1199 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
1200 static const real coeff[] = {
1214 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
1215 static const real coeff[] = {
1217 41, 64, 128, 1024, 2048,
1231 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
1232 static const real coeff[] = {
1234 41, 64, 128, 1024, 2048,
1236 47, 70, 128, 768, 4096,
1240 133, 224, 1120, 16384,
1251 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1253 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1254 (nC2_*nC2_ + 7*nC2_ - 2*(nC2_/2)) / 4,
1255 "Coefficient array size mismatch in C2f");
1260 for (
int l = 1; l <= nC2_; ++l) {
1261 int m = (nC2_ - l) / 2;
1262 c[l] = d *
Math::polyval(m, coeff + o, eps2) / coeff[o + m + 1];
1270 void Geodesic::A3coeff() {
1272 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
1273 static const real coeff[] = {
1281 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
1282 static const real coeff[] = {
1292 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
1293 static const real coeff[] = {
1305 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
1306 static const real coeff[] = {
1320 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
1321 static const real coeff[] = {
1337 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
1338 static const real coeff[] = {
1346 -5, -20, -4, -6, 128,
1357 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1359 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1360 (nA3_*nA3_ + 7*nA3_ - 2*(nA3_/2)) / 4,
1361 "Coefficient array size mismatch in A3f");
1363 for (
int j = nA3_ - 1; j >= 0; --j) {
1364 int m = min(nA3_ - j - 1, j);
1365 _A3x[k++] =
Math::polyval(m, coeff + o, _n) / coeff[o + m + 1];
1372 void Geodesic::C3coeff() {
1374 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
1375 static const real coeff[] = {
1383 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
1384 static const real coeff[] = {
1400 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
1401 static const real coeff[] = {
1423 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
1424 static const real coeff[] = {
1456 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
1457 static const real coeff[] = {
1501 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
1502 static const real coeff[] = {
1536 10, -6, -10, 9, 384,
1546 -7, 20, -28, 14, 1024,
1561 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1563 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1564 ((nC3_-1)*(nC3_*nC3_ + 7*nC3_ - 2*(nC3_/2)))/8,
1565 "Coefficient array size mismatch in C3coeff");
1567 for (
int l = 1; l < nC3_; ++l) {
1568 for (
int j = nC3_ - 1; j >= l; --j) {
1569 int m = min(nC3_ - j - 1, j);
1570 _C3x[k++] =
Math::polyval(m, coeff + o, _n) / coeff[o + m + 1];
1577 void Geodesic::C4coeff() {
1579 #if GEOGRAPHICLIB_GEODESIC_ORDER == 3
1580 static const real coeff[] = {
1594 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 4
1595 static const real coeff[] = {
1603 4, 24, -84, 210, 315,
1617 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 5
1618 static const real coeff[] = {
1624 1088, -352, -66, 3465,
1626 48, -352, 528, -231, 1155,
1628 16, 44, 264, -924, 2310, 3465,
1634 -896, 704, -198, 10395,
1636 -48, 352, -528, 231, 10395,
1642 320, -352, 132, 17325,
1650 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 6
1651 static const real coeff[] = {
1657 -224, -4784, 1573, 45045,
1659 -10656, 14144, -4576, -858, 45045,
1661 64, 624, -4576, 6864, -3003, 15015,
1663 100, 208, 572, 3432, -12012, 30030, 45045,
1669 5792, 1040, -1287, 135135,
1671 5952, -11648, 9152, -2574, 135135,
1673 -64, -624, 4576, -6864, 3003, 135135,
1679 -8448, 4992, -1144, 225225,
1681 -1440, 4160, -4576, 1716, 225225,
1687 3584, -3328, 1144, 315315,
1695 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 7
1696 static const real coeff[] = {
1702 -4480, 1088, 156, 45045,
1704 10736, -224, -4784, 1573, 45045,
1706 1664, -10656, 14144, -4576, -858, 45045,
1708 16, 64, 624, -4576, 6864, -3003, 15015,
1710 56, 100, 208, 572, 3432, -12012, 30030, 45045,
1716 3840, -2944, 468, 135135,
1718 -10704, 5792, 1040, -1287, 135135,
1720 -768, 5952, -11648, 9152, -2574, 135135,
1722 -16, -64, -624, 4576, -6864, 3003, 135135,
1728 1664, 1856, -936, 225225,
1730 6784, -8448, 4992, -1144, 225225,
1732 128, -1440, 4160, -4576, 1716, 225225,
1738 -2048, 1024, -208, 105105,
1740 -1792, 3584, -3328, 1144, 315315,
1746 3072, -2560, 832, 405405,
1754 #elif GEOGRAPHICLIB_GEODESIC_ORDER == 8
1755 static const real coeff[] = {
1761 20960, -7888, 4947, 765765,
1763 12480, -76160, 18496, 2652, 765765,
1765 -154048, 182512, -3808, -81328, 26741, 765765,
1767 3232, 28288, -181152, 240448, -77792, -14586, 765765,
1769 96, 272, 1088, 10608, -77792, 116688, -51051, 255255,
1771 588, 952, 1700, 3536, 9724, 58344, -204204, 510510, 765765,
1777 -39840, 1904, 255, 2297295,
1779 52608, 65280, -50048, 7956, 2297295,
1781 103744, -181968, 98464, 17680, -21879, 2297295,
1783 -1344, -13056, 101184, -198016, 155584, -43758, 2297295,
1785 -96, -272, -1088, -10608, 77792, -116688, 51051, 2297295,
1789 -928, -612, 3828825,
1791 64256, -28288, 2856, 3828825,
1793 -126528, 28288, 31552, -15912, 3828825,
1795 -41472, 115328, -143616, 84864, -19448, 3828825,
1797 160, 2176, -24480, 70720, -77792, 29172, 3828825,
1801 -16384, 1088, 5360355,
1803 -2560, 30464, -11560, 5360355,
1805 35840, -34816, 17408, -3536, 1786785,
1807 7168, -30464, 60928, -56576, 19448, 5360355,
1811 26624, -8704, 6891885,
1813 -77824, 34816, -6528, 6891885,
1815 -32256, 52224, -43520, 14144, 6891885,
1819 24576, -4352, 8423415,
1821 45056, -34816, 10880, 8423415,
1825 -28672, 8704, 9954945,
1830 #error "Bad value for GEOGRAPHICLIB_GEODESIC_ORDER"
1832 GEOGRAPHICLIB_STATIC_ASSERT(
sizeof(coeff) /
sizeof(
real) ==
1833 (nC4_ * (nC4_ + 1) * (nC4_ + 5)) / 6,
1834 "Coefficient array size mismatch in C4coeff");
1836 for (
int l = 0; l < nC4_; ++l) {
1837 for (
int j = nC4_ - 1; j >= l; --j) {
1838 int m = nC4_ - j - 1;
1839 _C4x[k++] =
Math::polyval(m, coeff + o, _n) / coeff[o + m + 1];
Header for GeographicLib::GeodesicLine class.
GeodesicLine Line(real lat1, real lon1, real azi1, unsigned caps=ALL) const
GeographicLib::Math::real real
static const Geodesic & WGS84()
Math::real GenInverse(real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
static bool isfinite(T x)
Mathematical functions needed by GeographicLib.
static void sincosd(T x, T &sinx, T &cosx)
static void norm(T &x, T &y)
#define GEOGRAPHICLIB_VOLATILE
Header for GeographicLib::Geodesic class.
friend class GeodesicLine
Math::real GenDirect(real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
static T atan2d(T y, T x)
static T polyval(int N, const T p[], T x)
Namespace for GeographicLib.
static T AngDiff(T x, T y)
Exception handling for GeographicLib.
#define GEOGRAPHICLIB_PANIC