1

2# -*- coding: utf-8 -*-

3

4 u'''A pure Python version of I{Karney}'s I{elliptic functions}, I{Krüger series expansion}, C++

5 classes U{Rhumb<https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1Rhumb.html>} and

6 and U{RhumbLine<https://GeographicLib.SourceForge.io/C++/doc/classGeographicLib_1_1RhumbLine.html>}

7 from I{GeographicLib version 2.0}, kept for backward compatibility.

8

9 Class L{RhumbLine} has been enhanced with methods C{Intersecant2}, C{Intersection} and C{PlumbTo} to

10 iteratively find the intersection of a rhumb line and a circle or an other rhumb line, respectively

11 a perpendicular geodesic or other rhumb line.

12

13 For more details, see the C++ U{GeographicLib<https://GeographicLib.SourceForge.io/C++/doc/index.html>}

14 documentation, especially the U{Class List<https://GeographicLib.SourceForge.io/C++/doc/annotated.html>},

15 the background information on U{Rhumb lines<https://GeographicLib.SourceForge.io/C++/doc/rhumb.html>},

16 the utily U{RhumbSolve<https://GeographicLib.SourceForge.io/C++/doc/RhumbSolve.1.html>} and U{Online

17 rhumb line calculations<https://GeographicLib.SourceForge.io/cgi-bin/RhumbSolve>}.

18

19 Copyright (C) U{Charles Karney<mailto:Karney@Alum.MIT.edu>} (2014-2024) and licensed under the MIT/X11

20 License. For more information, see the U{GeographicLib<https://GeographicLib.SourceForge.io>} documentation.

21'''

22# make sure int/int division yields float quotient

23 from __future__ import division as _; del _ # PYCHOK semicolon

24

25 from pygeodesy.basics import copysign0, neg

26 from pygeodesy.constants import PI_2, _0_0s, _0_0, _0_5, _1_0, \

27 _2_0, _4_0, _720_0, _over, _1_over

28# from pygeodesy.datums import _WGS84 # from .rhumb.bases

29# from pygeodesy.deprecated import RhumbOrder2Tuple # _MODS

30 from pygeodesy.errors import RhumbError, _xkwds_pop2, _Xorder

31 from pygeodesy.fmath import hypot, hypot1

32# from pygeodesy.fsums import fsum1f_ # _MODS

33# from pygeodesy.karney import Caps # from .rhumb.bases

34 from pygeodesy.ktm import KTransverseMercator, _Xs, \

35 _AlpCoeffs, _BetCoeffs # PYCHOK used!

36 from pygeodesy.lazily import _ALL_DOCS, _ALL_LAZY, _ALL_MODS as _MODS

37 from pygeodesy.props import deprecated_method, Property, Property_RO, \

38 property_RO

39 from pygeodesy.rhumb.bases import RhumbBase, RhumbLineBase, \

40 Caps, _update_all_rls, _WGS84

41 from pygeodesy.utily import atan1, sincos2_

42

43 from math import asinh, atan, cos, cosh, radians, sin, sinh, sqrt, tan # as _tan

44

45__all__ = _ALL_LAZY.rhumb_ekx

46__version__ = '25.04.12'

47

48

49 class Rhumb(RhumbBase):

50 '''Class to solve the I{direct} and I{inverse rhumb} problems, based on

51 I{elliptic functions} or I{Krüger series expansion}

52

53 @see: The U{Detailed Description<https://GeographicLib.SourceForge.io/C++/doc/

54 classGeographicLib_1_1Rhumb.html>} of I{Karney}'s C++ C{Rhumb Class}.

55 '''

56 _mRA = 6 # see .RAorder

57

58 def __init__(self, a_earth=_WGS84, f=None, exact=True, **RA_TMorder_name):

59 '''New C{Rhumb}.

60

61 @kwarg a_earth: This rhumb's earth model (L{Datum}, L{Ellipsoid},

62 L{Ellipsoid2}, L{a_f2Tuple}, 2-tuple C{(a, f)}) or

63 the (equatorial) radius (C{meter}, conventionally).

64 @kwarg f: The ellipsoid's flattening (C{scalar}), required if B{C{a_earth}}

65 is C{scalar}, ignored otherwise.

66 @kwarg exact: If C{True}, use an addition theorem for elliptic integrals

67 to compute I{Divided differences}, otherwise use the I{Krüger}

68 series expansion (C{bool} or C{None}), see also properties

69 C{exact} and C{TMorder}.

70 @kwarg RA_TMorder_name: Optional C{B{name}=NN} (C{str}) and optional keyword

71 arguments B{C{RAorder}=6} and B{C{TMorder}=6} to set the respective

72 C{order}, see properties C{RAorder} and C{TMorder}.

73

74 @raise RhumbError: Invalid B{C{a_earth}}, B{C{f}}, B{C{RAorder}} or B{C{TMorder}}.

75 '''

76 if RA_TMorder_name:

77 M = self._mRA

78 m, kwds = _xkwds_pop2(RA_TMorder_name, RAorder=M)

79 if m != M:

80 self.RAorder = m

81 else:

82 kwds = {}

83 RhumbBase.__init__(self, a_earth, f, exact, kwds)

84

85 @Property_RO

86 def _A2(self): # Conformal2RectifyingCoeffs

87 m = self.TMorder

88 return _Xs(_AlpCoeffs, m, self.ellipsoid), m

89

90 @Property_RO

91 def _B2(self): # Rectifying2ConformalCoeffs

92 m = self.TMorder

93 return _Xs(_BetCoeffs, m, self.ellipsoid), m

94

95 def _DConformal2Rectifying(self, x, y): # radians

96 return _1_0 + (_sincosSeries(True, x, y, *self._A2) if self.f else _0_0)

97

98 @deprecated_method

99 def Direct7(self, lat1, lon1, azi12, s12, outmask=Caps.LATITUDE_LONGITUDE_AREA): # PYCHOK no cover

100 '''DEPRECATED, use method L{Rhumb.Direct8}.

101

102 @return: A I{DEPRECATED} L{Rhumb7Tuple}.

103 '''

104 return self.Direct8(lat1, lon1, azi12, s12, outmask=outmask)._to7Tuple()

105

106 def _DIsometrict(self, phix, phiy, tphix, tphiy, _Dtan_phix_phiy):

107 E = self.ellipsoid

108 return _Dtan_phix_phiy * _Dasinh(tphix, tphiy) - \

109 _Dsin(phix, phiy) * _DeatanhE(sin(phix), sin(phiy), E)

110

111 def _DIsometric2Rectifyingd(self, psix, psiy): # degrees

112 if self.exact:

113 E = self.ellipsoid

114 phix, phiy, tphix, tphiy = _Eaux4(E.auxIsometric, psix, psiy)

115 t = _Dtant(phix - phiy, tphix, tphiy)

116 r = _over(self._DRectifyingt( tphix, tphiy, t),

117 self._DIsometrict(phix, phiy, tphix, tphiy, t))

118 else:

119 x, y = radians(psix), radians(psiy)

120 r = self._DConformal2Rectifying(_gd(x), _gd(y)) * _Dgd(x, y)

121 return r

122

123 def _DRectifyingt(self, tphix, tphiy, _Dtan_phix_phiy):

124 E = self.ellipsoid

125 tbetx = E.f1 * tphix

126 tbety = E.f1 * tphiy

127 return (E.f1 * _Dtan_phix_phiy * E.b * PI_2

128 * _DfEt( tbetx, tbety, self._eF)

129 * _Datan(tbetx, tbety)) / E.L

130

131 def _DRectifying2Conformal(self, x, y): # radians

132 return _1_0 - (_sincosSeries(True, x, y, *self._B2) if self.f else _0_0)

133

134 def _DRectifying2Isometricd(self, mux, muy): # degrees

135 E = self.ellipsoid

136 phix, phiy, tphix, tphiy = _Eaux4(E.auxRectifying, mux, muy)

137 if self.exact:

138 t = _Dtant(phix - phiy, tphix, tphiy)

139 r = _over(self._DIsometrict(phix, phiy, tphix, tphiy, t),

140 self._DRectifyingt( tphix, tphiy, t))

141 else:

142 r = self._DRectifying2Conformal(radians(mux), radians(muy)) * \

143 _Dgdinv(E.es_taupf(tphix), E.es_taupf(tphiy))

144 return r

145

146 @Property_RO

147 def _eF(self):

148 '''(INTERNAL) Get the ellipsoid's elliptic function.

149 '''

150 # .k2 = 0.006739496742276434

151 return self.ellipsoid._elliptic_e12 # _MODS.elliptic.Elliptic(-self.ellipsoid._e12)

152

153 def _Inverse4(self, lon12, r, outmask):

154 '''(INTERNAL) See method C{RhumbBase.Inverse}.

155 '''

156 E, Cs = self.ellipsoid, Caps

157 psi1 = E.auxIsometric(r.lat1)

158 psi2 = E.auxIsometric(r.lat2)

159 psi12 = psi2 - psi1 # degrees

160 if (outmask & Cs.DISTANCE):

161 a = s = hypot(lon12, psi12)

162 if a:

163 a *= self._DIsometric2Rectifyingd(psi2, psi1)

164 s = self._mpd * a # == E._Lpd

165 a = copysign0(a, s)

166 r.set_(a12=a, s12=s)

167

168 if ((outmask | self._debug) & Cs._DEBUG_INVERSE): # PYCHOK no cover

169 r.set_(a=E.a, f=E.f, f1=E.f1, L=E.L,

170 b=E.b, e=E.e, e2=E.e2, k2=self._eF.k2,

171 lon12=lon12, psi1=psi1, exact=self.exact,

172 psi12=psi12, psi2=psi2)

173 return lon12, psi12, psi1, psi2

174

175 @deprecated_method

176 def Inverse7(self, lat1, lon1, azi12, s12, outmask=Caps.AZIMUTH_DISTANCE_AREA): # PYCHOK no cover

177 '''DEPRECATED, use method L{Rhumb.Inverse8}.

178

179 @return: A I{DEPRECATED} L{Rhumb7Tuple}.

180 '''

181 return self.Inverse8(lat1, lon1, azi12, s12, outmask=outmask)._to7Tuple()

182

183 @Property_RO

184 def _mpd(self): # meter per degree

185 return self.ellipsoid._Lpd

186

187 @Property_RO

188 def _mpr(self): # meter per radian

189 return self.ellipsoid._Lpr # degrees(._Lpd)

190

191 @deprecated_method

192 def orders(self, RAorder=6, TMorder=6): # PYCHOK no cover

193 '''DEPRECATED, use properties C{RAorder} and/or C{TMorder}.

194

195 Get and set the I{RAorder} and/or I{TMorder}.

196

197 @kwarg RAorder: I{Rhumb Area} order (C{int}, 4, 5, 6, 7

198 or 8).

199 @kwarg TMorder: I{Transverse Mercator} order (C{int}, 4,

200 5, 6, 7 or 8).

201

202 @return: DEPRECATED L{RhumbOrder2Tuple}C{(RAorder, TMorder)}

203 with the previous C{RAorder} and C{TMorder} setting.

204 '''

205 t = _MODS.deprecated.classes.RhumbOrder2Tuple(self.RAorder, self.TMorder)

206 if RAorder != t.RAorder: # PYCHOK attr

207 self.RAorder = RAorder

208 if TMorder != t.TMorder: # PYCHOK attr

209 self.TMorder = TMorder

210 return t

211

212 @Property_RO

213 def _RA2(self):

214 # for WGS84: (0, -0.0005583633519275459, -3.743803759172812e-07, -4.633682270824446e-10,

215 # RAorder 6: -7.709197397676237e-13, -1.5323287106694307e-15, -3.462875359099873e-18)

216 m = self.RAorder

217 return _Xs(_RACoeffs, m, self.ellipsoid, RA=True), m

218

219 @Property

220 def RAorder(self):

221 '''Get the I{Rhumb Area} order (C{int}, 4, 5, 6, 7 or 8).

222 '''

223 return self._mRA

224

225 @RAorder.setter # PYCHOK setter!

226 def RAorder(self, order):

227 '''Set the I{Rhumb Area} order (C{int}, 4, 5, 6, 7 or 8).

228 '''

229 m = _Xorder(_RACoeffs, RhumbError, RAorder=order)

230 if self._mRA != m:

231 _update_all_rls(self)

232 self._mRA = m

233

234# _RhumbLine = RhumbLine # see further below

235

236 def _S12d(self, psi1, psi2, lon12): # degrees

237 '''(INTERNAL) Compute the area C{S12}.

238 '''

239 S = (self.ellipsoid.areax if self.exact else

240 self.ellipsoid.area) * lon12 / _720_0

241 if S:

242 x, y = radians(psi1), radians(psi2) # _meanSinXi(x, y)

243 s = _Dlog(cosh(x), cosh(y)) * _Dcosh(x, y)

244 if self.f:

245 s += _sincosSeries(False, _gd(x), _gd(y), *self._RA2) * _Dgd(x, y)

246 S *= s

247 return S

248

249

250 class RhumbLine(RhumbLineBase):

251 '''Compute one or several points on a single rhumb line.

252

253 Class C{RhumbLine} facilitates the determination of points on

254 a single rhumb line. The starting point (C{lat1}, C{lon1})

255 and the azimuth C{azi12} are specified once.

256 '''

257 _Rhumb = Rhumb # rhumb.ekx.Rhumb

258

259 def __init__(self, rhumb, lat1=0, lon1=0, azi12=None, **caps_name): # PYCHOK signature

260 '''New C{RhumbLine}.

261

262 @arg rhumb: The rhumb reference (L{Rhumb}).

263 @kwarg lat1: Latitude of the start point (C{degrees90}).

264 @kwarg lon1: Longitude of the start point (C{degrees180}).

265 @kwarg azi12: Azimuth of this rhumb line (compass C{degrees}).

266 @kwarg caps_name: Optional keyword arguments C{B{name}=NN} and C{B{caps}=0},

267 a bit-or'ed combination of L{Caps<pygeodesy.karney.Caps>} values

268 specifying the required capabilities. Include C{Caps.LINE_OFF}

269 if updates to the B{C{rhumb}} should I{not be reflected} in this

270 rhumb line.

271 '''

272 RhumbLineBase.__init__(self, rhumb, lat1, lon1, azi12, **caps_name)

273

274 @Property_RO

275 def _dpm12(self): # PYCHOK no cover

276 '''(INTERNAL) Get this rhumb line's parallel I{circle radius} (C{degree per meter}).

277 '''

278 r = self._salp

279 if r:

280 r = _over(r, self.ellipsoid.circle4(self.lat1).radius)

281 return r

282

283 @Property_RO

284 def _mu1(self):

285 '''(INTERNAL) Get the I{rectifying auxiliary} latitude (C{degrees}).

286 '''

287 return self.ellipsoid.auxRectifying(self.lat1)

288

289 def _mu2lat(self, mu):

290 '''(INTERNAL) Get the inverse I{rectifying auxiliary} latitude (C{degrees}).

291 '''

292 return self.ellipsoid.auxRectifying(mu, inverse=True)

293

294 def _Position4(self, unused, mu2, s12, mu12):

295 '''(INTERNAL) See method C{RhumbLineBase._Position}.

296 '''

297 psi1 = psi2 = self._psi1

298 if mu12: # self._calp != 0

299 lat2 = self._mu2lat(mu2)

300 psi12 = self.rhumb._DRectifying2Isometricd(mu2, self._mu1) * mu12

301 lon2 = self._talp * psi12

302 psi2 += psi12

303 else: # meridional

304 lat2 = self.lat1

305 lon2 = self._dpm12 * s12

306 return lat2, lon2, psi1, psi2

307

308 @Property_RO

309 def _psi1(self):

310 '''(INTERNAL) Get the I{isometric auxiliary} latitude C{psi} (C{degrees}).

311 '''

312 return self.ellipsoid.auxIsometric(self.lat1)

313

314 @property_RO

315 def RAorder(self):

316 '''Get this rhumb line's I{Rhumb Area} order (C{int}, 4, 5, 6, 7 or 8).

317 '''

318 return self.rhumb.RAorder

319

320 Rhumb._RhumbLine = RhumbLine # PYCHOK see RhumbBase._RhumbLine

321

322

323# Use I{Divided Differences} to determine (mu2 - mu1) / (psi2 - psi1) accurately.

324# Definition: _Df(x,y,d) = (f(x) - f(y)) / (x - y), @see W. M. Kahan & R. J.

325# Fateman, "Symbolic computation of Divided Differences", SIGSAM Bull. 33(3),

326# 7-28 (1999). U{ACM<https://DL.ACM.org/doi/pdf/10.1145/334714.334716> and @see

327# U{UCB<https://www.CS.Berkeley.edu/~fateman/papers/divdiff.pdf>}, Dec 8, 1999.

328

329 def _Dasinh(x, y):

330 hx = hypot1(x)

331 d = x - y

332 if d:

333 hx *= y

334 hy = x * hypot1(y)

335 t = (d * (x + y) / (hy + hx)) if (x * y) > 0 else (hy - hx)

336 r = asinh(t) / d

337 else:

338 r = _1_0 / hx

339 return r

340

341

342 def _Datan(x, y):

343 xy = x * y

344 r = xy + _1_0

345 d = x - y

346 if d: # 2 * xy > -1 == 2 * xy + 1 > 0 == xy + r > 0 == xy > -r

347 r = (atan1(d, r) if xy > -r else (atan1(x) - atan1(y))) / d

348 else:

349 r = _1_over(r)

350 return r

351

352

353 def _Dcosh(x, y):

354 return _Dsincos(x, y, sinh, sinh)

355

356

357 def _DeatanhE(x, y, E): # see .albers._Datanhee

358 # Deatanhe(x, y) = eatanhe((x - y) / (1 - e^2 * x * y)) / (x - y)

359 e = _1_0 - E.e2 * x * y

360 if e: # assert not isnear0(e)

361 d = x - y

362 e = (E._es_atanh(d / e) / d) if d else (E.e2 / e)

363 return e

364

365

366 def _DfEt(tx, ty, eF): # tangents

367 # eF = Elliptic(-E.e12) # -E.e2 / (1 - E.e2)

368 r, x, y, = _1_0, atan(tx), atan(ty)

369 d = x - y

370 if (x * y) > 0:

371 # See U{DLMF<https://DLMF.NIST.gov/19.11>}: 19.11.2 and 19.11.4

372 # letting theta -> x, phi -> -y, psi -> z

373 # (E(x) - E(y)) / d = E(z)/d - k2 * sin(x) * sin(y) * sin(z)/d

374 # tan(z/2) = (sin(x)*Delta(y) - sin(y)*Delta(x)) / (cos(x) + cos(y))

375 # = d * Dsin(x,y) * (sin(x) + sin(y))/(cos(x) + cos(y)) /

376 # (sin(x)*Delta(y) + sin(y)*Delta(x))

377 # = t = d * Dt

378 # sin(z) = 2*t/(1+t^2); cos(z) = (1-t^2)/(1+t^2)

379 # Alt (this only works for |z| <= pi/2 -- however, this conditions

380 # holds if x*y > 0):

381 # sin(z) = d * Dsin(x,y) * (sin(x) + sin(y)) /

382 # (sin(x)*cos(y)*Delta(y) + sin(y)*cos(x)*Delta(x))

383 # cos(z) = sqrt((1-sin(z))*(1+sin(z)))

384 sx, cx, sy, cy = sincos2_(x, y)

385 D = (cx + cy) * (eF.fDelta(sy, cy) * sx +

386 eF.fDelta(sx, cx) * sy)

387 D = (sx + sy) * _Dsin(x, y) / D

388 t = D * d

389 t2 = _1_0 + t**2

390 D *= _2_0 / t2

391 s = D * d

392 if s:

393 c = (t + _1_0) * (_1_0 - t) / t2

394 r = eF.fE(s, c, eF.fDelta(s, c)) / s

395 r = D * (r - eF.k2 * sx * sy)

396 elif d:

397 r = (eF.fE(x) - eF.fE(y)) / d

398 return r

399

400

401 def _Dgd(x, y):

402 return _Datan(sinh(x), sinh(y)) * _Dsinh(x, y)

403

404

405 def _Dgdinv(x, y): # x, y are tangents

406 return _Dasinh(x, y) / _Datan(x, y)

407

408

409 def _Dlog(x, y):

410 d = (x - y) * _0_5

411 # Changed atanh(t / (x + y)) to asinh(t / (2 * sqrt(x*y))) to

412 # avoid taking atanh(1) when x is large and y is 1. This also

413 # fixes bogus results being returned for the area when an endpoint

414 # is at a pole. N.B. this routine is invoked with positive x

415 # and y, so the sqrt is always taken of a positive quantity.

416 return (asinh(d / sqrt(x * y)) / d) if d else _1_over(x)

417

418

419 def _Dsin(x, y):

420 return _Dsincos(x, y, sin, cos)

421

422

423 def _Dsincos(x, y, sin_, cos_):

424 r = cos_((x + y) * _0_5)

425 d = (x - y) * _0_5

426 if d:

427 r *= sin_(d) / d

428 return r

429

430

431 def _Dsinh(x, y):

432 return _Dsincos(x, y, sinh, cosh)

433

434

435 def _Dtan(x, y): # PYCHOK no cover

436 return _Dtant(x - y, tan(x), tan(y))

437

438

439 def _Dtant(dxy, tx, ty):

440 txy = tx * ty

441 r = txy + _1_0

442 if dxy: # 2 * txy > -1 == 2 * txy + 1 > 0 == txy + r > 0 == txy > -r

443 r = ((tan(dxy) * r) if txy > -r else (tx - ty)) / dxy

444 return r

445

446

447 def _Eaux4(E_aux, mu_psi_x, mu_psi_y): # degrees

448 # get inverse auxiliary lats in radians and tangents

449 phix = radians(E_aux(mu_psi_x, inverse=True))

450 phiy = radians(E_aux(mu_psi_y, inverse=True))

451 return phix, phiy, tan(phix), tan(phiy)

452

453

454 def _gd(x):

455 return atan(sinh(x))

456

457

458 def _sincosSeries(sinp, x, y, C, n):

459 # N.B. C[] has n+1 elements of which

460 # C[0] is ignored and n >= 0

461 # Use Clenshaw summation to evaluate

462 # m = (g(x) + g(y)) / 2 -- mean value

463 # s = (g(x) - g(y)) / (x - y) -- average slope

464 # where

465 # g(x) = sum(C[j] * SC(2 * j * x), j = 1..n)

466 # SC = sinp ? sin : cos

467 # CS = sinp ? cos : sin

468 # ...

469 d, _neg = (x - y), neg

470 sp, cp, sd, cd = sincos2_(x + y, d)

471 sd = (sd / d) if d else _1_0

472 s = _neg(sp * sd) # negative

473 # 2x2 matrices in row-major order

474 a1 = s * d**2

475 a2 = s * _4_0

476 a0 = a3 = _2_0 * cp * cd # m

477 b2 = b1 = _0_0s(4)

478 if n > 0:

479 b1 = C[n], _0_0, _0_0, C[n]

480

481 _fsum = _MODS.fsums.fsum1f_

482 for j in range(n - 1, 0, -1): # C[0] unused

483 b1, b2, Cj = b2, b1, C[j]

484 # b1 = a * b2 - b1 + C[j] * I

485 m0, m1, m2, m3 = b2

486 n0, n1, n2, n3 = map(_neg, b1)

487 b1 = (_fsum(a0 * m0, a1 * m2, n0, Cj),

488 _fsum(a0 * m1, a1 * m3, n1),

489 _fsum(a2 * m0, a3 * m2, n2),

490 _fsum(a2 * m1, a3 * m3, n3, Cj))

491 # Here are the full expressions for m and s

492 # f01, f02, f11, f12 = (0, 0, cd * sp, 2 * sd * cp) if sinp else \

493 # (1, 0, cd * cp, -2 * sd * sp)

494 # m = -b2[1] * f02 + (C[0] - b2[0]) * f01 + b1[0] * f11 + b1[1] * f12

495 # s = -b2[2] * f01 + (C[0] - b2[3]) * f02 + b1[2] * f11 + b1[3] * f12

496 cd *= b1[2]

497 sd *= b1[3] * _2_0

498 s = _fsum(cd * sp, sd * cp) if sinp else \

499 _fsum(cd * cp, _neg(sd * sp), _neg(b2[2]))

500 return s

501

502

503_RACoeffs = { # Generated by Maxima on 2015-05-15 08:24:04-04:00

504 4: ( # GEOGRAPHICLIB_RHUMBAREA_ORDER == 4

505 691, 7860, -20160, 18900, 0, 56700, # R[0]/n^0, polynomial(n), order 4

506 1772, -5340, 6930, -4725, 14175, # R[1]/n^1, polynomial(n), order 3

507 -1747, 1590, -630, 4725, # PYCHOK R[2]/n^2, polynomial(n), order 2

508 104, -31, 315, # R[3]/n^3, polynomial(n), order 1

509 -41, 420), # PYCHOK R[4]/n^4, polynomial(n), order 0, count = 20

510 5: ( # GEOGRAPHICLIB_RHUMBAREA_ORDER == 5

511 -79036, 22803, 259380, -665280, 623700, 0, 1871100, # PYCHOK R[0]/n^0, polynomial(n), order 5

512 41662, 58476, -176220, 228690, -155925, 467775, # PYCHOK R[1]/n^1, polynomial(n), order 4

513 18118, -57651, 52470, -20790, 155925, # PYCHOK R[2]/n^2, polynomial(n), order 3

514 -23011, 17160, -5115, 51975, # PYCHOK R[3]/n^3, polynomial(n), order 2

515 5480, -1353, 13860, # PYCHOK R[4]/n^4, polynomial(n), order 1

516 -668, 5775), # PYCHOK R[5]/n^5, polynomial(n), order 0, count = 27

517 6: ( # GEOGRAPHICLIB_RHUMBAREA_ORDER == 6

518 128346268, -107884140, 31126095, 354053700, -908107200, 851350500, 0, 2554051500, # R[0]/n^0, polynomial(n), order 6

519 -114456994, 56868630, 79819740, -240540300, 312161850, -212837625, 638512875, # PYCHOK R[1]/n^1, polynomial(n), order 5

520 51304574, 24731070, -78693615, 71621550, -28378350, 212837625, # R[2]/n^2, polynomial(n), order 4

521 1554472, -6282003, 4684680, -1396395, 14189175, # R[3]/n^3, polynomial(n), order 3

522 -4913956, 3205800, -791505, 8108100, # PYCHOK R[4]/n^4, polynomial(n), order 2

523 1092376, -234468, 2027025, # R[5]/n^5, polynomial(n), order 1

524 -313076, 2027025), # PYCHOK R[6]/n^6, polynomial(n), order 0, count = 35

525 7: ( # GEOGRAPHICLIB_RHUMBAREA_ORDER == 7

526 -317195588, 385038804, -323652420, 93378285, 1062161100, -2724321600, 2554051500, 0, 7662154500, # PYCHOK R[0]/n^0, polynomial(n), order 7

527 258618446, -343370982, 170605890, 239459220, -721620900, 936485550, -638512875, 1915538625, # PYCHOK R[1]/n^1, polynomial(n), order 6

528 -248174686, 153913722, 74193210, -236080845, 214864650, -85135050, 638512875, # PYCHOK R[2]/n^2, polynomial(n), order 5

529 114450437, 23317080, -94230045, 70270200, -20945925, 212837625, # PYCHOK R[3]/n^3, polynomial(n), order 4

530 15445736, -103193076, 67321800, -16621605, 170270100, # PYCHOK R[4]/n^4, polynomial(n), order 3

531 -27766753, 16385640, -3517020, 30405375, # PYCHOK R[4]/n^4, polynomial(n), order 3

532 4892722, -939228, 6081075, # PYCHOK R[4]/n^4, polynomial(n), order 3

533 -3189007, 14189175), # PYCHOK R[7]/n^7, polynomial(n), order 0, count = 44

534 8: ( # GEOGRAPHICLIB_RHUMBAREA_ORDER == 8

535 71374704821, -161769749880, 196369790040, -165062734200, 47622925350, 541702161000, -1389404016000, 1302566265000, 0, 3907698795000, # R[0]/n^0, polynomial(n), order 8

536 -13691187484, 65947703730, -87559600410, 43504501950, 61062101100, -184013329500, 238803815250, -162820783125, 488462349375, # PYCHOK R[1]/n^1, polynomial(n), order 7

537 30802104839, -63284544930, 39247999110, 18919268550, -60200615475, 54790485750, -21709437750, 162820783125, # R[2]/n^2, polynomial(n), order 6

538 -8934064508, 5836972287, 1189171080, -4805732295, 3583780200, -1068242175, 10854718875, # PYCHOK R[3]/n^3, polynomial(n), order 5

539 50072287748, 3938662680, -26314234380, 17167059000, -4238509275, 43418875500, # R[4]/n^4, polynomial(n), order 4

540 359094172, -9912730821, 5849673480, -1255576140, 10854718875, # R[5]/n^5, polynomial(n), order 3

541 -16053944387, 8733508770, -1676521980, 10854718875, # PYCHOK R[6]/n^6, polynomial(n), order 2

542 930092876, -162639357, 723647925, # R[7]/n^7, polynomial(n), order 1

543 -673429061, 1929727800) # PYCHOK R[8]/n^8, polynomial(n), order 0, count = 54

544}

545

546__all__ += _ALL_DOCS(Caps)

547

548# **) MIT License

549#

550# Copyright (C) 2022-2025 -- mrJean1 at Gmail -- All Rights Reserved.

551#

552# Permission is hereby granted, free of charge, to any person obtaining a

553# copy of this software and associated documentation files (the "Software"),

554# to deal in the Software without restriction, including without limitation

555# the rights to use, copy, modify, merge, publish, distribute, sublicense,

556# and/or sell copies of the Software, and to permit persons to whom the

557# Software is furnished to do so, subject to the following conditions:

558#

559# The above copyright notice and this permission notice shall be included

560# in all copies or substantial portions of the Software.

561#

562# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS

563# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

564# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

565# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR

566# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,

567# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

568# OTHER DEALINGS IN THE SOFTWARE.