@math.gl/geospatial 5.0.0-alpha.19 → 5.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1213) hide show
  1. package/GEOGRAPHICLIB-LICENSE.txt +27 -0
  2. package/LICENSE +264 -73
  3. package/README.md +6 -1
  4. package/THIRD-PARTY-NOTICES.md +95 -0
  5. package/dist/constants.js +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/discontinuous/air-ocean-mesh.d.ts +15 -0
  8. package/dist/discontinuous/air-ocean-mesh.d.ts.map +1 -0
  9. package/dist/discontinuous/air-ocean-mesh.js +75 -0
  10. package/dist/discontinuous/air-ocean-mesh.js.map +1 -0
  11. package/dist/discontinuous/albers-usa.d.ts +9 -0
  12. package/dist/discontinuous/albers-usa.d.ts.map +1 -0
  13. package/dist/discontinuous/albers-usa.js +105 -0
  14. package/dist/discontinuous/albers-usa.js.map +1 -0
  15. package/dist/discontinuous/cap-map.d.ts +23 -0
  16. package/dist/discontinuous/cap-map.d.ts.map +1 -0
  17. package/dist/discontinuous/cap-map.js +314 -0
  18. package/dist/discontinuous/cap-map.js.map +1 -0
  19. package/dist/discontinuous/elastic/data.d.ts +26 -0
  20. package/dist/discontinuous/elastic/data.d.ts.map +1 -0
  21. package/dist/discontinuous/elastic/data.js +72 -0
  22. package/dist/discontinuous/elastic/data.js.map +1 -0
  23. package/dist/discontinuous/elastic/elasticI.d.ts +3 -0
  24. package/dist/discontinuous/elastic/elasticI.d.ts.map +1 -0
  25. package/dist/discontinuous/elastic/elasticI.js +5233 -0
  26. package/dist/discontinuous/elastic/elasticI.js.map +1 -0
  27. package/dist/discontinuous/elastic/elasticII.d.ts +3 -0
  28. package/dist/discontinuous/elastic/elasticII.d.ts.map +1 -0
  29. package/dist/discontinuous/elastic/elasticII.js +18162 -0
  30. package/dist/discontinuous/elastic/elasticII.js.map +1 -0
  31. package/dist/discontinuous/elastic/elasticIII.d.ts +3 -0
  32. package/dist/discontinuous/elastic/elasticIII.d.ts.map +1 -0
  33. package/dist/discontinuous/elastic/elasticIII.js +29566 -0
  34. package/dist/discontinuous/elastic/elasticIII.js.map +1 -0
  35. package/dist/discontinuous/elastic/geometry.d.ts +22 -0
  36. package/dist/discontinuous/elastic/geometry.d.ts.map +1 -0
  37. package/dist/discontinuous/elastic/geometry.js +131 -0
  38. package/dist/discontinuous/elastic/geometry.js.map +1 -0
  39. package/dist/discontinuous/elastic/grid.d.ts +15 -0
  40. package/dist/discontinuous/elastic/grid.d.ts.map +1 -0
  41. package/dist/discontinuous/elastic/grid.js +177 -0
  42. package/dist/discontinuous/elastic/grid.js.map +1 -0
  43. package/dist/discontinuous/elastic/map.d.ts +8 -0
  44. package/dist/discontinuous/elastic/map.d.ts.map +1 -0
  45. package/dist/discontinuous/elastic/map.js +260 -0
  46. package/dist/discontinuous/elastic/map.js.map +1 -0
  47. package/dist/discontinuous/gray-fuller.d.ts +5 -0
  48. package/dist/discontinuous/gray-fuller.d.ts.map +1 -0
  49. package/dist/discontinuous/gray-fuller.js +36 -0
  50. package/dist/discontinuous/gray-fuller.js.map +1 -0
  51. package/dist/discontinuous/gringorten-kernel.d.ts +5 -0
  52. package/dist/discontinuous/gringorten-kernel.d.ts.map +1 -0
  53. package/dist/discontinuous/gringorten-kernel.js +94 -0
  54. package/dist/discontinuous/gringorten-kernel.js.map +1 -0
  55. package/dist/discontinuous/healpix.d.ts +13 -0
  56. package/dist/discontinuous/healpix.d.ts.map +1 -0
  57. package/dist/discontinuous/healpix.js +61 -0
  58. package/dist/discontinuous/healpix.js.map +1 -0
  59. package/dist/discontinuous/layout.d.ts +72 -0
  60. package/dist/discontinuous/layout.d.ts.map +1 -0
  61. package/dist/discontinuous/layout.js +114 -0
  62. package/dist/discontinuous/layout.js.map +1 -0
  63. package/dist/discontinuous/map-engine.d.ts +197 -0
  64. package/dist/discontinuous/map-engine.d.ts.map +1 -0
  65. package/dist/discontinuous/map-engine.js +356 -0
  66. package/dist/discontinuous/map-engine.js.map +1 -0
  67. package/dist/discontinuous/map-layout.d.ts +93 -0
  68. package/dist/discontinuous/map-layout.d.ts.map +1 -0
  69. package/dist/discontinuous/map-layout.js +490 -0
  70. package/dist/discontinuous/map-layout.js.map +1 -0
  71. package/dist/discontinuous/map-transition.d.ts +42 -0
  72. package/dist/discontinuous/map-transition.d.ts.map +1 -0
  73. package/dist/discontinuous/map-transition.js +283 -0
  74. package/dist/discontinuous/map-transition.js.map +1 -0
  75. package/dist/discontinuous/math.d.ts +19 -0
  76. package/dist/discontinuous/math.d.ts.map +1 -0
  77. package/dist/discontinuous/math.js +65 -0
  78. package/dist/discontinuous/math.js.map +1 -0
  79. package/dist/discontinuous/mercator-map.d.ts +22 -0
  80. package/dist/discontinuous/mercator-map.d.ts.map +1 -0
  81. package/dist/discontinuous/mercator-map.js +130 -0
  82. package/dist/discontinuous/mercator-map.js.map +1 -0
  83. package/dist/discontinuous/myriahedral/graticule.d.ts +6 -0
  84. package/dist/discontinuous/myriahedral/graticule.d.ts.map +1 -0
  85. package/dist/discontinuous/myriahedral/graticule.js +37 -0
  86. package/dist/discontinuous/myriahedral/graticule.js.map +1 -0
  87. package/dist/discontinuous/myriahedral/mesh.d.ts +18 -0
  88. package/dist/discontinuous/myriahedral/mesh.d.ts.map +1 -0
  89. package/dist/discontinuous/myriahedral/mesh.js +131 -0
  90. package/dist/discontinuous/myriahedral/mesh.js.map +1 -0
  91. package/dist/discontinuous/myriahedral/unfold.d.ts +36 -0
  92. package/dist/discontinuous/myriahedral/unfold.d.ts.map +1 -0
  93. package/dist/discontinuous/myriahedral/unfold.js +172 -0
  94. package/dist/discontinuous/myriahedral/unfold.js.map +1 -0
  95. package/dist/discontinuous/myriahedral.d.ts +56 -0
  96. package/dist/discontinuous/myriahedral.d.ts.map +1 -0
  97. package/dist/discontinuous/myriahedral.js +204 -0
  98. package/dist/discontinuous/myriahedral.js.map +1 -0
  99. package/dist/discontinuous/petroff.d.ts +8 -0
  100. package/dist/discontinuous/petroff.d.ts.map +1 -0
  101. package/dist/discontinuous/petroff.js +159 -0
  102. package/dist/discontinuous/petroff.js.map +1 -0
  103. package/dist/discontinuous/polyhedral.d.ts +8 -0
  104. package/dist/discontinuous/polyhedral.d.ts.map +1 -0
  105. package/dist/discontinuous/polyhedral.js +117 -0
  106. package/dist/discontinuous/polyhedral.js.map +1 -0
  107. package/dist/discontinuous/prepare-features.d.ts +78 -0
  108. package/dist/discontinuous/prepare-features.d.ts.map +1 -0
  109. package/dist/discontinuous/prepare-features.js +146 -0
  110. package/dist/discontinuous/prepare-features.js.map +1 -0
  111. package/dist/discontinuous/presets.d.ts +71 -0
  112. package/dist/discontinuous/presets.d.ts.map +1 -0
  113. package/dist/discontinuous/presets.js +372 -0
  114. package/dist/discontinuous/presets.js.map +1 -0
  115. package/dist/discontinuous/projection-catalog.d.ts +33 -0
  116. package/dist/discontinuous/projection-catalog.d.ts.map +1 -0
  117. package/dist/discontinuous/projection-catalog.js +96 -0
  118. package/dist/discontinuous/projection-catalog.js.map +1 -0
  119. package/dist/discontinuous/quincuncial-kernel.d.ts +9 -0
  120. package/dist/discontinuous/quincuncial-kernel.d.ts.map +1 -0
  121. package/dist/discontinuous/quincuncial-kernel.js +139 -0
  122. package/dist/discontinuous/quincuncial-kernel.js.map +1 -0
  123. package/dist/discontinuous/quincuncial-star.d.ts +29 -0
  124. package/dist/discontinuous/quincuncial-star.d.ts.map +1 -0
  125. package/dist/discontinuous/quincuncial-star.js +307 -0
  126. package/dist/discontinuous/quincuncial-star.js.map +1 -0
  127. package/dist/discontinuous/regional-map.d.ts +18 -0
  128. package/dist/discontinuous/regional-map.d.ts.map +1 -0
  129. package/dist/discontinuous/regional-map.js +193 -0
  130. package/dist/discontinuous/regional-map.js.map +1 -0
  131. package/dist/discontinuous/retroazimuthal-map.d.ts +6 -0
  132. package/dist/discontinuous/retroazimuthal-map.d.ts.map +1 -0
  133. package/dist/discontinuous/retroazimuthal-map.js +52 -0
  134. package/dist/discontinuous/retroazimuthal-map.js.map +1 -0
  135. package/dist/discontinuous/rotated-map.d.ts +31 -0
  136. package/dist/discontinuous/rotated-map.d.ts.map +1 -0
  137. package/dist/discontinuous/rotated-map.js +66 -0
  138. package/dist/discontinuous/rotated-map.js.map +1 -0
  139. package/dist/discontinuous/snyder-mesh.d.ts +11 -0
  140. package/dist/discontinuous/snyder-mesh.d.ts.map +1 -0
  141. package/dist/discontinuous/snyder-mesh.js +88 -0
  142. package/dist/discontinuous/snyder-mesh.js.map +1 -0
  143. package/dist/discontinuous/snyder.d.ts +16 -0
  144. package/dist/discontinuous/snyder.d.ts.map +1 -0
  145. package/dist/discontinuous/snyder.js +153 -0
  146. package/dist/discontinuous/snyder.js.map +1 -0
  147. package/dist/discontinuous/spherical-clip/cartesian.d.ts +8 -0
  148. package/dist/discontinuous/spherical-clip/cartesian.d.ts.map +1 -0
  149. package/dist/discontinuous/spherical-clip/cartesian.js +34 -0
  150. package/dist/discontinuous/spherical-clip/cartesian.js.map +1 -0
  151. package/dist/discontinuous/spherical-clip/circle.d.ts +2 -0
  152. package/dist/discontinuous/spherical-clip/circle.d.ts.map +1 -0
  153. package/dist/discontinuous/spherical-clip/circle.js +34 -0
  154. package/dist/discontinuous/spherical-clip/circle.js.map +1 -0
  155. package/dist/discontinuous/spherical-clip/clip-buffer.d.ts +9 -0
  156. package/dist/discontinuous/spherical-clip/clip-buffer.d.ts.map +1 -0
  157. package/dist/discontinuous/spherical-clip/clip-buffer.js +28 -0
  158. package/dist/discontinuous/spherical-clip/clip-buffer.js.map +1 -0
  159. package/dist/discontinuous/spherical-clip/clip-circle.d.ts +9 -0
  160. package/dist/discontinuous/spherical-clip/clip-circle.d.ts.map +1 -0
  161. package/dist/discontinuous/spherical-clip/clip-circle.js +160 -0
  162. package/dist/discontinuous/spherical-clip/clip-circle.js.map +1 -0
  163. package/dist/discontinuous/spherical-clip/clip-index.d.ts +9 -0
  164. package/dist/discontinuous/spherical-clip/clip-index.d.ts.map +1 -0
  165. package/dist/discontinuous/spherical-clip/clip-index.js +117 -0
  166. package/dist/discontinuous/spherical-clip/clip-index.js.map +1 -0
  167. package/dist/discontinuous/spherical-clip/clip-rejoin.d.ts +2 -0
  168. package/dist/discontinuous/spherical-clip/clip-rejoin.d.ts.map +1 -0
  169. package/dist/discontinuous/spherical-clip/clip-rejoin.js +99 -0
  170. package/dist/discontinuous/spherical-clip/clip-rejoin.js.map +1 -0
  171. package/dist/discontinuous/spherical-clip/helpers.d.ts +8 -0
  172. package/dist/discontinuous/spherical-clip/helpers.d.ts.map +1 -0
  173. package/dist/discontinuous/spherical-clip/helpers.js +21 -0
  174. package/dist/discontinuous/spherical-clip/helpers.js.map +1 -0
  175. package/dist/discontinuous/spherical-clip/math.d.ts +26 -0
  176. package/dist/discontinuous/spherical-clip/math.d.ts.map +1 -0
  177. package/dist/discontinuous/spherical-clip/math.js +39 -0
  178. package/dist/discontinuous/spherical-clip/math.js.map +1 -0
  179. package/dist/discontinuous/spherical-clip/noop.d.ts +2 -0
  180. package/dist/discontinuous/spherical-clip/noop.d.ts.map +1 -0
  181. package/dist/discontinuous/spherical-clip/noop.js +6 -0
  182. package/dist/discontinuous/spherical-clip/noop.js.map +1 -0
  183. package/dist/discontinuous/spherical-clip/pointEqual.d.ts +2 -0
  184. package/dist/discontinuous/spherical-clip/pointEqual.d.ts.map +1 -0
  185. package/dist/discontinuous/spherical-clip/pointEqual.js +9 -0
  186. package/dist/discontinuous/spherical-clip/pointEqual.js.map +1 -0
  187. package/dist/discontinuous/spherical-clip/polygonContains.d.ts +2 -0
  188. package/dist/discontinuous/spherical-clip/polygonContains.d.ts.map +1 -0
  189. package/dist/discontinuous/spherical-clip/polygonContains.js +52 -0
  190. package/dist/discontinuous/spherical-clip/polygonContains.js.map +1 -0
  191. package/dist/discontinuous/world-composite-kernels.d.ts +11 -0
  192. package/dist/discontinuous/world-composite-kernels.d.ts.map +1 -0
  193. package/dist/discontinuous/world-composite-kernels.js +30 -0
  194. package/dist/discontinuous/world-composite-kernels.js.map +1 -0
  195. package/dist/discontinuous/world-kernels/airy.d.ts +5 -0
  196. package/dist/discontinuous/world-kernels/airy.d.ts.map +1 -0
  197. package/dist/discontinuous/world-kernels/airy.js +28 -0
  198. package/dist/discontinuous/world-kernels/airy.js.map +1 -0
  199. package/dist/discontinuous/world-kernels/aitoff.d.ts +5 -0
  200. package/dist/discontinuous/world-kernels/aitoff.d.ts.map +1 -0
  201. package/dist/discontinuous/world-kernels/aitoff.js +26 -0
  202. package/dist/discontinuous/world-kernels/aitoff.js.map +1 -0
  203. package/dist/discontinuous/world-kernels/armadillo.d.ts +5 -0
  204. package/dist/discontinuous/world-kernels/armadillo.d.ts.map +1 -0
  205. package/dist/discontinuous/world-kernels/armadillo.js +28 -0
  206. package/dist/discontinuous/world-kernels/armadillo.js.map +1 -0
  207. package/dist/discontinuous/world-kernels/august.d.ts +5 -0
  208. package/dist/discontinuous/world-kernels/august.d.ts.map +1 -0
  209. package/dist/discontinuous/world-kernels/august.js +21 -0
  210. package/dist/discontinuous/world-kernels/august.js.map +1 -0
  211. package/dist/discontinuous/world-kernels/baker.d.ts +5 -0
  212. package/dist/discontinuous/world-kernels/baker.d.ts.map +1 -0
  213. package/dist/discontinuous/world-kernels/baker.js +29 -0
  214. package/dist/discontinuous/world-kernels/baker.js.map +1 -0
  215. package/dist/discontinuous/world-kernels/bertin.d.ts +5 -0
  216. package/dist/discontinuous/world-kernels/bertin.d.ts.map +1 -0
  217. package/dist/discontinuous/world-kernels/bertin.js +32 -0
  218. package/dist/discontinuous/world-kernels/bertin.js.map +1 -0
  219. package/dist/discontinuous/world-kernels/boggs.d.ts +5 -0
  220. package/dist/discontinuous/world-kernels/boggs.d.ts.map +1 -0
  221. package/dist/discontinuous/world-kernels/boggs.js +24 -0
  222. package/dist/discontinuous/world-kernels/boggs.js.map +1 -0
  223. package/dist/discontinuous/world-kernels/bonne.d.ts +3 -0
  224. package/dist/discontinuous/world-kernels/bonne.d.ts.map +1 -0
  225. package/dist/discontinuous/world-kernels/bonne.js +22 -0
  226. package/dist/discontinuous/world-kernels/bonne.js.map +1 -0
  227. package/dist/discontinuous/world-kernels/bottomley.d.ts +5 -0
  228. package/dist/discontinuous/world-kernels/bottomley.d.ts.map +1 -0
  229. package/dist/discontinuous/world-kernels/bottomley.js +18 -0
  230. package/dist/discontinuous/world-kernels/bottomley.js.map +1 -0
  231. package/dist/discontinuous/world-kernels/bromley.d.ts +5 -0
  232. package/dist/discontinuous/world-kernels/bromley.d.ts.map +1 -0
  233. package/dist/discontinuous/world-kernels/bromley.js +9 -0
  234. package/dist/discontinuous/world-kernels/bromley.js.map +1 -0
  235. package/dist/discontinuous/world-kernels/chamberlin.d.ts +2 -0
  236. package/dist/discontinuous/world-kernels/chamberlin.d.ts.map +1 -0
  237. package/dist/discontinuous/world-kernels/chamberlin.js +81 -0
  238. package/dist/discontinuous/world-kernels/chamberlin.js.map +1 -0
  239. package/dist/discontinuous/world-kernels/collignon.d.ts +5 -0
  240. package/dist/discontinuous/world-kernels/collignon.d.ts.map +1 -0
  241. package/dist/discontinuous/world-kernels/collignon.js +15 -0
  242. package/dist/discontinuous/world-kernels/collignon.js.map +1 -0
  243. package/dist/discontinuous/world-kernels/craig.d.ts +5 -0
  244. package/dist/discontinuous/world-kernels/craig.d.ts.map +1 -0
  245. package/dist/discontinuous/world-kernels/craig.js +30 -0
  246. package/dist/discontinuous/world-kernels/craig.js.map +1 -0
  247. package/dist/discontinuous/world-kernels/craster.d.ts +5 -0
  248. package/dist/discontinuous/world-kernels/craster.d.ts.map +1 -0
  249. package/dist/discontinuous/world-kernels/craster.js +15 -0
  250. package/dist/discontinuous/world-kernels/craster.js.map +1 -0
  251. package/dist/discontinuous/world-kernels/cylindricalEqualArea.d.ts +5 -0
  252. package/dist/discontinuous/world-kernels/cylindricalEqualArea.d.ts.map +1 -0
  253. package/dist/discontinuous/world-kernels/cylindricalEqualArea.js +17 -0
  254. package/dist/discontinuous/world-kernels/cylindricalEqualArea.js.map +1 -0
  255. package/dist/discontinuous/world-kernels/cylindricalStereographic.d.ts +5 -0
  256. package/dist/discontinuous/world-kernels/cylindricalStereographic.d.ts.map +1 -0
  257. package/dist/discontinuous/world-kernels/cylindricalStereographic.js +17 -0
  258. package/dist/discontinuous/world-kernels/cylindricalStereographic.js.map +1 -0
  259. package/dist/discontinuous/world-kernels/d3-geo-raw.d.ts +9 -0
  260. package/dist/discontinuous/world-kernels/d3-geo-raw.d.ts.map +1 -0
  261. package/dist/discontinuous/world-kernels/d3-geo-raw.js +21 -0
  262. package/dist/discontinuous/world-kernels/d3-geo-raw.js.map +1 -0
  263. package/dist/discontinuous/world-kernels/eckert1.d.ts +5 -0
  264. package/dist/discontinuous/world-kernels/eckert1.d.ts.map +1 -0
  265. package/dist/discontinuous/world-kernels/eckert1.js +15 -0
  266. package/dist/discontinuous/world-kernels/eckert1.js.map +1 -0
  267. package/dist/discontinuous/world-kernels/eckert2.d.ts +5 -0
  268. package/dist/discontinuous/world-kernels/eckert2.d.ts.map +1 -0
  269. package/dist/discontinuous/world-kernels/eckert2.js +15 -0
  270. package/dist/discontinuous/world-kernels/eckert2.js.map +1 -0
  271. package/dist/discontinuous/world-kernels/eckert3.d.ts +5 -0
  272. package/dist/discontinuous/world-kernels/eckert3.d.ts.map +1 -0
  273. package/dist/discontinuous/world-kernels/eckert3.js +15 -0
  274. package/dist/discontinuous/world-kernels/eckert3.js.map +1 -0
  275. package/dist/discontinuous/world-kernels/eckert4.d.ts +5 -0
  276. package/dist/discontinuous/world-kernels/eckert4.d.ts.map +1 -0
  277. package/dist/discontinuous/world-kernels/eckert4.js +20 -0
  278. package/dist/discontinuous/world-kernels/eckert4.js.map +1 -0
  279. package/dist/discontinuous/world-kernels/eckert5.d.ts +5 -0
  280. package/dist/discontinuous/world-kernels/eckert5.d.ts.map +1 -0
  281. package/dist/discontinuous/world-kernels/eckert5.js +14 -0
  282. package/dist/discontinuous/world-kernels/eckert5.js.map +1 -0
  283. package/dist/discontinuous/world-kernels/eckert6.d.ts +5 -0
  284. package/dist/discontinuous/world-kernels/eckert6.d.ts.map +1 -0
  285. package/dist/discontinuous/world-kernels/eckert6.js +19 -0
  286. package/dist/discontinuous/world-kernels/eckert6.js.map +1 -0
  287. package/dist/discontinuous/world-kernels/eisenlohr.d.ts +5 -0
  288. package/dist/discontinuous/world-kernels/eisenlohr.d.ts.map +1 -0
  289. package/dist/discontinuous/world-kernels/eisenlohr.js +41 -0
  290. package/dist/discontinuous/world-kernels/eisenlohr.js.map +1 -0
  291. package/dist/discontinuous/world-kernels/fahey.d.ts +5 -0
  292. package/dist/discontinuous/world-kernels/fahey.d.ts.map +1 -0
  293. package/dist/discontinuous/world-kernels/fahey.js +16 -0
  294. package/dist/discontinuous/world-kernels/fahey.js.map +1 -0
  295. package/dist/discontinuous/world-kernels/foucaut.d.ts +5 -0
  296. package/dist/discontinuous/world-kernels/foucaut.d.ts.map +1 -0
  297. package/dist/discontinuous/world-kernels/foucaut.js +15 -0
  298. package/dist/discontinuous/world-kernels/foucaut.js.map +1 -0
  299. package/dist/discontinuous/world-kernels/foucautSinusoidal.d.ts +5 -0
  300. package/dist/discontinuous/world-kernels/foucautSinusoidal.d.ts.map +1 -0
  301. package/dist/discontinuous/world-kernels/foucautSinusoidal.js +27 -0
  302. package/dist/discontinuous/world-kernels/foucautSinusoidal.js.map +1 -0
  303. package/dist/discontinuous/world-kernels/ginzburg4.d.ts +5 -0
  304. package/dist/discontinuous/world-kernels/ginzburg4.d.ts.map +1 -0
  305. package/dist/discontinuous/world-kernels/ginzburg4.js +8 -0
  306. package/dist/discontinuous/world-kernels/ginzburg4.js.map +1 -0
  307. package/dist/discontinuous/world-kernels/ginzburg5.d.ts +5 -0
  308. package/dist/discontinuous/world-kernels/ginzburg5.d.ts.map +1 -0
  309. package/dist/discontinuous/world-kernels/ginzburg5.js +8 -0
  310. package/dist/discontinuous/world-kernels/ginzburg5.js.map +1 -0
  311. package/dist/discontinuous/world-kernels/ginzburg6.d.ts +5 -0
  312. package/dist/discontinuous/world-kernels/ginzburg6.d.ts.map +1 -0
  313. package/dist/discontinuous/world-kernels/ginzburg6.js +9 -0
  314. package/dist/discontinuous/world-kernels/ginzburg6.js.map +1 -0
  315. package/dist/discontinuous/world-kernels/ginzburg8.d.ts +5 -0
  316. package/dist/discontinuous/world-kernels/ginzburg8.d.ts.map +1 -0
  317. package/dist/discontinuous/world-kernels/ginzburg8.js +28 -0
  318. package/dist/discontinuous/world-kernels/ginzburg8.js.map +1 -0
  319. package/dist/discontinuous/world-kernels/ginzburg9.d.ts +5 -0
  320. package/dist/discontinuous/world-kernels/ginzburg9.d.ts.map +1 -0
  321. package/dist/discontinuous/world-kernels/ginzburg9.js +8 -0
  322. package/dist/discontinuous/world-kernels/ginzburg9.js.map +1 -0
  323. package/dist/discontinuous/world-kernels/ginzburgPolyconic.d.ts +5 -0
  324. package/dist/discontinuous/world-kernels/ginzburgPolyconic.d.ts.map +1 -0
  325. package/dist/discontinuous/world-kernels/ginzburgPolyconic.js +29 -0
  326. package/dist/discontinuous/world-kernels/ginzburgPolyconic.js.map +1 -0
  327. package/dist/discontinuous/world-kernels/hammer.d.ts +3 -0
  328. package/dist/discontinuous/world-kernels/hammer.d.ts.map +1 -0
  329. package/dist/discontinuous/world-kernels/hammer.js +34 -0
  330. package/dist/discontinuous/world-kernels/hammer.js.map +1 -0
  331. package/dist/discontinuous/world-kernels/hammerRetroazimuthal.d.ts +5 -0
  332. package/dist/discontinuous/world-kernels/hammerRetroazimuthal.d.ts.map +1 -0
  333. package/dist/discontinuous/world-kernels/hammerRetroazimuthal.js +37 -0
  334. package/dist/discontinuous/world-kernels/hammerRetroazimuthal.js.map +1 -0
  335. package/dist/discontinuous/world-kernels/hill.d.ts +5 -0
  336. package/dist/discontinuous/world-kernels/hill.d.ts.map +1 -0
  337. package/dist/discontinuous/world-kernels/hill.js +36 -0
  338. package/dist/discontinuous/world-kernels/hill.js.map +1 -0
  339. package/dist/discontinuous/world-kernels/homolosine.d.ts +5 -0
  340. package/dist/discontinuous/world-kernels/homolosine.d.ts.map +1 -0
  341. package/dist/discontinuous/world-kernels/homolosine.js +22 -0
  342. package/dist/discontinuous/world-kernels/homolosine.js.map +1 -0
  343. package/dist/discontinuous/world-kernels/hufnagel.d.ts +5 -0
  344. package/dist/discontinuous/world-kernels/hufnagel.d.ts.map +1 -0
  345. package/dist/discontinuous/world-kernels/hufnagel.js +53 -0
  346. package/dist/discontinuous/world-kernels/hufnagel.js.map +1 -0
  347. package/dist/discontinuous/world-kernels/hyperelliptical.d.ts +5 -0
  348. package/dist/discontinuous/world-kernels/hyperelliptical.d.ts.map +1 -0
  349. package/dist/discontinuous/world-kernels/hyperelliptical.js +47 -0
  350. package/dist/discontinuous/world-kernels/hyperelliptical.js.map +1 -0
  351. package/dist/discontinuous/world-kernels/integrate.d.ts +2 -0
  352. package/dist/discontinuous/world-kernels/integrate.d.ts.map +1 -0
  353. package/dist/discontinuous/world-kernels/integrate.js +82 -0
  354. package/dist/discontinuous/world-kernels/integrate.js.map +1 -0
  355. package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts +5 -0
  356. package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts.map +1 -0
  357. package/dist/discontinuous/world-kernels/kavrayskiy7.js +13 -0
  358. package/dist/discontinuous/world-kernels/kavrayskiy7.js.map +1 -0
  359. package/dist/discontinuous/world-kernels/lagrange.d.ts +5 -0
  360. package/dist/discontinuous/world-kernels/lagrange.d.ts.map +1 -0
  361. package/dist/discontinuous/world-kernels/lagrange.js +27 -0
  362. package/dist/discontinuous/world-kernels/lagrange.js.map +1 -0
  363. package/dist/discontinuous/world-kernels/larrivee.d.ts +5 -0
  364. package/dist/discontinuous/world-kernels/larrivee.d.ts.map +1 -0
  365. package/dist/discontinuous/world-kernels/larrivee.js +26 -0
  366. package/dist/discontinuous/world-kernels/larrivee.js.map +1 -0
  367. package/dist/discontinuous/world-kernels/laskowski.d.ts +5 -0
  368. package/dist/discontinuous/world-kernels/laskowski.d.ts.map +1 -0
  369. package/dist/discontinuous/world-kernels/laskowski.js +31 -0
  370. package/dist/discontinuous/world-kernels/laskowski.js.map +1 -0
  371. package/dist/discontinuous/world-kernels/littrow.d.ts +5 -0
  372. package/dist/discontinuous/world-kernels/littrow.d.ts.map +1 -0
  373. package/dist/discontinuous/world-kernels/littrow.js +13 -0
  374. package/dist/discontinuous/world-kernels/littrow.js.map +1 -0
  375. package/dist/discontinuous/world-kernels/loximuthal.d.ts +5 -0
  376. package/dist/discontinuous/world-kernels/loximuthal.d.ts.map +1 -0
  377. package/dist/discontinuous/world-kernels/loximuthal.js +30 -0
  378. package/dist/discontinuous/world-kernels/loximuthal.js.map +1 -0
  379. package/dist/discontinuous/world-kernels/math.d.ts +36 -0
  380. package/dist/discontinuous/world-kernels/math.d.ts.map +1 -0
  381. package/dist/discontinuous/world-kernels/math.js +63 -0
  382. package/dist/discontinuous/world-kernels/math.js.map +1 -0
  383. package/dist/discontinuous/world-kernels/miller.d.ts +5 -0
  384. package/dist/discontinuous/world-kernels/miller.d.ts.map +1 -0
  385. package/dist/discontinuous/world-kernels/miller.js +13 -0
  386. package/dist/discontinuous/world-kernels/miller.js.map +1 -0
  387. package/dist/discontinuous/world-kernels/modifiedStereographic.d.ts +18 -0
  388. package/dist/discontinuous/world-kernels/modifiedStereographic.d.ts.map +1 -0
  389. package/dist/discontinuous/world-kernels/modifiedStereographic.js +79 -0
  390. package/dist/discontinuous/world-kernels/modifiedStereographic.js.map +1 -0
  391. package/dist/discontinuous/world-kernels/mollweide.d.ts +10 -0
  392. package/dist/discontinuous/world-kernels/mollweide.d.ts.map +1 -0
  393. package/dist/discontinuous/world-kernels/mollweide.js +24 -0
  394. package/dist/discontinuous/world-kernels/mollweide.js.map +1 -0
  395. package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.d.ts +5 -0
  396. package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.d.ts.map +1 -0
  397. package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.js +19 -0
  398. package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.js.map +1 -0
  399. package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.d.ts +5 -0
  400. package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.d.ts.map +1 -0
  401. package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.js +26 -0
  402. package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.js.map +1 -0
  403. package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.d.ts +5 -0
  404. package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.d.ts.map +1 -0
  405. package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.js +22 -0
  406. package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.js.map +1 -0
  407. package/dist/discontinuous/world-kernels/naturalEarth2.d.ts +5 -0
  408. package/dist/discontinuous/world-kernels/naturalEarth2.d.ts.map +1 -0
  409. package/dist/discontinuous/world-kernels/naturalEarth2.js +37 -0
  410. package/dist/discontinuous/world-kernels/naturalEarth2.js.map +1 -0
  411. package/dist/discontinuous/world-kernels/nellHammer.d.ts +5 -0
  412. package/dist/discontinuous/world-kernels/nellHammer.d.ts.map +1 -0
  413. package/dist/discontinuous/world-kernels/nellHammer.js +18 -0
  414. package/dist/discontinuous/world-kernels/nellHammer.js.map +1 -0
  415. package/dist/discontinuous/world-kernels/newton.d.ts +3 -0
  416. package/dist/discontinuous/world-kernels/newton.d.ts.map +1 -0
  417. package/dist/discontinuous/world-kernels/newton.js +65 -0
  418. package/dist/discontinuous/world-kernels/newton.js.map +1 -0
  419. package/dist/discontinuous/world-kernels/nicolosi.d.ts +5 -0
  420. package/dist/discontinuous/world-kernels/nicolosi.d.ts.map +1 -0
  421. package/dist/discontinuous/world-kernels/nicolosi.js +38 -0
  422. package/dist/discontinuous/world-kernels/nicolosi.js.map +1 -0
  423. package/dist/discontinuous/world-kernels/patterson.d.ts +5 -0
  424. package/dist/discontinuous/world-kernels/patterson.d.ts.map +1 -0
  425. package/dist/discontinuous/world-kernels/patterson.js +32 -0
  426. package/dist/discontinuous/world-kernels/patterson.js.map +1 -0
  427. package/dist/discontinuous/world-kernels/polyconic.d.ts +5 -0
  428. package/dist/discontinuous/world-kernels/polyconic.d.ts.map +1 -0
  429. package/dist/discontinuous/world-kernels/polyconic.js +30 -0
  430. package/dist/discontinuous/world-kernels/polyconic.js.map +1 -0
  431. package/dist/discontinuous/world-kernels/rectangularPolyconic.d.ts +5 -0
  432. package/dist/discontinuous/world-kernels/rectangularPolyconic.d.ts.map +1 -0
  433. package/dist/discontinuous/world-kernels/rectangularPolyconic.js +31 -0
  434. package/dist/discontinuous/world-kernels/rectangularPolyconic.js.map +1 -0
  435. package/dist/discontinuous/world-kernels/robinson.d.ts +5 -0
  436. package/dist/discontinuous/world-kernels/robinson.d.ts.map +1 -0
  437. package/dist/discontinuous/world-kernels/robinson.js +63 -0
  438. package/dist/discontinuous/world-kernels/robinson.js.map +1 -0
  439. package/dist/discontinuous/world-kernels/satellite.d.ts +5 -0
  440. package/dist/discontinuous/world-kernels/satellite.d.ts.map +1 -0
  441. package/dist/discontinuous/world-kernels/satellite.js +32 -0
  442. package/dist/discontinuous/world-kernels/satellite.js.map +1 -0
  443. package/dist/discontinuous/world-kernels/sinuMollweide.d.ts +7 -0
  444. package/dist/discontinuous/world-kernels/sinuMollweide.d.ts.map +1 -0
  445. package/dist/discontinuous/world-kernels/sinuMollweide.js +20 -0
  446. package/dist/discontinuous/world-kernels/sinuMollweide.js.map +1 -0
  447. package/dist/discontinuous/world-kernels/sinusoidal.d.ts +5 -0
  448. package/dist/discontinuous/world-kernels/sinusoidal.d.ts.map +1 -0
  449. package/dist/discontinuous/world-kernels/sinusoidal.js +13 -0
  450. package/dist/discontinuous/world-kernels/sinusoidal.js.map +1 -0
  451. package/dist/discontinuous/world-kernels/times.d.ts +5 -0
  452. package/dist/discontinuous/world-kernels/times.d.ts.map +1 -0
  453. package/dist/discontinuous/world-kernels/times.js +15 -0
  454. package/dist/discontinuous/world-kernels/times.js.map +1 -0
  455. package/dist/discontinuous/world-kernels/twoPointEquidistant.d.ts +3 -0
  456. package/dist/discontinuous/world-kernels/twoPointEquidistant.d.ts.map +1 -0
  457. package/dist/discontinuous/world-kernels/twoPointEquidistant.js +28 -0
  458. package/dist/discontinuous/world-kernels/twoPointEquidistant.js.map +1 -0
  459. package/dist/discontinuous/world-kernels/vanDerGrinten.d.ts +5 -0
  460. package/dist/discontinuous/world-kernels/vanDerGrinten.d.ts.map +1 -0
  461. package/dist/discontinuous/world-kernels/vanDerGrinten.js +30 -0
  462. package/dist/discontinuous/world-kernels/vanDerGrinten.js.map +1 -0
  463. package/dist/discontinuous/world-kernels/vanDerGrinten2.d.ts +5 -0
  464. package/dist/discontinuous/world-kernels/vanDerGrinten2.d.ts.map +1 -0
  465. package/dist/discontinuous/world-kernels/vanDerGrinten2.js +25 -0
  466. package/dist/discontinuous/world-kernels/vanDerGrinten2.js.map +1 -0
  467. package/dist/discontinuous/world-kernels/vanDerGrinten3.d.ts +5 -0
  468. package/dist/discontinuous/world-kernels/vanDerGrinten3.d.ts.map +1 -0
  469. package/dist/discontinuous/world-kernels/vanDerGrinten3.js +22 -0
  470. package/dist/discontinuous/world-kernels/vanDerGrinten3.js.map +1 -0
  471. package/dist/discontinuous/world-kernels/vanDerGrinten4.d.ts +5 -0
  472. package/dist/discontinuous/world-kernels/vanDerGrinten4.d.ts.map +1 -0
  473. package/dist/discontinuous/world-kernels/vanDerGrinten4.js +38 -0
  474. package/dist/discontinuous/world-kernels/vanDerGrinten4.js.map +1 -0
  475. package/dist/discontinuous/world-kernels/wagner.d.ts +5 -0
  476. package/dist/discontinuous/world-kernels/wagner.d.ts.map +1 -0
  477. package/dist/discontinuous/world-kernels/wagner.js +44 -0
  478. package/dist/discontinuous/world-kernels/wagner.js.map +1 -0
  479. package/dist/discontinuous/world-kernels/wagner4.d.ts +5 -0
  480. package/dist/discontinuous/world-kernels/wagner4.d.ts.map +1 -0
  481. package/dist/discontinuous/world-kernels/wagner4.js +10 -0
  482. package/dist/discontinuous/world-kernels/wagner4.js.map +1 -0
  483. package/dist/discontinuous/world-kernels/wagner6.d.ts +5 -0
  484. package/dist/discontinuous/world-kernels/wagner6.d.ts.map +1 -0
  485. package/dist/discontinuous/world-kernels/wagner6.js +13 -0
  486. package/dist/discontinuous/world-kernels/wagner6.js.map +1 -0
  487. package/dist/discontinuous/world-kernels/wiechel.d.ts +5 -0
  488. package/dist/discontinuous/world-kernels/wiechel.d.ts.map +1 -0
  489. package/dist/discontinuous/world-kernels/wiechel.js +15 -0
  490. package/dist/discontinuous/world-kernels/wiechel.js.map +1 -0
  491. package/dist/discontinuous/world-kernels/winkel3.d.ts +5 -0
  492. package/dist/discontinuous/world-kernels/winkel3.d.ts.map +1 -0
  493. package/dist/discontinuous/world-kernels/winkel3.js +20 -0
  494. package/dist/discontinuous/world-kernels/winkel3.js.map +1 -0
  495. package/dist/discontinuous/world-kernels.d.ts +150 -0
  496. package/dist/discontinuous/world-kernels.d.ts.map +1 -0
  497. package/dist/discontinuous/world-kernels.js +215 -0
  498. package/dist/discontinuous/world-kernels.js.map +1 -0
  499. package/dist/discontinuous/world-map.d.ts +25 -0
  500. package/dist/discontinuous/world-map.d.ts.map +1 -0
  501. package/dist/discontinuous/world-map.js +187 -0
  502. package/dist/discontinuous/world-map.js.map +1 -0
  503. package/dist/discontinuous.cjs +7037 -0
  504. package/dist/discontinuous.cjs.map +6 -0
  505. package/dist/discontinuous.d.ts +50 -0
  506. package/dist/discontinuous.d.ts.map +1 -0
  507. package/dist/discontinuous.js +35 -0
  508. package/dist/discontinuous.js.map +1 -0
  509. package/dist/elastic.cjs +52991 -0
  510. package/dist/elastic.cjs.map +6 -0
  511. package/dist/elastic.d.ts +5 -0
  512. package/dist/elastic.d.ts.map +1 -0
  513. package/dist/elastic.js +8 -0
  514. package/dist/elastic.js.map +1 -0
  515. package/dist/ellipsoid-geodesic.d.ts +62 -0
  516. package/dist/ellipsoid-geodesic.d.ts.map +1 -0
  517. package/dist/ellipsoid-geodesic.js +69 -0
  518. package/dist/ellipsoid-geodesic.js.map +1 -0
  519. package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
  520. package/dist/ellipsoid-helpers/ellipsoid-transform.js +15 -5
  521. package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
  522. package/dist/ellipsoid-helpers/exact-nearest-surface.d.ts +16 -0
  523. package/dist/ellipsoid-helpers/exact-nearest-surface.d.ts.map +1 -0
  524. package/dist/ellipsoid-helpers/exact-nearest-surface.js +108 -0
  525. package/dist/ellipsoid-helpers/exact-nearest-surface.js.map +1 -0
  526. package/dist/ellipsoid-helpers/intersection-bounds.d.ts +18 -0
  527. package/dist/ellipsoid-helpers/intersection-bounds.d.ts.map +1 -0
  528. package/dist/ellipsoid-helpers/intersection-bounds.js +60 -0
  529. package/dist/ellipsoid-helpers/intersection-bounds.js.map +1 -0
  530. package/dist/ellipsoid-helpers/nearest-surface.d.ts +12 -0
  531. package/dist/ellipsoid-helpers/nearest-surface.d.ts.map +1 -0
  532. package/dist/ellipsoid-helpers/nearest-surface.js +127 -0
  533. package/dist/ellipsoid-helpers/nearest-surface.js.map +1 -0
  534. package/dist/ellipsoid-helpers/rhumb-pole-distance.d.ts +3 -0
  535. package/dist/ellipsoid-helpers/rhumb-pole-distance.d.ts.map +1 -0
  536. package/dist/ellipsoid-helpers/rhumb-pole-distance.js +63 -0
  537. package/dist/ellipsoid-helpers/rhumb-pole-distance.js.map +1 -0
  538. package/dist/ellipsoid-helpers/scale-to-geodetic-surface.d.ts.map +1 -1
  539. package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +14 -78
  540. package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
  541. package/dist/ellipsoid-helpers/surface-polygon.d.ts +65 -0
  542. package/dist/ellipsoid-helpers/surface-polygon.d.ts.map +1 -0
  543. package/dist/ellipsoid-helpers/surface-polygon.js +159 -0
  544. package/dist/ellipsoid-helpers/surface-polygon.js.map +1 -0
  545. package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +7 -0
  546. package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -0
  547. package/dist/ellipsoid-helpers/tangent-plane-numerics.js +88 -0
  548. package/dist/ellipsoid-helpers/tangent-plane-numerics.js.map +1 -0
  549. package/dist/ellipsoid-metrics.d.ts +31 -0
  550. package/dist/ellipsoid-metrics.d.ts.map +1 -0
  551. package/dist/ellipsoid-metrics.js +186 -0
  552. package/dist/ellipsoid-metrics.js.map +1 -0
  553. package/dist/ellipsoid-rhumb.d.ts +52 -0
  554. package/dist/ellipsoid-rhumb.d.ts.map +1 -0
  555. package/dist/ellipsoid-rhumb.js +321 -0
  556. package/dist/ellipsoid-rhumb.js.map +1 -0
  557. package/dist/ellipsoid-tangent-plane.d.ts +29 -7
  558. package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
  559. package/dist/ellipsoid-tangent-plane.js +177 -29
  560. package/dist/ellipsoid-tangent-plane.js.map +1 -1
  561. package/dist/ellipsoid-transforms.d.ts +12 -0
  562. package/dist/ellipsoid-transforms.d.ts.map +1 -0
  563. package/dist/ellipsoid-transforms.js +15 -0
  564. package/dist/ellipsoid-transforms.js.map +1 -0
  565. package/dist/ellipsoid.d.ts +2 -12
  566. package/dist/ellipsoid.d.ts.map +1 -1
  567. package/dist/ellipsoid.js +167 -73
  568. package/dist/ellipsoid.js.map +1 -1
  569. package/dist/entries/ellipsoid.cjs +3640 -302
  570. package/dist/entries/ellipsoid.cjs.map +3 -3
  571. package/dist/entries/ellipsoid.d.ts +21 -0
  572. package/dist/entries/ellipsoid.d.ts.map +1 -1
  573. package/dist/entries/ellipsoid.js +10 -0
  574. package/dist/entries/ellipsoid.js.map +1 -1
  575. package/dist/expressions.cjs +442 -244
  576. package/dist/expressions.cjs.map +3 -3
  577. package/dist/expressions.d.ts.map +1 -1
  578. package/dist/expressions.js +2 -1
  579. package/dist/expressions.js.map +1 -1
  580. package/dist/geoarrow/builder-entry.cjs.map +1 -1
  581. package/dist/geoarrow/codecs.d.ts.map +1 -1
  582. package/dist/geoarrow/codecs.js +3 -8
  583. package/dist/geoarrow/codecs.js.map +1 -1
  584. package/dist/geoarrow/index.cjs +34 -9
  585. package/dist/geoarrow/index.cjs.map +1 -1
  586. package/dist/geoarrow/index.d.ts +1 -1
  587. package/dist/geoarrow/index.d.ts.map +1 -1
  588. package/dist/geoarrow/index.js +1 -1
  589. package/dist/geoarrow/index.js.map +1 -1
  590. package/dist/geoarrow/tessellation-entry.cjs.map +1 -1
  591. package/dist/geoarrow/types.d.ts +8 -0
  592. package/dist/geoarrow/types.d.ts.map +1 -1
  593. package/dist/geoarrow/types.js +30 -0
  594. package/dist/geoarrow/types.js.map +1 -1
  595. package/dist/geoarrow/wkb-entry.cjs +14 -9
  596. package/dist/geoarrow/wkb-entry.cjs.map +1 -1
  597. package/dist/geodesic-exact/area.d.ts +5 -0
  598. package/dist/geodesic-exact/area.d.ts.map +1 -0
  599. package/dist/geodesic-exact/area.js +56 -0
  600. package/dist/geodesic-exact/area.js.map +1 -0
  601. package/dist/geodesic-exact/inverse-engine.d.ts +57 -0
  602. package/dist/geodesic-exact/inverse-engine.d.ts.map +1 -0
  603. package/dist/geodesic-exact/inverse-engine.js +56 -0
  604. package/dist/geodesic-exact/inverse-engine.js.map +1 -0
  605. package/dist/geodesic-exact/polygon.d.ts +12 -0
  606. package/dist/geodesic-exact/polygon.d.ts.map +1 -0
  607. package/dist/geodesic-exact/polygon.js +27 -0
  608. package/dist/geodesic-exact/polygon.js.map +1 -0
  609. package/dist/geodesic-exact/quadrature.d.ts +9 -0
  610. package/dist/geodesic-exact/quadrature.d.ts.map +1 -0
  611. package/dist/geodesic-exact/quadrature.js +62 -0
  612. package/dist/geodesic-exact/quadrature.js.map +1 -0
  613. package/dist/geodesic-exact.cjs +1871 -0
  614. package/dist/geodesic-exact.cjs.map +6 -0
  615. package/dist/geodesic-exact.d.ts +23 -0
  616. package/dist/geodesic-exact.d.ts.map +1 -0
  617. package/dist/geodesic-exact.js +210 -0
  618. package/dist/geodesic-exact.js.map +1 -0
  619. package/dist/geodesic-intersections.d.ts +83 -0
  620. package/dist/geodesic-intersections.d.ts.map +1 -0
  621. package/dist/geodesic-intersections.js +451 -0
  622. package/dist/geodesic-intersections.js.map +1 -0
  623. package/dist/geodesic-path.d.ts +28 -0
  624. package/dist/geodesic-path.d.ts.map +1 -0
  625. package/dist/geodesic-path.js +102 -0
  626. package/dist/geodesic-path.js.map +1 -0
  627. package/dist/geodesic-polygon.d.ts +11 -0
  628. package/dist/geodesic-polygon.d.ts.map +1 -0
  629. package/dist/geodesic-polygon.js +16 -0
  630. package/dist/geodesic-polygon.js.map +1 -0
  631. package/dist/geographic-seams/edge.d.ts +46 -0
  632. package/dist/geographic-seams/edge.d.ts.map +1 -0
  633. package/dist/geographic-seams/edge.js +362 -0
  634. package/dist/geographic-seams/edge.js.map +1 -0
  635. package/dist/geographic-seams/polygon.d.ts +8 -0
  636. package/dist/geographic-seams/polygon.d.ts.map +1 -0
  637. package/dist/geographic-seams/polygon.js +381 -0
  638. package/dist/geographic-seams/polygon.js.map +1 -0
  639. package/dist/geographic-seams/types.d.ts +59 -0
  640. package/dist/geographic-seams/types.d.ts.map +1 -0
  641. package/dist/geographic-seams/types.js +8 -0
  642. package/dist/geographic-seams/types.js.map +1 -0
  643. package/dist/geographic-seams.d.ts +12 -0
  644. package/dist/geographic-seams.d.ts.map +1 -0
  645. package/dist/geographic-seams.js +54 -0
  646. package/dist/geographic-seams.js.map +1 -0
  647. package/dist/globe.cjs +3520 -367
  648. package/dist/globe.cjs.map +3 -3
  649. package/dist/globe.d.ts +6 -0
  650. package/dist/globe.d.ts.map +1 -1
  651. package/dist/globe.js +3 -0
  652. package/dist/globe.js.map +1 -1
  653. package/dist/index.cjs +4495 -378
  654. package/dist/index.cjs.map +3 -3
  655. package/dist/lng-lat-rectangle.js +1 -1
  656. package/dist/lng-lat-rectangle.js.map +1 -1
  657. package/dist/local-reference-frame.d.ts +57 -0
  658. package/dist/local-reference-frame.d.ts.map +1 -0
  659. package/dist/local-reference-frame.js +247 -0
  660. package/dist/local-reference-frame.js.map +1 -0
  661. package/dist/make-obb-from-region.js +1 -1
  662. package/dist/make-obb-from-region.js.map +1 -1
  663. package/dist/projection/experimental/authalic-latitude.d.ts +7 -0
  664. package/dist/projection/experimental/authalic-latitude.d.ts.map +1 -0
  665. package/dist/projection/experimental/authalic-latitude.js +51 -0
  666. package/dist/projection/experimental/authalic-latitude.js.map +1 -0
  667. package/dist/projection/experimental/common/adjust_lat.js +2 -2
  668. package/dist/projection/experimental/common/adjust_lat.js.map +1 -1
  669. package/dist/projection/experimental/common/adjust_lon.js +1 -1
  670. package/dist/projection/experimental/common/adjust_lon.js.map +1 -1
  671. package/dist/projection/experimental/common/asinhy.js +1 -1
  672. package/dist/projection/experimental/common/asinhy.js.map +1 -1
  673. package/dist/projection/experimental/common/asinz.js +1 -1
  674. package/dist/projection/experimental/common/asinz.js.map +1 -1
  675. package/dist/projection/experimental/common/authlat.js +1 -1
  676. package/dist/projection/experimental/common/authlat.js.map +1 -1
  677. package/dist/projection/experimental/common/authset.js +1 -1
  678. package/dist/projection/experimental/common/authset.js.map +1 -1
  679. package/dist/projection/experimental/common/clens.js +1 -1
  680. package/dist/projection/experimental/common/clens.js.map +1 -1
  681. package/dist/projection/experimental/common/clens_cmplx.js +1 -1
  682. package/dist/projection/experimental/common/clens_cmplx.js.map +1 -1
  683. package/dist/projection/experimental/common/constants.js +1 -1
  684. package/dist/projection/experimental/common/constants.js.map +1 -1
  685. package/dist/projection/experimental/common/cosh.js +1 -1
  686. package/dist/projection/experimental/common/cosh.js.map +1 -1
  687. package/dist/projection/experimental/common/e0fn.js +1 -1
  688. package/dist/projection/experimental/common/e0fn.js.map +1 -1
  689. package/dist/projection/experimental/common/e1fn.js +1 -1
  690. package/dist/projection/experimental/common/e1fn.js.map +1 -1
  691. package/dist/projection/experimental/common/e2fn.js +1 -1
  692. package/dist/projection/experimental/common/e2fn.js.map +1 -1
  693. package/dist/projection/experimental/common/e3fn.js +1 -1
  694. package/dist/projection/experimental/common/e3fn.js.map +1 -1
  695. package/dist/projection/experimental/common/fL.js +1 -1
  696. package/dist/projection/experimental/common/fL.js.map +1 -1
  697. package/dist/projection/experimental/common/gN.js +1 -1
  698. package/dist/projection/experimental/common/gN.js.map +1 -1
  699. package/dist/projection/experimental/common/gatg.js +1 -1
  700. package/dist/projection/experimental/common/gatg.js.map +1 -1
  701. package/dist/projection/experimental/common/hypot.js +1 -1
  702. package/dist/projection/experimental/common/hypot.js.map +1 -1
  703. package/dist/projection/experimental/common/imlfn.js +1 -1
  704. package/dist/projection/experimental/common/imlfn.js.map +1 -1
  705. package/dist/projection/experimental/common/invlatiso.js +1 -1
  706. package/dist/projection/experimental/common/invlatiso.js.map +1 -1
  707. package/dist/projection/experimental/common/iqsfnz.js +1 -1
  708. package/dist/projection/experimental/common/iqsfnz.js.map +1 -1
  709. package/dist/projection/experimental/common/latiso.js +1 -1
  710. package/dist/projection/experimental/common/latiso.js.map +1 -1
  711. package/dist/projection/experimental/common/log1py.js +1 -1
  712. package/dist/projection/experimental/common/log1py.js.map +1 -1
  713. package/dist/projection/experimental/common/mlfn.js +1 -1
  714. package/dist/projection/experimental/common/mlfn.js.map +1 -1
  715. package/dist/projection/experimental/common/msfnz.js +1 -1
  716. package/dist/projection/experimental/common/msfnz.js.map +1 -1
  717. package/dist/projection/experimental/common/phi2z.js +1 -1
  718. package/dist/projection/experimental/common/phi2z.js.map +1 -1
  719. package/dist/projection/experimental/common/pj_enfn.js +1 -1
  720. package/dist/projection/experimental/common/pj_enfn.js.map +1 -1
  721. package/dist/projection/experimental/common/pj_inv_mlfn.js +1 -1
  722. package/dist/projection/experimental/common/pj_inv_mlfn.js.map +1 -1
  723. package/dist/projection/experimental/common/pj_mlfn.js +1 -1
  724. package/dist/projection/experimental/common/pj_mlfn.js.map +1 -1
  725. package/dist/projection/experimental/common/qsfnz.js +1 -1
  726. package/dist/projection/experimental/common/qsfnz.js.map +1 -1
  727. package/dist/projection/experimental/common/sign.js +1 -1
  728. package/dist/projection/experimental/common/sign.js.map +1 -1
  729. package/dist/projection/experimental/common/sinh.js +1 -1
  730. package/dist/projection/experimental/common/sinh.js.map +1 -1
  731. package/dist/projection/experimental/common/srat.js +1 -1
  732. package/dist/projection/experimental/common/srat.js.map +1 -1
  733. package/dist/projection/experimental/common/tsfnz.d.ts.map +1 -1
  734. package/dist/projection/experimental/common/tsfnz.js +6 -6
  735. package/dist/projection/experimental/common/tsfnz.js.map +1 -1
  736. package/dist/projection/experimental/common/vincenty.js +1 -1
  737. package/dist/projection/experimental/common/vincenty.js.map +1 -1
  738. package/dist/projection/experimental/crs/datum-table.js +1 -1
  739. package/dist/projection/experimental/crs/datum-table.js.map +1 -1
  740. package/dist/projection/experimental/crs/ellipsoid-table.js +1 -1
  741. package/dist/projection/experimental/crs/ellipsoid-table.js.map +1 -1
  742. package/dist/projection/experimental/crs/primemeridian-table.js +1 -1
  743. package/dist/projection/experimental/crs/primemeridian-table.js.map +1 -1
  744. package/dist/projection/experimental/crs/structured.js +1 -1
  745. package/dist/projection/experimental/crs/structured.js.map +1 -1
  746. package/dist/projection/experimental/crs/wkt.js +1 -1
  747. package/dist/projection/experimental/crs/wkt.js.map +1 -1
  748. package/dist/projection/experimental/datum.js +1 -1
  749. package/dist/projection/experimental/datum.js.map +1 -1
  750. package/dist/projection/experimental/ellipsoidal-gnomonic.d.ts +10 -0
  751. package/dist/projection/experimental/ellipsoidal-gnomonic.d.ts.map +1 -0
  752. package/dist/projection/experimental/ellipsoidal-gnomonic.js +59 -0
  753. package/dist/projection/experimental/ellipsoidal-gnomonic.js.map +1 -0
  754. package/dist/projection/experimental/entries/projections/aea.cjs +34 -27
  755. package/dist/projection/experimental/entries/projections/aea.cjs.map +2 -2
  756. package/dist/projection/experimental/entries/projections/aeqd.cjs +9 -9
  757. package/dist/projection/experimental/entries/projections/aeqd.cjs.map +3 -3
  758. package/dist/projection/experimental/entries/projections/bonne.cjs +1 -1
  759. package/dist/projection/experimental/entries/projections/bonne.cjs.map +1 -1
  760. package/dist/projection/experimental/entries/projections/cass.cjs +1 -1
  761. package/dist/projection/experimental/entries/projections/cass.cjs.map +1 -1
  762. package/dist/projection/experimental/entries/projections/eck6.cjs +5 -2
  763. package/dist/projection/experimental/entries/projections/eck6.cjs.map +1 -1
  764. package/dist/projection/experimental/entries/projections/eqdc.cjs +1 -1
  765. package/dist/projection/experimental/entries/projections/eqdc.cjs.map +1 -1
  766. package/dist/projection/experimental/entries/projections/eqearth.cjs +10 -1
  767. package/dist/projection/experimental/entries/projections/eqearth.cjs.map +1 -1
  768. package/dist/projection/experimental/entries/projections/equi.cjs +2 -0
  769. package/dist/projection/experimental/entries/projections/equi.cjs.map +1 -1
  770. package/dist/projection/experimental/entries/projections/gnom.cjs +1461 -4
  771. package/dist/projection/experimental/entries/projections/gnom.cjs.map +3 -3
  772. package/dist/projection/experimental/entries/projections/krovak.cjs +1 -1
  773. package/dist/projection/experimental/entries/projections/krovak.cjs.map +1 -1
  774. package/dist/projection/experimental/entries/projections/laea.cjs +82 -46
  775. package/dist/projection/experimental/entries/projections/laea.cjs.map +2 -2
  776. package/dist/projection/experimental/entries/projections/lcc.cjs +7 -12
  777. package/dist/projection/experimental/entries/projections/lcc.cjs.map +2 -2
  778. package/dist/projection/experimental/entries/projections/moll.cjs +46 -39
  779. package/dist/projection/experimental/entries/projections/moll.cjs.map +1 -1
  780. package/dist/projection/experimental/entries/projections/omerc.cjs +6 -8
  781. package/dist/projection/experimental/entries/projections/omerc.cjs.map +2 -2
  782. package/dist/projection/experimental/entries/projections/ortho.cjs +52 -106
  783. package/dist/projection/experimental/entries/projections/ortho.cjs.map +2 -2
  784. package/dist/projection/experimental/entries/projections/poly.cjs +83 -49
  785. package/dist/projection/experimental/entries/projections/poly.cjs.map +3 -3
  786. package/dist/projection/experimental/entries/projections/qsc.cjs +31 -50
  787. package/dist/projection/experimental/entries/projections/qsc.cjs.map +1 -1
  788. package/dist/projection/experimental/entries/projections/sinu.cjs +5 -2
  789. package/dist/projection/experimental/entries/projections/sinu.cjs.map +1 -1
  790. package/dist/projection/experimental/entries/projections/somerc.cjs +22 -29
  791. package/dist/projection/experimental/entries/projections/somerc.cjs.map +1 -1
  792. package/dist/projection/experimental/entries/projections/stere.cjs +19 -6
  793. package/dist/projection/experimental/entries/projections/stere.cjs.map +2 -2
  794. package/dist/projection/experimental/entries/projections/sterea.cjs +9 -1
  795. package/dist/projection/experimental/entries/projections/sterea.cjs.map +2 -2
  796. package/dist/projection/experimental/entries/projections/tpers.cjs.map +1 -1
  797. package/dist/projection/experimental/grids/geotiff.js +1 -1
  798. package/dist/projection/experimental/grids/geotiff.js.map +1 -1
  799. package/dist/projection/experimental/grids/ntv2.js +1 -1
  800. package/dist/projection/experimental/grids/ntv2.js.map +1 -1
  801. package/dist/projection/experimental/index.cjs +1870 -365
  802. package/dist/projection/experimental/index.cjs.map +3 -3
  803. package/dist/projection/experimental/inverse-spherical-latitude.d.ts +2 -0
  804. package/dist/projection/experimental/inverse-spherical-latitude.d.ts.map +1 -0
  805. package/dist/projection/experimental/inverse-spherical-latitude.js +11 -0
  806. package/dist/projection/experimental/inverse-spherical-latitude.js.map +1 -0
  807. package/dist/projection/experimental/kernels/aea.d.ts.map +1 -1
  808. package/dist/projection/experimental/kernels/aea.js +11 -29
  809. package/dist/projection/experimental/kernels/aea.js.map +1 -1
  810. package/dist/projection/experimental/kernels/aeqd.d.ts.map +1 -1
  811. package/dist/projection/experimental/kernels/aeqd.js +3 -3
  812. package/dist/projection/experimental/kernels/aeqd.js.map +1 -1
  813. package/dist/projection/experimental/kernels/bonne.js +1 -1
  814. package/dist/projection/experimental/kernels/bonne.js.map +1 -1
  815. package/dist/projection/experimental/kernels/cass.js +1 -1
  816. package/dist/projection/experimental/kernels/cass.js.map +1 -1
  817. package/dist/projection/experimental/kernels/cea.js +1 -1
  818. package/dist/projection/experimental/kernels/cea.js.map +1 -1
  819. package/dist/projection/experimental/kernels/eck6.js +1 -1
  820. package/dist/projection/experimental/kernels/eck6.js.map +1 -1
  821. package/dist/projection/experimental/kernels/eqdc.js +1 -1
  822. package/dist/projection/experimental/kernels/eqdc.js.map +1 -1
  823. package/dist/projection/experimental/kernels/eqearth.d.ts.map +1 -1
  824. package/dist/projection/experimental/kernels/eqearth.js +13 -2
  825. package/dist/projection/experimental/kernels/eqearth.js.map +1 -1
  826. package/dist/projection/experimental/kernels/equi.d.ts.map +1 -1
  827. package/dist/projection/experimental/kernels/equi.js +3 -1
  828. package/dist/projection/experimental/kernels/equi.js.map +1 -1
  829. package/dist/projection/experimental/kernels/etmerc.js +1 -1
  830. package/dist/projection/experimental/kernels/etmerc.js.map +1 -1
  831. package/dist/projection/experimental/kernels/gauss.js +1 -1
  832. package/dist/projection/experimental/kernels/gauss.js.map +1 -1
  833. package/dist/projection/experimental/kernels/geos.js +1 -1
  834. package/dist/projection/experimental/kernels/geos.js.map +1 -1
  835. package/dist/projection/experimental/kernels/gnom.d.ts +2 -0
  836. package/dist/projection/experimental/kernels/gnom.d.ts.map +1 -1
  837. package/dist/projection/experimental/kernels/gnom.js +8 -1
  838. package/dist/projection/experimental/kernels/gnom.js.map +1 -1
  839. package/dist/projection/experimental/kernels/gstmerc.js +1 -1
  840. package/dist/projection/experimental/kernels/gstmerc.js.map +1 -1
  841. package/dist/projection/experimental/kernels/krovak.js +2 -2
  842. package/dist/projection/experimental/kernels/krovak.js.map +1 -1
  843. package/dist/projection/experimental/kernels/laea.d.ts +0 -1
  844. package/dist/projection/experimental/kernels/laea.d.ts.map +1 -1
  845. package/dist/projection/experimental/kernels/laea.js +33 -15
  846. package/dist/projection/experimental/kernels/laea.js.map +1 -1
  847. package/dist/projection/experimental/kernels/lcc.d.ts.map +1 -1
  848. package/dist/projection/experimental/kernels/lcc.js +2 -7
  849. package/dist/projection/experimental/kernels/lcc.js.map +1 -1
  850. package/dist/projection/experimental/kernels/mill.js +1 -1
  851. package/dist/projection/experimental/kernels/mill.js.map +1 -1
  852. package/dist/projection/experimental/kernels/moll.d.ts.map +1 -1
  853. package/dist/projection/experimental/kernels/moll.js +65 -50
  854. package/dist/projection/experimental/kernels/moll.js.map +1 -1
  855. package/dist/projection/experimental/kernels/nzmg.js +1 -1
  856. package/dist/projection/experimental/kernels/nzmg.js.map +1 -1
  857. package/dist/projection/experimental/kernels/omerc.js +1 -1
  858. package/dist/projection/experimental/kernels/omerc.js.map +1 -1
  859. package/dist/projection/experimental/kernels/ortho.d.ts +6 -5
  860. package/dist/projection/experimental/kernels/ortho.d.ts.map +1 -1
  861. package/dist/projection/experimental/kernels/ortho.js +35 -83
  862. package/dist/projection/experimental/kernels/ortho.js.map +1 -1
  863. package/dist/projection/experimental/kernels/poly.d.ts +2 -5
  864. package/dist/projection/experimental/kernels/poly.d.ts.map +1 -1
  865. package/dist/projection/experimental/kernels/poly.js +83 -31
  866. package/dist/projection/experimental/kernels/poly.js.map +1 -1
  867. package/dist/projection/experimental/kernels/qsc.d.ts.map +1 -1
  868. package/dist/projection/experimental/kernels/qsc.js +37 -52
  869. package/dist/projection/experimental/kernels/qsc.js.map +1 -1
  870. package/dist/projection/experimental/kernels/robin.js +1 -1
  871. package/dist/projection/experimental/kernels/robin.js.map +1 -1
  872. package/dist/projection/experimental/kernels/sinu.d.ts.map +1 -1
  873. package/dist/projection/experimental/kernels/sinu.js +5 -2
  874. package/dist/projection/experimental/kernels/sinu.js.map +1 -1
  875. package/dist/projection/experimental/kernels/somerc.d.ts +2 -2
  876. package/dist/projection/experimental/kernels/somerc.d.ts.map +1 -1
  877. package/dist/projection/experimental/kernels/somerc.js +35 -37
  878. package/dist/projection/experimental/kernels/somerc.js.map +1 -1
  879. package/dist/projection/experimental/kernels/stere.d.ts.map +1 -1
  880. package/dist/projection/experimental/kernels/stere.js +15 -3
  881. package/dist/projection/experimental/kernels/stere.js.map +1 -1
  882. package/dist/projection/experimental/kernels/sterea.d.ts.map +1 -1
  883. package/dist/projection/experimental/kernels/sterea.js +4 -2
  884. package/dist/projection/experimental/kernels/sterea.js.map +1 -1
  885. package/dist/projection/experimental/kernels/tmerc.js +1 -1
  886. package/dist/projection/experimental/kernels/tmerc.js.map +1 -1
  887. package/dist/projection/experimental/kernels/tpers.js +1 -1
  888. package/dist/projection/experimental/kernels/tpers.js.map +1 -1
  889. package/dist/projection/experimental/kernels/vandg.js +1 -1
  890. package/dist/projection/experimental/kernels/vandg.js.map +1 -1
  891. package/dist/projection/experimental/kinematic-helmert.js +1 -1
  892. package/dist/projection/experimental/kinematic-helmert.js.map +1 -1
  893. package/dist/projection/experimental/projections/gnom.d.ts.map +1 -1
  894. package/dist/projection/experimental/projections/gnom.js +4 -2
  895. package/dist/projection/experimental/projections/gnom.js.map +1 -1
  896. package/dist/projection/experimental/projections/laea.js +3 -3
  897. package/dist/projection/experimental/projections/laea.js.map +1 -1
  898. package/dist/projection/experimental/projections/ortho.js +4 -4
  899. package/dist/projection/experimental/projections/ortho.js.map +1 -1
  900. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts +7 -0
  901. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts.map +1 -1
  902. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js +42 -2
  903. package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js.map +1 -1
  904. package/dist/projection/index.cjs +1870 -365
  905. package/dist/projection/index.cjs.map +3 -3
  906. package/dist/rhumb-path.d.ts +28 -0
  907. package/dist/rhumb-path.d.ts.map +1 -0
  908. package/dist/rhumb-path.js +100 -0
  909. package/dist/rhumb-path.js.map +1 -0
  910. package/dist/rhumb-polygon.d.ts +11 -0
  911. package/dist/rhumb-polygon.d.ts.map +1 -0
  912. package/dist/rhumb-polygon.js +19 -0
  913. package/dist/rhumb-polygon.js.map +1 -0
  914. package/dist/subdivide-geodesic-polyline.d.ts +15 -0
  915. package/dist/subdivide-geodesic-polyline.d.ts.map +1 -0
  916. package/dist/subdivide-geodesic-polyline.js +52 -0
  917. package/dist/subdivide-geodesic-polyline.js.map +1 -0
  918. package/dist/subdivide-rhumb-polyline.d.ts +12 -0
  919. package/dist/subdivide-rhumb-polyline.d.ts.map +1 -0
  920. package/dist/subdivide-rhumb-polyline.js +82 -0
  921. package/dist/subdivide-rhumb-polyline.js.map +1 -0
  922. package/dist/triaxial/integrate.d.ts +2 -0
  923. package/dist/triaxial/integrate.d.ts.map +1 -0
  924. package/dist/triaxial/integrate.js +76 -0
  925. package/dist/triaxial/integrate.js.map +1 -0
  926. package/dist/triaxial.cjs +204 -0
  927. package/dist/triaxial.cjs.map +6 -0
  928. package/dist/triaxial.d.ts +38 -0
  929. package/dist/triaxial.d.ts.map +1 -0
  930. package/dist/triaxial.js +121 -0
  931. package/dist/triaxial.js.map +1 -0
  932. package/dist/vendor/geographiclib-geodesic/runtime.d.ts +9 -0
  933. package/dist/vendor/geographiclib-geodesic/runtime.d.ts.map +1 -0
  934. package/dist/vendor/geographiclib-geodesic/runtime.js +2244 -0
  935. package/dist/vendor/geographiclib-geodesic/runtime.js.map +1 -0
  936. package/dist/wkb/index.cjs +7 -2
  937. package/dist/wkb/index.cjs.map +1 -1
  938. package/dist/wkb/wkb-builder.d.ts.map +1 -1
  939. package/dist/wkb/wkb-builder.js +9 -2
  940. package/dist/wkb/wkb-builder.js.map +1 -1
  941. package/package.json +30 -6
  942. package/projection/THIRD-PARTY-NOTICES.md +58 -11
  943. package/src/constants.ts +1 -1
  944. package/src/discontinuous/AIR-OCEAN-LICENSE.txt +26 -0
  945. package/src/discontinuous/D3-LICENSE.txt +37 -0
  946. package/src/discontinuous/PETROFF-LICENSE.txt +55 -0
  947. package/src/discontinuous/PROJ-LICENSE.txt +34 -0
  948. package/src/discontinuous/air-ocean-mesh.ts +86 -0
  949. package/src/discontinuous/albers-usa.ts +181 -0
  950. package/src/discontinuous/cap-map.ts +406 -0
  951. package/src/discontinuous/elastic/README.md +20 -0
  952. package/src/discontinuous/elastic/UNLICENSE.txt +24 -0
  953. package/src/discontinuous/elastic/data.ts +86 -0
  954. package/src/discontinuous/elastic/elasticI.ts +5238 -0
  955. package/src/discontinuous/elastic/elasticII.ts +18167 -0
  956. package/src/discontinuous/elastic/elasticIII.ts +29571 -0
  957. package/src/discontinuous/elastic/geometry.ts +172 -0
  958. package/src/discontinuous/elastic/grid.ts +194 -0
  959. package/src/discontinuous/elastic/map.ts +317 -0
  960. package/src/discontinuous/gray-fuller.ts +38 -0
  961. package/src/discontinuous/gringorten-kernel.ts +160 -0
  962. package/src/discontinuous/healpix.ts +61 -0
  963. package/src/discontinuous/layout.ts +177 -0
  964. package/src/discontinuous/map-engine.ts +528 -0
  965. package/src/discontinuous/map-layout.ts +605 -0
  966. package/src/discontinuous/map-transition.ts +339 -0
  967. package/src/discontinuous/math.ts +67 -0
  968. package/src/discontinuous/mercator-map.ts +155 -0
  969. package/src/discontinuous/myriahedral/graticule.ts +40 -0
  970. package/src/discontinuous/myriahedral/mesh.ts +138 -0
  971. package/src/discontinuous/myriahedral/unfold.ts +208 -0
  972. package/src/discontinuous/myriahedral.ts +285 -0
  973. package/src/discontinuous/petroff.ts +178 -0
  974. package/src/discontinuous/polyhedral.ts +138 -0
  975. package/src/discontinuous/prepare-features.ts +239 -0
  976. package/src/discontinuous/presets.ts +450 -0
  977. package/src/discontinuous/projection-catalog.ts +132 -0
  978. package/src/discontinuous/quincuncial-kernel.ts +173 -0
  979. package/src/discontinuous/quincuncial-star.ts +328 -0
  980. package/src/discontinuous/regional-map.ts +228 -0
  981. package/src/discontinuous/retroazimuthal-map.ts +52 -0
  982. package/src/discontinuous/rotated-map.ts +86 -0
  983. package/src/discontinuous/snyder-mesh.ts +88 -0
  984. package/src/discontinuous/snyder.ts +171 -0
  985. package/src/discontinuous/spherical-clip/D3-GEO-LICENSE.txt +34 -0
  986. package/src/discontinuous/spherical-clip/README.md +16 -0
  987. package/src/discontinuous/spherical-clip/cartesian.js +43 -0
  988. package/src/discontinuous/spherical-clip/circle.js +35 -0
  989. package/src/discontinuous/spherical-clip/clip-buffer.js +29 -0
  990. package/src/discontinuous/spherical-clip/clip-circle.js +197 -0
  991. package/src/discontinuous/spherical-clip/clip-index.js +140 -0
  992. package/src/discontinuous/spherical-clip/clip-rejoin.js +111 -0
  993. package/src/discontinuous/spherical-clip/helpers.js +20 -0
  994. package/src/discontinuous/spherical-clip/math.js +45 -0
  995. package/src/discontinuous/spherical-clip/noop.js +6 -0
  996. package/src/discontinuous/spherical-clip/pointEqual.js +10 -0
  997. package/src/discontinuous/spherical-clip/polygonContains.js +96 -0
  998. package/src/discontinuous/world-composite-kernels.ts +30 -0
  999. package/src/discontinuous/world-kernels/INTEGRATE-LICENSE.txt +21 -0
  1000. package/src/discontinuous/world-kernels/README.md +24 -0
  1001. package/src/discontinuous/world-kernels/airy.js +43 -0
  1002. package/src/discontinuous/world-kernels/aitoff.js +48 -0
  1003. package/src/discontinuous/world-kernels/armadillo.js +51 -0
  1004. package/src/discontinuous/world-kernels/august.js +36 -0
  1005. package/src/discontinuous/world-kernels/baker.js +50 -0
  1006. package/src/discontinuous/world-kernels/bertin.js +41 -0
  1007. package/src/discontinuous/world-kernels/boggs.js +32 -0
  1008. package/src/discontinuous/world-kernels/bonne.js +27 -0
  1009. package/src/discontinuous/world-kernels/bottomley.js +25 -0
  1010. package/src/discontinuous/world-kernels/bromley.js +10 -0
  1011. package/src/discontinuous/world-kernels/chamberlin.js +97 -0
  1012. package/src/discontinuous/world-kernels/collignon.js +17 -0
  1013. package/src/discontinuous/world-kernels/craig.js +33 -0
  1014. package/src/discontinuous/world-kernels/craster.js +18 -0
  1015. package/src/discontinuous/world-kernels/cylindricalEqualArea.js +21 -0
  1016. package/src/discontinuous/world-kernels/cylindricalStereographic.js +21 -0
  1017. package/src/discontinuous/world-kernels/d3-geo-raw.js +26 -0
  1018. package/src/discontinuous/world-kernels/eckert1.js +18 -0
  1019. package/src/discontinuous/world-kernels/eckert2.js +17 -0
  1020. package/src/discontinuous/world-kernels/eckert3.js +17 -0
  1021. package/src/discontinuous/world-kernels/eckert4.js +24 -0
  1022. package/src/discontinuous/world-kernels/eckert5.js +17 -0
  1023. package/src/discontinuous/world-kernels/eckert6.js +22 -0
  1024. package/src/discontinuous/world-kernels/eisenlohr.js +88 -0
  1025. package/src/discontinuous/world-kernels/fahey.js +19 -0
  1026. package/src/discontinuous/world-kernels/foucaut.js +20 -0
  1027. package/src/discontinuous/world-kernels/foucautSinusoidal.js +38 -0
  1028. package/src/discontinuous/world-kernels/ginzburg4.js +17 -0
  1029. package/src/discontinuous/world-kernels/ginzburg5.js +17 -0
  1030. package/src/discontinuous/world-kernels/ginzburg6.js +19 -0
  1031. package/src/discontinuous/world-kernels/ginzburg8.js +34 -0
  1032. package/src/discontinuous/world-kernels/ginzburg9.js +17 -0
  1033. package/src/discontinuous/world-kernels/ginzburgPolyconic.js +64 -0
  1034. package/src/discontinuous/world-kernels/hammer.js +37 -0
  1035. package/src/discontinuous/world-kernels/hammerRetroazimuthal.js +63 -0
  1036. package/src/discontinuous/world-kernels/hill.js +57 -0
  1037. package/src/discontinuous/world-kernels/homolosine.js +24 -0
  1038. package/src/discontinuous/world-kernels/hufnagel.js +68 -0
  1039. package/src/discontinuous/world-kernels/hyperelliptical.js +56 -0
  1040. package/src/discontinuous/world-kernels/integrate.js +99 -0
  1041. package/src/discontinuous/world-kernels/kavrayskiy7.js +15 -0
  1042. package/src/discontinuous/world-kernels/lagrange.js +32 -0
  1043. package/src/discontinuous/world-kernels/larrivee.js +43 -0
  1044. package/src/discontinuous/world-kernels/laskowski.js +50 -0
  1045. package/src/discontinuous/world-kernels/littrow.js +19 -0
  1046. package/src/discontinuous/world-kernels/loximuthal.js +38 -0
  1047. package/src/discontinuous/world-kernels/math.js +98 -0
  1048. package/src/discontinuous/world-kernels/miller.js +15 -0
  1049. package/src/discontinuous/world-kernels/modifiedStereographic.js +112 -0
  1050. package/src/discontinuous/world-kernels/mollweide.js +30 -0
  1051. package/src/discontinuous/world-kernels/mtFlatPolarParabolic.js +23 -0
  1052. package/src/discontinuous/world-kernels/mtFlatPolarQuartic.js +29 -0
  1053. package/src/discontinuous/world-kernels/mtFlatPolarSinusoidal.js +25 -0
  1054. package/src/discontinuous/world-kernels/naturalEarth2.js +46 -0
  1055. package/src/discontinuous/world-kernels/nellHammer.js +20 -0
  1056. package/src/discontinuous/world-kernels/newton.js +77 -0
  1057. package/src/discontinuous/world-kernels/nicolosi.js +60 -0
  1058. package/src/discontinuous/world-kernels/patterson.js +45 -0
  1059. package/src/discontinuous/world-kernels/polyconic.js +36 -0
  1060. package/src/discontinuous/world-kernels/rectangularPolyconic.js +41 -0
  1061. package/src/discontinuous/world-kernels/robinson.js +88 -0
  1062. package/src/discontinuous/world-kernels/satellite.js +44 -0
  1063. package/src/discontinuous/world-kernels/sinuMollweide.js +24 -0
  1064. package/src/discontinuous/world-kernels/sinusoidal.js +15 -0
  1065. package/src/discontinuous/world-kernels/times.js +19 -0
  1066. package/src/discontinuous/world-kernels/twoPointEquidistant.js +41 -0
  1067. package/src/discontinuous/world-kernels/vanDerGrinten.js +48 -0
  1068. package/src/discontinuous/world-kernels/vanDerGrinten2.js +32 -0
  1069. package/src/discontinuous/world-kernels/vanDerGrinten3.js +24 -0
  1070. package/src/discontinuous/world-kernels/vanDerGrinten4.js +70 -0
  1071. package/src/discontinuous/world-kernels/wagner.js +61 -0
  1072. package/src/discontinuous/world-kernels/wagner4.js +13 -0
  1073. package/src/discontinuous/world-kernels/wagner6.js +15 -0
  1074. package/src/discontinuous/world-kernels/wiechel.js +25 -0
  1075. package/src/discontinuous/world-kernels/winkel3.js +45 -0
  1076. package/src/discontinuous/world-kernels.ts +249 -0
  1077. package/src/discontinuous/world-map.ts +257 -0
  1078. package/src/discontinuous.ts +134 -0
  1079. package/src/elastic.ts +7 -0
  1080. package/src/ellipsoid-geodesic.ts +159 -0
  1081. package/src/ellipsoid-helpers/ellipsoid-transform.ts +17 -5
  1082. package/src/ellipsoid-helpers/exact-nearest-surface.ts +118 -0
  1083. package/src/ellipsoid-helpers/intersection-bounds.ts +85 -0
  1084. package/src/ellipsoid-helpers/nearest-surface.ts +157 -0
  1085. package/src/ellipsoid-helpers/rhumb-pole-distance.ts +76 -0
  1086. package/src/ellipsoid-helpers/scale-to-geodetic-surface.ts +14 -107
  1087. package/src/ellipsoid-helpers/surface-polygon.ts +210 -0
  1088. package/src/ellipsoid-helpers/tangent-plane-numerics.ts +124 -0
  1089. package/src/ellipsoid-metrics.ts +225 -0
  1090. package/src/ellipsoid-rhumb.ts +404 -0
  1091. package/src/ellipsoid-tangent-plane.ts +232 -36
  1092. package/src/ellipsoid-transforms.ts +61 -0
  1093. package/src/ellipsoid.ts +210 -126
  1094. package/src/entries/ellipsoid.ts +36 -0
  1095. package/src/expressions.ts +2 -1
  1096. package/src/geoarrow/codecs.ts +3 -9
  1097. package/src/geoarrow/index.ts +3 -1
  1098. package/src/geoarrow/types.ts +40 -0
  1099. package/src/geodesic-exact/area.ts +70 -0
  1100. package/src/geodesic-exact/inverse-engine.ts +166 -0
  1101. package/src/geodesic-exact/polygon.ts +36 -0
  1102. package/src/geodesic-exact/quadrature.ts +60 -0
  1103. package/src/geodesic-exact.ts +290 -0
  1104. package/src/geodesic-intersections.ts +598 -0
  1105. package/src/geodesic-path.ts +128 -0
  1106. package/src/geodesic-polygon.ts +19 -0
  1107. package/src/geographic-seams/edge.ts +406 -0
  1108. package/src/geographic-seams/polygon.ts +478 -0
  1109. package/src/geographic-seams/types.ts +67 -0
  1110. package/src/geographic-seams.ts +81 -0
  1111. package/src/globe.ts +17 -0
  1112. package/src/lng-lat-rectangle.ts +1 -1
  1113. package/src/local-reference-frame.ts +320 -0
  1114. package/src/make-obb-from-region.ts +1 -1
  1115. package/src/projection/experimental/authalic-latitude.ts +49 -0
  1116. package/src/projection/experimental/common/adjust_lat.ts +2 -2
  1117. package/src/projection/experimental/common/adjust_lon.ts +1 -1
  1118. package/src/projection/experimental/common/asinhy.ts +1 -1
  1119. package/src/projection/experimental/common/asinz.ts +1 -1
  1120. package/src/projection/experimental/common/authlat.ts +1 -1
  1121. package/src/projection/experimental/common/authset.ts +1 -1
  1122. package/src/projection/experimental/common/clens.ts +1 -1
  1123. package/src/projection/experimental/common/clens_cmplx.ts +1 -1
  1124. package/src/projection/experimental/common/constants.ts +1 -1
  1125. package/src/projection/experimental/common/cosh.ts +1 -1
  1126. package/src/projection/experimental/common/e0fn.ts +1 -1
  1127. package/src/projection/experimental/common/e1fn.ts +1 -1
  1128. package/src/projection/experimental/common/e2fn.ts +1 -1
  1129. package/src/projection/experimental/common/e3fn.ts +1 -1
  1130. package/src/projection/experimental/common/fL.ts +1 -1
  1131. package/src/projection/experimental/common/gN.ts +1 -1
  1132. package/src/projection/experimental/common/gatg.ts +1 -1
  1133. package/src/projection/experimental/common/hypot.ts +1 -1
  1134. package/src/projection/experimental/common/imlfn.ts +1 -1
  1135. package/src/projection/experimental/common/invlatiso.ts +1 -1
  1136. package/src/projection/experimental/common/iqsfnz.ts +1 -1
  1137. package/src/projection/experimental/common/latiso.ts +1 -1
  1138. package/src/projection/experimental/common/log1py.ts +1 -1
  1139. package/src/projection/experimental/common/mlfn.ts +1 -1
  1140. package/src/projection/experimental/common/msfnz.ts +1 -1
  1141. package/src/projection/experimental/common/phi2z.ts +1 -1
  1142. package/src/projection/experimental/common/pj_enfn.ts +1 -1
  1143. package/src/projection/experimental/common/pj_inv_mlfn.ts +1 -1
  1144. package/src/projection/experimental/common/pj_mlfn.ts +1 -1
  1145. package/src/projection/experimental/common/qsfnz.ts +1 -1
  1146. package/src/projection/experimental/common/sign.ts +1 -1
  1147. package/src/projection/experimental/common/sinh.ts +1 -1
  1148. package/src/projection/experimental/common/srat.ts +1 -1
  1149. package/src/projection/experimental/common/tsfnz.ts +8 -7
  1150. package/src/projection/experimental/common/vincenty.ts +1 -1
  1151. package/src/projection/experimental/crs/datum-table.ts +1 -1
  1152. package/src/projection/experimental/crs/ellipsoid-table.ts +1 -1
  1153. package/src/projection/experimental/crs/primemeridian-table.ts +1 -1
  1154. package/src/projection/experimental/crs/structured.ts +1 -1
  1155. package/src/projection/experimental/crs/wkt.ts +1 -1
  1156. package/src/projection/experimental/datum.ts +1 -1
  1157. package/src/projection/experimental/ellipsoidal-gnomonic.ts +83 -0
  1158. package/src/projection/experimental/exact-helmert.ts +1 -1
  1159. package/src/projection/experimental/grids/geotiff.ts +1 -1
  1160. package/src/projection/experimental/grids/grid.ts +1 -1
  1161. package/src/projection/experimental/grids/ntv2.ts +1 -1
  1162. package/src/projection/experimental/helmert-flat.ts +1 -1
  1163. package/src/projection/experimental/inverse-spherical-latitude.ts +19 -0
  1164. package/src/projection/experimental/kernels/aea.ts +10 -31
  1165. package/src/projection/experimental/kernels/aeqd.ts +3 -3
  1166. package/src/projection/experimental/kernels/bonne.ts +1 -1
  1167. package/src/projection/experimental/kernels/cass.ts +1 -1
  1168. package/src/projection/experimental/kernels/cea.ts +1 -1
  1169. package/src/projection/experimental/kernels/eck6.ts +1 -1
  1170. package/src/projection/experimental/kernels/eqdc.ts +1 -1
  1171. package/src/projection/experimental/kernels/eqearth.ts +12 -2
  1172. package/src/projection/experimental/kernels/equi.ts +3 -1
  1173. package/src/projection/experimental/kernels/etmerc.ts +1 -1
  1174. package/src/projection/experimental/kernels/gauss.ts +1 -1
  1175. package/src/projection/experimental/kernels/geos.ts +1 -1
  1176. package/src/projection/experimental/kernels/gnom.ts +11 -1
  1177. package/src/projection/experimental/kernels/gstmerc.ts +1 -1
  1178. package/src/projection/experimental/kernels/krovak.ts +2 -2
  1179. package/src/projection/experimental/kernels/laea.ts +39 -16
  1180. package/src/projection/experimental/kernels/lcc.ts +2 -8
  1181. package/src/projection/experimental/kernels/mill.ts +1 -1
  1182. package/src/projection/experimental/kernels/moll.ts +62 -58
  1183. package/src/projection/experimental/kernels/nzmg.ts +1 -1
  1184. package/src/projection/experimental/kernels/omerc.ts +1 -1
  1185. package/src/projection/experimental/kernels/ortho.ts +38 -92
  1186. package/src/projection/experimental/kernels/poly.ts +97 -36
  1187. package/src/projection/experimental/kernels/qsc.ts +40 -50
  1188. package/src/projection/experimental/kernels/robin.ts +1 -1
  1189. package/src/projection/experimental/kernels/sinu.ts +4 -2
  1190. package/src/projection/experimental/kernels/somerc.ts +45 -55
  1191. package/src/projection/experimental/kernels/stere.ts +31 -3
  1192. package/src/projection/experimental/kernels/sterea.ts +4 -2
  1193. package/src/projection/experimental/kernels/tmerc.ts +1 -1
  1194. package/src/projection/experimental/kernels/tpers.ts +1 -1
  1195. package/src/projection/experimental/kernels/vandg.ts +1 -1
  1196. package/src/projection/experimental/kinematic-helmert-flat.ts +1 -1
  1197. package/src/projection/experimental/kinematic-helmert.ts +1 -1
  1198. package/src/projection/experimental/projection-pipeline.ts +1 -1
  1199. package/src/projection/experimental/projections/gnom.ts +22 -5
  1200. package/src/projection/experimental/projections/laea.ts +3 -3
  1201. package/src/projection/experimental/projections/ob-tran.ts +1 -1
  1202. package/src/projection/experimental/projections/ortho.ts +4 -4
  1203. package/src/projection/experimental/rendering-profile/azimuthal-rendering-bounds.ts +72 -2
  1204. package/src/rhumb-path.ts +128 -0
  1205. package/src/rhumb-polygon.ts +24 -0
  1206. package/src/subdivide-geodesic-polyline.ts +74 -0
  1207. package/src/subdivide-rhumb-polyline.ts +108 -0
  1208. package/src/triaxial/integrate.ts +82 -0
  1209. package/src/triaxial.ts +172 -0
  1210. package/src/type-utils.ts +1 -1
  1211. package/src/vendor/geographiclib-geodesic/README.md +21 -0
  1212. package/src/vendor/geographiclib-geodesic/runtime.js +2338 -0
  1213. package/src/wkb/wkb-builder.ts +11 -2
@@ -0,0 +1,2244 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // SPDX-FileCopyrightText: Copyright (c) 2011-2022 Charles Karney
4
+ // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
5
+ // SPDX-FileComment: Original math.gl follow-up evaluates short-edge cosine-series differences without cancellation; qualified by independent Decimal small-area controls. GeographicLib geodesic Math.js, Geodesic.js and GeodesicLine.js, pinned at 9c4036d6242aa997e08e43a20df789e2007fbe6f. Combined into an ESM module; version template fields set to 2.2.0. See ../../../GEOGRAPHICLIB-LICENSE.txt.
6
+ /*
7
+ * Math.js
8
+ * Transcription of Math.hpp, Constants.hpp, and Accumulator.hpp into
9
+ * JavaScript.
10
+ *
11
+ * Copyright (c) Charles Karney (2011-2021) <karney@alum.mit.edu> and licensed
12
+ * under the MIT/X11 License. For more information, see
13
+ * https://geographiclib.sourceforge.io/
14
+ */
15
+ /**
16
+ * @namespace geodesic
17
+ * @description The parent namespace for the following modules:
18
+ * - {@link module:geodesic/Geodesic geodesic/Geodesic} The main
19
+ * engine for solving geodesic problems via the
20
+ * {@link module:geodesic/Geodesic.Geodesic Geodesic} class.
21
+ * - {@link module:geodesic/GeodesicLine geodesic/GeodesicLine}
22
+ * computes points along a single geodesic line via the
23
+ * {@link module:geodesic/GeodesicLine.GeodesicLine GeodesicLine}
24
+ * class.
25
+ * - {@link module:geodesic/PolygonArea geodesic/PolygonArea}
26
+ * computes the area of a geodesic polygon via the
27
+ * {@link module:geodesic/PolygonArea.PolygonArea PolygonArea}
28
+ * class.
29
+ * - {@link module:geodesic/Constants geodesic/Constants} defines
30
+ * constants specifying the version numbers and the parameters for the WGS84
31
+ * ellipsoid.
32
+ *
33
+ * The following modules are used internally by the package:
34
+ * - {@link module:geodesic/Math geodesic/Math} defines various
35
+ * mathematical functions.
36
+ * - {@link module:geodesic/Accumulator geodesic/Accumulator}
37
+ * interally used by
38
+ * {@link module:geodesic/PolygonArea.PolygonArea PolygonArea} (via the
39
+ * {@link module:geodesic/Accumulator.Accumulator Accumulator} class)
40
+ * for summing the contributions to the area of a polygon.
41
+ */
42
+ // To allow swap via [y, x] = [x, y]
43
+ /* jshint esversion: 6 */
44
+ var geodesic = {};
45
+ geodesic.Constants = {};
46
+ geodesic.Math = {};
47
+ geodesic.Accumulator = {};
48
+ (function (
49
+ /**
50
+ * @exports geodesic/Constants
51
+ * @description Define constants defining the version and WGS84 parameters.
52
+ */
53
+ c) {
54
+ "use strict";
55
+ /**
56
+ * @constant
57
+ * @summary WGS84 parameters.
58
+ * @property {number} a the equatorial radius (meters).
59
+ * @property {number} f the flattening.
60
+ */
61
+ c.WGS84 = { a: 6378137, f: 1 / 298.257223563 };
62
+ /**
63
+ * @constant
64
+ * @summary an array of version numbers.
65
+ * @property {number} major the major version number.
66
+ * @property {number} minor the minor version number.
67
+ * @property {number} patch the patch number.
68
+ */
69
+ c.version = { major: 2,
70
+ minor: 2,
71
+ patch: 0 };
72
+ /**
73
+ * @constant
74
+ * @summary version string
75
+ */
76
+ c.version_string = "2.2.0";
77
+ })(geodesic.Constants);
78
+ (function (
79
+ /**
80
+ * @exports geodesic/Math
81
+ * @description Some useful mathematical constants and functions (mainly for
82
+ * internal use).
83
+ */
84
+ m) {
85
+ "use strict";
86
+ /**
87
+ * @summary The number of digits of precision in floating-point numbers.
88
+ * @constant {number}
89
+ */
90
+ m.digits = 53;
91
+ /**
92
+ * @summary The machine epsilon.
93
+ * @constant {number}
94
+ */
95
+ m.epsilon = Math.pow(0.5, m.digits - 1);
96
+ /**
97
+ * @summary The factor to convert degrees to radians.
98
+ * @constant {number}
99
+ */
100
+ m.degree = Math.PI / 180;
101
+ /**
102
+ * @summary Square a number.
103
+ * @param {number} x the number.
104
+ * @return {number} the square.
105
+ */
106
+ m.sq = function (x) { return x * x; };
107
+ /**
108
+ * @summary The hypotenuse function.
109
+ * @param {number} x the first side.
110
+ * @param {number} y the second side.
111
+ * @return {number} the hypotenuse.
112
+ */
113
+ m.hypot = function (x, y) {
114
+ // Built in Math.hypot give incorrect results from GeodSolve92.
115
+ return Math.sqrt(x * x + y * y);
116
+ };
117
+ /**
118
+ * @summary Cube root function.
119
+ * @param {number} x the argument.
120
+ * @return {number} the real cube root.
121
+ */
122
+ m.cbrt = Math.cbrt || function (x) {
123
+ var y = Math.pow(Math.abs(x), 1 / 3);
124
+ return x > 0 ? y : (x < 0 ? -y : x);
125
+ };
126
+ /**
127
+ * @summary The log1p function.
128
+ * @param {number} x the argument.
129
+ * @return {number} log(1 + x).
130
+ */
131
+ m.log1p = Math.log1p || function (x) {
132
+ var y = 1 + x, z = y - 1;
133
+ // Here's the explanation for this magic: y = 1 + z, exactly, and z
134
+ // approx x, thus log(y)/z (which is nearly constant near z = 0) returns
135
+ // a good approximation to the true log(1 + x)/x. The multiplication x *
136
+ // (log(y)/z) introduces little additional error.
137
+ return z === 0 ? x : x * Math.log(y) / z;
138
+ };
139
+ /**
140
+ * @summary Inverse hyperbolic tangent.
141
+ * @param {number} x the argument.
142
+ * @return {number} tanh<sup>&minus;1</sup> x.
143
+ */
144
+ m.atanh = Math.atanh || function (x) {
145
+ var y = Math.abs(x); // Enforce odd parity
146
+ y = m.log1p(2 * y / (1 - y)) / 2;
147
+ return x > 0 ? y : (x < 0 ? -y : x);
148
+ };
149
+ /**
150
+ * @summary Copy the sign.
151
+ * @param {number} x gives the magitude of the result.
152
+ * @param {number} y gives the sign of the result.
153
+ * @return {number} value with the magnitude of x and with the sign of y.
154
+ */
155
+ m.copysign = function (x, y) {
156
+ return Math.abs(x) * (y < 0 || (y === 0 && 1 / y < 0) ? -1 : 1);
157
+ };
158
+ /**
159
+ * @summary An error-free sum.
160
+ * @param {number} u
161
+ * @param {number} v
162
+ * @return {object} sum with sum.s = round(u + v) and sum.t is u + v &minus;
163
+ * round(u + v)
164
+ */
165
+ m.sum = function (u, v) {
166
+ var s = u + v, up = s - v, vpp = s - up, t;
167
+ up -= u;
168
+ vpp -= v;
169
+ // if s = 0, then t = 0 and give t the same sign as s
170
+ t = s ? 0 - (up + vpp) : s;
171
+ // u + v = s + t
172
+ // = round(u + v) + t
173
+ return { s: s, t: t };
174
+ };
175
+ /**
176
+ * @summary Evaluate a polynomial.
177
+ * @param {integer} N the order of the polynomial.
178
+ * @param {array} p the coefficient array (of size N + 1) (leading
179
+ * order coefficient first)
180
+ * @param {number} x the variable.
181
+ * @return {number} the value of the polynomial.
182
+ */
183
+ m.polyval = function (N, p, s, x) {
184
+ var y = N < 0 ? 0 : p[s++];
185
+ while (--N >= 0)
186
+ y = y * x + p[s++];
187
+ return y;
188
+ };
189
+ /**
190
+ * @summary Coarsen a value close to zero.
191
+ * @param {number} x
192
+ * @return {number} the coarsened value.
193
+ */
194
+ m.AngRound = function (x) {
195
+ // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^57 for
196
+ // reals = 0.7 pm on the earth if x is an angle in degrees. (This is about
197
+ // 1000 times more resolution than we get with angles around 90 degrees.)
198
+ // We use this to avoid having to deal with near singular cases when x is
199
+ // non-zero but tiny (e.g., 1.0e-200). This converts -0 to +0; however
200
+ // tiny negative numbers get converted to -0.
201
+ var z = 1 / 16, y = Math.abs(x);
202
+ // The compiler mustn't "simplify" z - (z - y) to y
203
+ y = y < z ? z - (z - y) : y;
204
+ return m.copysign(y, x);
205
+ };
206
+ /**
207
+ * @summary The remainder function.
208
+ * @param {number} x the numerator of the division
209
+ * @param {number} y the denominator of the division
210
+ * @return {number} the remainder in the range [&minus;y/2, y/2].
211
+ * <p>
212
+ * The range of x is unrestricted; y must be positive.
213
+ */
214
+ m.remainder = function (x, y) {
215
+ x %= y;
216
+ return x < -y / 2 ? x + y : (x < y / 2 ? x : x - y);
217
+ };
218
+ /**
219
+ * @summary Normalize an angle.
220
+ * @param {number} x the angle in degrees.
221
+ * @return {number} the angle reduced to the range [&minus;180&deg;,
222
+ * 180&deg;].
223
+ *
224
+ * The range of x is unrestricted. If the result is &plusmn;0&deg; or
225
+ * &plusmn;180&deg; then the sign is the sign of \e x.
226
+ */
227
+ m.AngNormalize = function (x) {
228
+ // Place angle in [-180, 180].
229
+ var y = m.remainder(x, 360);
230
+ return Math.abs(y) === 180 ? m.copysign(180, x) : y;
231
+ };
232
+ /**
233
+ * @summary Normalize a latitude.
234
+ * @param {number} x the angle in degrees.
235
+ * @return {number} x if it is in the range [&minus;90&deg;, 90&deg;],
236
+ * otherwise return NaN.
237
+ */
238
+ m.LatFix = function (x) {
239
+ // Replace angle with NaN if outside [-90, 90].
240
+ return Math.abs(x) > 90 ? NaN : x;
241
+ };
242
+ /**
243
+ * @summary The exact difference of two angles reduced to [&minus;180&deg;,
244
+ * 180&deg;]
245
+ * @param {number} x the first angle in degrees.
246
+ * @param {number} y the second angle in degrees.
247
+ * @return {object} diff the exact difference, diff.d + diff.e = y &minus; x
248
+ * mod 360&deg;.
249
+ *
250
+ * This computes z = y &minus; x exactly, reduced to
251
+ * [&minus;180&deg;, 180&deg;]; and then sets z = d + e where d
252
+ * is the nearest representable number to z and e is the truncation
253
+ * error. If z = &plusmn;0&deg; or &plusmn;180&deg;, then the sign of
254
+ * d is given by the sign of y &minus; x. The maximum absolute
255
+ * value of e is 2<sup>&minus;26</sup> (for doubles).
256
+ */
257
+ m.AngDiff = function (x, y) {
258
+ // Compute y - x and reduce to [-180,180] accurately.
259
+ var r = m.sum(m.remainder(-x, 360), m.remainder(y, 360)), d, e;
260
+ r = m.sum(m.remainder(r.s, 360), r.t);
261
+ d = r.s;
262
+ e = r.t;
263
+ // Fix the sign if d = -180, 0, 180.
264
+ if (d === 0 || Math.abs(d) === 180)
265
+ // If e == 0, take sign from y - x
266
+ // else (e != 0, implies d = +/-180), d and e must have opposite signs
267
+ d = m.copysign(d, e === 0 ? y - x : -e);
268
+ return { d: d, e: e };
269
+ };
270
+ /**
271
+ * @summary Evaluate the sine and cosine function with the argument in
272
+ * degrees
273
+ * @param {number} x in degrees.
274
+ * @return {object} r with r.s = sin(x) and r.c = cos(x).
275
+ */
276
+ m.sincosd = function (x) {
277
+ // In order to minimize round-off errors, this function exactly reduces
278
+ // the argument to the range [-45, 45] before converting it to radians.
279
+ var d, r, q, s, c, sinx, cosx;
280
+ d = x % 360;
281
+ q = Math.round(d / 90); // If d is NaN this returns NaN
282
+ d -= 90 * q;
283
+ // now abs(d) <= 45
284
+ r = d * this.degree;
285
+ // Possibly could call the gnu extension sincos
286
+ s = Math.sin(r);
287
+ c = Math.cos(r);
288
+ if (Math.abs(d) === 45) {
289
+ c = Math.sqrt(0.5);
290
+ s = m.copysign(c, r);
291
+ }
292
+ else if (Math.abs(d) === 30) {
293
+ c = Math.sqrt(0.75);
294
+ s = m.copysign(0.5, r);
295
+ }
296
+ switch (q & 3) {
297
+ case 0:
298
+ sinx = s;
299
+ cosx = c;
300
+ break;
301
+ case 1:
302
+ sinx = c;
303
+ cosx = -s;
304
+ break;
305
+ case 2:
306
+ sinx = -s;
307
+ cosx = -c;
308
+ break;
309
+ default:
310
+ sinx = -c;
311
+ cosx = s;
312
+ break; // case 3
313
+ }
314
+ cosx += 0;
315
+ if (sinx === 0)
316
+ sinx = m.copysign(sinx, x);
317
+ return { s: sinx, c: cosx };
318
+ };
319
+ /**
320
+ * @summary Evaluate the sine and cosine with reduced argument plus correction
321
+ *
322
+ * @param {number} x reduced angle in degrees.
323
+ * @param {number} t correction in degrees.
324
+ * @return {object} r with r.s = sin(x + t) and r.c = cos(x + t).
325
+ */
326
+ m.sincosde = function (x, t) {
327
+ // In order to minimize round-off errors, this function exactly reduces
328
+ // the argument to the range [-45, 45] before converting it to radians.
329
+ var d, r, q, s, c, sinx, cosx;
330
+ d = x % 360;
331
+ q = Math.round(d / 90); // If d is NaN this returns NaN
332
+ d = m.AngRound((d - 90 * q) + t);
333
+ // now abs(d) <= 45
334
+ r = d * this.degree;
335
+ // Possibly could call the gnu extension sincos
336
+ s = Math.sin(r);
337
+ c = Math.cos(r);
338
+ if (Math.abs(d) === 45) {
339
+ c = Math.sqrt(0.5);
340
+ s = m.copysign(c, r);
341
+ }
342
+ else if (Math.abs(d) === 30) {
343
+ c = Math.sqrt(0.75);
344
+ s = m.copysign(0.5, r);
345
+ }
346
+ switch (q & 3) {
347
+ case 0:
348
+ sinx = s;
349
+ cosx = c;
350
+ break;
351
+ case 1:
352
+ sinx = c;
353
+ cosx = -s;
354
+ break;
355
+ case 2:
356
+ sinx = -s;
357
+ cosx = -c;
358
+ break;
359
+ default:
360
+ sinx = -c;
361
+ cosx = s;
362
+ break; // case 3
363
+ }
364
+ cosx += 0;
365
+ if (sinx === 0)
366
+ sinx = m.copysign(sinx, x + t);
367
+ return { s: sinx, c: cosx };
368
+ };
369
+ /**
370
+ * @summary Evaluate the atan2 function with the result in degrees
371
+ * @param {number} y
372
+ * @param {number} x
373
+ * @return atan2(y, x) in degrees, in the range [&minus;180&deg;
374
+ * 180&deg;].
375
+ */
376
+ m.atan2d = function (y, x) {
377
+ // In order to minimize round-off errors, this function rearranges the
378
+ // arguments so that result of atan2 is in the range [-pi/4, pi/4] before
379
+ // converting it to degrees and mapping the result to the correct
380
+ // quadrant.
381
+ var q = 0, ang;
382
+ if (Math.abs(y) > Math.abs(x)) {
383
+ [y, x] = [x, y];
384
+ q = 2;
385
+ } // swap(x, y)
386
+ if (m.copysign(1, x) < 0) {
387
+ x = -x;
388
+ ++q;
389
+ }
390
+ // here x >= 0 and x >= abs(y), so angle is in [-pi/4, pi/4]
391
+ ang = Math.atan2(y, x) / this.degree;
392
+ switch (q) {
393
+ // Note that atan2d(-0.0, 1.0) will return -0. However, we expect that
394
+ // atan2d will not be called with y = -0. If need be, include
395
+ //
396
+ // case 0: ang = 0 + ang; break;
397
+ //
398
+ // and handle mpfr as in AngRound.
399
+ case 1:
400
+ ang = m.copysign(180, y) - ang;
401
+ break;
402
+ case 2:
403
+ ang = 90 - ang;
404
+ break;
405
+ case 3:
406
+ ang = -90 + ang;
407
+ break;
408
+ default: break;
409
+ }
410
+ return ang;
411
+ };
412
+ })(geodesic.Math);
413
+ (function (
414
+ /**
415
+ * @exports geodesic/Accumulator
416
+ * @description Accurate summation via the
417
+ * {@link module:geodesic/Accumulator.Accumulator Accumulator} class
418
+ * (mainly for internal use).
419
+ */
420
+ a, m) {
421
+ "use strict";
422
+ /**
423
+ * @class
424
+ * @summary Accurate summation of many numbers.
425
+ * @classdesc This allows many numbers to be added together with twice the
426
+ * normal precision. In the documentation of the member functions, sum
427
+ * stands for the value currently held in the accumulator.
428
+ * @param {number | Accumulator} [y = 0] set sum = y.
429
+ */
430
+ a.Accumulator = function (y) {
431
+ this.Set(y);
432
+ };
433
+ /**
434
+ * @summary Set the accumulator to a number.
435
+ * @param {number | Accumulator} [y = 0] set sum = y.
436
+ */
437
+ a.Accumulator.prototype.Set = function (y) {
438
+ if (!y)
439
+ y = 0;
440
+ if (y.constructor === a.Accumulator) {
441
+ this._s = y._s;
442
+ this._t = y._t;
443
+ }
444
+ else {
445
+ this._s = y;
446
+ this._t = 0;
447
+ }
448
+ };
449
+ /**
450
+ * @summary Add a number to the accumulator.
451
+ * @param {number} [y = 0] set sum += y.
452
+ */
453
+ a.Accumulator.prototype.Add = function (y) {
454
+ // Here's Shewchuk's solution...
455
+ // Accumulate starting at least significant end
456
+ var u = m.sum(y, this._t), v = m.sum(u.s, this._s);
457
+ u = u.t;
458
+ this._s = v.s;
459
+ this._t = v.t;
460
+ // Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u)
461
+ // exactly with s, t, u non-adjacent and in decreasing order (except
462
+ // for possible zeros). The following code tries to normalize the
463
+ // result. Ideally, we want _s = round(s+t+u) and _u = round(s+t+u -
464
+ // _s). The follow does an approximate job (and maintains the
465
+ // decreasing non-adjacent property). Here are two "failures" using
466
+ // 3-bit floats:
467
+ //
468
+ // Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp
469
+ // [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3
470
+ //
471
+ // Case 2: _s+_t is not as close to s+t+u as it shold be
472
+ // [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1)
473
+ // should be [80, -7] = 73 (exact)
474
+ //
475
+ // "Fixing" these problems is probably not worth the expense. The
476
+ // representation inevitably leads to small errors in the accumulated
477
+ // values. The additional errors illustrated here amount to 1 ulp of
478
+ // the less significant word during each addition to the Accumulator
479
+ // and an additional possible error of 1 ulp in the reported sum.
480
+ //
481
+ // Incidentally, the "ideal" representation described above is not
482
+ // canonical, because _s = round(_s + _t) may not be true. For
483
+ // example, with 3-bit floats:
484
+ //
485
+ // [128, 16] + 1 -> [160, -16] -- 160 = round(145).
486
+ // But [160, 0] - 16 -> [128, 16] -- 128 = round(144).
487
+ //
488
+ if (this._s === 0) // This implies t == 0,
489
+ this._s = u; // so result is u
490
+ else
491
+ this._t += u; // otherwise just accumulate u to t.
492
+ };
493
+ /**
494
+ * @summary Return the result of adding a number to sum (but
495
+ * don't change sum).
496
+ * @param {number} [y = 0] the number to be added to the sum.
497
+ * @return sum + y.
498
+ */
499
+ a.Accumulator.prototype.Sum = function (y) {
500
+ var b;
501
+ if (!y)
502
+ return this._s;
503
+ else {
504
+ b = new a.Accumulator(this);
505
+ b.Add(y);
506
+ return b._s;
507
+ }
508
+ };
509
+ /**
510
+ * @summary Set sum = &minus;sum.
511
+ */
512
+ a.Accumulator.prototype.Negate = function () {
513
+ this._s *= -1;
514
+ this._t *= -1;
515
+ };
516
+ /**
517
+ * @summary Take the remainder
518
+ * @param {number} y the divisor of the remainder operation.
519
+ * @return sum in range [&minus;y/2, y/2].
520
+ */
521
+ a.Accumulator.prototype.Remainder = function (y) {
522
+ this._s = m.remainder(this._s, y);
523
+ this.Add(0);
524
+ };
525
+ })(geodesic.Accumulator, geodesic.Math);
526
+ /*
527
+ * Geodesic.js
528
+ * Transcription of Geodesic.[ch]pp into JavaScript.
529
+ *
530
+ * See the documentation for the C++ class. The conversion is a literal
531
+ * conversion from C++.
532
+ *
533
+ * The algorithms are derived in
534
+ *
535
+ * Charles F. F. Karney,
536
+ * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
537
+ * https://doi.org/10.1007/s00190-012-0578-z
538
+ * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html
539
+ *
540
+ * Copyright (c) Charles Karney (2011-2022) <karney@alum.mit.edu> and licensed
541
+ * under the MIT/X11 License. For more information, see
542
+ * https://geographiclib.sourceforge.io/
543
+ */
544
+ // Load AFTER Math.js
545
+ // To allow swap via [y, x] = [x, y]
546
+ /* jshint esversion: 6 */
547
+ geodesic.Geodesic = {};
548
+ geodesic.GeodesicLine = {};
549
+ geodesic.PolygonArea = {};
550
+ (function (
551
+ /**
552
+ * @exports geodesic/Geodesic
553
+ * @description Solve geodesic problems via the
554
+ * {@link module:geodesic/Geodesic.Geodesic Geodesic} class.
555
+ */
556
+ g, l, p, m, c) {
557
+ "use strict";
558
+ var GEOGRAPHICLIB_GEODESIC_ORDER = 6, nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER, nA3x_ = nA3_, nC3x_, nC4x_, maxit1_ = 20, maxit2_ = maxit1_ + m.digits + 10, tol0_ = m.epsilon, tol1_ = 200 * tol0_, tol2_ = Math.sqrt(tol0_), tolb_ = tol0_, xthresh_ = 1000 * tol2_, CAP_NONE = 0, CAP_ALL = 0x1F, OUT_ALL = 0x7F80, astroid, A1m1f_coeff, C1f_coeff, C1pf_coeff, A2m1f_coeff, C2f_coeff, A3_coeff, C3_coeff, C4_coeff;
559
+ // N.B. Number.MIN_VALUE is denormalized; divide by Number.EPSILON to get min
560
+ // normalized positive number.
561
+ g.tiny_ = Math.sqrt(Number.MIN_VALUE / Number.EPSILON);
562
+ g.nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
563
+ g.nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER;
564
+ g.nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
565
+ g.nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
566
+ g.nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER;
567
+ nC3x_ = (g.nC3_ * (g.nC3_ - 1)) / 2;
568
+ nC4x_ = (g.nC4_ * (g.nC4_ + 1)) / 2;
569
+ g.CAP_C1 = 1 << 0;
570
+ g.CAP_C1p = 1 << 1;
571
+ g.CAP_C2 = 1 << 2;
572
+ g.CAP_C3 = 1 << 3;
573
+ g.CAP_C4 = 1 << 4;
574
+ g.NONE = 0;
575
+ g.ARC = 1 << 6;
576
+ g.LATITUDE = 1 << 7 | CAP_NONE;
577
+ g.LONGITUDE = 1 << 8 | g.CAP_C3;
578
+ g.AZIMUTH = 1 << 9 | CAP_NONE;
579
+ g.DISTANCE = 1 << 10 | g.CAP_C1;
580
+ g.STANDARD = g.LATITUDE | g.LONGITUDE | g.AZIMUTH | g.DISTANCE;
581
+ g.DISTANCE_IN = 1 << 11 | g.CAP_C1 | g.CAP_C1p;
582
+ g.REDUCEDLENGTH = 1 << 12 | g.CAP_C1 | g.CAP_C2;
583
+ g.GEODESICSCALE = 1 << 13 | g.CAP_C1 | g.CAP_C2;
584
+ g.AREA = 1 << 14 | g.CAP_C4;
585
+ g.ALL = OUT_ALL | CAP_ALL;
586
+ g.LONG_UNROLL = 1 << 15;
587
+ g.OUT_MASK = OUT_ALL | g.LONG_UNROLL;
588
+ // Original math.gl stable difference: cos(k*(x+d))-cos(k*x)
589
+ // = -2*sin(k*(x+d/2))*sin(k*d/2), k odd. Retain tiny arc bits.
590
+ g.SinCosSeries = function (sinp, sinx, cosx, c, delta) {
591
+ if (delta !== undefined) {
592
+ var h = delta / 2, sh = Math.sin(h), ch = Math.cos(h);
593
+ // sin((2*i+1)*mid) = (-1)^i*cos((2*i+1)*(pi/2-mid)).
594
+ return -2 * g.SinCosSeries(false, cosx * ch - sinx * sh, sinx * ch + cosx * sh, c.map(function (v, i) { return (i % 2 ? -v : v) * Math.sin((2 * i + 1) * h); }));
595
+ }
596
+ // Evaluate
597
+ // y = sinp ? sum(c[i] * sin( 2*i * x), i, 1, n) :
598
+ // sum(c[i] * cos((2*i+1) * x), i, 0, n-1)
599
+ // using Clenshaw summation. N.B. c[0] is unused for sin series
600
+ // Approx operation count = (n + 5) mult and (2 * n + 2) add
601
+ var k = c.length, // Point to one beyond last element
602
+ n = k - (sinp ? 1 : 0), ar = 2 * (cosx - sinx) * (cosx + sinx), // 2 * cos(2 * x)
603
+ y0 = n & 1 ? c[--k] : 0, y1 = 0; // accumulators for sum
604
+ // Now n is even
605
+ n = Math.floor(n / 2);
606
+ while (n--) {
607
+ // Unroll loop x 2, so accumulators return to their original role
608
+ y1 = ar * y0 - y1 + c[--k];
609
+ y0 = ar * y1 - y0 + c[--k];
610
+ }
611
+ return (sinp ? 2 * sinx * cosx * y0 : // sin(2 * x) * y0
612
+ cosx * (y0 - y1)); // cos(x) * (y0 - y1)
613
+ };
614
+ astroid = function (x, y) {
615
+ // Solve k^4+2*k^3-(x^2+y^2-1)*k^2-2*y^2*k-y^2 = 0 for positive
616
+ // root k. This solution is adapted from Geocentric::Reverse.
617
+ var k, p = m.sq(x), q = m.sq(y), r = (p + q - 1) / 6, S, r2, r3, disc, u, T3, T, ang, v, uv, w;
618
+ if (!(q === 0 && r <= 0)) {
619
+ // Avoid possible division by zero when r = 0 by multiplying
620
+ // equations for s and t by r^3 and r, resp.
621
+ S = p * q / 4; // S = r^3 * s
622
+ r2 = m.sq(r);
623
+ r3 = r * r2;
624
+ // The discriminant of the quadratic equation for T3. This is
625
+ // zero on the evolute curve p^(1/3)+q^(1/3) = 1
626
+ disc = S * (S + 2 * r3);
627
+ u = r;
628
+ if (disc >= 0) {
629
+ T3 = S + r3;
630
+ // Pick the sign on the sqrt to maximize abs(T3). This
631
+ // minimizes loss of precision due to cancellation. The
632
+ // result is unchanged because of the way the T is used
633
+ // in definition of u.
634
+ T3 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc); // T3 = (r * t)^3
635
+ // N.B. cbrt always returns the real root. cbrt(-8) = -2.
636
+ T = m.cbrt(T3); // T = r * t
637
+ // T can be zero; but then r2 / T -> 0.
638
+ u += T + (T !== 0 ? r2 / T : 0);
639
+ }
640
+ else {
641
+ // T is complex, but the way u is defined the result is real.
642
+ ang = Math.atan2(Math.sqrt(-disc), -(S + r3));
643
+ // There are three possible cube roots. We choose the
644
+ // root which avoids cancellation. Note that disc < 0
645
+ // implies that r < 0.
646
+ u += 2 * r * Math.cos(ang / 3);
647
+ }
648
+ v = Math.sqrt(m.sq(u) + q); // guaranteed positive
649
+ // Avoid loss of accuracy when u < 0.
650
+ uv = u < 0 ? q / (v - u) : u + v; // u+v, guaranteed positive
651
+ w = (uv - q) / (2 * v); // positive?
652
+ // Rearrange expression for k to avoid loss of accuracy due to
653
+ // subtraction. Division by 0 not possible because uv > 0, w >= 0.
654
+ k = uv / (Math.sqrt(uv + m.sq(w)) + w); // guaranteed positive
655
+ }
656
+ else { // q == 0 && r <= 0
657
+ // y = 0 with |x| <= 1. Handle this case directly.
658
+ // for y small, positive root is k = abs(y)/sqrt(1-x^2)
659
+ k = 0;
660
+ }
661
+ return k;
662
+ };
663
+ A1m1f_coeff = [
664
+ // (1-eps)*A1-1, polynomial in eps2 of order 3
665
+ +1, 4, 64, 0, 256
666
+ ];
667
+ // The scale factor A1-1 = mean value of (d/dsigma)I1 - 1
668
+ g.A1m1f = function (eps) {
669
+ var p = Math.floor(nA1_ / 2), t = m.polyval(p, A1m1f_coeff, 0, m.sq(eps)) / A1m1f_coeff[p + 1];
670
+ return (t + eps) / (1 - eps);
671
+ };
672
+ C1f_coeff = [
673
+ // C1[1]/eps^1, polynomial in eps2 of order 2
674
+ -1, 6, -16, 32,
675
+ // C1[2]/eps^2, polynomial in eps2 of order 2
676
+ -9, 64, -128, 2048,
677
+ // C1[3]/eps^3, polynomial in eps2 of order 1
678
+ +9, -16, 768,
679
+ // C1[4]/eps^4, polynomial in eps2 of order 1
680
+ +3, -5, 512,
681
+ // C1[5]/eps^5, polynomial in eps2 of order 0
682
+ -7, 1280,
683
+ // C1[6]/eps^6, polynomial in eps2 of order 0
684
+ -7, 2048
685
+ ];
686
+ // The coefficients C1[l] in the Fourier expansion of B1
687
+ g.C1f = function (eps, c) {
688
+ var eps2 = m.sq(eps), d = eps, o = 0, l, p;
689
+ for (l = 1; l <= g.nC1_; ++l) { // l is index of C1p[l]
690
+ p = Math.floor((g.nC1_ - l) / 2); // order of polynomial in eps^2
691
+ c[l] = d * m.polyval(p, C1f_coeff, o, eps2) / C1f_coeff[o + p + 1];
692
+ o += p + 2;
693
+ d *= eps;
694
+ }
695
+ };
696
+ C1pf_coeff = [
697
+ // C1p[1]/eps^1, polynomial in eps2 of order 2
698
+ +205, -432, 768, 1536,
699
+ // C1p[2]/eps^2, polynomial in eps2 of order 2
700
+ +4005, -4736, 3840, 12288,
701
+ // C1p[3]/eps^3, polynomial in eps2 of order 1
702
+ -225, 116, 384,
703
+ // C1p[4]/eps^4, polynomial in eps2 of order 1
704
+ -7173, 2695, 7680,
705
+ // C1p[5]/eps^5, polynomial in eps2 of order 0
706
+ +3467, 7680,
707
+ // C1p[6]/eps^6, polynomial in eps2 of order 0
708
+ +38081, 61440
709
+ ];
710
+ // The coefficients C1p[l] in the Fourier expansion of B1p
711
+ g.C1pf = function (eps, c) {
712
+ var eps2 = m.sq(eps), d = eps, o = 0, l, p;
713
+ for (l = 1; l <= g.nC1p_; ++l) { // l is index of C1p[l]
714
+ p = Math.floor((g.nC1p_ - l) / 2); // order of polynomial in eps^2
715
+ c[l] = d * m.polyval(p, C1pf_coeff, o, eps2) / C1pf_coeff[o + p + 1];
716
+ o += p + 2;
717
+ d *= eps;
718
+ }
719
+ };
720
+ A2m1f_coeff = [
721
+ // (eps+1)*A2-1, polynomial in eps2 of order 3
722
+ -11, -28, -192, 0, 256
723
+ ];
724
+ // The scale factor A2-1 = mean value of (d/dsigma)I2 - 1
725
+ g.A2m1f = function (eps) {
726
+ var p = Math.floor(nA2_ / 2), t = m.polyval(p, A2m1f_coeff, 0, m.sq(eps)) / A2m1f_coeff[p + 1];
727
+ return (t - eps) / (1 + eps);
728
+ };
729
+ C2f_coeff = [
730
+ // C2[1]/eps^1, polynomial in eps2 of order 2
731
+ +1, 2, 16, 32,
732
+ // C2[2]/eps^2, polynomial in eps2 of order 2
733
+ +35, 64, 384, 2048,
734
+ // C2[3]/eps^3, polynomial in eps2 of order 1
735
+ +15, 80, 768,
736
+ // C2[4]/eps^4, polynomial in eps2 of order 1
737
+ +7, 35, 512,
738
+ // C2[5]/eps^5, polynomial in eps2 of order 0
739
+ +63, 1280,
740
+ // C2[6]/eps^6, polynomial in eps2 of order 0
741
+ +77, 2048
742
+ ];
743
+ // The coefficients C2[l] in the Fourier expansion of B2
744
+ g.C2f = function (eps, c) {
745
+ var eps2 = m.sq(eps), d = eps, o = 0, l, p;
746
+ for (l = 1; l <= g.nC2_; ++l) { // l is index of C2[l]
747
+ p = Math.floor((g.nC2_ - l) / 2); // order of polynomial in eps^2
748
+ c[l] = d * m.polyval(p, C2f_coeff, o, eps2) / C2f_coeff[o + p + 1];
749
+ o += p + 2;
750
+ d *= eps;
751
+ }
752
+ };
753
+ /**
754
+ * @class
755
+ * @property {number} a the equatorial radius (meters).
756
+ * @property {number} f the flattening.
757
+ * @summary Initialize a Geodesic object for a specific ellipsoid.
758
+ * @classdesc Performs geodesic calculations on an ellipsoid of revolution.
759
+ * The routines for solving the direct and inverse problems return an
760
+ * object with some of the following fields set: lat1, lon1, azi1, lat2,
761
+ * lon2, azi2, s12, a12, m12, M12, M21, S12. See {@tutorial 2-interface},
762
+ * section "The results".
763
+ * @example
764
+ * var geodesic = require("geographiclib-geodesic"),
765
+ * geod = geodesic.Geodesic.WGS84;
766
+ * var inv = geod.Inverse(1,2,3,4);
767
+ * console.log("lat1 = " + inv.lat1 + ", lon1 = " + inv.lon1 +
768
+ * ", lat2 = " + inv.lat2 + ", lon2 = " + inv.lon2 +
769
+ * ",\nazi1 = " + inv.azi1 + ", azi2 = " + inv.azi2 +
770
+ * ", s12 = " + inv.s12);
771
+ * @param {number} a the equatorial radius of the ellipsoid (meters).
772
+ * @param {number} f the flattening of the ellipsoid. Setting f = 0 gives
773
+ * a sphere (on which geodesics are great circles). Negative f gives a
774
+ * prolate ellipsoid.
775
+ * @throws an error if the parameters are illegal.
776
+ */
777
+ g.Geodesic = function (a, f) {
778
+ this.a = a;
779
+ this.f = f;
780
+ this._f1 = 1 - this.f;
781
+ this._e2 = this.f * (2 - this.f);
782
+ this._ep2 = this._e2 / m.sq(this._f1); // e2 / (1 - e2)
783
+ this._n = this.f / (2 - this.f);
784
+ this._b = this.a * this._f1;
785
+ // authalic radius squared
786
+ this._c2 = (m.sq(this.a) + m.sq(this._b) *
787
+ (this._e2 === 0 ? 1 :
788
+ (this._e2 > 0 ? m.atanh(Math.sqrt(this._e2)) :
789
+ Math.atan(Math.sqrt(-this._e2))) /
790
+ Math.sqrt(Math.abs(this._e2)))) / 2;
791
+ // The sig12 threshold for "really short". Using the auxiliary sphere
792
+ // solution with dnm computed at (bet1 + bet2) / 2, the relative error in
793
+ // the azimuth consistency check is sig12^2 * abs(f) * min(1, 1-f/2) / 2.
794
+ // (Error measured for 1/100 < b/a < 100 and abs(f) >= 1/1000. For a given
795
+ // f and sig12, the max error occurs for lines near the pole. If the old
796
+ // rule for computing dnm = (dn1 + dn2)/2 is used, then the error increases
797
+ // by a factor of 2.) Setting this equal to epsilon gives sig12 = etol2.
798
+ // Here 0.1 is a safety factor (error decreased by 100) and max(0.001,
799
+ // abs(f)) stops etol2 getting too large in the nearly spherical case.
800
+ this._etol2 = 0.1 * tol2_ /
801
+ Math.sqrt(Math.max(0.001, Math.abs(this.f)) *
802
+ Math.min(1, 1 - this.f / 2) / 2);
803
+ if (!(isFinite(this.a) && this.a > 0))
804
+ throw new Error("Equatorial radius is not positive");
805
+ if (!(isFinite(this._b) && this._b > 0))
806
+ throw new Error("Polar semi-axis is not positive");
807
+ this._A3x = new Array(nA3x_);
808
+ this._C3x = new Array(nC3x_);
809
+ this._C4x = new Array(nC4x_);
810
+ this.A3coeff();
811
+ this.C3coeff();
812
+ this.C4coeff();
813
+ };
814
+ A3_coeff = [
815
+ // A3, coeff of eps^5, polynomial in n of order 0
816
+ -3, 128,
817
+ // A3, coeff of eps^4, polynomial in n of order 1
818
+ -2, -3, 64,
819
+ // A3, coeff of eps^3, polynomial in n of order 2
820
+ -1, -3, -1, 16,
821
+ // A3, coeff of eps^2, polynomial in n of order 2
822
+ +3, -1, -2, 8,
823
+ // A3, coeff of eps^1, polynomial in n of order 1
824
+ +1, -1, 2,
825
+ // A3, coeff of eps^0, polynomial in n of order 0
826
+ +1, 1
827
+ ];
828
+ // The scale factor A3 = mean value of (d/dsigma)I3
829
+ g.Geodesic.prototype.A3coeff = function () {
830
+ var o = 0, k = 0, j, p;
831
+ for (j = nA3_ - 1; j >= 0; --j) { // coeff of eps^j
832
+ p = Math.min(nA3_ - j - 1, j); // order of polynomial in n
833
+ this._A3x[k++] = m.polyval(p, A3_coeff, o, this._n) /
834
+ A3_coeff[o + p + 1];
835
+ o += p + 2;
836
+ }
837
+ };
838
+ C3_coeff = [
839
+ // C3[1], coeff of eps^5, polynomial in n of order 0
840
+ +3, 128,
841
+ // C3[1], coeff of eps^4, polynomial in n of order 1
842
+ +2, 5, 128,
843
+ // C3[1], coeff of eps^3, polynomial in n of order 2
844
+ -1, 3, 3, 64,
845
+ // C3[1], coeff of eps^2, polynomial in n of order 2
846
+ -1, 0, 1, 8,
847
+ // C3[1], coeff of eps^1, polynomial in n of order 1
848
+ -1, 1, 4,
849
+ // C3[2], coeff of eps^5, polynomial in n of order 0
850
+ +5, 256,
851
+ // C3[2], coeff of eps^4, polynomial in n of order 1
852
+ +1, 3, 128,
853
+ // C3[2], coeff of eps^3, polynomial in n of order 2
854
+ -3, -2, 3, 64,
855
+ // C3[2], coeff of eps^2, polynomial in n of order 2
856
+ +1, -3, 2, 32,
857
+ // C3[3], coeff of eps^5, polynomial in n of order 0
858
+ +7, 512,
859
+ // C3[3], coeff of eps^4, polynomial in n of order 1
860
+ -10, 9, 384,
861
+ // C3[3], coeff of eps^3, polynomial in n of order 2
862
+ +5, -9, 5, 192,
863
+ // C3[4], coeff of eps^5, polynomial in n of order 0
864
+ +7, 512,
865
+ // C3[4], coeff of eps^4, polynomial in n of order 1
866
+ -14, 7, 512,
867
+ // C3[5], coeff of eps^5, polynomial in n of order 0
868
+ +21, 2560
869
+ ];
870
+ // The coefficients C3[l] in the Fourier expansion of B3
871
+ g.Geodesic.prototype.C3coeff = function () {
872
+ var o = 0, k = 0, l, j, p;
873
+ for (l = 1; l < g.nC3_; ++l) { // l is index of C3[l]
874
+ for (j = g.nC3_ - 1; j >= l; --j) { // coeff of eps^j
875
+ p = Math.min(g.nC3_ - j - 1, j); // order of polynomial in n
876
+ this._C3x[k++] = m.polyval(p, C3_coeff, o, this._n) /
877
+ C3_coeff[o + p + 1];
878
+ o += p + 2;
879
+ }
880
+ }
881
+ };
882
+ C4_coeff = [
883
+ // C4[0], coeff of eps^5, polynomial in n of order 0
884
+ +97, 15015,
885
+ // C4[0], coeff of eps^4, polynomial in n of order 1
886
+ +1088, 156, 45045,
887
+ // C4[0], coeff of eps^3, polynomial in n of order 2
888
+ -224, -4784, 1573, 45045,
889
+ // C4[0], coeff of eps^2, polynomial in n of order 3
890
+ -10656, 14144, -4576, -858, 45045,
891
+ // C4[0], coeff of eps^1, polynomial in n of order 4
892
+ +64, 624, -4576, 6864, -3003, 15015,
893
+ // C4[0], coeff of eps^0, polynomial in n of order 5
894
+ +100, 208, 572, 3432, -12012, 30030, 45045,
895
+ // C4[1], coeff of eps^5, polynomial in n of order 0
896
+ +1, 9009,
897
+ // C4[1], coeff of eps^4, polynomial in n of order 1
898
+ -2944, 468, 135135,
899
+ // C4[1], coeff of eps^3, polynomial in n of order 2
900
+ +5792, 1040, -1287, 135135,
901
+ // C4[1], coeff of eps^2, polynomial in n of order 3
902
+ +5952, -11648, 9152, -2574, 135135,
903
+ // C4[1], coeff of eps^1, polynomial in n of order 4
904
+ -64, -624, 4576, -6864, 3003, 135135,
905
+ // C4[2], coeff of eps^5, polynomial in n of order 0
906
+ +8, 10725,
907
+ // C4[2], coeff of eps^4, polynomial in n of order 1
908
+ +1856, -936, 225225,
909
+ // C4[2], coeff of eps^3, polynomial in n of order 2
910
+ -8448, 4992, -1144, 225225,
911
+ // C4[2], coeff of eps^2, polynomial in n of order 3
912
+ -1440, 4160, -4576, 1716, 225225,
913
+ // C4[3], coeff of eps^5, polynomial in n of order 0
914
+ -136, 63063,
915
+ // C4[3], coeff of eps^4, polynomial in n of order 1
916
+ +1024, -208, 105105,
917
+ // C4[3], coeff of eps^3, polynomial in n of order 2
918
+ +3584, -3328, 1144, 315315,
919
+ // C4[4], coeff of eps^5, polynomial in n of order 0
920
+ -128, 135135,
921
+ // C4[4], coeff of eps^4, polynomial in n of order 1
922
+ -2560, 832, 405405,
923
+ // C4[5], coeff of eps^5, polynomial in n of order 0
924
+ +128, 99099
925
+ ];
926
+ g.Geodesic.prototype.C4coeff = function () {
927
+ var o = 0, k = 0, l, j, p;
928
+ for (l = 0; l < g.nC4_; ++l) { // l is index of C4[l]
929
+ for (j = g.nC4_ - 1; j >= l; --j) { // coeff of eps^j
930
+ p = g.nC4_ - j - 1; // order of polynomial in n
931
+ this._C4x[k++] = m.polyval(p, C4_coeff, o, this._n) /
932
+ C4_coeff[o + p + 1];
933
+ o += p + 2;
934
+ }
935
+ }
936
+ };
937
+ g.Geodesic.prototype.A3f = function (eps) {
938
+ // Evaluate A3
939
+ return m.polyval(nA3x_ - 1, this._A3x, 0, eps);
940
+ };
941
+ g.Geodesic.prototype.C3f = function (eps, c) {
942
+ // Evaluate C3 coeffs
943
+ // Elements c[1] thru c[nC3_ - 1] are set
944
+ var mult = 1, o = 0, l, p;
945
+ for (l = 1; l < g.nC3_; ++l) { // l is index of C3[l]
946
+ p = g.nC3_ - l - 1; // order of polynomial in eps
947
+ mult *= eps;
948
+ c[l] = mult * m.polyval(p, this._C3x, o, eps);
949
+ o += p + 1;
950
+ }
951
+ };
952
+ g.Geodesic.prototype.C4f = function (eps, c) {
953
+ // Evaluate C4 coeffs
954
+ // Elements c[0] thru c[g.nC4_ - 1] are set
955
+ var mult = 1, o = 0, l, p;
956
+ for (l = 0; l < g.nC4_; ++l) { // l is index of C4[l]
957
+ p = g.nC4_ - l - 1; // order of polynomial in eps
958
+ c[l] = mult * m.polyval(p, this._C4x, o, eps);
959
+ o += p + 1;
960
+ mult *= eps;
961
+ }
962
+ };
963
+ // return s12b, m12b, m0, M12, M21
964
+ g.Geodesic.prototype.Lengths = function (eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, C1a, C2a) {
965
+ // Return m12b = (reduced length)/_b; also calculate s12b =
966
+ // distance/_b, and m0 = coefficient of secular term in
967
+ // expression for reduced length.
968
+ outmask &= g.OUT_MASK;
969
+ var vals = {}, m0x = 0, J12 = 0, A1 = 0, A2 = 0, B1, B2, l, csig12, t;
970
+ if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
971
+ A1 = g.A1m1f(eps);
972
+ g.C1f(eps, C1a);
973
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
974
+ A2 = g.A2m1f(eps);
975
+ g.C2f(eps, C2a);
976
+ m0x = A1 - A2;
977
+ A2 = 1 + A2;
978
+ }
979
+ A1 = 1 + A1;
980
+ }
981
+ if (outmask & g.DISTANCE) {
982
+ B1 = g.SinCosSeries(true, ssig2, csig2, C1a) -
983
+ g.SinCosSeries(true, ssig1, csig1, C1a);
984
+ // Missing a factor of _b
985
+ vals.s12b = A1 * (sig12 + B1);
986
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
987
+ B2 = g.SinCosSeries(true, ssig2, csig2, C2a) -
988
+ g.SinCosSeries(true, ssig1, csig1, C2a);
989
+ J12 = m0x * sig12 + (A1 * B1 - A2 * B2);
990
+ }
991
+ }
992
+ else if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
993
+ // Assume here that nC1_ >= nC2_
994
+ for (l = 1; l <= g.nC2_; ++l)
995
+ C2a[l] = A1 * C1a[l] - A2 * C2a[l];
996
+ J12 = m0x * sig12 + (g.SinCosSeries(true, ssig2, csig2, C2a) -
997
+ g.SinCosSeries(true, ssig1, csig1, C2a));
998
+ }
999
+ if (outmask & g.REDUCEDLENGTH) {
1000
+ vals.m0 = m0x;
1001
+ // Missing a factor of _b.
1002
+ // Add parens around (csig1 * ssig2) and (ssig1 * csig2) to ensure
1003
+ // accurate cancellation in the case of coincident points.
1004
+ vals.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) -
1005
+ csig1 * csig2 * J12;
1006
+ }
1007
+ else
1008
+ vals.m12b = NaN;
1009
+ if (outmask & g.GEODESICSCALE) {
1010
+ csig12 = csig1 * csig2 + ssig1 * ssig2;
1011
+ t = this._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
1012
+ vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
1013
+ vals.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
1014
+ }
1015
+ return vals;
1016
+ };
1017
+ // return sig12, salp1, calp1, salp2, calp2, dnm
1018
+ g.Geodesic.prototype.InverseStart = function (sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a) {
1019
+ // Return a starting point for Newton's method in salp1 and calp1
1020
+ // (function value is -1). If Newton's method doesn't need to be
1021
+ // used, return also salp2 and calp2 and function value is sig12.
1022
+ // salp2, calp2 only updated if return val >= 0.
1023
+ var vals = {},
1024
+ // bet12 = bet2 - bet1 in [0, pi); bet12a = bet2 + bet1 in (-pi, 0]
1025
+ sbet12 = sbet2 * cbet1 - cbet2 * sbet1, cbet12 = cbet2 * cbet1 + sbet2 * sbet1, sbet12a, shortline, omg12, sbetm2, somg12, comg12, t, ssig12, csig12, x, y, lamscale, betscale, k2, eps, cbet12a, bet12a, m12b, m0, nvals, k, omg12a, lam12x;
1026
+ vals.sig12 = -1; // Return value
1027
+ // Volatile declaration needed to fix inverse cases
1028
+ // 88.202499451857 0 -88.202499451857 179.981022032992859592
1029
+ // 89.262080389218 0 -89.262080389218 179.992207982775375662
1030
+ // 89.333123580033 0 -89.333123580032997687 179.99295812360148422
1031
+ // which otherwise fail with g++ 4.4.4 x86 -O3
1032
+ sbet12a = sbet2 * cbet1;
1033
+ sbet12a += cbet2 * sbet1;
1034
+ shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5;
1035
+ if (shortline) {
1036
+ sbetm2 = m.sq(sbet1 + sbet2);
1037
+ // sin((bet1+bet2)/2)^2
1038
+ // = (sbet1 + sbet2)^2 / ((sbet1 + sbet2)^2 + (cbet1 + cbet2)^2)
1039
+ sbetm2 /= sbetm2 + m.sq(cbet1 + cbet2);
1040
+ vals.dnm = Math.sqrt(1 + this._ep2 * sbetm2);
1041
+ omg12 = lam12 / (this._f1 * vals.dnm);
1042
+ somg12 = Math.sin(omg12);
1043
+ comg12 = Math.cos(omg12);
1044
+ }
1045
+ else {
1046
+ somg12 = slam12;
1047
+ comg12 = clam12;
1048
+ }
1049
+ vals.salp1 = cbet2 * somg12;
1050
+ vals.calp1 = comg12 >= 0 ?
1051
+ sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) :
1052
+ sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
1053
+ ssig12 = m.hypot(vals.salp1, vals.calp1);
1054
+ csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
1055
+ if (shortline && ssig12 < this._etol2) {
1056
+ // really short lines
1057
+ vals.salp2 = cbet1 * somg12;
1058
+ vals.calp2 = sbet12 - cbet1 * sbet2 *
1059
+ (comg12 >= 0 ? m.sq(somg12) / (1 + comg12) : 1 - comg12);
1060
+ // norm(vals.salp2, vals.calp2);
1061
+ t = m.hypot(vals.salp2, vals.calp2);
1062
+ vals.salp2 /= t;
1063
+ vals.calp2 /= t;
1064
+ // Set return value
1065
+ vals.sig12 = Math.atan2(ssig12, csig12);
1066
+ }
1067
+ else if (Math.abs(this._n) > 0.1 || // Skip astroid calc if too eccentric
1068
+ csig12 >= 0 ||
1069
+ ssig12 >= 6 * Math.abs(this._n) * Math.PI * m.sq(cbet1)) {
1070
+ // Nothing to do, zeroth order spherical approximation is OK
1071
+ }
1072
+ else {
1073
+ // Scale lam12 and bet2 to x, y coordinate system where antipodal
1074
+ // point is at origin and singular point is at y = 0, x = -1.
1075
+ lam12x = Math.atan2(-slam12, -clam12); // lam12 - pi
1076
+ if (this.f >= 0) { // In fact f == 0 does not get here
1077
+ // x = dlong, y = dlat
1078
+ k2 = m.sq(sbet1) * this._ep2;
1079
+ eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1080
+ lamscale = this.f * cbet1 * this.A3f(eps) * Math.PI;
1081
+ betscale = lamscale * cbet1;
1082
+ x = lam12x / lamscale;
1083
+ y = sbet12a / betscale;
1084
+ }
1085
+ else { // f < 0
1086
+ // x = dlat, y = dlong
1087
+ cbet12a = cbet2 * cbet1 - sbet2 * sbet1;
1088
+ bet12a = Math.atan2(sbet12a, cbet12a);
1089
+ // In the case of lon12 = 180, this repeats a calculation made
1090
+ // in Inverse.
1091
+ nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
1092
+ m12b = nvals.m12b;
1093
+ m0 = nvals.m0;
1094
+ x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI);
1095
+ betscale = x < -0.01 ? sbet12a / x :
1096
+ -this.f * m.sq(cbet1) * Math.PI;
1097
+ lamscale = betscale / cbet1;
1098
+ y = lam12 / lamscale;
1099
+ }
1100
+ if (y > -tol1_ && x > -1 - xthresh_) {
1101
+ // strip near cut
1102
+ if (this.f >= 0) {
1103
+ vals.salp1 = Math.min(1, -x);
1104
+ vals.calp1 = -Math.sqrt(1 - m.sq(vals.salp1));
1105
+ }
1106
+ else {
1107
+ vals.calp1 = Math.max(x > -tol1_ ? 0 : -1, x);
1108
+ vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1));
1109
+ }
1110
+ }
1111
+ else {
1112
+ // Estimate alp1, by solving the astroid problem.
1113
+ //
1114
+ // Could estimate alpha1 = theta + pi/2, directly, i.e.,
1115
+ // calp1 = y/k; salp1 = -x/(1+k); for f >= 0
1116
+ // calp1 = x/(1+k); salp1 = -y/k; for f < 0 (need to check)
1117
+ //
1118
+ // However, it's better to estimate omg12 from astroid and use
1119
+ // spherical formula to compute alp1. This reduces the mean number of
1120
+ // Newton iterations for astroid cases from 2.24 (min 0, max 6) to 2.12
1121
+ // (min 0 max 5). The changes in the number of iterations are as
1122
+ // follows:
1123
+ //
1124
+ // change percent
1125
+ // 1 5
1126
+ // 0 78
1127
+ // -1 16
1128
+ // -2 0.6
1129
+ // -3 0.04
1130
+ // -4 0.002
1131
+ //
1132
+ // The histogram of iterations is (m = number of iterations estimating
1133
+ // alp1 directly, n = number of iterations estimating via omg12, total
1134
+ // number of trials = 148605):
1135
+ //
1136
+ // iter m n
1137
+ // 0 148 186
1138
+ // 1 13046 13845
1139
+ // 2 93315 102225
1140
+ // 3 36189 32341
1141
+ // 4 5396 7
1142
+ // 5 455 1
1143
+ // 6 56 0
1144
+ //
1145
+ // Because omg12 is near pi, estimate work with omg12a = pi - omg12
1146
+ k = astroid(x, y);
1147
+ omg12a = lamscale * (this.f >= 0 ? -x * k / (1 + k) : -y * (1 + k) / k);
1148
+ somg12 = Math.sin(omg12a);
1149
+ comg12 = -Math.cos(omg12a);
1150
+ // Update spherical estimate of alp1 using omg12 instead of
1151
+ // lam12
1152
+ vals.salp1 = cbet2 * somg12;
1153
+ vals.calp1 = sbet12a -
1154
+ cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
1155
+ }
1156
+ }
1157
+ // Sanity check on starting guess. Backwards check allows NaN through.
1158
+ // jshint -W018
1159
+ if (!(vals.salp1 <= 0)) {
1160
+ // norm(vals.salp1, vals.calp1);
1161
+ t = m.hypot(vals.salp1, vals.calp1);
1162
+ vals.salp1 /= t;
1163
+ vals.calp1 /= t;
1164
+ }
1165
+ else {
1166
+ vals.salp1 = 1;
1167
+ vals.calp1 = 0;
1168
+ }
1169
+ return vals;
1170
+ };
1171
+ // return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps,
1172
+ // domg12, dlam12,
1173
+ g.Geodesic.prototype.Lambda12 = function (sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, C1a, C2a, C3a) {
1174
+ var vals = {}, t, salp0, calp0, somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals;
1175
+ if (sbet1 === 0 && calp1 === 0)
1176
+ // Break degeneracy of equatorial line. This case has already been
1177
+ // handled.
1178
+ calp1 = -g.tiny_;
1179
+ // sin(alp1) * cos(bet1) = sin(alp0)
1180
+ salp0 = salp1 * cbet1;
1181
+ calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0
1182
+ // tan(bet1) = tan(sig1) * cos(alp1)
1183
+ // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1)
1184
+ vals.ssig1 = sbet1;
1185
+ somg1 = salp0 * sbet1;
1186
+ vals.csig1 = comg1 = calp1 * cbet1;
1187
+ // norm(vals.ssig1, vals.csig1);
1188
+ t = m.hypot(vals.ssig1, vals.csig1);
1189
+ vals.ssig1 /= t;
1190
+ vals.csig1 /= t;
1191
+ // norm(somg1, comg1); -- don't need to normalize!
1192
+ // Enforce symmetries in the case abs(bet2) = -bet1. Need to be careful
1193
+ // about this case, since this can yield singularities in the Newton
1194
+ // iteration.
1195
+ // sin(alp2) * cos(bet2) = sin(alp0)
1196
+ vals.salp2 = cbet2 !== cbet1 ? salp0 / cbet2 : salp1;
1197
+ // calp2 = sqrt(1 - sq(salp2))
1198
+ // = sqrt(sq(calp0) - sq(sbet2)) / cbet2
1199
+ // and subst for calp0 and rearrange to give (choose positive sqrt
1200
+ // to give alp2 in [0, pi/2]).
1201
+ vals.calp2 = cbet2 !== cbet1 || Math.abs(sbet2) !== -sbet1 ?
1202
+ Math.sqrt(m.sq(calp1 * cbet1) + (cbet1 < -sbet1 ?
1203
+ (cbet2 - cbet1) * (cbet1 + cbet2) :
1204
+ (sbet1 - sbet2) * (sbet1 + sbet2))) /
1205
+ cbet2 : Math.abs(calp1);
1206
+ // tan(bet2) = tan(sig2) * cos(alp2)
1207
+ // tan(omg2) = sin(alp0) * tan(sig2).
1208
+ vals.ssig2 = sbet2;
1209
+ somg2 = salp0 * sbet2;
1210
+ vals.csig2 = comg2 = vals.calp2 * cbet2;
1211
+ // norm(vals.ssig2, vals.csig2);
1212
+ t = m.hypot(vals.ssig2, vals.csig2);
1213
+ vals.ssig2 /= t;
1214
+ vals.csig2 /= t;
1215
+ // norm(somg2, comg2); -- don't need to normalize!
1216
+ // sig12 = sig2 - sig1, limit to [0, pi]
1217
+ vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 -
1218
+ vals.ssig1 * vals.csig2), vals.csig1 * vals.csig2 +
1219
+ vals.ssig1 * vals.ssig2);
1220
+ // omg12 = omg2 - omg1, limit to [0, pi]
1221
+ somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
1222
+ comg12 = comg1 * comg2 + somg1 * somg2;
1223
+ // eta = omg12 - lam120
1224
+ eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120);
1225
+ k2 = m.sq(calp0) * this._ep2;
1226
+ vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1227
+ this.C3f(vals.eps, C3a);
1228
+ B312 = (g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a) -
1229
+ g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a));
1230
+ vals.domg12 = -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312);
1231
+ vals.lam12 = eta + vals.domg12;
1232
+ if (diffp) {
1233
+ if (vals.calp2 === 0)
1234
+ vals.dlam12 = -2 * this._f1 * dn1 / sbet1;
1235
+ else {
1236
+ nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, dn1, vals.ssig2, vals.csig2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
1237
+ vals.dlam12 = nvals.m12b;
1238
+ vals.dlam12 *= this._f1 / (vals.calp2 * cbet2);
1239
+ }
1240
+ }
1241
+ return vals;
1242
+ };
1243
+ /**
1244
+ * @summary Solve the inverse geodesic problem.
1245
+ * @param {number} lat1 the latitude of the first point in degrees.
1246
+ * @param {number} lon1 the longitude of the first point in degrees.
1247
+ * @param {number} lat2 the latitude of the second point in degrees.
1248
+ * @param {number} lon2 the longitude of the second point in degrees.
1249
+ * @param {bitmask} [outmask = STANDARD] which results to include.
1250
+ * @return {object} the requested results
1251
+ * @description The lat1, lon1, lat2, lon2, and a12 fields of the result are
1252
+ * always set. For details on the outmask parameter, see {@tutorial
1253
+ * 2-interface}, "The outmask and caps parameters".
1254
+ */
1255
+ g.Geodesic.prototype.Inverse = function (lat1, lon1, lat2, lon2, outmask) {
1256
+ var r, vals;
1257
+ if (!outmask)
1258
+ outmask = g.STANDARD;
1259
+ if (outmask === g.LONG_UNROLL)
1260
+ outmask |= g.STANDARD;
1261
+ outmask &= g.OUT_MASK;
1262
+ r = this.InverseInt(lat1, lon1, lat2, lon2, outmask);
1263
+ vals = r.vals;
1264
+ if (outmask & g.AZIMUTH) {
1265
+ vals.azi1 = m.atan2d(r.salp1, r.calp1);
1266
+ vals.azi2 = m.atan2d(r.salp2, r.calp2);
1267
+ }
1268
+ return vals;
1269
+ };
1270
+ g.Geodesic.prototype.InverseInt = function (lat1, lon1, lat2, lon2, outmask) {
1271
+ var vals = {}, lon12, lon12s, lonsign, t, swapp, latsign, sbet1, cbet1, sbet2, cbet2, s12x, m12x, dn1, dn2, lam12, slam12, clam12, sig12, calp1, salp1, calp2, salp2, C1a, C2a, C3a, meridian, nvals, ssig1, csig1, ssig2, csig2, eps, omg12, dnm, numit, salp1a, calp1a, salp1b, calp1b, tripn, tripb, v, dv, dalp1, sdalp1, cdalp1, nsalp1, lengthmask, salp0, calp0, alp12, k2, A4, C4a, B41, B42, somg12, comg12, domg12, dbet1, dbet2, salp12, calp12, sdomg12, cdomg12;
1272
+ // Compute longitude difference (AngDiff does this carefully). Result is
1273
+ // in [-180, 180] but -180 is only for west-going geodesics. 180 is for
1274
+ // east-going and meridional geodesics.
1275
+ vals.lat1 = lat1 = m.LatFix(lat1);
1276
+ vals.lat2 = lat2 = m.LatFix(lat2);
1277
+ // If really close to the equator, treat as on equator.
1278
+ lat1 = m.AngRound(lat1);
1279
+ lat2 = m.AngRound(lat2);
1280
+ lon12 = m.AngDiff(lon1, lon2);
1281
+ lon12s = lon12.e;
1282
+ lon12 = lon12.d;
1283
+ if (outmask & g.LONG_UNROLL) {
1284
+ vals.lon1 = lon1;
1285
+ vals.lon2 = (lon1 + lon12) + lon12s;
1286
+ }
1287
+ else {
1288
+ vals.lon1 = m.AngNormalize(lon1);
1289
+ vals.lon2 = m.AngNormalize(lon2);
1290
+ }
1291
+ // Make longitude difference positive.
1292
+ lonsign = m.copysign(1, lon12);
1293
+ lon12 *= lonsign;
1294
+ lon12s *= lonsign;
1295
+ lam12 = lon12 * m.degree;
1296
+ // Calculate sincos of lon12 + error (this applies AngRound internally).
1297
+ t = m.sincosde(lon12, lon12s);
1298
+ slam12 = t.s;
1299
+ clam12 = t.c;
1300
+ lon12s = (180 - lon12) - lon12s; // the supplementary longitude difference
1301
+ // Swap points so that point with higher (abs) latitude is point 1
1302
+ // If one latitude is a nan, then it becomes lat1.
1303
+ swapp = Math.abs(lat1) < Math.abs(lat2) || isNaN(lat2) ? -1 : 1;
1304
+ if (swapp < 0) {
1305
+ lonsign *= -1;
1306
+ [lat2, lat1] = [lat1, lat2]; // swap(lat1, lat2);
1307
+ }
1308
+ // Make lat1 <= 0
1309
+ latsign = m.copysign(1, -lat1);
1310
+ lat1 *= latsign;
1311
+ lat2 *= latsign;
1312
+ // Now we have
1313
+ //
1314
+ // 0 <= lon12 <= 180
1315
+ // -90 <= lat1 <= 0
1316
+ // lat1 <= lat2 <= -lat1
1317
+ //
1318
+ // longsign, swapp, latsign register the transformation to bring the
1319
+ // coordinates to this canonical form. In all cases, 1 means no change was
1320
+ // made. We make these transformations so that there are few cases to
1321
+ // check, e.g., on verifying quadrants in atan2. In addition, this
1322
+ // enforces some symmetries in the results returned.
1323
+ t = m.sincosd(lat1);
1324
+ sbet1 = this._f1 * t.s;
1325
+ cbet1 = t.c;
1326
+ // norm(sbet1, cbet1);
1327
+ t = m.hypot(sbet1, cbet1);
1328
+ sbet1 /= t;
1329
+ cbet1 /= t;
1330
+ // Ensure cbet1 = +epsilon at poles
1331
+ cbet1 = Math.max(g.tiny_, cbet1);
1332
+ t = m.sincosd(lat2);
1333
+ sbet2 = this._f1 * t.s;
1334
+ cbet2 = t.c;
1335
+ // norm(sbet2, cbet2);
1336
+ t = m.hypot(sbet2, cbet2);
1337
+ sbet2 /= t;
1338
+ cbet2 /= t;
1339
+ // Ensure cbet2 = +epsilon at poles
1340
+ cbet2 = Math.max(g.tiny_, cbet2);
1341
+ // If cbet1 < -sbet1, then cbet2 - cbet1 is a sensitive measure of the
1342
+ // |bet1| - |bet2|. Alternatively (cbet1 >= -sbet1), abs(sbet2) + sbet1 is
1343
+ // a better measure. This logic is used in assigning calp2 in Lambda12.
1344
+ // Sometimes these quantities vanish and in that case we force bet2 = +/-
1345
+ // bet1 exactly. An example where is is necessary is the inverse problem
1346
+ // 48.522876735459 0 -48.52287673545898293 179.599720456223079643
1347
+ // which failed with Visual Studio 10 (Release and Debug)
1348
+ if (cbet1 < -sbet1) {
1349
+ if (cbet2 === cbet1)
1350
+ sbet2 = m.copysign(sbet1, sbet2);
1351
+ }
1352
+ else {
1353
+ if (Math.abs(sbet2) === -sbet1)
1354
+ cbet2 = cbet1;
1355
+ }
1356
+ dn1 = Math.sqrt(1 + this._ep2 * m.sq(sbet1));
1357
+ dn2 = Math.sqrt(1 + this._ep2 * m.sq(sbet2));
1358
+ // index zero elements of these arrays are unused
1359
+ C1a = new Array(g.nC1_ + 1);
1360
+ C2a = new Array(g.nC2_ + 1);
1361
+ C3a = new Array(g.nC3_);
1362
+ meridian = lat1 === -90 || slam12 === 0;
1363
+ if (meridian) {
1364
+ // Endpoints are on a single full meridian, so the geodesic might
1365
+ // lie on a meridian.
1366
+ calp1 = clam12;
1367
+ salp1 = slam12; // Head to the target longitude
1368
+ calp2 = 1;
1369
+ salp2 = 0; // At the target we're heading north
1370
+ // tan(bet) = tan(sig) * cos(alp)
1371
+ ssig1 = sbet1;
1372
+ csig1 = calp1 * cbet1;
1373
+ ssig2 = sbet2;
1374
+ csig2 = calp2 * cbet2;
1375
+ // sig12 = sig2 - sig1
1376
+ sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2);
1377
+ nvals = this.Lengths(this._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | g.DISTANCE | g.REDUCEDLENGTH, C1a, C2a);
1378
+ s12x = nvals.s12b;
1379
+ m12x = nvals.m12b;
1380
+ // Ignore m0
1381
+ if (outmask & g.GEODESICSCALE) {
1382
+ vals.M12 = nvals.M12;
1383
+ vals.M21 = nvals.M21;
1384
+ }
1385
+ // Add the check for sig12 since zero length geodesics might yield
1386
+ // m12 < 0. Test case was
1387
+ //
1388
+ // echo 20.001 0 20.001 0 | GeodSolve -i
1389
+ if (sig12 < tol2_ || m12x >= 0) {
1390
+ // Need at least 2, to handle 90 0 90 180
1391
+ if (sig12 < 3 * g.tiny_ ||
1392
+ // Prevent negative s12 or m12 for short lines
1393
+ (sig12 < tol0_ && (s12x < 0 || m12x < 0)))
1394
+ sig12 = m12x = s12x = 0;
1395
+ m12x *= this._b;
1396
+ s12x *= this._b;
1397
+ vals.a12 = sig12 / m.degree;
1398
+ }
1399
+ else
1400
+ // m12 < 0, i.e., prolate and too close to anti-podal
1401
+ meridian = false;
1402
+ }
1403
+ somg12 = 2;
1404
+ if (!meridian &&
1405
+ sbet1 === 0 && // and sbet2 == 0
1406
+ (this.f <= 0 || lon12s >= this.f * 180)) {
1407
+ // Geodesic runs along equator
1408
+ calp1 = calp2 = 0;
1409
+ salp1 = salp2 = 1;
1410
+ s12x = this.a * lam12;
1411
+ sig12 = omg12 = lam12 / this._f1;
1412
+ m12x = this._b * Math.sin(sig12);
1413
+ if (outmask & g.GEODESICSCALE)
1414
+ vals.M12 = vals.M21 = Math.cos(sig12);
1415
+ vals.a12 = lon12 / this._f1;
1416
+ }
1417
+ else if (!meridian) {
1418
+ // Now point1 and point2 belong within a hemisphere bounded by a
1419
+ // meridian and geodesic is neither meridional or equatorial.
1420
+ // Figure a starting point for Newton's method
1421
+ nvals = this.InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a);
1422
+ sig12 = nvals.sig12;
1423
+ salp1 = nvals.salp1;
1424
+ calp1 = nvals.calp1;
1425
+ if (sig12 >= 0) {
1426
+ salp2 = nvals.salp2;
1427
+ calp2 = nvals.calp2;
1428
+ // Short lines (InverseStart sets salp2, calp2, dnm)
1429
+ dnm = nvals.dnm;
1430
+ s12x = sig12 * this._b * dnm;
1431
+ m12x = m.sq(dnm) * this._b * Math.sin(sig12 / dnm);
1432
+ if (outmask & g.GEODESICSCALE)
1433
+ vals.M12 = vals.M21 = Math.cos(sig12 / dnm);
1434
+ vals.a12 = sig12 / m.degree;
1435
+ omg12 = lam12 / (this._f1 * dnm);
1436
+ }
1437
+ else {
1438
+ // Newton's method. This is a straightforward solution of f(alp1) =
1439
+ // lambda12(alp1) - lam12 = 0 with one wrinkle. f(alp) has exactly one
1440
+ // root in the interval (0, pi) and its derivative is positive at the
1441
+ // root. Thus f(alp) is positive for alp > alp1 and negative for alp <
1442
+ // alp1. During the course of the iteration, a range (alp1a, alp1b) is
1443
+ // maintained which brackets the root and with each evaluation of
1444
+ // f(alp) the range is shrunk if possible. Newton's method is
1445
+ // restarted whenever the derivative of f is negative (because the new
1446
+ // value of alp1 is then further from the solution) or if the new
1447
+ // estimate of alp1 lies outside (0,pi); in this case, the new starting
1448
+ // guess is taken to be (alp1a + alp1b) / 2.
1449
+ numit = 0;
1450
+ // Bracketing range
1451
+ salp1a = g.tiny_;
1452
+ calp1a = 1;
1453
+ salp1b = g.tiny_;
1454
+ calp1b = -1;
1455
+ for (tripn = false, tripb = false;; ++numit) {
1456
+ // the WGS84 test set: mean = 1.47, sd = 1.25, max = 16
1457
+ // WGS84 and random input: mean = 2.85, sd = 0.60
1458
+ nvals = this.Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a);
1459
+ v = nvals.lam12;
1460
+ salp2 = nvals.salp2;
1461
+ calp2 = nvals.calp2;
1462
+ sig12 = nvals.sig12;
1463
+ ssig1 = nvals.ssig1;
1464
+ csig1 = nvals.csig1;
1465
+ ssig2 = nvals.ssig2;
1466
+ csig2 = nvals.csig2;
1467
+ eps = nvals.eps;
1468
+ domg12 = nvals.domg12;
1469
+ dv = nvals.dlam12;
1470
+ // Reversed test to allow escape with NaNs
1471
+ // jshint -W018
1472
+ if (tripb || !(Math.abs(v) >= (tripn ? 8 : 1) * tol0_) ||
1473
+ numit == maxit2_)
1474
+ break;
1475
+ // Update bracketing values
1476
+ if (v > 0 && (numit < maxit1_ || calp1 / salp1 > calp1b / salp1b)) {
1477
+ salp1b = salp1;
1478
+ calp1b = calp1;
1479
+ }
1480
+ else if (v < 0 &&
1481
+ (numit < maxit1_ || calp1 / salp1 < calp1a / salp1a)) {
1482
+ salp1a = salp1;
1483
+ calp1a = calp1;
1484
+ }
1485
+ if (numit < maxit1_ && dv > 0) {
1486
+ dalp1 = -v / dv;
1487
+ if (Math.abs(dalp1) < Math.PI) {
1488
+ sdalp1 = Math.sin(dalp1);
1489
+ cdalp1 = Math.cos(dalp1);
1490
+ nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
1491
+ if (nsalp1 > 0) {
1492
+ calp1 = calp1 * cdalp1 - salp1 * sdalp1;
1493
+ salp1 = nsalp1;
1494
+ // norm(salp1, calp1);
1495
+ t = m.hypot(salp1, calp1);
1496
+ salp1 /= t;
1497
+ calp1 /= t;
1498
+ // In some regimes we don't get quadratic convergence because
1499
+ // slope -> 0. So use convergence conditions based on epsilon
1500
+ // instead of sqrt(epsilon).
1501
+ tripn = Math.abs(v) <= 16 * tol0_;
1502
+ continue;
1503
+ }
1504
+ }
1505
+ }
1506
+ // Either dv was not positive or updated value was outside legal
1507
+ // range. Use the midpoint of the bracket as the next estimate.
1508
+ // This mechanism is not needed for the WGS84 ellipsoid, but it does
1509
+ // catch problems with more eccentric ellipsoids. Its efficacy is
1510
+ // such for the WGS84 test set with the starting guess set to alp1 =
1511
+ // 90deg:
1512
+ // the WGS84 test set: mean = 5.21, sd = 3.93, max = 24
1513
+ // WGS84 and random input: mean = 4.74, sd = 0.99
1514
+ salp1 = (salp1a + salp1b) / 2;
1515
+ calp1 = (calp1a + calp1b) / 2;
1516
+ // norm(salp1, calp1);
1517
+ t = m.hypot(salp1, calp1);
1518
+ salp1 /= t;
1519
+ calp1 /= t;
1520
+ tripn = false;
1521
+ tripb = (Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ ||
1522
+ Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_);
1523
+ }
1524
+ lengthmask = outmask |
1525
+ (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE) ?
1526
+ g.DISTANCE : g.NONE);
1527
+ nvals = this.Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a);
1528
+ s12x = nvals.s12b;
1529
+ m12x = nvals.m12b;
1530
+ // Ignore m0
1531
+ if (outmask & g.GEODESICSCALE) {
1532
+ vals.M12 = nvals.M12;
1533
+ vals.M21 = nvals.M21;
1534
+ }
1535
+ m12x *= this._b;
1536
+ s12x *= this._b;
1537
+ vals.a12 = sig12 / m.degree;
1538
+ if (outmask & g.AREA) {
1539
+ // omg12 = lam12 - domg12
1540
+ sdomg12 = Math.sin(domg12);
1541
+ cdomg12 = Math.cos(domg12);
1542
+ somg12 = slam12 * cdomg12 - clam12 * sdomg12;
1543
+ comg12 = clam12 * cdomg12 + slam12 * sdomg12;
1544
+ }
1545
+ }
1546
+ }
1547
+ if (outmask & g.DISTANCE)
1548
+ vals.s12 = 0 + s12x; // Convert -0 to 0
1549
+ if (outmask & g.REDUCEDLENGTH)
1550
+ vals.m12 = 0 + m12x; // Convert -0 to 0
1551
+ if (outmask & g.AREA) {
1552
+ // From Lambda12: sin(alp1) * cos(bet1) = sin(alp0)
1553
+ salp0 = salp1 * cbet1;
1554
+ calp0 = m.hypot(calp1, salp1 * sbet1); // calp0 > 0
1555
+ if (calp0 !== 0 && salp0 !== 0) {
1556
+ // From Lambda12: tan(bet) = tan(sig) * cos(alp)
1557
+ ssig1 = sbet1;
1558
+ csig1 = calp1 * cbet1;
1559
+ ssig2 = sbet2;
1560
+ csig2 = calp2 * cbet2;
1561
+ k2 = m.sq(calp0) * this._ep2;
1562
+ eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1563
+ // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0).
1564
+ A4 = m.sq(this.a) * calp0 * salp0 * this._e2;
1565
+ // norm(ssig1, csig1);
1566
+ t = m.hypot(ssig1, csig1);
1567
+ ssig1 /= t;
1568
+ csig1 /= t;
1569
+ // norm(ssig2, csig2);
1570
+ t = m.hypot(ssig2, csig2);
1571
+ ssig2 /= t;
1572
+ csig2 /= t;
1573
+ C4a = new Array(g.nC4_);
1574
+ this.C4f(eps, C4a);
1575
+ B41 = g.SinCosSeries(false, ssig1, csig1, C4a);
1576
+ B42 = g.SinCosSeries(false, ssig2, csig2, C4a);
1577
+ vals.S12 = A4 * (sig12 < 0.01 ?
1578
+ g.SinCosSeries(false, ssig1, csig1, C4a, sig12) : B42 - B41);
1579
+ }
1580
+ else
1581
+ // Avoid problems with indeterminate sig1, sig2 on equator
1582
+ vals.S12 = 0;
1583
+ if (!meridian && somg12 == 2) {
1584
+ somg12 = Math.sin(omg12);
1585
+ comg12 = Math.cos(omg12);
1586
+ }
1587
+ if (!meridian &&
1588
+ comg12 > -0.7071 && // Long difference not too big
1589
+ sbet2 - sbet1 < 1.75) { // Lat difference not too big
1590
+ // Use tan(Gamma/2) = tan(omg12/2)
1591
+ // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2))
1592
+ // with tan(x/2) = sin(x)/(1+cos(x))
1593
+ domg12 = 1 + comg12;
1594
+ dbet1 = 1 + cbet1;
1595
+ dbet2 = 1 + cbet2;
1596
+ alp12 = 2 * Math.atan2(somg12 * (sbet1 * dbet2 + sbet2 * dbet1), domg12 * (sbet1 * sbet2 + dbet1 * dbet2));
1597
+ }
1598
+ else {
1599
+ // alp12 = alp2 - alp1, used in atan2 so no need to normalize
1600
+ salp12 = salp2 * calp1 - calp2 * salp1;
1601
+ calp12 = calp2 * calp1 + salp2 * salp1;
1602
+ // The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz
1603
+ // salp12 = -0 and alp12 = -180. However this depends on the sign
1604
+ // being attached to 0 correctly. The following ensures the correct
1605
+ // behavior.
1606
+ if (salp12 === 0 && calp12 < 0) {
1607
+ salp12 = g.tiny_ * calp1;
1608
+ calp12 = -1;
1609
+ }
1610
+ alp12 = Math.atan2(salp12, calp12);
1611
+ }
1612
+ vals.S12 += this._c2 * alp12;
1613
+ vals.S12 *= swapp * lonsign * latsign;
1614
+ // Convert -0 to 0
1615
+ vals.S12 += 0;
1616
+ }
1617
+ // Convert calp, salp to azimuth accounting for lonsign, swapp, latsign.
1618
+ if (swapp < 0) {
1619
+ [salp2, salp1] = [salp1, salp2]; // swap(salp1, salp2);
1620
+ [calp2, calp1] = [calp1, calp2]; // swap(calp1, calp2);
1621
+ if (outmask & g.GEODESICSCALE) {
1622
+ [vals.M21, vals.M12] = [vals.M12, vals.M21]; //swap(vals.M12, vals.M21);
1623
+ }
1624
+ }
1625
+ salp1 *= swapp * lonsign;
1626
+ calp1 *= swapp * latsign;
1627
+ salp2 *= swapp * lonsign;
1628
+ calp2 *= swapp * latsign;
1629
+ return { vals: vals,
1630
+ salp1: salp1, calp1: calp1,
1631
+ salp2: salp2, calp2: calp2 };
1632
+ };
1633
+ /**
1634
+ * @summary Solve the general direct geodesic problem.
1635
+ * @param {number} lat1 the latitude of the first point in degrees.
1636
+ * @param {number} lon1 the longitude of the first point in degrees.
1637
+ * @param {number} azi1 the azimuth at the first point in degrees.
1638
+ * @param {bool} arcmode is the next parameter an arc length?
1639
+ * @param {number} s12_a12 the (arcmode ? arc length : distance) from the
1640
+ * first point to the second in (arcmode ? degrees : meters).
1641
+ * @param {bitmask} [outmask = STANDARD] which results to include.
1642
+ * @return {object} the requested results.
1643
+ * @description The lat1, lon1, azi1, and a12 fields of the result are always
1644
+ * set; s12 is included if arcmode is false. For details on the outmask
1645
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1646
+ * parameters".
1647
+ */
1648
+ g.Geodesic.prototype.GenDirect = function (lat1, lon1, azi1, arcmode, s12_a12, outmask) {
1649
+ var line;
1650
+ if (!outmask)
1651
+ outmask = g.STANDARD;
1652
+ else if (outmask === g.LONG_UNROLL)
1653
+ outmask |= g.STANDARD;
1654
+ // Automatically supply DISTANCE_IN if necessary
1655
+ if (!arcmode)
1656
+ outmask |= g.DISTANCE_IN;
1657
+ line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask);
1658
+ return line.GenPosition(arcmode, s12_a12, outmask);
1659
+ };
1660
+ /**
1661
+ * @summary Solve the direct geodesic problem.
1662
+ * @param {number} lat1 the latitude of the first point in degrees.
1663
+ * @param {number} lon1 the longitude of the first point in degrees.
1664
+ * @param {number} azi1 the azimuth at the first point in degrees.
1665
+ * @param {number} s12 the distance from the first point to the second in
1666
+ * meters.
1667
+ * @param {bitmask} [outmask = STANDARD] which results to include.
1668
+ * @return {object} the requested results.
1669
+ * @description The lat1, lon1, azi1, s12, and a12 fields of the result are
1670
+ * always set. For details on the outmask parameter, see {@tutorial
1671
+ * 2-interface}, "The outmask and caps parameters".
1672
+ */
1673
+ g.Geodesic.prototype.Direct = function (lat1, lon1, azi1, s12, outmask) {
1674
+ return this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
1675
+ };
1676
+ /**
1677
+ * @summary Solve the direct geodesic problem with arc length.
1678
+ * @param {number} lat1 the latitude of the first point in degrees.
1679
+ * @param {number} lon1 the longitude of the first point in degrees.
1680
+ * @param {number} azi1 the azimuth at the first point in degrees.
1681
+ * @param {number} a12 the arc length from the first point to the second in
1682
+ * degrees.
1683
+ * @param {bitmask} [outmask = STANDARD] which results to include.
1684
+ * @return {object} the requested results.
1685
+ * @description The lat1, lon1, azi1, and a12 fields of the result are
1686
+ * always set. For details on the outmask parameter, see {@tutorial
1687
+ * 2-interface}, "The outmask and caps parameters".
1688
+ */
1689
+ g.Geodesic.prototype.ArcDirect = function (lat1, lon1, azi1, a12, outmask) {
1690
+ return this.GenDirect(lat1, lon1, azi1, true, a12, outmask);
1691
+ };
1692
+ /**
1693
+ * @summary Create a {@link module:geodesic/GeodesicLine.GeodesicLine
1694
+ * GeodesicLine} object.
1695
+ * @param {number} lat1 the latitude of the first point in degrees.
1696
+ * @param {number} lon1 the longitude of the first point in degrees.
1697
+ * @param {number} azi1 the azimuth at the first point in degrees.
1698
+ * degrees.
1699
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1700
+ * include.
1701
+ * @return {object} the
1702
+ * {@link module:geodesic/GeodesicLine.GeodesicLine
1703
+ * GeodesicLine} object
1704
+ * @description For details on the caps parameter, see {@tutorial
1705
+ * 2-interface}, "The outmask and caps parameters".
1706
+ */
1707
+ g.Geodesic.prototype.Line = function (lat1, lon1, azi1, caps) {
1708
+ return new l.GeodesicLine(this, lat1, lon1, azi1, caps);
1709
+ };
1710
+ /**
1711
+ * @summary Define a {@link module:geodesic/GeodesicLine.GeodesicLine
1712
+ * GeodesicLine} in terms of the direct geodesic problem specified in terms
1713
+ * of distance.
1714
+ * @param {number} lat1 the latitude of the first point in degrees.
1715
+ * @param {number} lon1 the longitude of the first point in degrees.
1716
+ * @param {number} azi1 the azimuth at the first point in degrees.
1717
+ * degrees.
1718
+ * @param {number} s12 the distance between point 1 and point 2 (meters); it
1719
+ * can be negative.
1720
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1721
+ * include.
1722
+ * @return {object} the
1723
+ * {@link module:geodesic/GeodesicLine.GeodesicLine
1724
+ * GeodesicLine} object
1725
+ * @description This function sets point 3 of the GeodesicLine to correspond
1726
+ * to point 2 of the direct geodesic problem. For details on the caps
1727
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1728
+ * parameters".
1729
+ */
1730
+ g.Geodesic.prototype.DirectLine = function (lat1, lon1, azi1, s12, caps) {
1731
+ return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps);
1732
+ };
1733
+ /**
1734
+ * @summary Define a {@link module:geodesic/GeodesicLine.GeodesicLine
1735
+ * GeodesicLine} in terms of the direct geodesic problem specified in terms
1736
+ * of arc length.
1737
+ * @param {number} lat1 the latitude of the first point in degrees.
1738
+ * @param {number} lon1 the longitude of the first point in degrees.
1739
+ * @param {number} azi1 the azimuth at the first point in degrees.
1740
+ * degrees.
1741
+ * @param {number} a12 the arc length between point 1 and point 2 (degrees);
1742
+ * it can be negative.
1743
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1744
+ * include.
1745
+ * @return {object} the
1746
+ * {@link module:geodesic/GeodesicLine.GeodesicLine
1747
+ * GeodesicLine} object
1748
+ * @description This function sets point 3 of the GeodesicLine to correspond
1749
+ * to point 2 of the direct geodesic problem. For details on the caps
1750
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1751
+ * parameters".
1752
+ */
1753
+ g.Geodesic.prototype.ArcDirectLine = function (lat1, lon1, azi1, a12, caps) {
1754
+ return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps);
1755
+ };
1756
+ /**
1757
+ * @summary Define a {@link module:geodesic/GeodesicLine.GeodesicLine
1758
+ * GeodesicLine} in terms of the direct geodesic problem specified in terms
1759
+ * of either distance or arc length.
1760
+ * @param {number} lat1 the latitude of the first point in degrees.
1761
+ * @param {number} lon1 the longitude of the first point in degrees.
1762
+ * @param {number} azi1 the azimuth at the first point in degrees.
1763
+ * degrees.
1764
+ * @param {bool} arcmode boolean flag determining the meaning of the
1765
+ * s12_a12.
1766
+ * @param {number} s12_a12 if arcmode is false, this is the distance between
1767
+ * point 1 and point 2 (meters); otherwise it is the arc length between
1768
+ * point 1 and point 2 (degrees); it can be negative.
1769
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1770
+ * include.
1771
+ * @return {object} the
1772
+ * {@link module:geodesic/GeodesicLine.GeodesicLine
1773
+ * GeodesicLine} object
1774
+ * @description This function sets point 3 of the GeodesicLine to correspond
1775
+ * to point 2 of the direct geodesic problem. For details on the caps
1776
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1777
+ * parameters".
1778
+ */
1779
+ g.Geodesic.prototype.GenDirectLine = function (lat1, lon1, azi1, arcmode, s12_a12, caps) {
1780
+ var t;
1781
+ if (!caps)
1782
+ caps = g.STANDARD | g.DISTANCE_IN;
1783
+ // Automatically supply DISTANCE_IN if necessary
1784
+ if (!arcmode)
1785
+ caps |= g.DISTANCE_IN;
1786
+ t = new l.GeodesicLine(this, lat1, lon1, azi1, caps);
1787
+ t.GenSetDistance(arcmode, s12_a12);
1788
+ return t;
1789
+ };
1790
+ /**
1791
+ * @summary Define a {@link module:geodesic/GeodesicLine.GeodesicLine
1792
+ * GeodesicLine} in terms of the inverse geodesic problem.
1793
+ * @param {number} lat1 the latitude of the first point in degrees.
1794
+ * @param {number} lon1 the longitude of the first point in degrees.
1795
+ * @param {number} lat2 the latitude of the second point in degrees.
1796
+ * @param {number} lon2 the longitude of the second point in degrees.
1797
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1798
+ * include.
1799
+ * @return {object} the
1800
+ * {@link module:geodesic/GeodesicLine.GeodesicLine
1801
+ * GeodesicLine} object
1802
+ * @description This function sets point 3 of the GeodesicLine to correspond
1803
+ * to point 2 of the inverse geodesic problem. For details on the caps
1804
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1805
+ * parameters".
1806
+ */
1807
+ g.Geodesic.prototype.InverseLine = function (lat1, lon1, lat2, lon2, caps) {
1808
+ var r, t, azi1;
1809
+ if (!caps)
1810
+ caps = g.STANDARD | g.DISTANCE_IN;
1811
+ r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC);
1812
+ azi1 = m.atan2d(r.salp1, r.calp1);
1813
+ // Ensure that a12 can be converted to a distance
1814
+ if (caps & (g.OUT_MASK & g.DISTANCE_IN))
1815
+ caps |= g.DISTANCE;
1816
+ t = new l.GeodesicLine(this, lat1, lon1, azi1, caps, r.salp1, r.calp1);
1817
+ t.SetArc(r.vals.a12);
1818
+ return t;
1819
+ };
1820
+ /**
1821
+ * @summary Create a {@link module:geodesic/PolygonArea.PolygonArea
1822
+ * PolygonArea} object.
1823
+ * @param {bool} [polyline = false] if true the new PolygonArea object
1824
+ * describes a polyline instead of a polygon.
1825
+ * @return {object} the
1826
+ * {@link module:geodesic/PolygonArea.PolygonArea
1827
+ * PolygonArea} object
1828
+ */
1829
+ g.Geodesic.prototype.Polygon = function (polyline) {
1830
+ return new p.PolygonArea(this, polyline);
1831
+ };
1832
+ /**
1833
+ * @summary a {@link module:geodesic/Geodesic.Geodesic Geodesic} object
1834
+ * initialized for the WGS84 ellipsoid.
1835
+ * @constant {object}
1836
+ */
1837
+ g.WGS84 = new g.Geodesic(c.WGS84.a, c.WGS84.f);
1838
+ })(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.PolygonArea, geodesic.Math, geodesic.Constants);
1839
+ /*
1840
+ * GeodesicLine.js
1841
+ * Transcription of GeodesicLine.[ch]pp into JavaScript.
1842
+ *
1843
+ * See the documentation for the C++ class. The conversion is a literal
1844
+ * conversion from C++.
1845
+ *
1846
+ * The algorithms are derived in
1847
+ *
1848
+ * Charles F. F. Karney,
1849
+ * Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
1850
+ * https://doi.org/10.1007/s00190-012-0578-z
1851
+ * Addenda: https://geographiclib.sourceforge.io/geod-addenda.html
1852
+ *
1853
+ * Copyright (c) Charles Karney (2011-2022) <karney@alum.mit.edu> and licensed
1854
+ * under the MIT/X11 License. For more information, see
1855
+ * https://geographiclib.sourceforge.io/
1856
+ */
1857
+ // Load AFTER geodesic/Math.js, geodesic/Geodesic.js
1858
+ (function (g,
1859
+ /**
1860
+ * @exports geodesic/GeodesicLine
1861
+ * @description Solve geodesic problems on a single geodesic line via the
1862
+ * {@link module:geodesic/GeodesicLine.GeodesicLine GeodesicLine}
1863
+ * class.
1864
+ */
1865
+ l, m) {
1866
+ "use strict";
1867
+ /**
1868
+ * @class
1869
+ * @property {number} a the equatorial radius (meters).
1870
+ * @property {number} f the flattening.
1871
+ * @property {number} lat1 the initial latitude (degrees).
1872
+ * @property {number} lon1 the initial longitude (degrees).
1873
+ * @property {number} azi1 the initial azimuth (degrees).
1874
+ * @property {number} salp1 the sine of the azimuth at the first point.
1875
+ * @property {number} calp1 the cosine the azimuth at the first point.
1876
+ * @property {number} s13 the distance to point 3 (meters).
1877
+ * @property {number} a13 the arc length to point 3 (degrees).
1878
+ * @property {bitmask} caps the capabilities of the object.
1879
+ * @summary Initialize a GeodesicLine object. For details on the caps
1880
+ * parameter, see {@tutorial 2-interface}, "The outmask and caps
1881
+ * parameters".
1882
+ * @classdesc Performs geodesic calculations along a given geodesic line.
1883
+ * This object is usually instantiated by
1884
+ * {@link module:geodesic/Geodesic.Geodesic#Line Geodesic.Line}.
1885
+ * The methods
1886
+ * {@link module:geodesic/Geodesic.Geodesic#DirectLine
1887
+ * Geodesic.DirectLine} and
1888
+ * {@link module:geodesic/Geodesic.Geodesic#InverseLine
1889
+ * Geodesic.InverseLine} set in addition the position of a reference point
1890
+ * 3.
1891
+ * @param {object} geod a {@link module:geodesic/Geodesic.Geodesic
1892
+ * Geodesic} object.
1893
+ * @param {number} lat1 the latitude of the first point in degrees.
1894
+ * @param {number} lon1 the longitude of the first point in degrees.
1895
+ * @param {number} azi1 the azimuth at the first point in degrees.
1896
+ * @param {bitmask} [caps = STANDARD | DISTANCE_IN] which capabilities to
1897
+ * include; LATITUDE | AZIMUTH are always included.
1898
+ */
1899
+ l.GeodesicLine = function (geod, lat1, lon1, azi1, caps, salp1, calp1) {
1900
+ var t, cbet1, sbet1, eps, s, c;
1901
+ if (!caps)
1902
+ caps = g.STANDARD | g.DISTANCE_IN;
1903
+ this.a = geod.a;
1904
+ this.f = geod.f;
1905
+ this._b = geod._b;
1906
+ this._c2 = geod._c2;
1907
+ this._f1 = geod._f1;
1908
+ this.caps = caps | g.LATITUDE | g.AZIMUTH | g.LONG_UNROLL;
1909
+ this.lat1 = m.LatFix(lat1);
1910
+ this.lon1 = lon1;
1911
+ if (typeof salp1 === 'undefined' || typeof calp1 === 'undefined') {
1912
+ this.azi1 = m.AngNormalize(azi1);
1913
+ t = m.sincosd(m.AngRound(this.azi1));
1914
+ this.salp1 = t.s;
1915
+ this.calp1 = t.c;
1916
+ }
1917
+ else {
1918
+ this.azi1 = azi1;
1919
+ this.salp1 = salp1;
1920
+ this.calp1 = calp1;
1921
+ }
1922
+ t = m.sincosd(m.AngRound(this.lat1));
1923
+ sbet1 = this._f1 * t.s;
1924
+ cbet1 = t.c;
1925
+ // norm(sbet1, cbet1);
1926
+ t = m.hypot(sbet1, cbet1);
1927
+ sbet1 /= t;
1928
+ cbet1 /= t;
1929
+ // Ensure cbet1 = +epsilon at poles
1930
+ cbet1 = Math.max(g.tiny_, cbet1);
1931
+ this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1));
1932
+ // Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0),
1933
+ this._salp0 = this.salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|]
1934
+ // Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following
1935
+ // is slightly better (consider the case salp1 = 0).
1936
+ this._calp0 = m.hypot(this.calp1, this.salp1 * sbet1);
1937
+ // Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1).
1938
+ // sig = 0 is nearest northward crossing of equator.
1939
+ // With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line).
1940
+ // With bet1 = pi/2, alp1 = -pi, sig1 = pi/2
1941
+ // With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2
1942
+ // Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1).
1943
+ // With alp0 in (0, pi/2], quadrants for sig and omg coincide.
1944
+ // No atan2(0,0) ambiguity at poles since cbet1 = +epsilon.
1945
+ // With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi.
1946
+ this._ssig1 = sbet1;
1947
+ this._somg1 = this._salp0 * sbet1;
1948
+ this._csig1 = this._comg1 =
1949
+ sbet1 !== 0 || this.calp1 !== 0 ? cbet1 * this.calp1 : 1;
1950
+ // norm(this._ssig1, this._csig1); // sig1 in (-pi, pi]
1951
+ t = m.hypot(this._ssig1, this._csig1);
1952
+ this._ssig1 /= t;
1953
+ this._csig1 /= t;
1954
+ // norm(this._somg1, this._comg1); -- don't need to normalize!
1955
+ this._k2 = m.sq(this._calp0) * geod._ep2;
1956
+ eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2);
1957
+ if (this.caps & g.CAP_C1) {
1958
+ this._A1m1 = g.A1m1f(eps);
1959
+ this._C1a = new Array(g.nC1_ + 1);
1960
+ g.C1f(eps, this._C1a);
1961
+ this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C1a);
1962
+ s = Math.sin(this._B11);
1963
+ c = Math.cos(this._B11);
1964
+ // tau1 = sig1 + B11
1965
+ this._stau1 = this._ssig1 * c + this._csig1 * s;
1966
+ this._ctau1 = this._csig1 * c - this._ssig1 * s;
1967
+ // Not necessary because C1pa reverts C1a
1968
+ // _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa);
1969
+ }
1970
+ if (this.caps & g.CAP_C1p) {
1971
+ this._C1pa = new Array(g.nC1p_ + 1);
1972
+ g.C1pf(eps, this._C1pa);
1973
+ }
1974
+ if (this.caps & g.CAP_C2) {
1975
+ this._A2m1 = g.A2m1f(eps);
1976
+ this._C2a = new Array(g.nC2_ + 1);
1977
+ g.C2f(eps, this._C2a);
1978
+ this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C2a);
1979
+ }
1980
+ if (this.caps & g.CAP_C3) {
1981
+ this._C3a = new Array(g.nC3_);
1982
+ geod.C3f(eps, this._C3a);
1983
+ this._A3c = -this.f * this._salp0 * geod.A3f(eps);
1984
+ this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C3a);
1985
+ }
1986
+ if (this.caps & g.CAP_C4) {
1987
+ this._C4a = new Array(g.nC4_); // all the elements of _C4a are used
1988
+ geod.C4f(eps, this._C4a);
1989
+ // Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0)
1990
+ this._A4 = m.sq(this.a) * this._calp0 * this._salp0 * geod._e2;
1991
+ this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a);
1992
+ }
1993
+ this.a13 = this.s13 = NaN;
1994
+ };
1995
+ /**
1996
+ * @summary Find the position on the line (general case).
1997
+ * @param {bool} arcmode is the next parameter an arc length?
1998
+ * @param {number} s12_a12 the (arcmode ? arc length : distance) from the
1999
+ * first point to the second in (arcmode ? degrees : meters).
2000
+ * @param {bitmask} [outmask = STANDARD] which results to include; this is
2001
+ * subject to the capabilities of the object.
2002
+ * @return {object} the requested results.
2003
+ * @description The lat1, lon1, azi1, and a12 fields of the result are
2004
+ * always set; s12 is included if arcmode is false. For details on the
2005
+ * outmask parameter, see {@tutorial 2-interface}, "The outmask and caps
2006
+ * parameters".
2007
+ */
2008
+ l.GeodesicLine.prototype.GenPosition = function (arcmode, s12_a12, outmask) {
2009
+ var vals = {}, sig12, ssig12, csig12, B12, AB1, ssig2, csig2, tau12, s, c, serr, omg12, lam12, lon12, E, sbet2, cbet2, somg2, comg2, salp2, calp2, dn2, B22, AB2, J12, t, B42, salp12, calp12;
2010
+ if (!outmask)
2011
+ outmask = g.STANDARD;
2012
+ else if (outmask === g.LONG_UNROLL)
2013
+ outmask |= g.STANDARD;
2014
+ outmask &= this.caps & g.OUT_MASK;
2015
+ vals.lat1 = this.lat1;
2016
+ vals.azi1 = this.azi1;
2017
+ vals.lon1 = outmask & g.LONG_UNROLL ?
2018
+ this.lon1 : m.AngNormalize(this.lon1);
2019
+ if (arcmode)
2020
+ vals.a12 = s12_a12;
2021
+ else
2022
+ vals.s12 = s12_a12;
2023
+ if (!(arcmode || (this.caps & g.DISTANCE_IN & g.OUT_MASK))) {
2024
+ // Uninitialized or impossible distance calculation requested
2025
+ vals.a12 = NaN;
2026
+ return vals;
2027
+ }
2028
+ // Avoid warning about uninitialized B12.
2029
+ B12 = 0;
2030
+ AB1 = 0;
2031
+ if (arcmode) {
2032
+ // Interpret s12_a12 as spherical arc length
2033
+ sig12 = s12_a12 * m.degree;
2034
+ t = m.sincosd(s12_a12);
2035
+ ssig12 = t.s;
2036
+ csig12 = t.c;
2037
+ }
2038
+ else {
2039
+ // Interpret s12_a12 as distance
2040
+ tau12 = s12_a12 / (this._b * (1 + this._A1m1));
2041
+ s = Math.sin(tau12);
2042
+ c = Math.cos(tau12);
2043
+ // tau2 = tau1 + tau12
2044
+ B12 = -g.SinCosSeries(true, this._stau1 * c + this._ctau1 * s, this._ctau1 * c - this._stau1 * s, this._C1pa);
2045
+ sig12 = tau12 - (B12 - this._B11);
2046
+ ssig12 = Math.sin(sig12);
2047
+ csig12 = Math.cos(sig12);
2048
+ if (Math.abs(this.f) > 0.01) {
2049
+ // Reverted distance series is inaccurate for |f| > 1/100, so correct
2050
+ // sig12 with 1 Newton iteration. The following table shows the
2051
+ // approximate maximum error for a = WGS_a() and various f relative to
2052
+ // GeodesicExact.
2053
+ // erri = the error in the inverse solution (nm)
2054
+ // errd = the error in the direct solution (series only) (nm)
2055
+ // errda = the error in the direct solution
2056
+ // (series + 1 Newton) (nm)
2057
+ //
2058
+ // f erri errd errda
2059
+ // -1/5 12e6 1.2e9 69e6
2060
+ // -1/10 123e3 12e6 765e3
2061
+ // -1/20 1110 108e3 7155
2062
+ // -1/50 18.63 200.9 27.12
2063
+ // -1/100 18.63 23.78 23.37
2064
+ // -1/150 18.63 21.05 20.26
2065
+ // 1/150 22.35 24.73 25.83
2066
+ // 1/100 22.35 25.03 25.31
2067
+ // 1/50 29.80 231.9 30.44
2068
+ // 1/20 5376 146e3 10e3
2069
+ // 1/10 829e3 22e6 1.5e6
2070
+ // 1/5 157e6 3.8e9 280e6
2071
+ ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
2072
+ csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
2073
+ B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
2074
+ serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) -
2075
+ s12_a12 / this._b;
2076
+ sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2));
2077
+ ssig12 = Math.sin(sig12);
2078
+ csig12 = Math.cos(sig12);
2079
+ // Update B12 below
2080
+ }
2081
+ }
2082
+ // sig2 = sig1 + sig12
2083
+ ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
2084
+ csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
2085
+ dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2));
2086
+ if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
2087
+ if (arcmode || Math.abs(this.f) > 0.01)
2088
+ B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
2089
+ AB1 = (1 + this._A1m1) * (B12 - this._B11);
2090
+ }
2091
+ // sin(bet2) = cos(alp0) * sin(sig2)
2092
+ sbet2 = this._calp0 * ssig2;
2093
+ // Alt: cbet2 = hypot(csig2, salp0 * ssig2);
2094
+ cbet2 = m.hypot(this._salp0, this._calp0 * csig2);
2095
+ if (cbet2 === 0)
2096
+ // I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case
2097
+ cbet2 = csig2 = g.tiny_;
2098
+ // tan(alp0) = cos(sig2)*tan(alp2)
2099
+ salp2 = this._salp0;
2100
+ calp2 = this._calp0 * csig2; // No need to normalize
2101
+ if (arcmode && (outmask & g.DISTANCE))
2102
+ vals.s12 = this._b * ((1 + this._A1m1) * sig12 + AB1);
2103
+ if (outmask & g.LONGITUDE) {
2104
+ // tan(omg2) = sin(alp0) * tan(sig2)
2105
+ somg2 = this._salp0 * ssig2;
2106
+ comg2 = csig2; // No need to normalize
2107
+ E = m.copysign(1, this._salp0);
2108
+ // omg12 = omg2 - omg1
2109
+ omg12 = outmask & g.LONG_UNROLL ?
2110
+ E * (sig12 -
2111
+ (Math.atan2(ssig2, csig2) -
2112
+ Math.atan2(this._ssig1, this._csig1)) +
2113
+ (Math.atan2(E * somg2, comg2) -
2114
+ Math.atan2(E * this._somg1, this._comg1))) :
2115
+ Math.atan2(somg2 * this._comg1 - comg2 * this._somg1, comg2 * this._comg1 + somg2 * this._somg1);
2116
+ lam12 = omg12 + this._A3c *
2117
+ (sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a) -
2118
+ this._B31));
2119
+ lon12 = lam12 / m.degree;
2120
+ vals.lon2 = outmask & g.LONG_UNROLL ? this.lon1 + lon12 :
2121
+ m.AngNormalize(m.AngNormalize(this.lon1) + m.AngNormalize(lon12));
2122
+ }
2123
+ if (outmask & g.LATITUDE)
2124
+ vals.lat2 = m.atan2d(sbet2, this._f1 * cbet2);
2125
+ if (outmask & g.AZIMUTH)
2126
+ vals.azi2 = m.atan2d(salp2, calp2);
2127
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
2128
+ B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a);
2129
+ AB2 = (1 + this._A2m1) * (B22 - this._B21);
2130
+ J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2);
2131
+ if (outmask & g.REDUCEDLENGTH)
2132
+ // Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure
2133
+ // accurate cancellation in the case of coincident points.
2134
+ vals.m12 = this._b * ((dn2 * (this._csig1 * ssig2) -
2135
+ this._dn1 * (this._ssig1 * csig2)) -
2136
+ this._csig1 * csig2 * J12);
2137
+ if (outmask & g.GEODESICSCALE) {
2138
+ t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) /
2139
+ (this._dn1 + dn2);
2140
+ vals.M12 = csig12 +
2141
+ (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1;
2142
+ vals.M21 = csig12 -
2143
+ (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2;
2144
+ }
2145
+ }
2146
+ if (outmask & g.AREA) {
2147
+ B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a);
2148
+ if (this._calp0 === 0 || this._salp0 === 0) {
2149
+ // alp12 = alp2 - alp1, used in atan2 so no need to normalize
2150
+ salp12 = salp2 * this.calp1 - calp2 * this.salp1;
2151
+ calp12 = calp2 * this.calp1 + salp2 * this.salp1;
2152
+ }
2153
+ else {
2154
+ // tan(alp) = tan(alp0) * sec(sig)
2155
+ // tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1)
2156
+ // = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2)
2157
+ // If csig12 > 0, write
2158
+ // csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1)
2159
+ // else
2160
+ // csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1
2161
+ // No need to normalize
2162
+ salp12 = this._calp0 * this._salp0 *
2163
+ (csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 :
2164
+ ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1));
2165
+ calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2;
2166
+ }
2167
+ vals.S12 = this._c2 * Math.atan2(salp12, calp12) +
2168
+ this._A4 * (Math.abs(sig12) < 0.01 ?
2169
+ g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a, sig12) : B42 - this._B41);
2170
+ }
2171
+ if (!arcmode)
2172
+ vals.a12 = sig12 / m.degree;
2173
+ return vals;
2174
+ };
2175
+ /**
2176
+ * @summary Find the position on the line given s12.
2177
+ * @param {number} s12 the distance from the first point to the second in
2178
+ * meters.
2179
+ * @param {bitmask} [outmask = STANDARD] which results to include; this is
2180
+ * subject to the capabilities of the object.
2181
+ * @return {object} the requested results.
2182
+ * @description The lat1, lon1, azi1, s12, and a12 fields of the result are
2183
+ * always set; s12 is included if arcmode is false. For details on the
2184
+ * outmask parameter, see {@tutorial 2-interface}, "The outmask and caps
2185
+ * parameters".
2186
+ */
2187
+ l.GeodesicLine.prototype.Position = function (s12, outmask) {
2188
+ return this.GenPosition(false, s12, outmask);
2189
+ };
2190
+ /**
2191
+ * @summary Find the position on the line given a12.
2192
+ * @param {number} a12 the arc length from the first point to the second in
2193
+ * degrees.
2194
+ * @param {bitmask} [outmask = STANDARD] which results to include; this is
2195
+ * subject to the capabilities of the object.
2196
+ * @return {object} the requested results.
2197
+ * @description The lat1, lon1, azi1, and a12 fields of the result are
2198
+ * always set. For details on the outmask parameter, see {@tutorial
2199
+ * 2-interface}, "The outmask and caps parameters".
2200
+ */
2201
+ l.GeodesicLine.prototype.ArcPosition = function (a12, outmask) {
2202
+ return this.GenPosition(true, a12, outmask);
2203
+ };
2204
+ /**
2205
+ * @summary Specify position of point 3 in terms of either distance or arc
2206
+ * length.
2207
+ * @param {bool} arcmode boolean flag determining the meaning of the second
2208
+ * parameter; if arcmode is false, then the GeodesicLine object must have
2209
+ * been constructed with caps |= DISTANCE_IN.
2210
+ * @param {number} s13_a13 if arcmode is false, this is the distance from
2211
+ * point 1 to point 3 (meters); otherwise it is the arc length from
2212
+ * point 1 to point 3 (degrees); it can be negative.
2213
+ */
2214
+ l.GeodesicLine.prototype.GenSetDistance = function (arcmode, s13_a13) {
2215
+ if (arcmode)
2216
+ this.SetArc(s13_a13);
2217
+ else
2218
+ this.SetDistance(s13_a13);
2219
+ };
2220
+ /**
2221
+ * @summary Specify position of point 3 in terms distance.
2222
+ * @param {number} s13 the distance from point 1 to point 3 (meters); it
2223
+ * can be negative.
2224
+ */
2225
+ l.GeodesicLine.prototype.SetDistance = function (s13) {
2226
+ var r;
2227
+ this.s13 = s13;
2228
+ r = this.GenPosition(false, this.s13, g.ARC);
2229
+ this.a13 = 0 + r.a12; // the 0+ converts undefined into NaN
2230
+ };
2231
+ /**
2232
+ * @summary Specify position of point 3 in terms of arc length.
2233
+ * @param {number} a13 the arc length from point 1 to point 3 (degrees);
2234
+ * it can be negative.
2235
+ */
2236
+ l.GeodesicLine.prototype.SetArc = function (a13) {
2237
+ var r;
2238
+ this.a13 = a13;
2239
+ r = this.GenPosition(true, this.a13, g.DISTANCE);
2240
+ this.s13 = 0 + r.s12; // the 0+ converts undefined into NaN
2241
+ };
2242
+ })(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.Math);
2243
+ export { geodesic };
2244
+ //# sourceMappingURL=runtime.js.map