@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
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,29 +14,32 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
 
29
19
  // dist/entries/ellipsoid.js
30
20
  var ellipsoid_exports = {};
31
21
  __export(ellipsoid_exports, {
32
22
  Ellipsoid: () => Ellipsoid,
23
+ EllipsoidGeodesic: () => EllipsoidGeodesic,
24
+ EllipsoidMetrics: () => EllipsoidMetrics,
25
+ EllipsoidRhumb: () => EllipsoidRhumb,
33
26
  EllipsoidTangentPlane: () => EllipsoidTangentPlane,
34
- isWGS84: () => isWGS84
27
+ GeodesicIntersections: () => GeodesicIntersections,
28
+ GeodesicPath: () => GeodesicPath,
29
+ GeodesicPolygon: () => GeodesicPolygon,
30
+ LocalReferenceFrame: () => LocalReferenceFrame,
31
+ RhumbDomainError: () => RhumbDomainError,
32
+ RhumbPath: () => RhumbPath,
33
+ RhumbPolygon: () => RhumbPolygon,
34
+ eastNorthUpToFixedFrame: () => eastNorthUpToFixedFrame,
35
+ isWGS84: () => isWGS84,
36
+ localFrameToFixedFrame: () => localFrameToFixedFrame2
35
37
  });
36
38
  module.exports = __toCommonJS(ellipsoid_exports);
37
39
 
38
40
  // dist/ellipsoid.js
39
- var import_core4 = require("@math.gl/core");
41
+ var import_core3 = require("@math.gl/core");
40
42
  var import_spheroid = require("@math.gl/core/spheroid");
41
- var vec3 = __toESM(require("@math.gl/core/vec3"), 1);
42
43
 
43
44
  // dist/constants.js
44
45
  var WGS84_RADIUS_X = 6378137;
@@ -117,212 +118,220 @@ function isWGS84(vector) {
117
118
  return Math.abs(x2 + y2 + z2 - 1) < centerToleranceSquared;
118
119
  }
119
120
 
120
- // dist/ellipsoid-helpers/ellipsoid-transform.js
121
+ // dist/ellipsoid-helpers/scale-to-geodetic-surface.js
121
122
  var import_core2 = require("@math.gl/core");
122
- var import_local_frame = require("@math.gl/core/local-frame");
123
- var EPSILON14 = 1e-14;
124
- var scratchOrigin = new import_core2.Vector3();
125
- var scratchBasis = (0, import_local_frame.createLocalFrameBasis)();
126
- var VECTOR_PRODUCT_LOCAL_FRAME = {
127
- up: {
128
- south: "east",
129
- north: "west",
130
- west: "south",
131
- east: "north"
132
- },
133
- down: {
134
- south: "west",
135
- north: "east",
136
- west: "north",
137
- east: "south"
138
- },
139
- south: {
140
- up: "west",
141
- down: "east",
142
- west: "down",
143
- east: "up"
144
- },
145
- north: {
146
- up: "east",
147
- down: "west",
148
- west: "up",
149
- east: "down"
150
- },
151
- west: {
152
- up: "north",
153
- down: "south",
154
- north: "down",
155
- south: "up"
156
- },
157
- east: {
158
- up: "south",
159
- down: "north",
160
- north: "up",
161
- south: "down"
162
- }
163
- };
164
- var degeneratePositionLocalFrame = {
165
- north: [-1, 0, 0],
166
- east: [0, 1, 0],
167
- up: [0, 0, 1],
168
- south: [1, 0, 0],
169
- west: [0, -1, 0],
170
- down: [0, 0, -1]
171
- };
172
- var scratchAxisVectors = {
173
- east: new import_core2.Vector3(),
174
- north: new import_core2.Vector3(),
175
- up: new import_core2.Vector3(),
176
- west: new import_core2.Vector3(),
177
- south: new import_core2.Vector3(),
178
- down: new import_core2.Vector3()
179
- };
180
- var scratchVector1 = new import_core2.Vector3();
181
- var scratchVector2 = new import_core2.Vector3();
182
- var scratchVector3 = new import_core2.Vector3();
183
- function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
184
- const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
185
- (0, import_core2.assert)(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
186
- let firstAxisVector;
187
- let secondAxisVector;
188
- let thirdAxisVector;
189
- const origin = scratchOrigin.copy(cartesianOrigin);
190
- const atPole = (0, import_core2.equals)(origin.x, 0, EPSILON14) && (0, import_core2.equals)(origin.y, 0, EPSILON14);
191
- const radii = ellipsoid.radii;
192
- if (radii.x === radii.y && radii.x > 0 && radii.z > 0 && radii.z <= radii.x && (!atPole || origin.z !== 0)) {
193
- const { east, up } = scratchAxisVectors;
194
- if (atPole) {
195
- east.set(0, 1, 0);
196
- up.set(0, 0, Math.sign(origin.z));
197
- } else {
198
- east.set(-origin.y, origin.x, 0).normalize();
199
- ellipsoid.geodeticSurfaceNormal(origin, up);
123
+
124
+ // dist/ellipsoid-helpers/exact-nearest-surface.js
125
+ function exactNearestSurface(x, y, z, a, b, c, result) {
126
+ const values = [a, b, c, Math.abs(x), Math.abs(y), Math.abs(z)];
127
+ const parts = values.map((value) => {
128
+ const bits = value.toString(2);
129
+ const dot2 = bits.indexOf(".");
130
+ return {
131
+ integer: BigInt("0b" + bits.replace(".", "")),
132
+ exponent: dot2 < 0 ? 0 : dot2 + 1 - bits.length
133
+ };
134
+ });
135
+ const exponent = Math.min(...parts.filter((p) => p.integer !== 0n).map((p) => p.exponent));
136
+ const integers = parts.map((p) => p.integer << BigInt(p.exponent - exponent));
137
+ const squares = integers.slice(0, 3).map((v) => v * v);
138
+ const minimum = squares.reduce((p, v) => p < v ? p : v);
139
+ const offsets = squares.map((v) => v - minimum);
140
+ const products = squares.map((_, i) => integers[i] * integers[i + 3]);
141
+ let precision = 64;
142
+ if (!products.some((u3, i) => offsets[i] === 0n && u3 !== 0n)) {
143
+ let numerator = -1n, denominator = 1n;
144
+ for (let i = 0; i < 3; i++) {
145
+ if (offsets[i] === 0n)
146
+ continue;
147
+ const d2 = offsets[i] * offsets[i];
148
+ numerator = numerator * d2 + products[i] * products[i] * denominator;
149
+ denominator *= d2;
200
150
  }
201
- if (!(0, import_local_frame.eastNorthUpBasisFromDirections)(east, up, scratchBasis) || !(0, import_local_frame.localFrameToMatrix)(scratchBasis, origin, firstAxis, secondAxis, thirdAxis, result))
202
- throw new Error("Unsupported local frame");
203
- return result;
204
- }
205
- if (atPole) {
206
- const sign = Math.sign(origin.z);
207
- firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
208
- if (firstAxis !== "east" && firstAxis !== "west") {
209
- firstAxisVector.scale(sign);
151
+ if (numerator < 0n)
152
+ return false;
153
+ if (numerator === 0n) {
154
+ return commit(0n, 1n);
210
155
  }
211
- secondAxisVector = scratchVector2.fromArray(degeneratePositionLocalFrame[secondAxis]);
212
- if (secondAxis !== "east" && secondAxis !== "west") {
213
- secondAxisVector.scale(sign);
156
+ const positive = offsets.filter((d2) => d2 > 0n);
157
+ const least = positive.reduce((p, v) => p < v ? p : v);
158
+ precision = Math.max(64, (2n * (denominator + numerator)).toString(2).length - (numerator * least).toString(2).length + 128);
159
+ }
160
+ const unit = 1n << BigInt(precision);
161
+ const d = offsets.map((v) => v * unit);
162
+ const u = products.map((v) => v * unit);
163
+ const u2 = u.map((v) => v * v);
164
+ let lower = 0n, upper = u.reduce((sum, v) => sum + v, 0n);
165
+ if (upper === 0n)
166
+ return false;
167
+ for (let iteration = 0; iteration < 4096; iteration++) {
168
+ const t = lower + upper >> 1n;
169
+ if (t === lower)
170
+ return false;
171
+ const dx = d[0] + t, dy = d[1] + t, dz = d[2] + t;
172
+ const xx = dx * dx, yy = dy * dy, zz = dz * dz;
173
+ const sign = u2[0] * yy * zz + u2[1] * xx * zz + u2[2] * xx * yy - xx * yy * zz;
174
+ if (sign === 0n)
175
+ return commit(t, unit);
176
+ if (sign > 0n)
177
+ lower = t;
178
+ else
179
+ upper = t;
180
+ if (lower > 0n && upper - lower <= lower >> 60n)
181
+ return commit(lower + upper >> 1n, unit);
182
+ }
183
+ return false;
184
+ function commit(t, unit2) {
185
+ const output = squares.map((r2, i) => {
186
+ const denominator = offsets[i] * unit2 + t;
187
+ return denominator === 0n ? 0 : ratio(r2 * integers[i + 3] * unit2, denominator, exponent);
188
+ });
189
+ if (!output.every(Number.isFinite))
190
+ return false;
191
+ const qx = Math.sign(x) * output[0], qy = Math.sign(y) * output[1], qz = Math.sign(z) * output[2];
192
+ result.x = qx;
193
+ result.y = qy;
194
+ result.z = qz;
195
+ return true;
196
+ }
197
+ }
198
+ function ratio(n, d, exponent) {
199
+ if (n === 0n)
200
+ return 0;
201
+ const shift = 52 - (n.toString(2).length - d.toString(2).length);
202
+ const numerator = shift >= 0 ? n << BigInt(shift) : n;
203
+ const denominator = shift >= 0 ? d : d << BigInt(-shift);
204
+ let quotient = numerator / denominator;
205
+ const remainder = numerator % denominator;
206
+ if (2n * remainder > denominator || 2n * remainder === denominator && quotient & 1n)
207
+ quotient++;
208
+ const power = exponent - shift;
209
+ const first = Math.max(-1022, Math.min(1023, power));
210
+ return Number(quotient) * 2 ** first * 2 ** (power - first);
211
+ }
212
+
213
+ // dist/ellipsoid-helpers/nearest-surface.js
214
+ function nearestSurface(x, y, z, a, b, c, result) {
215
+ const minimum = Math.min(a, b, c);
216
+ const minimumSquared = minimum * minimum;
217
+ const aa = a * a, bb = b * b, cc = c * c;
218
+ if (!(minimum > 0) || !(minimumSquared > 0) || !Number.isFinite(Math.max(aa, bb, cc)))
219
+ return false;
220
+ const minimumError = productError(minimum, minimum, minimumSquared);
221
+ const dx = aa - minimumSquared, dy = bb - minimumSquared, dz = cc - minimumSquared;
222
+ const ex = sumError(aa, -minimumSquared, dx) + productError(a, a, aa) - minimumError;
223
+ const ey = sumError(bb, -minimumSquared, dy) + productError(b, b, bb) - minimumError;
224
+ const ez = sumError(cc, -minimumSquared, dz) + productError(c, c, cc) - minimumError;
225
+ const ux = a * Math.abs(x), uy = b * Math.abs(y), uz = c * Math.abs(z);
226
+ if (minimumSquared < 2 ** -1022 || x !== 0 && ux < 2 ** -1022 || y !== 0 && uy < 2 ** -1022 || z !== 0 && uz < 2 ** -1022)
227
+ return exactNearestSurface(x, y, z, a, b, c, result);
228
+ const fx = productError(a, Math.abs(x), ux);
229
+ const fy = productError(b, Math.abs(y), uy);
230
+ const fz = productError(c, Math.abs(z), uz);
231
+ const limit = Math.hypot(dx === 0 ? ux === 0 ? 0 : Infinity : ux / (dx + ex), dy === 0 ? uy === 0 ? 0 : Infinity : uy / (dy + ey), dz === 0 ? uz === 0 ? 0 : Infinity : uz / (dz + ez));
232
+ if (limit <= 1 + 64 * Number.EPSILON)
233
+ return exactNearestSurface(x, y, z, a, b, c, result);
234
+ if ((x !== 0 ? 1 : 0) + (y !== 0 ? 1 : 0) + (z !== 0 ? 1 : 0) === 1) {
235
+ result.x = x === 0 ? x : Math.sign(x) * a;
236
+ result.y = y === 0 ? y : Math.sign(y) * b;
237
+ result.z = z === 0 ? z : Math.sign(z) * c;
238
+ return true;
239
+ }
240
+ let lower = Math.hypot(dx === 0 ? ux : 0, dy === 0 ? uy : 0, dz === 0 ? uz : 0);
241
+ let upper = Math.hypot(ux, uy, uz);
242
+ if (!(upper > 0) || !Number.isFinite(upper))
243
+ return exactNearestSurface(x, y, z, a, b, c, result);
244
+ let t = lower > 0 ? lower : upper;
245
+ for (let iteration = 0; iteration < 512; iteration++) {
246
+ const hx = dx + t, hy = dy + t, hz = dz + t;
247
+ const lx = sumError(dx, t, hx) + ex;
248
+ const ly = sumError(dy, t, hy) + ey;
249
+ const lz = sumError(dz, t, hz) + ez;
250
+ const vx = ux / hx, vy = uy / hy, vz = uz / hz;
251
+ let term, rest;
252
+ if (vx >= vy && vx >= vz) {
253
+ term = offset(ux, fx, dx, ex, t, hx) * (vx + 1);
254
+ rest = (vy * (1 - ly / hy)) ** 2 + (vz * (1 - lz / hz)) ** 2;
255
+ } else if (vy >= vz) {
256
+ term = offset(uy, fy, dy, ey, t, hy) * (vy + 1);
257
+ rest = (vx * (1 - lx / hx)) ** 2 + (vz * (1 - lz / hz)) ** 2;
258
+ } else {
259
+ term = offset(uz, fz, dz, ez, t, hz) * (vz + 1);
260
+ rest = (vx * (1 - lx / hx)) ** 2 + (vy * (1 - ly / hy)) ** 2;
214
261
  }
215
- thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);
216
- if (thirdAxis !== "east" && thirdAxis !== "west") {
217
- thirdAxisVector.scale(sign);
262
+ const derivative = -2 * (vx * vx / hx + vy * vy / hy + vz * vz / hz);
263
+ const roundoff = 4 * Number.EPSILON * (Math.abs(term) + rest);
264
+ const residual = term + rest;
265
+ if (!Number.isFinite(residual))
266
+ return exactNearestSurface(x, y, z, a, b, c, result);
267
+ if (Math.abs(residual) <= 4 * Number.EPSILON * (Math.abs(term) + rest) || upper - lower <= 4 * Number.EPSILON * t) {
268
+ const uncertainty = roundoff / Math.abs(derivative);
269
+ if (!Number.isFinite(derivative) || !(Math.abs(derivative) > 0) || uncertainty > 2e-13 * t)
270
+ return exactNearestSurface(x, y, z, a, b, c, result);
271
+ const qx = Math.sign(x) * a * (vx * (1 - lx / hx));
272
+ const qy = Math.sign(y) * b * (vy * (1 - ly / hy));
273
+ const qz = Math.sign(z) * c * (vz * (1 - lz / hz));
274
+ const displacement = 2 * uncertainty * Math.max(Math.abs(qx / hx), Math.abs(qy / hy), Math.abs(qz / hz));
275
+ if (!Number.isFinite(displacement) || displacement > 2e-13 * Math.max(a, b, c))
276
+ return exactNearestSurface(x, y, z, a, b, c, result);
277
+ if (!Number.isFinite(qx) || !Number.isFinite(qy) || !Number.isFinite(qz))
278
+ return exactNearestSurface(x, y, z, a, b, c, result);
279
+ result.x = qx;
280
+ result.y = qy;
281
+ result.z = qz;
282
+ return true;
218
283
  }
219
- } else {
220
- const { up, east, north } = scratchAxisVectors;
221
- east.set(-origin.y, origin.x, 0).normalize();
222
- ellipsoid.geodeticSurfaceNormal(origin, up);
223
- north.copy(up).cross(east);
224
- const { down, west, south } = scratchAxisVectors;
225
- down.copy(up).scale(-1);
226
- west.copy(east).scale(-1);
227
- south.copy(north).scale(-1);
228
- firstAxisVector = scratchAxisVectors[firstAxis];
229
- secondAxisVector = scratchAxisVectors[secondAxis];
230
- thirdAxisVector = scratchAxisVectors[thirdAxis];
284
+ if (residual > 0)
285
+ lower = t;
286
+ else
287
+ upper = t;
288
+ const candidate = t - residual / derivative;
289
+ const next = candidate > lower && candidate < upper ? candidate : lower + (upper - lower) / 2;
290
+ if (next === t)
291
+ return exactNearestSurface(x, y, z, a, b, c, result);
292
+ t = next;
231
293
  }
232
- const ax = firstAxisVector.x, ay = firstAxisVector.y, az = firstAxisVector.z;
233
- const bx = secondAxisVector.x, by = secondAxisVector.y, bz = secondAxisVector.z;
234
- const cx = thirdAxisVector.x, cy = thirdAxisVector.y, cz = thirdAxisVector.z;
235
- const x = origin.x, y = origin.y, z = origin.z;
236
- result[0] = ax;
237
- result[1] = ay;
238
- result[2] = az;
239
- result[3] = 0;
240
- result[4] = bx;
241
- result[5] = by;
242
- result[6] = bz;
243
- result[7] = 0;
244
- result[8] = cx;
245
- result[9] = cy;
246
- result[10] = cz;
247
- result[11] = 0;
248
- result[12] = x;
249
- result[13] = y;
250
- result[14] = z;
251
- result[15] = 1;
252
- return result;
294
+ return exactNearestSurface(x, y, z, a, b, c, result);
295
+ }
296
+ function offset(u, error, d, dError, t, denominator) {
297
+ const difference = u - d;
298
+ const correction = sumError(u, -d, difference) + error - dError;
299
+ const base = difference + correction;
300
+ const low = sumError(difference, correction, base);
301
+ const shifted = base - t;
302
+ return (shifted + (sumError(base, -t, shifted) + low)) / denominator;
303
+ }
304
+ function sumError(x, y, sum) {
305
+ const part = sum - x;
306
+ return x - (sum - part) + (y - part);
307
+ }
308
+ function productError(x, y, product) {
309
+ const sx = 134217729 * x, sy = 134217729 * y;
310
+ if (!Number.isFinite(sx) || !Number.isFinite(sy))
311
+ return 0;
312
+ const hx = sx - (sx - x), hy = sy - (sy - y);
313
+ const lx = x - hx, ly = y - hy;
314
+ return hx * hy - product + hx * ly + lx * hy + lx * ly;
253
315
  }
254
316
 
255
317
  // dist/ellipsoid-helpers/scale-to-geodetic-surface.js
256
- var import_core3 = require("@math.gl/core");
257
- var scratchVector4 = new import_core3.Vector3();
258
- var scaleToGeodeticSurfaceIntersection = new import_core3.Vector3();
259
- var scaleToGeodeticSurfaceGradient = new import_core3.Vector3();
318
+ var surface = { x: 0, y: 0, z: 0 };
260
319
  function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
261
- const { oneOverRadii, oneOverRadiiSquared, centerToleranceSquared } = ellipsoid;
262
320
  const object = cartesian;
263
- const positionX = "x" in cartesian ? object.x : cartesian[0];
264
- const positionY = "x" in cartesian ? object.y : cartesian[1];
265
- const positionZ = "x" in cartesian ? object.z : cartesian[2];
266
- if (!Number.isFinite(positionX) || !Number.isFinite(positionY) || !Number.isFinite(positionZ)) {
321
+ const x = "x" in cartesian ? object.x : cartesian[0];
322
+ const y = "x" in cartesian ? object.y : cartesian[1];
323
+ const z = "x" in cartesian ? object.z : cartesian[2];
324
+ if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
267
325
  return void 0;
268
- }
269
- scratchVector4.set(positionX, positionY, positionZ);
270
- const oneOverRadiiX = oneOverRadii.x;
271
- const oneOverRadiiY = oneOverRadii.y;
272
- const oneOverRadiiZ = oneOverRadii.z;
273
- const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
274
- const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
275
- const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
276
- const squaredNorm = x2 + y2 + z2;
277
- const ratio = Math.sqrt(1 / squaredNorm);
278
- if (!Number.isFinite(ratio) || !Number.isFinite(squaredNorm)) {
326
+ if (!Number.isFinite(x * x + y * y + z * z))
279
327
  return void 0;
280
- }
281
- const intersection = scaleToGeodeticSurfaceIntersection;
282
- intersection.set(positionX, positionY, positionZ).scale(ratio);
283
- if (squaredNorm < centerToleranceSquared) {
284
- return writeResult(result, intersection.x, intersection.y, intersection.z);
285
- }
286
- const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
287
- const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
288
- const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
289
- const gradient = scaleToGeodeticSurfaceGradient;
290
- gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
291
- let lambda = (1 - ratio) * scratchVector4.len() / (0.5 * gradient.len());
292
- let correction = 0;
293
- let xMultiplier;
294
- let yMultiplier;
295
- let zMultiplier;
296
- let func;
297
- for (let iteration = 0; iteration < 64; iteration++) {
298
- lambda -= correction;
299
- xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
300
- yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
301
- zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
302
- const xMultiplier2 = xMultiplier * xMultiplier;
303
- const yMultiplier2 = yMultiplier * yMultiplier;
304
- const zMultiplier2 = zMultiplier * zMultiplier;
305
- const xMultiplier3 = xMultiplier2 * xMultiplier;
306
- const yMultiplier3 = yMultiplier2 * yMultiplier;
307
- const zMultiplier3 = zMultiplier2 * zMultiplier;
308
- func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
309
- if (!Number.isFinite(func))
310
- return void 0;
311
- if (Math.abs(func) <= import_core3._MathUtils.EPSILON12) {
312
- return writeResult(result, positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);
313
- }
314
- const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
315
- const derivative = -2 * denominator;
316
- if (!Number.isFinite(derivative) || derivative === 0)
317
- return void 0;
318
- correction = func / derivative;
319
- if (!Number.isFinite(correction))
320
- return void 0;
321
- }
322
- return void 0;
328
+ const { radii } = ellipsoid;
329
+ if (!nearestSurface(x, y, z, radii.x, radii.y, radii.z, surface))
330
+ return void 0;
331
+ return writeResult(result, surface.x, surface.y, surface.z);
323
332
  }
324
333
  function writeResult(result, x, y, z) {
325
- if ((0, import_core3.isArray)(result)) {
334
+ if ((0, import_core2.isArray)(result)) {
326
335
  result[0] = x;
327
336
  result[1] = y;
328
337
  result[2] = z;
@@ -337,12 +346,10 @@ function writeResult(result, x, y, z) {
337
346
 
338
347
  // dist/ellipsoid.js
339
348
  var spheroidScratch = { x: 0, y: 0, z: 0 };
340
- var scratchVector5 = new import_core4.Vector3();
341
- var scratchNormal = new import_core4.Vector3();
342
- var scratchK = new import_core4.Vector3();
343
- var scratchPosition = new import_core4.Vector3();
344
- var scratchHeight = new import_core4.Vector3();
345
- var scratchCartesian = new import_core4.Vector3();
349
+ var scratchVector2 = new import_core3.Vector3();
350
+ var scratchNormal = new import_core3.Vector3();
351
+ var scratchPosition = new import_core3.Vector3();
352
+ var scratchCartesian = new import_core3.Vector3();
346
353
  var Ellipsoid = class _Ellipsoid {
347
354
  /** Construct from two-axis geometry, including normalized projection ellipsoids.
348
355
  * The equatorial X/Y radii are equal; no CRS or datum information is inferred.
@@ -353,26 +360,31 @@ var Ellipsoid = class _Ellipsoid {
353
360
  return new _Ellipsoid(semiMajorAxis, semiMajorAxis, semiMinorAxis);
354
361
  }
355
362
  constructor(x = 0, y = 0, z = 0) {
356
- this.centerToleranceSquared = import_core4._MathUtils.EPSILON1;
357
- (0, import_core4.assert)(x >= 0);
358
- (0, import_core4.assert)(y >= 0);
359
- (0, import_core4.assert)(z >= 0);
360
- this.radii = new import_core4.Vector3(x, y, z);
361
- this.radiiSquared = new import_core4.Vector3(x * x, y * y, z * z);
362
- this.radiiToTheFourth = new import_core4.Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
363
- this.oneOverRadii = new import_core4.Vector3(x === 0 ? 0 : 1 / x, y === 0 ? 0 : 1 / y, z === 0 ? 0 : 1 / z);
364
- this.oneOverRadiiSquared = new import_core4.Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
363
+ this.centerToleranceSquared = import_core3._MathUtils.EPSILON1;
364
+ (0, import_core3.assert)(Number.isFinite(x) && x >= 0);
365
+ (0, import_core3.assert)(Number.isFinite(y) && y >= 0);
366
+ (0, import_core3.assert)(Number.isFinite(z) && z >= 0);
367
+ this.radii = new import_core3.Vector3(x, y, z);
368
+ this.radiiSquared = new import_core3.Vector3(x * x, y * y, z * z);
369
+ this.radiiToTheFourth = new import_core3.Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
370
+ this.oneOverRadii = new import_core3.Vector3(x === 0 ? 0 : 1 / x, y === 0 ? 0 : 1 / y, z === 0 ? 0 : 1 / z);
371
+ this.oneOverRadiiSquared = new import_core3.Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
365
372
  this.minimumRadius = Math.min(x, y, z);
366
373
  this.maximumRadius = Math.max(x, y, z);
367
- if (this.radiiSquared.z !== 0) {
368
- this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
374
+ if (z !== 0) {
375
+ this.squaredXOverSquaredZ = (x / z) ** 2;
369
376
  }
370
377
  if (x === y && z > 0 && z <= x && Number.isFinite(this.radiiSquared.x) && this.radiiSquared.z > 0)
371
378
  this.spheroidGeometry = Object.freeze({
372
379
  semiMajorAxis: x,
373
380
  semiMinorAxis: z,
374
- eccentricitySquared: 1 - this.radiiSquared.z / this.radiiSquared.x
381
+ eccentricitySquared: 1 - (z / x) ** 2
375
382
  });
383
+ Object.freeze(this.radii);
384
+ Object.freeze(this.radiiSquared);
385
+ Object.freeze(this.radiiToTheFourth);
386
+ Object.freeze(this.oneOverRadii);
387
+ Object.freeze(this.oneOverRadiiSquared);
376
388
  Object.freeze(this);
377
389
  }
378
390
  /** Return an owned geometry snapshot for a sphere or oblate spheroid.
@@ -390,30 +402,34 @@ var Ellipsoid = class _Ellipsoid {
390
402
  equals(right) {
391
403
  return this === right || Boolean(right && this.radii.equals(right.radii));
392
404
  }
393
- /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */
405
+ /** Creates a string representing this Ellipsoid in the format '[radii.x, radii.y, radii.z]'. */
394
406
  toString() {
395
407
  return this.radii.toString();
396
408
  }
397
409
  cartographicToCartesian(cartographic, result = [0, 0, 0]) {
398
- if (this.spheroidGeometry) {
399
- const llh = fromCartographicToRadians(cartographic, scratchCartesian);
400
- spheroidScratch.x = llh[0];
401
- spheroidScratch.y = llh[1];
402
- spheroidScratch.z = llh[2];
410
+ const llh = fromCartographicToRadians(cartographic, scratchCartesian);
411
+ const longitude = llh[0], latitude = llh[1], height = llh[2];
412
+ if (!Number.isFinite(longitude) || !Number.isFinite(latitude) || !Number.isFinite(height) || !(this.minimumRadius > 0) || !Number.isFinite(this.maximumRadius * this.maximumRadius))
413
+ return void 0;
414
+ if (this.spheroidGeometry && (import_core3.config._cartographicRadians || Math.abs(latitude) <= Math.PI / 4)) {
415
+ spheroidScratch.x = longitude;
416
+ spheroidScratch.y = latitude;
417
+ spheroidScratch.z = height;
403
418
  if (!(0, import_spheroid.spheroidToCartesian)(spheroidScratch, this.spheroidGeometry))
404
419
  return void 0;
405
420
  return writeResult(result, spheroidScratch.x, spheroidScratch.y, spheroidScratch.z);
406
421
  }
407
422
  const normal = scratchNormal;
408
- const k = scratchK;
409
- const [, , height] = cartographic;
410
423
  this.geodeticSurfaceNormalCartographic(cartographic, normal);
411
- k.copy(this.radiiSquared).scale(normal);
412
- const gamma = Math.sqrt(normal.dot(k));
413
- k.scale(1 / gamma);
414
- normal.scale(height);
415
- k.add(normal);
416
- return k.to(result);
424
+ const nx = normal.x, ny = normal.y, nz = normal.z;
425
+ const rx = this.radii.x, ry = this.radii.y, rz = this.radii.z;
426
+ const gamma = Math.hypot(rx * nx, ry * ny, rz * nz);
427
+ const x = rx * (rx * nx / gamma) + height * nx;
428
+ const y = ry * (ry * ny / gamma) + height * ny;
429
+ const z = rz * (rz * nz / gamma) + height * nz;
430
+ if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
431
+ return void 0;
432
+ return writeResult(result, x, y, z);
417
433
  }
418
434
  cartesianToCartographic(cartesian, result = [0, 0, 0]) {
419
435
  const object = cartesian;
@@ -426,45 +442,68 @@ var Ellipsoid = class _Ellipsoid {
426
442
  spheroidScratch.x = x;
427
443
  spheroidScratch.y = y;
428
444
  spheroidScratch.z = z;
429
- if (!(0, import_spheroid.cartesianToSpheroid)(spheroidScratch, this.spheroidGeometry))
430
- return void 0;
431
- const longitude2 = x === 0 && y === 0 ? Math.atan2(y, x) : spheroidScratch.x;
432
- return toCartographicFromRadiansComponents(longitude2, spheroidScratch.y, spheroidScratch.z, result);
445
+ const shape = this.spheroidGeometry;
446
+ const nearBoundary = z === 0 && shape.semiMinorAxis < shape.semiMajorAxis && Math.abs(Math.hypot(x, y) - shape.semiMajorAxis * shape.eccentricitySquared) <= 64 * Number.EPSILON * shape.semiMajorAxis;
447
+ if (!nearBoundary && (0, import_spheroid.cartesianToSpheroid)(spheroidScratch, shape)) {
448
+ const longitude2 = x === 0 && y === 0 ? Math.atan2(y, x) : spheroidScratch.x;
449
+ return toCartographicFromRadiansComponents(longitude2, spheroidScratch.y, spheroidScratch.z, result);
450
+ }
433
451
  }
452
+ if (!(this.minimumRadius > 0) || !Number.isFinite(this.maximumRadius * this.maximumRadius) || !Number.isFinite(1 / (this.minimumRadius * this.minimumRadius)))
453
+ return void 0;
434
454
  scratchCartesian.set(x, y, z);
435
455
  const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
436
456
  if (!point) {
437
457
  return void 0;
438
458
  }
439
- const normal = this.geodeticSurfaceNormal(point, scratchNormal);
440
- const h = scratchHeight;
441
- h.copy(scratchCartesian).subtract(point);
442
- const longitude = Math.atan2(normal.y, normal.x);
443
- const latitude = Math.atan2(normal.z, Math.hypot(normal.x, normal.y));
444
- const height = Math.sign(vec3.dot(h, scratchCartesian)) * vec3.length(h);
459
+ const gx = point[0] * this.oneOverRadiiSquared.x;
460
+ const gy = point[1] * this.oneOverRadiiSquared.y;
461
+ const gz = point[2] * this.oneOverRadiiSquared.z;
462
+ const length = Math.hypot(gx, gy, gz);
463
+ if (!(length > 0) || !Number.isFinite(length))
464
+ return void 0;
465
+ const nx = gx / length, ny = gy / length, nz = gz / length;
466
+ const longitude = Math.atan2(ny, nx);
467
+ const latitude = Math.atan2(nz, Math.hypot(nx, ny));
468
+ const height = (x - point[0]) * nx + (y - point[1]) * ny + (z - point[2]) * nz;
445
469
  return toCartographicFromRadiansComponents(longitude, latitude, height, result);
446
470
  }
447
- eastNorthUpToFixedFrame(origin, result = new import_core4.Matrix4()) {
448
- return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
449
- }
450
- // Computes a 4x4 transformation matrix from a reference frame centered at
451
- // the provided origin to the ellipsoid's fixed reference frame.
452
- localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new import_core4.Matrix4()) {
453
- return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
454
- }
455
471
  geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
456
- return scratchVector5.from(cartesian).normalize().to(result);
472
+ fromCartographic(cartesian, scratchVector2);
473
+ const point = scratchVector2;
474
+ return normalResult(point.x, point.y, point.z, result);
457
475
  }
458
476
  geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
459
- const cartographicVectorRadians = fromCartographicToRadians(cartographic);
460
- const longitude = cartographicVectorRadians[0];
461
- const latitude = cartographicVectorRadians[1];
462
- const cosLatitude = Math.cos(latitude);
463
- scratchVector5.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
464
- return scratchVector5.to(result);
477
+ const point = fromCartographic(cartographic, scratchCartesian);
478
+ const longitude = import_core3.config._cartographicRadians ? point[0] : point[0] * Math.PI / 180;
479
+ const latitude = import_core3.config._cartographicRadians ? point[1] : point[1] * Math.PI / 180;
480
+ const polarDegrees = !import_core3.config._cartographicRadians && Math.abs(point[1]) > 45;
481
+ const complement = (90 - Math.abs(point[1])) * Math.PI / 180;
482
+ const cosLatitude = polarDegrees ? Math.sin(complement) : Math.abs(latitude) === Math.PI / 2 ? 0 : Math.cos(latitude);
483
+ const sinLatitude = polarDegrees ? Math.sign(point[1]) * Math.cos(complement) : Math.sin(latitude);
484
+ return normalResult(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), sinLatitude, result);
465
485
  }
466
486
  geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
467
- return scratchVector5.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
487
+ if (!(this.minimumRadius > 0))
488
+ return void 0;
489
+ fromCartographic(cartesian, scratchVector2);
490
+ const point = scratchVector2;
491
+ const scale = Math.max(Math.abs(point.x), Math.abs(point.y), Math.abs(point.z));
492
+ if (!(scale > 0) || !Number.isFinite(scale))
493
+ return void 0;
494
+ const nx = point.x / scale * (this.minimumRadius / this.radii.x) ** 2;
495
+ const ny = point.y / scale * (this.minimumRadius / this.radii.y) ** 2;
496
+ const nz = point.z / scale * (this.minimumRadius / this.radii.z) ** 2;
497
+ if ((point.x === 0 || Math.abs(nx) >= 2 ** -1022) && (point.y === 0 || Math.abs(ny) >= 2 ** -1022) && (point.z === 0 || Math.abs(nz) >= 2 ** -1022))
498
+ return normalResult(nx, ny, nz, result);
499
+ const ex = point.x === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.x))));
500
+ const ey = point.y === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.y))));
501
+ const ez = point.z === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.z))));
502
+ const ax = Math.min(1023, Math.floor(Math.log2(this.radii.x)));
503
+ const ay = Math.min(1023, Math.floor(Math.log2(this.radii.y)));
504
+ const az = Math.min(1023, Math.floor(Math.log2(this.radii.z)));
505
+ const common = Math.max(point.x === 0 ? -Infinity : ex - 2 * ax, point.y === 0 ? -Infinity : ey - 2 * ay, point.z === 0 ? -Infinity : ez - 2 * az);
506
+ return normalResult(point.x === 0 ? point.x : point.x / 2 ** ex / (this.radii.x / 2 ** ax) ** 2 * 2 ** (ex - 2 * ax - common), point.y === 0 ? point.y : point.y / 2 ** ey / (this.radii.y / 2 ** ay) ** 2 * 2 ** (ey - 2 * ay - common), point.z === 0 ? point.z : point.z / 2 ** ez / (this.radii.z / 2 ** az) ** 2 * 2 ** (ez - 2 * az - common), result);
468
507
  }
469
508
  /** Scales the provided Cartesian position along the geodetic surface normal
470
509
  * so that it is on the surface of this ellipsoid. If the position is
@@ -475,34 +514,49 @@ var Ellipsoid = class _Ellipsoid {
475
514
  /** Scales the provided Cartesian position along the geocentric surface normal
476
515
  * so that it is on the surface of this ellipsoid. */
477
516
  scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
478
- scratchPosition.from(cartesian);
479
- const positionX = scratchPosition.x;
480
- const positionY = scratchPosition.y;
481
- const positionZ = scratchPosition.z;
482
- const oneOverRadiiSquared = this.oneOverRadiiSquared;
483
- const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
484
- return scratchPosition.multiplyByScalar(beta).to(result);
517
+ fromCartographic(cartesian, scratchPosition);
518
+ const point = scratchPosition;
519
+ const scale = Math.max(Math.abs(point.x), Math.abs(point.y), Math.abs(point.z));
520
+ if (!(this.minimumRadius > 0) || !(scale > 0) || !Number.isFinite(scale))
521
+ return void 0;
522
+ const squared = point.x * point.x * this.oneOverRadiiSquared.x + point.y * point.y * this.oneOverRadiiSquared.y + point.z * point.z * this.oneOverRadiiSquared.z;
523
+ if (squared >= 2 ** -1022 && Number.isFinite(squared) && scale * scale >= 2 ** -1022 && Number.isFinite(scale * scale)) {
524
+ const beta = 1 / Math.sqrt(squared);
525
+ return writeResult(result, point.x * beta, point.y * beta, point.z * beta);
526
+ }
527
+ const x = point.x / scale, y = point.y / scale, z = point.z / scale;
528
+ const norm = Math.hypot(x / this.radii.x, y / this.radii.y, z / this.radii.z);
529
+ if (!(norm > 0) || !Number.isFinite(norm))
530
+ return void 0;
531
+ return writeResult(result, x / norm, y / norm, z / norm);
485
532
  }
486
533
  /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
487
534
  * its components by the result of `Ellipsoid#oneOverRadii` */
488
535
  transformPositionToScaledSpace(position, result = [0, 0, 0]) {
489
- return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
536
+ fromCartographic(position, scratchPosition);
537
+ const point = scratchPosition.scale(this.oneOverRadii);
538
+ return writeResult(result, point.x, point.y, point.z);
490
539
  }
491
540
  /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
492
541
  * its components by the result of `Ellipsoid#radii`. */
493
542
  transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
494
- return scratchPosition.from(position).scale(this.radii).to(result);
543
+ fromCartographic(position, scratchPosition);
544
+ const point = scratchPosition.scale(this.radii);
545
+ return writeResult(result, point.x, point.y, point.z);
495
546
  }
496
547
  /** Computes a point which is the intersection of the surface normal with the z-axis. */
497
548
  getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
498
- (0, import_core4.assert)((0, import_core4.equals)(this.radii.x, this.radii.y, import_core4._MathUtils.EPSILON15));
499
- (0, import_core4.assert)(this.radii.z > 0);
500
- scratchPosition.from(position);
549
+ (0, import_core3.assert)(this.radii.x === this.radii.y && this.minimumRadius > 0);
550
+ fromCartographic(position, scratchPosition);
551
+ if (!Number.isFinite(scratchPosition.x) || !Number.isFinite(scratchPosition.y) || !Number.isFinite(scratchPosition.z) || !Number.isFinite(buffer))
552
+ return void 0;
501
553
  const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
554
+ if (!Number.isFinite(z))
555
+ return void 0;
502
556
  if (Math.abs(z) >= this.radii.z - buffer) {
503
557
  return void 0;
504
558
  }
505
- return scratchPosition.set(0, 0, z).to(result);
559
+ return writeResult(result, 0, 0, z);
506
560
  }
507
561
  };
508
562
  Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
@@ -510,63 +564,3347 @@ function validateSpheroid(a, b) {
510
564
  if (!Number.isFinite(a) || !Number.isFinite(b) || a <= 0 || b <= 0 || b > a)
511
565
  throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis");
512
566
  }
567
+ function normalResult(x, y, z, result) {
568
+ const scale = Math.max(Math.abs(x), Math.abs(y), Math.abs(z));
569
+ if (!(scale > 0) || !Number.isFinite(scale))
570
+ return void 0;
571
+ const nx = x / scale, ny = y / scale, nz = z / scale;
572
+ const length = Math.hypot(nx, ny, nz);
573
+ return writeResult(result, nx / length, ny / length, nz / length);
574
+ }
513
575
 
514
576
  // dist/ellipsoid-tangent-plane.js
515
- var import_core5 = require("@math.gl/core");
577
+ var import_core4 = require("@math.gl/core");
516
578
  var import_culling = require("@math.gl/geometry/culling");
517
- var scratchOrigin2 = new import_core5.Vector3();
518
- var scratchCart3 = new import_core5.Vector3();
519
- var scratchEastNorthUp = new import_core5.Matrix4();
520
- var scratchProjectPointOntoPlaneCartesian3 = new import_core5.Vector3();
579
+
580
+ // dist/ellipsoid-helpers/tangent-plane-numerics.js
581
+ var SPLITTER = 134217729;
582
+ function productError2(a, b, product) {
583
+ const ca = SPLITTER * a, cb = SPLITTER * b;
584
+ const ah = ca - (ca - a), al = a - ah;
585
+ const bh = cb - (cb - b), bl = b - bh;
586
+ return ah * bh - product + ah * bl + al * bh + al * bl;
587
+ }
588
+ function sumError2(a, b, sum) {
589
+ const v = sum - a;
590
+ return a - (sum - v) + (b - v);
591
+ }
592
+ function binaryScale(value) {
593
+ return 2 ** Math.min(1023, Math.floor(Math.log2(value)));
594
+ }
595
+ function compensatedDot3(x, y, z, a, b, c) {
596
+ const magnitude = Math.max(Math.abs(x), Math.abs(y), Math.abs(z));
597
+ if (magnitude === 0)
598
+ return 0;
599
+ const scale = binaryScale(magnitude);
600
+ const sx = x / scale, sy = y / scale, sz = z / scale;
601
+ const p = sx * a, q = sy * b, r = sz * c;
602
+ const s = p + q, t = s + r;
603
+ return (t + (sumError2(p, q, s) + sumError2(s, r, t) + productError2(sx, a, p) + productError2(sy, b, q) + productError2(sz, c, r))) * scale;
604
+ }
605
+ function exactNormalIntersection(radii, origin, east, north, normal, point, sphereRadius) {
606
+ const values = sphereRadius ? [
607
+ sphereRadius,
608
+ sphereRadius,
609
+ sphereRadius,
610
+ sphereRadius,
611
+ 0,
612
+ 0,
613
+ 0,
614
+ 1,
615
+ 0,
616
+ 0,
617
+ 0,
618
+ 1,
619
+ 1,
620
+ 0,
621
+ 0,
622
+ point[0],
623
+ point[1]
624
+ ] : [...radii, ...origin, ...east, ...north, ...normal, ...point];
625
+ const v = values.map((value2) => {
626
+ const [whole, fraction = ""] = Math.abs(value2).toString(2).split(".");
627
+ return (value2 < 0 ? -1n : 1n) * BigInt("0b" + whole + fraction) << BigInt(1074 - fraction.length);
628
+ });
629
+ const unit = 1n << 1074n, q = 1n << 64n;
630
+ const factors = [v[1] * v[2], v[0] * v[2], v[0] * v[1]];
631
+ const p = [0, 1, 2].map((i) => (v[3 + i] * unit + v[6 + i] * v[15] + v[9 + i] * v[16]) * factors[i]);
632
+ const n = v.slice(12, 15).map((x, i) => x * factors[i]);
633
+ const dot2 = (x, y) => x.reduce((s, v2, i) => s + v2 * y[i], 0n);
634
+ const a = dot2(n, n), b = dot2(n, p), c = dot2(p, p) - (v[0] * v[1] * v[2] * unit) ** 2n;
635
+ const discriminant = b * b - a * c;
636
+ if (a === 0n || discriminant < 0n)
637
+ return void 0;
638
+ const value = discriminant << 128n;
639
+ let root = value === 0n ? 0n : 1n << BigInt(Math.ceil(value.toString(2).length / 2));
640
+ if (root)
641
+ for (; ; ) {
642
+ const next = root + value / root >> 1n;
643
+ if (next >= root)
644
+ break;
645
+ root = next;
646
+ }
647
+ const output = p.map((x, i) => signedRatio(x * a * q + n[i] * (root - b * q), a * q * factors[i]));
648
+ return sphereRadius ? output.map((_, i) => east[i] * output[1] + north[i] * output[2] + normal[i] * output[0]) : output;
649
+ }
650
+ function signedRatio(n, d) {
651
+ return Math.sign(Number(n)) * ratio(n < 0n ? -n : n, d, -2148);
652
+ }
653
+
654
+ // dist/ellipsoid-tangent-plane.js
521
655
  var EllipsoidTangentPlane = class {
522
656
  /**
523
- * Creates a new plane tangent to the WGS84 ellipsoid at the provided origin.
657
+ * Creates a new plane tangent to an ellipsoid at the provided origin.
524
658
  * If origin is not on the surface of the ellipsoid, its surface projection will be used.
525
659
  *
526
660
  * @param origin A nonzero Cartesian point on or near the ellipsoid.
527
661
  * @param ellipsoid The ellipsoid to which the origin belongs. Defaults to WGS84.
528
662
  */
529
663
  constructor(origin, ellipsoid = Ellipsoid.WGS84) {
530
- const originOnSurface = ellipsoid.scaleToGeodeticSurface(origin, scratchOrigin2);
531
- const eastNorthUp = ellipsoid.eastNorthUpToFixedFrame(originOnSurface, scratchEastNorthUp);
532
- this._origin = new import_core5.Vector3(originOnSurface);
533
- this._xAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(0)));
534
- this._yAxis = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(1)));
535
- const normal = new import_core5.Vector3(scratchCart3.from(eastNorthUp.getColumn(2)));
536
- this._plane = new import_culling.Plane().fromPointNormal(this._origin, normal);
664
+ finiteInput(origin, 3);
665
+ this.radii = Object.freeze(Array.from(ellipsoid.radii));
666
+ if (this.radii[0] === this.radii[1] && this.radii[1] === this.radii[2])
667
+ this.radius = this.radii[0];
668
+ if (!this.radii.every((radius) => radius > 0 && Number.isFinite(radius))) {
669
+ throw new RangeError("Tangent plane requires positive finite ellipsoid radii");
670
+ }
671
+ const originOnSurface = ellipsoid.scaleToGeodeticSurface(Array.from(origin), new import_core4.Vector3());
672
+ if (!originOnSurface)
673
+ throw new RangeError("Origin has no unique ellipsoid surface point");
674
+ this.anchor = new import_core4.Vector3(originOnSurface);
675
+ const normal = new import_core4.Vector3(ellipsoid.geodeticSurfaceNormal(originOnSurface));
676
+ if (!normal.every(Number.isFinite) || !(normal.len() > 0)) {
677
+ throw new RangeError("Cannot resolve tangent-plane normal");
678
+ }
679
+ normal.normalize();
680
+ const horizontal = Math.hypot(normal[0], normal[1]);
681
+ this.east = horizontal > 0 ? new import_core4.Vector3(-normal[1] / horizontal, normal[0] / horizontal, 0) : new import_core4.Vector3(0, 1, 0);
682
+ this.north = new import_core4.Vector3(normal).cross(this.east).normalize();
683
+ this._plane = new import_culling.Plane().fromPointNormal(this.anchor, normal);
537
684
  }
538
685
  /**
539
686
  * Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
540
687
  *
541
- * @param cartesian The WGS84 Cartesian point to project.
688
+ * @param cartesian The fixed Cartesian point to project.
542
689
  * @param result The optional object in which to store the local east-north coordinates.
543
690
  * @returns The supplied result or a new Vector2.
544
691
  */
545
- projectPointToNearestOnPlane(cartesian, result) {
546
- if (!result)
547
- result = new import_core5.Vector2();
548
- const intersectionPoint = this._plane.projectPointOntoPlane(cartesian, scratchProjectPointOntoPlaneCartesian3);
549
- const v = intersectionPoint.subtract(this._origin);
550
- const x = this._xAxis.dot(v);
551
- const y = this._yAxis.dot(v);
552
- result.x = x;
553
- result.y = y;
554
- return result;
692
+ projectPointToNearestOnPlane(cartesian, result = new import_core4.Vector2()) {
693
+ finiteInput(cartesian, 3);
694
+ const x = cartesian[0] - this.anchor[0];
695
+ const y = cartesian[1] - this.anchor[1];
696
+ const z = cartesian[2] - this.anchor[2];
697
+ const projected = writePlanePoint(this, x, y, z, result, this.radius);
698
+ if (!projected)
699
+ throw new RangeError("Tangent-plane projection overflow");
700
+ return projected;
701
+ }
702
+ /** Project along the outward ray from the ellipsoid center.
703
+ * Back-facing, horizon and nonfinite intersections return undefined without writing result.
704
+ */
705
+ projectPointRadiallyOntoPlane(cartesian, result = new import_core4.Vector2()) {
706
+ finiteInput(cartesian, 3);
707
+ const scale = Math.max(Math.abs(cartesian[0]), Math.abs(cartesian[1]), Math.abs(cartesian[2]));
708
+ if (scale === 0)
709
+ return void 0;
710
+ const sx = cartesian[0] / scale, sy = cartesian[1] / scale, sz = cartesian[2] / scale;
711
+ const length = Math.hypot(sx, sy, sz);
712
+ const x = sx / length;
713
+ const y = sy / length;
714
+ const z = sz / length;
715
+ const n = this.zAxis;
716
+ const denominator = x * n[0] + y * n[1] + z * n[2];
717
+ if (denominator <= 1e-14)
718
+ return void 0;
719
+ const distance = this.anchor.dot(n) / denominator;
720
+ return writePlanePoint(this, x * distance - this.anchor[0], y * distance - this.anchor[1], z * distance - this.anchor[2], result, this.radius);
721
+ }
722
+ /** Lift a local east/north point to the ellipsoid. Radial is the inverse of radial
723
+ * projection. Normal selects the nearest-facing line intersection and can miss.
724
+ * Neither operation restores a source point's height. Failure leaves result untouched.
725
+ */
726
+ projectPointOntoEllipsoid(point, mode = "radial", result = new import_core4.Vector3()) {
727
+ finiteInput(point, 2);
728
+ checkMode(mode);
729
+ const [rx, ry, rz] = this.radii;
730
+ if (mode === "radial") {
731
+ const scale = Math.max(Math.abs(this.anchor[0]), Math.abs(this.anchor[1]), Math.abs(this.anchor[2]), Math.abs(point[0]), Math.abs(point[1]));
732
+ const u = point[0] / scale, v = point[1] / scale;
733
+ const x = this.anchor[0] / scale + this.east[0] * u + this.north[0] * v;
734
+ const y = this.anchor[1] / scale + this.east[1] * u + this.north[1] * v;
735
+ const z = this.anchor[2] / scale + this.east[2] * u + this.north[2] * v;
736
+ const minimum = Math.min(rx, ry, rz);
737
+ const ax2 = x * (minimum / rx), ay2 = y * (minimum / ry), az2 = z * (minimum / rz);
738
+ const length = Math.hypot(ax2, ay2, az2);
739
+ if (!(length > 0 && Number.isFinite(length)))
740
+ return void 0;
741
+ return writeSurfacePoint(rx * (ax2 / length), ry * (ay2 / length), rz * (az2 / length), result);
742
+ }
743
+ const n = this.zAxis;
744
+ const p = [
745
+ this.anchor[0] + this.east[0] * point[0] + this.north[0] * point[1],
746
+ this.anchor[1] + this.east[1] * point[0] + this.north[1] * point[1],
747
+ this.anchor[2] + this.east[2] * point[0] + this.north[2] * point[1]
748
+ ];
749
+ if (!p.every(Number.isFinite))
750
+ return void 0;
751
+ const ax = n[0] / rx, ay = n[1] / ry, az = n[2] / rz;
752
+ const px = p[0] / rx, py = p[1] / ry, pz = p[2] / rz;
753
+ const a = ax * ax + ay * ay + az * az;
754
+ const b = ax * px + ay * py + az * pz;
755
+ const c = px * px + py * py + pz * pz - 1;
756
+ const squaredB = b * b, ac = a * c;
757
+ const error = 1e-6 * (Math.abs(squaredB) + Math.abs(ac));
758
+ const discriminant = squaredB - ac;
759
+ if (!(a > 0) || !Number.isFinite(discriminant) || Math.abs(discriminant) <= error) {
760
+ const exact2 = exactNormalIntersection(this.radii, this.anchor, this.east, this.north, n, point, this.radius);
761
+ return exact2 && writeSurfacePoint(exact2[0], exact2[1], exact2[2], result);
762
+ }
763
+ if (discriminant < 0)
764
+ return void 0;
765
+ const root = Math.sqrt(Math.max(0, discriminant));
766
+ const t = b > 0 ? -c / (b + root) : (-b + root) / a;
767
+ return writeSurfacePoint(p[0] + t * n[0], p[1] + t * n[1], p[2] + t * n[2], result);
768
+ }
769
+ /** Packed XYZ to packed east/north. Invalid radial points produce NaN pairs and a zero mask.
770
+ * Optional output must have exactly two components per point and must not overlap input.
771
+ */
772
+ projectPointsFlat(input, mode = "normal", output) {
773
+ checkMode(mode);
774
+ if (input.length % 3)
775
+ throw new RangeError("Expected packed XYZ coordinates");
776
+ const count = input.length / 3;
777
+ const positions = output || new Float64Array(count * 2);
778
+ if (positions.length !== count * 2)
779
+ throw new RangeError("Invalid tangent-plane output length");
780
+ if (ArrayBuffer.isView(input) && input.buffer === positions.buffer && input.byteOffset < positions.byteOffset + positions.byteLength && positions.byteOffset < input.byteOffset + input.byteLength) {
781
+ throw new RangeError("Input and output buffers must not overlap");
782
+ }
783
+ for (let i = 0; i < input.length; i++) {
784
+ if (!Number.isFinite(input[i]))
785
+ throw new RangeError("Expected finite coordinates");
786
+ }
787
+ const valid = new Uint8Array(count);
788
+ const point = new import_core4.Vector3();
789
+ const projected = new import_core4.Vector2();
790
+ for (let i = 0; i < count; i++) {
791
+ point.set(input[i * 3], input[i * 3 + 1], input[i * 3 + 2]);
792
+ const value = mode === "normal" ? this.projectPointToNearestOnPlane(point, projected) : this.projectPointRadiallyOntoPlane(point, projected);
793
+ valid[i] = value ? 1 : 0;
794
+ positions[i * 2] = value ? value[0] : NaN;
795
+ positions[i * 2 + 1] = value ? value[1] : NaN;
796
+ }
797
+ return { positions, valid };
555
798
  }
556
799
  get plane() {
557
800
  return this._plane;
558
801
  }
559
802
  get origin() {
560
- return this._origin;
803
+ return this.anchor;
561
804
  }
562
805
  get xAxis() {
563
- return this._xAxis;
806
+ return this.east;
564
807
  }
565
808
  get yAxis() {
566
- return this._yAxis;
809
+ return this.north;
567
810
  }
568
811
  get zAxis() {
569
812
  return this._plane.normal;
570
813
  }
571
814
  };
815
+ function finiteInput(point, length) {
816
+ if (point.length !== length)
817
+ throw new RangeError(`Expected ${length} finite coordinates`);
818
+ for (let i = 0; i < length; i++) {
819
+ if (!Number.isFinite(point[i]))
820
+ throw new RangeError(`Expected ${length} finite coordinates`);
821
+ }
822
+ }
823
+ function checkMode(mode) {
824
+ if (mode !== "normal" && mode !== "radial")
825
+ throw new RangeError("Invalid tangent-plane mode");
826
+ }
827
+ function writePlanePoint(plane, x, y, z, result, radius) {
828
+ let east = x * plane.xAxis[0] + y * plane.xAxis[1] + z * plane.xAxis[2];
829
+ let north = x * plane.yAxis[0] + y * plane.yAxis[1] + z * plane.yAxis[2];
830
+ if (radius !== void 0 && Math.abs((east / radius) ** 2 + (north / radius) ** 2 - 1) <= 32 * Number.EPSILON) {
831
+ east = compensatedDot3(x, y, z, plane.xAxis[0], plane.xAxis[1], plane.xAxis[2]);
832
+ north = compensatedDot3(x, y, z, plane.yAxis[0], plane.yAxis[1], plane.yAxis[2]);
833
+ }
834
+ if (!Number.isFinite(east) || !Number.isFinite(north))
835
+ return void 0;
836
+ return result.set(east, north);
837
+ }
838
+ function writeSurfacePoint(x, y, z, result) {
839
+ if (![x, y, z].every(Number.isFinite))
840
+ return void 0;
841
+ return result.set(x, y, z);
842
+ }
843
+
844
+ // dist/vendor/geographiclib-geodesic/runtime.js
845
+ var geodesic = {};
846
+ geodesic.Constants = {};
847
+ geodesic.Math = {};
848
+ geodesic.Accumulator = {};
849
+ (function(c) {
850
+ "use strict";
851
+ c.WGS84 = { a: 6378137, f: 1 / 298.257223563 };
852
+ c.version = {
853
+ major: 2,
854
+ minor: 2,
855
+ patch: 0
856
+ };
857
+ c.version_string = "2.2.0";
858
+ })(geodesic.Constants);
859
+ (function(m) {
860
+ "use strict";
861
+ m.digits = 53;
862
+ m.epsilon = Math.pow(0.5, m.digits - 1);
863
+ m.degree = Math.PI / 180;
864
+ m.sq = function(x) {
865
+ return x * x;
866
+ };
867
+ m.hypot = function(x, y) {
868
+ return Math.sqrt(x * x + y * y);
869
+ };
870
+ m.cbrt = Math.cbrt || function(x) {
871
+ var y = Math.pow(Math.abs(x), 1 / 3);
872
+ return x > 0 ? y : x < 0 ? -y : x;
873
+ };
874
+ m.log1p = Math.log1p || function(x) {
875
+ var y = 1 + x, z = y - 1;
876
+ return z === 0 ? x : x * Math.log(y) / z;
877
+ };
878
+ m.atanh = Math.atanh || function(x) {
879
+ var y = Math.abs(x);
880
+ y = m.log1p(2 * y / (1 - y)) / 2;
881
+ return x > 0 ? y : x < 0 ? -y : x;
882
+ };
883
+ m.copysign = function(x, y) {
884
+ return Math.abs(x) * (y < 0 || y === 0 && 1 / y < 0 ? -1 : 1);
885
+ };
886
+ m.sum = function(u, v) {
887
+ var s = u + v, up = s - v, vpp = s - up, t;
888
+ up -= u;
889
+ vpp -= v;
890
+ t = s ? 0 - (up + vpp) : s;
891
+ return { s, t };
892
+ };
893
+ m.polyval = function(N, p, s, x) {
894
+ var y = N < 0 ? 0 : p[s++];
895
+ while (--N >= 0)
896
+ y = y * x + p[s++];
897
+ return y;
898
+ };
899
+ m.AngRound = function(x) {
900
+ var z = 1 / 16, y = Math.abs(x);
901
+ y = y < z ? z - (z - y) : y;
902
+ return m.copysign(y, x);
903
+ };
904
+ m.remainder = function(x, y) {
905
+ x %= y;
906
+ return x < -y / 2 ? x + y : x < y / 2 ? x : x - y;
907
+ };
908
+ m.AngNormalize = function(x) {
909
+ var y = m.remainder(x, 360);
910
+ return Math.abs(y) === 180 ? m.copysign(180, x) : y;
911
+ };
912
+ m.LatFix = function(x) {
913
+ return Math.abs(x) > 90 ? NaN : x;
914
+ };
915
+ m.AngDiff = function(x, y) {
916
+ var r = m.sum(m.remainder(-x, 360), m.remainder(y, 360)), d, e;
917
+ r = m.sum(m.remainder(r.s, 360), r.t);
918
+ d = r.s;
919
+ e = r.t;
920
+ if (d === 0 || Math.abs(d) === 180)
921
+ d = m.copysign(d, e === 0 ? y - x : -e);
922
+ return { d, e };
923
+ };
924
+ m.sincosd = function(x) {
925
+ var d, r, q, s, c, sinx, cosx;
926
+ d = x % 360;
927
+ q = Math.round(d / 90);
928
+ d -= 90 * q;
929
+ r = d * this.degree;
930
+ s = Math.sin(r);
931
+ c = Math.cos(r);
932
+ if (Math.abs(d) === 45) {
933
+ c = Math.sqrt(0.5);
934
+ s = m.copysign(c, r);
935
+ } else if (Math.abs(d) === 30) {
936
+ c = Math.sqrt(0.75);
937
+ s = m.copysign(0.5, r);
938
+ }
939
+ switch (q & 3) {
940
+ case 0:
941
+ sinx = s;
942
+ cosx = c;
943
+ break;
944
+ case 1:
945
+ sinx = c;
946
+ cosx = -s;
947
+ break;
948
+ case 2:
949
+ sinx = -s;
950
+ cosx = -c;
951
+ break;
952
+ default:
953
+ sinx = -c;
954
+ cosx = s;
955
+ break;
956
+ }
957
+ cosx += 0;
958
+ if (sinx === 0)
959
+ sinx = m.copysign(sinx, x);
960
+ return { s: sinx, c: cosx };
961
+ };
962
+ m.sincosde = function(x, t) {
963
+ var d, r, q, s, c, sinx, cosx;
964
+ d = x % 360;
965
+ q = Math.round(d / 90);
966
+ d = m.AngRound(d - 90 * q + t);
967
+ r = d * this.degree;
968
+ s = Math.sin(r);
969
+ c = Math.cos(r);
970
+ if (Math.abs(d) === 45) {
971
+ c = Math.sqrt(0.5);
972
+ s = m.copysign(c, r);
973
+ } else if (Math.abs(d) === 30) {
974
+ c = Math.sqrt(0.75);
975
+ s = m.copysign(0.5, r);
976
+ }
977
+ switch (q & 3) {
978
+ case 0:
979
+ sinx = s;
980
+ cosx = c;
981
+ break;
982
+ case 1:
983
+ sinx = c;
984
+ cosx = -s;
985
+ break;
986
+ case 2:
987
+ sinx = -s;
988
+ cosx = -c;
989
+ break;
990
+ default:
991
+ sinx = -c;
992
+ cosx = s;
993
+ break;
994
+ }
995
+ cosx += 0;
996
+ if (sinx === 0)
997
+ sinx = m.copysign(sinx, x + t);
998
+ return { s: sinx, c: cosx };
999
+ };
1000
+ m.atan2d = function(y, x) {
1001
+ var q = 0, ang;
1002
+ if (Math.abs(y) > Math.abs(x)) {
1003
+ [y, x] = [x, y];
1004
+ q = 2;
1005
+ }
1006
+ if (m.copysign(1, x) < 0) {
1007
+ x = -x;
1008
+ ++q;
1009
+ }
1010
+ ang = Math.atan2(y, x) / this.degree;
1011
+ switch (q) {
1012
+ // Note that atan2d(-0.0, 1.0) will return -0. However, we expect that
1013
+ // atan2d will not be called with y = -0. If need be, include
1014
+ //
1015
+ // case 0: ang = 0 + ang; break;
1016
+ //
1017
+ // and handle mpfr as in AngRound.
1018
+ case 1:
1019
+ ang = m.copysign(180, y) - ang;
1020
+ break;
1021
+ case 2:
1022
+ ang = 90 - ang;
1023
+ break;
1024
+ case 3:
1025
+ ang = -90 + ang;
1026
+ break;
1027
+ default:
1028
+ break;
1029
+ }
1030
+ return ang;
1031
+ };
1032
+ })(geodesic.Math);
1033
+ (function(a, m) {
1034
+ "use strict";
1035
+ a.Accumulator = function(y) {
1036
+ this.Set(y);
1037
+ };
1038
+ a.Accumulator.prototype.Set = function(y) {
1039
+ if (!y)
1040
+ y = 0;
1041
+ if (y.constructor === a.Accumulator) {
1042
+ this._s = y._s;
1043
+ this._t = y._t;
1044
+ } else {
1045
+ this._s = y;
1046
+ this._t = 0;
1047
+ }
1048
+ };
1049
+ a.Accumulator.prototype.Add = function(y) {
1050
+ var u = m.sum(y, this._t), v = m.sum(u.s, this._s);
1051
+ u = u.t;
1052
+ this._s = v.s;
1053
+ this._t = v.t;
1054
+ if (this._s === 0)
1055
+ this._s = u;
1056
+ else
1057
+ this._t += u;
1058
+ };
1059
+ a.Accumulator.prototype.Sum = function(y) {
1060
+ var b;
1061
+ if (!y)
1062
+ return this._s;
1063
+ else {
1064
+ b = new a.Accumulator(this);
1065
+ b.Add(y);
1066
+ return b._s;
1067
+ }
1068
+ };
1069
+ a.Accumulator.prototype.Negate = function() {
1070
+ this._s *= -1;
1071
+ this._t *= -1;
1072
+ };
1073
+ a.Accumulator.prototype.Remainder = function(y) {
1074
+ this._s = m.remainder(this._s, y);
1075
+ this.Add(0);
1076
+ };
1077
+ })(geodesic.Accumulator, geodesic.Math);
1078
+ geodesic.Geodesic = {};
1079
+ geodesic.GeodesicLine = {};
1080
+ geodesic.PolygonArea = {};
1081
+ (function(g, l, p, m, c) {
1082
+ "use strict";
1083
+ 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_ = 1e3 * tol2_, CAP_NONE = 0, CAP_ALL = 31, OUT_ALL = 32640, astroid, A1m1f_coeff, C1f_coeff, C1pf_coeff, A2m1f_coeff, C2f_coeff, A3_coeff, C3_coeff, C4_coeff;
1084
+ g.tiny_ = Math.sqrt(Number.MIN_VALUE / Number.EPSILON);
1085
+ g.nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
1086
+ g.nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER;
1087
+ g.nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
1088
+ g.nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
1089
+ g.nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER;
1090
+ nC3x_ = g.nC3_ * (g.nC3_ - 1) / 2;
1091
+ nC4x_ = g.nC4_ * (g.nC4_ + 1) / 2;
1092
+ g.CAP_C1 = 1 << 0;
1093
+ g.CAP_C1p = 1 << 1;
1094
+ g.CAP_C2 = 1 << 2;
1095
+ g.CAP_C3 = 1 << 3;
1096
+ g.CAP_C4 = 1 << 4;
1097
+ g.NONE = 0;
1098
+ g.ARC = 1 << 6;
1099
+ g.LATITUDE = 1 << 7 | CAP_NONE;
1100
+ g.LONGITUDE = 1 << 8 | g.CAP_C3;
1101
+ g.AZIMUTH = 1 << 9 | CAP_NONE;
1102
+ g.DISTANCE = 1 << 10 | g.CAP_C1;
1103
+ g.STANDARD = g.LATITUDE | g.LONGITUDE | g.AZIMUTH | g.DISTANCE;
1104
+ g.DISTANCE_IN = 1 << 11 | g.CAP_C1 | g.CAP_C1p;
1105
+ g.REDUCEDLENGTH = 1 << 12 | g.CAP_C1 | g.CAP_C2;
1106
+ g.GEODESICSCALE = 1 << 13 | g.CAP_C1 | g.CAP_C2;
1107
+ g.AREA = 1 << 14 | g.CAP_C4;
1108
+ g.ALL = OUT_ALL | CAP_ALL;
1109
+ g.LONG_UNROLL = 1 << 15;
1110
+ g.OUT_MASK = OUT_ALL | g.LONG_UNROLL;
1111
+ g.SinCosSeries = function(sinp, sinx, cosx, c2, delta) {
1112
+ if (delta !== void 0) {
1113
+ var h = delta / 2, sh = Math.sin(h), ch = Math.cos(h);
1114
+ return -2 * g.SinCosSeries(false, cosx * ch - sinx * sh, sinx * ch + cosx * sh, c2.map(function(v, i) {
1115
+ return (i % 2 ? -v : v) * Math.sin((2 * i + 1) * h);
1116
+ }));
1117
+ }
1118
+ var k = c2.length, n = k - (sinp ? 1 : 0), ar = 2 * (cosx - sinx) * (cosx + sinx), y0 = n & 1 ? c2[--k] : 0, y1 = 0;
1119
+ n = Math.floor(n / 2);
1120
+ while (n--) {
1121
+ y1 = ar * y0 - y1 + c2[--k];
1122
+ y0 = ar * y1 - y0 + c2[--k];
1123
+ }
1124
+ return sinp ? 2 * sinx * cosx * y0 : (
1125
+ // sin(2 * x) * y0
1126
+ cosx * (y0 - y1)
1127
+ );
1128
+ };
1129
+ astroid = function(x, y) {
1130
+ var k, p2 = m.sq(x), q = m.sq(y), r = (p2 + q - 1) / 6, S, r2, r3, disc, u, T3, T, ang, v, uv, w;
1131
+ if (!(q === 0 && r <= 0)) {
1132
+ S = p2 * q / 4;
1133
+ r2 = m.sq(r);
1134
+ r3 = r * r2;
1135
+ disc = S * (S + 2 * r3);
1136
+ u = r;
1137
+ if (disc >= 0) {
1138
+ T3 = S + r3;
1139
+ T3 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc);
1140
+ T = m.cbrt(T3);
1141
+ u += T + (T !== 0 ? r2 / T : 0);
1142
+ } else {
1143
+ ang = Math.atan2(Math.sqrt(-disc), -(S + r3));
1144
+ u += 2 * r * Math.cos(ang / 3);
1145
+ }
1146
+ v = Math.sqrt(m.sq(u) + q);
1147
+ uv = u < 0 ? q / (v - u) : u + v;
1148
+ w = (uv - q) / (2 * v);
1149
+ k = uv / (Math.sqrt(uv + m.sq(w)) + w);
1150
+ } else {
1151
+ k = 0;
1152
+ }
1153
+ return k;
1154
+ };
1155
+ A1m1f_coeff = [
1156
+ // (1-eps)*A1-1, polynomial in eps2 of order 3
1157
+ 1,
1158
+ 4,
1159
+ 64,
1160
+ 0,
1161
+ 256
1162
+ ];
1163
+ g.A1m1f = function(eps) {
1164
+ var p2 = Math.floor(nA1_ / 2), t = m.polyval(p2, A1m1f_coeff, 0, m.sq(eps)) / A1m1f_coeff[p2 + 1];
1165
+ return (t + eps) / (1 - eps);
1166
+ };
1167
+ C1f_coeff = [
1168
+ // C1[1]/eps^1, polynomial in eps2 of order 2
1169
+ -1,
1170
+ 6,
1171
+ -16,
1172
+ 32,
1173
+ // C1[2]/eps^2, polynomial in eps2 of order 2
1174
+ -9,
1175
+ 64,
1176
+ -128,
1177
+ 2048,
1178
+ // C1[3]/eps^3, polynomial in eps2 of order 1
1179
+ 9,
1180
+ -16,
1181
+ 768,
1182
+ // C1[4]/eps^4, polynomial in eps2 of order 1
1183
+ 3,
1184
+ -5,
1185
+ 512,
1186
+ // C1[5]/eps^5, polynomial in eps2 of order 0
1187
+ -7,
1188
+ 1280,
1189
+ // C1[6]/eps^6, polynomial in eps2 of order 0
1190
+ -7,
1191
+ 2048
1192
+ ];
1193
+ g.C1f = function(eps, c2) {
1194
+ var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
1195
+ for (l2 = 1; l2 <= g.nC1_; ++l2) {
1196
+ p2 = Math.floor((g.nC1_ - l2) / 2);
1197
+ c2[l2] = d * m.polyval(p2, C1f_coeff, o, eps2) / C1f_coeff[o + p2 + 1];
1198
+ o += p2 + 2;
1199
+ d *= eps;
1200
+ }
1201
+ };
1202
+ C1pf_coeff = [
1203
+ // C1p[1]/eps^1, polynomial in eps2 of order 2
1204
+ 205,
1205
+ -432,
1206
+ 768,
1207
+ 1536,
1208
+ // C1p[2]/eps^2, polynomial in eps2 of order 2
1209
+ 4005,
1210
+ -4736,
1211
+ 3840,
1212
+ 12288,
1213
+ // C1p[3]/eps^3, polynomial in eps2 of order 1
1214
+ -225,
1215
+ 116,
1216
+ 384,
1217
+ // C1p[4]/eps^4, polynomial in eps2 of order 1
1218
+ -7173,
1219
+ 2695,
1220
+ 7680,
1221
+ // C1p[5]/eps^5, polynomial in eps2 of order 0
1222
+ 3467,
1223
+ 7680,
1224
+ // C1p[6]/eps^6, polynomial in eps2 of order 0
1225
+ 38081,
1226
+ 61440
1227
+ ];
1228
+ g.C1pf = function(eps, c2) {
1229
+ var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
1230
+ for (l2 = 1; l2 <= g.nC1p_; ++l2) {
1231
+ p2 = Math.floor((g.nC1p_ - l2) / 2);
1232
+ c2[l2] = d * m.polyval(p2, C1pf_coeff, o, eps2) / C1pf_coeff[o + p2 + 1];
1233
+ o += p2 + 2;
1234
+ d *= eps;
1235
+ }
1236
+ };
1237
+ A2m1f_coeff = [
1238
+ // (eps+1)*A2-1, polynomial in eps2 of order 3
1239
+ -11,
1240
+ -28,
1241
+ -192,
1242
+ 0,
1243
+ 256
1244
+ ];
1245
+ g.A2m1f = function(eps) {
1246
+ var p2 = Math.floor(nA2_ / 2), t = m.polyval(p2, A2m1f_coeff, 0, m.sq(eps)) / A2m1f_coeff[p2 + 1];
1247
+ return (t - eps) / (1 + eps);
1248
+ };
1249
+ C2f_coeff = [
1250
+ // C2[1]/eps^1, polynomial in eps2 of order 2
1251
+ 1,
1252
+ 2,
1253
+ 16,
1254
+ 32,
1255
+ // C2[2]/eps^2, polynomial in eps2 of order 2
1256
+ 35,
1257
+ 64,
1258
+ 384,
1259
+ 2048,
1260
+ // C2[3]/eps^3, polynomial in eps2 of order 1
1261
+ 15,
1262
+ 80,
1263
+ 768,
1264
+ // C2[4]/eps^4, polynomial in eps2 of order 1
1265
+ 7,
1266
+ 35,
1267
+ 512,
1268
+ // C2[5]/eps^5, polynomial in eps2 of order 0
1269
+ 63,
1270
+ 1280,
1271
+ // C2[6]/eps^6, polynomial in eps2 of order 0
1272
+ 77,
1273
+ 2048
1274
+ ];
1275
+ g.C2f = function(eps, c2) {
1276
+ var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
1277
+ for (l2 = 1; l2 <= g.nC2_; ++l2) {
1278
+ p2 = Math.floor((g.nC2_ - l2) / 2);
1279
+ c2[l2] = d * m.polyval(p2, C2f_coeff, o, eps2) / C2f_coeff[o + p2 + 1];
1280
+ o += p2 + 2;
1281
+ d *= eps;
1282
+ }
1283
+ };
1284
+ g.Geodesic = function(a, f) {
1285
+ this.a = a;
1286
+ this.f = f;
1287
+ this._f1 = 1 - this.f;
1288
+ this._e2 = this.f * (2 - this.f);
1289
+ this._ep2 = this._e2 / m.sq(this._f1);
1290
+ this._n = this.f / (2 - this.f);
1291
+ this._b = this.a * this._f1;
1292
+ this._c2 = (m.sq(this.a) + m.sq(this._b) * (this._e2 === 0 ? 1 : (this._e2 > 0 ? m.atanh(Math.sqrt(this._e2)) : Math.atan(Math.sqrt(-this._e2))) / Math.sqrt(Math.abs(this._e2)))) / 2;
1293
+ this._etol2 = 0.1 * tol2_ / Math.sqrt(Math.max(1e-3, Math.abs(this.f)) * Math.min(1, 1 - this.f / 2) / 2);
1294
+ if (!(isFinite(this.a) && this.a > 0))
1295
+ throw new Error("Equatorial radius is not positive");
1296
+ if (!(isFinite(this._b) && this._b > 0))
1297
+ throw new Error("Polar semi-axis is not positive");
1298
+ this._A3x = new Array(nA3x_);
1299
+ this._C3x = new Array(nC3x_);
1300
+ this._C4x = new Array(nC4x_);
1301
+ this.A3coeff();
1302
+ this.C3coeff();
1303
+ this.C4coeff();
1304
+ };
1305
+ A3_coeff = [
1306
+ // A3, coeff of eps^5, polynomial in n of order 0
1307
+ -3,
1308
+ 128,
1309
+ // A3, coeff of eps^4, polynomial in n of order 1
1310
+ -2,
1311
+ -3,
1312
+ 64,
1313
+ // A3, coeff of eps^3, polynomial in n of order 2
1314
+ -1,
1315
+ -3,
1316
+ -1,
1317
+ 16,
1318
+ // A3, coeff of eps^2, polynomial in n of order 2
1319
+ 3,
1320
+ -1,
1321
+ -2,
1322
+ 8,
1323
+ // A3, coeff of eps^1, polynomial in n of order 1
1324
+ 1,
1325
+ -1,
1326
+ 2,
1327
+ // A3, coeff of eps^0, polynomial in n of order 0
1328
+ 1,
1329
+ 1
1330
+ ];
1331
+ g.Geodesic.prototype.A3coeff = function() {
1332
+ var o = 0, k = 0, j, p2;
1333
+ for (j = nA3_ - 1; j >= 0; --j) {
1334
+ p2 = Math.min(nA3_ - j - 1, j);
1335
+ this._A3x[k++] = m.polyval(p2, A3_coeff, o, this._n) / A3_coeff[o + p2 + 1];
1336
+ o += p2 + 2;
1337
+ }
1338
+ };
1339
+ C3_coeff = [
1340
+ // C3[1], coeff of eps^5, polynomial in n of order 0
1341
+ 3,
1342
+ 128,
1343
+ // C3[1], coeff of eps^4, polynomial in n of order 1
1344
+ 2,
1345
+ 5,
1346
+ 128,
1347
+ // C3[1], coeff of eps^3, polynomial in n of order 2
1348
+ -1,
1349
+ 3,
1350
+ 3,
1351
+ 64,
1352
+ // C3[1], coeff of eps^2, polynomial in n of order 2
1353
+ -1,
1354
+ 0,
1355
+ 1,
1356
+ 8,
1357
+ // C3[1], coeff of eps^1, polynomial in n of order 1
1358
+ -1,
1359
+ 1,
1360
+ 4,
1361
+ // C3[2], coeff of eps^5, polynomial in n of order 0
1362
+ 5,
1363
+ 256,
1364
+ // C3[2], coeff of eps^4, polynomial in n of order 1
1365
+ 1,
1366
+ 3,
1367
+ 128,
1368
+ // C3[2], coeff of eps^3, polynomial in n of order 2
1369
+ -3,
1370
+ -2,
1371
+ 3,
1372
+ 64,
1373
+ // C3[2], coeff of eps^2, polynomial in n of order 2
1374
+ 1,
1375
+ -3,
1376
+ 2,
1377
+ 32,
1378
+ // C3[3], coeff of eps^5, polynomial in n of order 0
1379
+ 7,
1380
+ 512,
1381
+ // C3[3], coeff of eps^4, polynomial in n of order 1
1382
+ -10,
1383
+ 9,
1384
+ 384,
1385
+ // C3[3], coeff of eps^3, polynomial in n of order 2
1386
+ 5,
1387
+ -9,
1388
+ 5,
1389
+ 192,
1390
+ // C3[4], coeff of eps^5, polynomial in n of order 0
1391
+ 7,
1392
+ 512,
1393
+ // C3[4], coeff of eps^4, polynomial in n of order 1
1394
+ -14,
1395
+ 7,
1396
+ 512,
1397
+ // C3[5], coeff of eps^5, polynomial in n of order 0
1398
+ 21,
1399
+ 2560
1400
+ ];
1401
+ g.Geodesic.prototype.C3coeff = function() {
1402
+ var o = 0, k = 0, l2, j, p2;
1403
+ for (l2 = 1; l2 < g.nC3_; ++l2) {
1404
+ for (j = g.nC3_ - 1; j >= l2; --j) {
1405
+ p2 = Math.min(g.nC3_ - j - 1, j);
1406
+ this._C3x[k++] = m.polyval(p2, C3_coeff, o, this._n) / C3_coeff[o + p2 + 1];
1407
+ o += p2 + 2;
1408
+ }
1409
+ }
1410
+ };
1411
+ C4_coeff = [
1412
+ // C4[0], coeff of eps^5, polynomial in n of order 0
1413
+ 97,
1414
+ 15015,
1415
+ // C4[0], coeff of eps^4, polynomial in n of order 1
1416
+ 1088,
1417
+ 156,
1418
+ 45045,
1419
+ // C4[0], coeff of eps^3, polynomial in n of order 2
1420
+ -224,
1421
+ -4784,
1422
+ 1573,
1423
+ 45045,
1424
+ // C4[0], coeff of eps^2, polynomial in n of order 3
1425
+ -10656,
1426
+ 14144,
1427
+ -4576,
1428
+ -858,
1429
+ 45045,
1430
+ // C4[0], coeff of eps^1, polynomial in n of order 4
1431
+ 64,
1432
+ 624,
1433
+ -4576,
1434
+ 6864,
1435
+ -3003,
1436
+ 15015,
1437
+ // C4[0], coeff of eps^0, polynomial in n of order 5
1438
+ 100,
1439
+ 208,
1440
+ 572,
1441
+ 3432,
1442
+ -12012,
1443
+ 30030,
1444
+ 45045,
1445
+ // C4[1], coeff of eps^5, polynomial in n of order 0
1446
+ 1,
1447
+ 9009,
1448
+ // C4[1], coeff of eps^4, polynomial in n of order 1
1449
+ -2944,
1450
+ 468,
1451
+ 135135,
1452
+ // C4[1], coeff of eps^3, polynomial in n of order 2
1453
+ 5792,
1454
+ 1040,
1455
+ -1287,
1456
+ 135135,
1457
+ // C4[1], coeff of eps^2, polynomial in n of order 3
1458
+ 5952,
1459
+ -11648,
1460
+ 9152,
1461
+ -2574,
1462
+ 135135,
1463
+ // C4[1], coeff of eps^1, polynomial in n of order 4
1464
+ -64,
1465
+ -624,
1466
+ 4576,
1467
+ -6864,
1468
+ 3003,
1469
+ 135135,
1470
+ // C4[2], coeff of eps^5, polynomial in n of order 0
1471
+ 8,
1472
+ 10725,
1473
+ // C4[2], coeff of eps^4, polynomial in n of order 1
1474
+ 1856,
1475
+ -936,
1476
+ 225225,
1477
+ // C4[2], coeff of eps^3, polynomial in n of order 2
1478
+ -8448,
1479
+ 4992,
1480
+ -1144,
1481
+ 225225,
1482
+ // C4[2], coeff of eps^2, polynomial in n of order 3
1483
+ -1440,
1484
+ 4160,
1485
+ -4576,
1486
+ 1716,
1487
+ 225225,
1488
+ // C4[3], coeff of eps^5, polynomial in n of order 0
1489
+ -136,
1490
+ 63063,
1491
+ // C4[3], coeff of eps^4, polynomial in n of order 1
1492
+ 1024,
1493
+ -208,
1494
+ 105105,
1495
+ // C4[3], coeff of eps^3, polynomial in n of order 2
1496
+ 3584,
1497
+ -3328,
1498
+ 1144,
1499
+ 315315,
1500
+ // C4[4], coeff of eps^5, polynomial in n of order 0
1501
+ -128,
1502
+ 135135,
1503
+ // C4[4], coeff of eps^4, polynomial in n of order 1
1504
+ -2560,
1505
+ 832,
1506
+ 405405,
1507
+ // C4[5], coeff of eps^5, polynomial in n of order 0
1508
+ 128,
1509
+ 99099
1510
+ ];
1511
+ g.Geodesic.prototype.C4coeff = function() {
1512
+ var o = 0, k = 0, l2, j, p2;
1513
+ for (l2 = 0; l2 < g.nC4_; ++l2) {
1514
+ for (j = g.nC4_ - 1; j >= l2; --j) {
1515
+ p2 = g.nC4_ - j - 1;
1516
+ this._C4x[k++] = m.polyval(p2, C4_coeff, o, this._n) / C4_coeff[o + p2 + 1];
1517
+ o += p2 + 2;
1518
+ }
1519
+ }
1520
+ };
1521
+ g.Geodesic.prototype.A3f = function(eps) {
1522
+ return m.polyval(nA3x_ - 1, this._A3x, 0, eps);
1523
+ };
1524
+ g.Geodesic.prototype.C3f = function(eps, c2) {
1525
+ var mult = 1, o = 0, l2, p2;
1526
+ for (l2 = 1; l2 < g.nC3_; ++l2) {
1527
+ p2 = g.nC3_ - l2 - 1;
1528
+ mult *= eps;
1529
+ c2[l2] = mult * m.polyval(p2, this._C3x, o, eps);
1530
+ o += p2 + 1;
1531
+ }
1532
+ };
1533
+ g.Geodesic.prototype.C4f = function(eps, c2) {
1534
+ var mult = 1, o = 0, l2, p2;
1535
+ for (l2 = 0; l2 < g.nC4_; ++l2) {
1536
+ p2 = g.nC4_ - l2 - 1;
1537
+ c2[l2] = mult * m.polyval(p2, this._C4x, o, eps);
1538
+ o += p2 + 1;
1539
+ mult *= eps;
1540
+ }
1541
+ };
1542
+ g.Geodesic.prototype.Lengths = function(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, C1a, C2a) {
1543
+ outmask &= g.OUT_MASK;
1544
+ var vals = {}, m0x = 0, J12 = 0, A1 = 0, A2 = 0, B1, B2, l2, csig12, t;
1545
+ if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
1546
+ A1 = g.A1m1f(eps);
1547
+ g.C1f(eps, C1a);
1548
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
1549
+ A2 = g.A2m1f(eps);
1550
+ g.C2f(eps, C2a);
1551
+ m0x = A1 - A2;
1552
+ A2 = 1 + A2;
1553
+ }
1554
+ A1 = 1 + A1;
1555
+ }
1556
+ if (outmask & g.DISTANCE) {
1557
+ B1 = g.SinCosSeries(true, ssig2, csig2, C1a) - g.SinCosSeries(true, ssig1, csig1, C1a);
1558
+ vals.s12b = A1 * (sig12 + B1);
1559
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
1560
+ B2 = g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a);
1561
+ J12 = m0x * sig12 + (A1 * B1 - A2 * B2);
1562
+ }
1563
+ } else if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
1564
+ for (l2 = 1; l2 <= g.nC2_; ++l2)
1565
+ C2a[l2] = A1 * C1a[l2] - A2 * C2a[l2];
1566
+ J12 = m0x * sig12 + (g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a));
1567
+ }
1568
+ if (outmask & g.REDUCEDLENGTH) {
1569
+ vals.m0 = m0x;
1570
+ vals.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12;
1571
+ } else
1572
+ vals.m12b = NaN;
1573
+ if (outmask & g.GEODESICSCALE) {
1574
+ csig12 = csig1 * csig2 + ssig1 * ssig2;
1575
+ t = this._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
1576
+ vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
1577
+ vals.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
1578
+ }
1579
+ return vals;
1580
+ };
1581
+ g.Geodesic.prototype.InverseStart = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a) {
1582
+ var vals = {}, 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;
1583
+ vals.sig12 = -1;
1584
+ sbet12a = sbet2 * cbet1;
1585
+ sbet12a += cbet2 * sbet1;
1586
+ shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5;
1587
+ if (shortline) {
1588
+ sbetm2 = m.sq(sbet1 + sbet2);
1589
+ sbetm2 /= sbetm2 + m.sq(cbet1 + cbet2);
1590
+ vals.dnm = Math.sqrt(1 + this._ep2 * sbetm2);
1591
+ omg12 = lam12 / (this._f1 * vals.dnm);
1592
+ somg12 = Math.sin(omg12);
1593
+ comg12 = Math.cos(omg12);
1594
+ } else {
1595
+ somg12 = slam12;
1596
+ comg12 = clam12;
1597
+ }
1598
+ vals.salp1 = cbet2 * somg12;
1599
+ vals.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
1600
+ ssig12 = m.hypot(vals.salp1, vals.calp1);
1601
+ csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
1602
+ if (shortline && ssig12 < this._etol2) {
1603
+ vals.salp2 = cbet1 * somg12;
1604
+ vals.calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? m.sq(somg12) / (1 + comg12) : 1 - comg12);
1605
+ t = m.hypot(vals.salp2, vals.calp2);
1606
+ vals.salp2 /= t;
1607
+ vals.calp2 /= t;
1608
+ vals.sig12 = Math.atan2(ssig12, csig12);
1609
+ } else if (Math.abs(this._n) > 0.1 || // Skip astroid calc if too eccentric
1610
+ csig12 >= 0 || ssig12 >= 6 * Math.abs(this._n) * Math.PI * m.sq(cbet1)) {
1611
+ } else {
1612
+ lam12x = Math.atan2(-slam12, -clam12);
1613
+ if (this.f >= 0) {
1614
+ k2 = m.sq(sbet1) * this._ep2;
1615
+ eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1616
+ lamscale = this.f * cbet1 * this.A3f(eps) * Math.PI;
1617
+ betscale = lamscale * cbet1;
1618
+ x = lam12x / lamscale;
1619
+ y = sbet12a / betscale;
1620
+ } else {
1621
+ cbet12a = cbet2 * cbet1 - sbet2 * sbet1;
1622
+ bet12a = Math.atan2(sbet12a, cbet12a);
1623
+ nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
1624
+ m12b = nvals.m12b;
1625
+ m0 = nvals.m0;
1626
+ x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI);
1627
+ betscale = x < -0.01 ? sbet12a / x : -this.f * m.sq(cbet1) * Math.PI;
1628
+ lamscale = betscale / cbet1;
1629
+ y = lam12 / lamscale;
1630
+ }
1631
+ if (y > -tol1_ && x > -1 - xthresh_) {
1632
+ if (this.f >= 0) {
1633
+ vals.salp1 = Math.min(1, -x);
1634
+ vals.calp1 = -Math.sqrt(1 - m.sq(vals.salp1));
1635
+ } else {
1636
+ vals.calp1 = Math.max(x > -tol1_ ? 0 : -1, x);
1637
+ vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1));
1638
+ }
1639
+ } else {
1640
+ k = astroid(x, y);
1641
+ omg12a = lamscale * (this.f >= 0 ? -x * k / (1 + k) : -y * (1 + k) / k);
1642
+ somg12 = Math.sin(omg12a);
1643
+ comg12 = -Math.cos(omg12a);
1644
+ vals.salp1 = cbet2 * somg12;
1645
+ vals.calp1 = sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
1646
+ }
1647
+ }
1648
+ if (!(vals.salp1 <= 0)) {
1649
+ t = m.hypot(vals.salp1, vals.calp1);
1650
+ vals.salp1 /= t;
1651
+ vals.calp1 /= t;
1652
+ } else {
1653
+ vals.salp1 = 1;
1654
+ vals.calp1 = 0;
1655
+ }
1656
+ return vals;
1657
+ };
1658
+ g.Geodesic.prototype.Lambda12 = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, C1a, C2a, C3a) {
1659
+ var vals = {}, t, salp0, calp0, somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals;
1660
+ if (sbet1 === 0 && calp1 === 0)
1661
+ calp1 = -g.tiny_;
1662
+ salp0 = salp1 * cbet1;
1663
+ calp0 = m.hypot(calp1, salp1 * sbet1);
1664
+ vals.ssig1 = sbet1;
1665
+ somg1 = salp0 * sbet1;
1666
+ vals.csig1 = comg1 = calp1 * cbet1;
1667
+ t = m.hypot(vals.ssig1, vals.csig1);
1668
+ vals.ssig1 /= t;
1669
+ vals.csig1 /= t;
1670
+ vals.salp2 = cbet2 !== cbet1 ? salp0 / cbet2 : salp1;
1671
+ vals.calp2 = cbet2 !== cbet1 || Math.abs(sbet2) !== -sbet1 ? Math.sqrt(m.sq(calp1 * cbet1) + (cbet1 < -sbet1 ? (cbet2 - cbet1) * (cbet1 + cbet2) : (sbet1 - sbet2) * (sbet1 + sbet2))) / cbet2 : Math.abs(calp1);
1672
+ vals.ssig2 = sbet2;
1673
+ somg2 = salp0 * sbet2;
1674
+ vals.csig2 = comg2 = vals.calp2 * cbet2;
1675
+ t = m.hypot(vals.ssig2, vals.csig2);
1676
+ vals.ssig2 /= t;
1677
+ vals.csig2 /= t;
1678
+ vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 - vals.ssig1 * vals.csig2), vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2);
1679
+ somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
1680
+ comg12 = comg1 * comg2 + somg1 * somg2;
1681
+ eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120);
1682
+ k2 = m.sq(calp0) * this._ep2;
1683
+ vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1684
+ this.C3f(vals.eps, C3a);
1685
+ B312 = g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a) - g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a);
1686
+ vals.domg12 = -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312);
1687
+ vals.lam12 = eta + vals.domg12;
1688
+ if (diffp) {
1689
+ if (vals.calp2 === 0)
1690
+ vals.dlam12 = -2 * this._f1 * dn1 / sbet1;
1691
+ else {
1692
+ nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, dn1, vals.ssig2, vals.csig2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
1693
+ vals.dlam12 = nvals.m12b;
1694
+ vals.dlam12 *= this._f1 / (vals.calp2 * cbet2);
1695
+ }
1696
+ }
1697
+ return vals;
1698
+ };
1699
+ g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) {
1700
+ var r, vals;
1701
+ if (!outmask)
1702
+ outmask = g.STANDARD;
1703
+ if (outmask === g.LONG_UNROLL)
1704
+ outmask |= g.STANDARD;
1705
+ outmask &= g.OUT_MASK;
1706
+ r = this.InverseInt(lat1, lon1, lat2, lon2, outmask);
1707
+ vals = r.vals;
1708
+ if (outmask & g.AZIMUTH) {
1709
+ vals.azi1 = m.atan2d(r.salp1, r.calp1);
1710
+ vals.azi2 = m.atan2d(r.salp2, r.calp2);
1711
+ }
1712
+ return vals;
1713
+ };
1714
+ g.Geodesic.prototype.InverseInt = function(lat1, lon1, lat2, lon2, outmask) {
1715
+ 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;
1716
+ vals.lat1 = lat1 = m.LatFix(lat1);
1717
+ vals.lat2 = lat2 = m.LatFix(lat2);
1718
+ lat1 = m.AngRound(lat1);
1719
+ lat2 = m.AngRound(lat2);
1720
+ lon12 = m.AngDiff(lon1, lon2);
1721
+ lon12s = lon12.e;
1722
+ lon12 = lon12.d;
1723
+ if (outmask & g.LONG_UNROLL) {
1724
+ vals.lon1 = lon1;
1725
+ vals.lon2 = lon1 + lon12 + lon12s;
1726
+ } else {
1727
+ vals.lon1 = m.AngNormalize(lon1);
1728
+ vals.lon2 = m.AngNormalize(lon2);
1729
+ }
1730
+ lonsign = m.copysign(1, lon12);
1731
+ lon12 *= lonsign;
1732
+ lon12s *= lonsign;
1733
+ lam12 = lon12 * m.degree;
1734
+ t = m.sincosde(lon12, lon12s);
1735
+ slam12 = t.s;
1736
+ clam12 = t.c;
1737
+ lon12s = 180 - lon12 - lon12s;
1738
+ swapp = Math.abs(lat1) < Math.abs(lat2) || isNaN(lat2) ? -1 : 1;
1739
+ if (swapp < 0) {
1740
+ lonsign *= -1;
1741
+ [lat2, lat1] = [lat1, lat2];
1742
+ }
1743
+ latsign = m.copysign(1, -lat1);
1744
+ lat1 *= latsign;
1745
+ lat2 *= latsign;
1746
+ t = m.sincosd(lat1);
1747
+ sbet1 = this._f1 * t.s;
1748
+ cbet1 = t.c;
1749
+ t = m.hypot(sbet1, cbet1);
1750
+ sbet1 /= t;
1751
+ cbet1 /= t;
1752
+ cbet1 = Math.max(g.tiny_, cbet1);
1753
+ t = m.sincosd(lat2);
1754
+ sbet2 = this._f1 * t.s;
1755
+ cbet2 = t.c;
1756
+ t = m.hypot(sbet2, cbet2);
1757
+ sbet2 /= t;
1758
+ cbet2 /= t;
1759
+ cbet2 = Math.max(g.tiny_, cbet2);
1760
+ if (cbet1 < -sbet1) {
1761
+ if (cbet2 === cbet1)
1762
+ sbet2 = m.copysign(sbet1, sbet2);
1763
+ } else {
1764
+ if (Math.abs(sbet2) === -sbet1)
1765
+ cbet2 = cbet1;
1766
+ }
1767
+ dn1 = Math.sqrt(1 + this._ep2 * m.sq(sbet1));
1768
+ dn2 = Math.sqrt(1 + this._ep2 * m.sq(sbet2));
1769
+ C1a = new Array(g.nC1_ + 1);
1770
+ C2a = new Array(g.nC2_ + 1);
1771
+ C3a = new Array(g.nC3_);
1772
+ meridian = lat1 === -90 || slam12 === 0;
1773
+ if (meridian) {
1774
+ calp1 = clam12;
1775
+ salp1 = slam12;
1776
+ calp2 = 1;
1777
+ salp2 = 0;
1778
+ ssig1 = sbet1;
1779
+ csig1 = calp1 * cbet1;
1780
+ ssig2 = sbet2;
1781
+ csig2 = calp2 * cbet2;
1782
+ sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2);
1783
+ nvals = this.Lengths(this._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | g.DISTANCE | g.REDUCEDLENGTH, C1a, C2a);
1784
+ s12x = nvals.s12b;
1785
+ m12x = nvals.m12b;
1786
+ if (outmask & g.GEODESICSCALE) {
1787
+ vals.M12 = nvals.M12;
1788
+ vals.M21 = nvals.M21;
1789
+ }
1790
+ if (sig12 < tol2_ || m12x >= 0) {
1791
+ if (sig12 < 3 * g.tiny_ || // Prevent negative s12 or m12 for short lines
1792
+ sig12 < tol0_ && (s12x < 0 || m12x < 0))
1793
+ sig12 = m12x = s12x = 0;
1794
+ m12x *= this._b;
1795
+ s12x *= this._b;
1796
+ vals.a12 = sig12 / m.degree;
1797
+ } else
1798
+ meridian = false;
1799
+ }
1800
+ somg12 = 2;
1801
+ if (!meridian && sbet1 === 0 && // and sbet2 == 0
1802
+ (this.f <= 0 || lon12s >= this.f * 180)) {
1803
+ calp1 = calp2 = 0;
1804
+ salp1 = salp2 = 1;
1805
+ s12x = this.a * lam12;
1806
+ sig12 = omg12 = lam12 / this._f1;
1807
+ m12x = this._b * Math.sin(sig12);
1808
+ if (outmask & g.GEODESICSCALE)
1809
+ vals.M12 = vals.M21 = Math.cos(sig12);
1810
+ vals.a12 = lon12 / this._f1;
1811
+ } else if (!meridian) {
1812
+ nvals = this.InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a);
1813
+ sig12 = nvals.sig12;
1814
+ salp1 = nvals.salp1;
1815
+ calp1 = nvals.calp1;
1816
+ if (sig12 >= 0) {
1817
+ salp2 = nvals.salp2;
1818
+ calp2 = nvals.calp2;
1819
+ dnm = nvals.dnm;
1820
+ s12x = sig12 * this._b * dnm;
1821
+ m12x = m.sq(dnm) * this._b * Math.sin(sig12 / dnm);
1822
+ if (outmask & g.GEODESICSCALE)
1823
+ vals.M12 = vals.M21 = Math.cos(sig12 / dnm);
1824
+ vals.a12 = sig12 / m.degree;
1825
+ omg12 = lam12 / (this._f1 * dnm);
1826
+ } else {
1827
+ numit = 0;
1828
+ salp1a = g.tiny_;
1829
+ calp1a = 1;
1830
+ salp1b = g.tiny_;
1831
+ calp1b = -1;
1832
+ for (tripn = false, tripb = false; ; ++numit) {
1833
+ nvals = this.Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a);
1834
+ v = nvals.lam12;
1835
+ salp2 = nvals.salp2;
1836
+ calp2 = nvals.calp2;
1837
+ sig12 = nvals.sig12;
1838
+ ssig1 = nvals.ssig1;
1839
+ csig1 = nvals.csig1;
1840
+ ssig2 = nvals.ssig2;
1841
+ csig2 = nvals.csig2;
1842
+ eps = nvals.eps;
1843
+ domg12 = nvals.domg12;
1844
+ dv = nvals.dlam12;
1845
+ if (tripb || !(Math.abs(v) >= (tripn ? 8 : 1) * tol0_) || numit == maxit2_)
1846
+ break;
1847
+ if (v > 0 && (numit < maxit1_ || calp1 / salp1 > calp1b / salp1b)) {
1848
+ salp1b = salp1;
1849
+ calp1b = calp1;
1850
+ } else if (v < 0 && (numit < maxit1_ || calp1 / salp1 < calp1a / salp1a)) {
1851
+ salp1a = salp1;
1852
+ calp1a = calp1;
1853
+ }
1854
+ if (numit < maxit1_ && dv > 0) {
1855
+ dalp1 = -v / dv;
1856
+ if (Math.abs(dalp1) < Math.PI) {
1857
+ sdalp1 = Math.sin(dalp1);
1858
+ cdalp1 = Math.cos(dalp1);
1859
+ nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
1860
+ if (nsalp1 > 0) {
1861
+ calp1 = calp1 * cdalp1 - salp1 * sdalp1;
1862
+ salp1 = nsalp1;
1863
+ t = m.hypot(salp1, calp1);
1864
+ salp1 /= t;
1865
+ calp1 /= t;
1866
+ tripn = Math.abs(v) <= 16 * tol0_;
1867
+ continue;
1868
+ }
1869
+ }
1870
+ }
1871
+ salp1 = (salp1a + salp1b) / 2;
1872
+ calp1 = (calp1a + calp1b) / 2;
1873
+ t = m.hypot(salp1, calp1);
1874
+ salp1 /= t;
1875
+ calp1 /= t;
1876
+ tripn = false;
1877
+ tripb = Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_;
1878
+ }
1879
+ lengthmask = outmask | (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE) ? g.DISTANCE : g.NONE);
1880
+ nvals = this.Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a);
1881
+ s12x = nvals.s12b;
1882
+ m12x = nvals.m12b;
1883
+ if (outmask & g.GEODESICSCALE) {
1884
+ vals.M12 = nvals.M12;
1885
+ vals.M21 = nvals.M21;
1886
+ }
1887
+ m12x *= this._b;
1888
+ s12x *= this._b;
1889
+ vals.a12 = sig12 / m.degree;
1890
+ if (outmask & g.AREA) {
1891
+ sdomg12 = Math.sin(domg12);
1892
+ cdomg12 = Math.cos(domg12);
1893
+ somg12 = slam12 * cdomg12 - clam12 * sdomg12;
1894
+ comg12 = clam12 * cdomg12 + slam12 * sdomg12;
1895
+ }
1896
+ }
1897
+ }
1898
+ if (outmask & g.DISTANCE)
1899
+ vals.s12 = 0 + s12x;
1900
+ if (outmask & g.REDUCEDLENGTH)
1901
+ vals.m12 = 0 + m12x;
1902
+ if (outmask & g.AREA) {
1903
+ salp0 = salp1 * cbet1;
1904
+ calp0 = m.hypot(calp1, salp1 * sbet1);
1905
+ if (calp0 !== 0 && salp0 !== 0) {
1906
+ ssig1 = sbet1;
1907
+ csig1 = calp1 * cbet1;
1908
+ ssig2 = sbet2;
1909
+ csig2 = calp2 * cbet2;
1910
+ k2 = m.sq(calp0) * this._ep2;
1911
+ eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
1912
+ A4 = m.sq(this.a) * calp0 * salp0 * this._e2;
1913
+ t = m.hypot(ssig1, csig1);
1914
+ ssig1 /= t;
1915
+ csig1 /= t;
1916
+ t = m.hypot(ssig2, csig2);
1917
+ ssig2 /= t;
1918
+ csig2 /= t;
1919
+ C4a = new Array(g.nC4_);
1920
+ this.C4f(eps, C4a);
1921
+ B41 = g.SinCosSeries(false, ssig1, csig1, C4a);
1922
+ B42 = g.SinCosSeries(false, ssig2, csig2, C4a);
1923
+ vals.S12 = A4 * (sig12 < 0.01 ? g.SinCosSeries(false, ssig1, csig1, C4a, sig12) : B42 - B41);
1924
+ } else
1925
+ vals.S12 = 0;
1926
+ if (!meridian && somg12 == 2) {
1927
+ somg12 = Math.sin(omg12);
1928
+ comg12 = Math.cos(omg12);
1929
+ }
1930
+ if (!meridian && comg12 > -0.7071 && // Long difference not too big
1931
+ sbet2 - sbet1 < 1.75) {
1932
+ domg12 = 1 + comg12;
1933
+ dbet1 = 1 + cbet1;
1934
+ dbet2 = 1 + cbet2;
1935
+ alp12 = 2 * Math.atan2(somg12 * (sbet1 * dbet2 + sbet2 * dbet1), domg12 * (sbet1 * sbet2 + dbet1 * dbet2));
1936
+ } else {
1937
+ salp12 = salp2 * calp1 - calp2 * salp1;
1938
+ calp12 = calp2 * calp1 + salp2 * salp1;
1939
+ if (salp12 === 0 && calp12 < 0) {
1940
+ salp12 = g.tiny_ * calp1;
1941
+ calp12 = -1;
1942
+ }
1943
+ alp12 = Math.atan2(salp12, calp12);
1944
+ }
1945
+ vals.S12 += this._c2 * alp12;
1946
+ vals.S12 *= swapp * lonsign * latsign;
1947
+ vals.S12 += 0;
1948
+ }
1949
+ if (swapp < 0) {
1950
+ [salp2, salp1] = [salp1, salp2];
1951
+ [calp2, calp1] = [calp1, calp2];
1952
+ if (outmask & g.GEODESICSCALE) {
1953
+ [vals.M21, vals.M12] = [vals.M12, vals.M21];
1954
+ }
1955
+ }
1956
+ salp1 *= swapp * lonsign;
1957
+ calp1 *= swapp * latsign;
1958
+ salp2 *= swapp * lonsign;
1959
+ calp2 *= swapp * latsign;
1960
+ return {
1961
+ vals,
1962
+ salp1,
1963
+ calp1,
1964
+ salp2,
1965
+ calp2
1966
+ };
1967
+ };
1968
+ g.Geodesic.prototype.GenDirect = function(lat1, lon1, azi1, arcmode, s12_a12, outmask) {
1969
+ var line;
1970
+ if (!outmask)
1971
+ outmask = g.STANDARD;
1972
+ else if (outmask === g.LONG_UNROLL)
1973
+ outmask |= g.STANDARD;
1974
+ if (!arcmode)
1975
+ outmask |= g.DISTANCE_IN;
1976
+ line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask);
1977
+ return line.GenPosition(arcmode, s12_a12, outmask);
1978
+ };
1979
+ g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) {
1980
+ return this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
1981
+ };
1982
+ g.Geodesic.prototype.ArcDirect = function(lat1, lon1, azi1, a12, outmask) {
1983
+ return this.GenDirect(lat1, lon1, azi1, true, a12, outmask);
1984
+ };
1985
+ g.Geodesic.prototype.Line = function(lat1, lon1, azi1, caps) {
1986
+ return new l.GeodesicLine(this, lat1, lon1, azi1, caps);
1987
+ };
1988
+ g.Geodesic.prototype.DirectLine = function(lat1, lon1, azi1, s12, caps) {
1989
+ return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps);
1990
+ };
1991
+ g.Geodesic.prototype.ArcDirectLine = function(lat1, lon1, azi1, a12, caps) {
1992
+ return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps);
1993
+ };
1994
+ g.Geodesic.prototype.GenDirectLine = function(lat1, lon1, azi1, arcmode, s12_a12, caps) {
1995
+ var t;
1996
+ if (!caps)
1997
+ caps = g.STANDARD | g.DISTANCE_IN;
1998
+ if (!arcmode)
1999
+ caps |= g.DISTANCE_IN;
2000
+ t = new l.GeodesicLine(this, lat1, lon1, azi1, caps);
2001
+ t.GenSetDistance(arcmode, s12_a12);
2002
+ return t;
2003
+ };
2004
+ g.Geodesic.prototype.InverseLine = function(lat1, lon1, lat2, lon2, caps) {
2005
+ var r, t, azi1;
2006
+ if (!caps)
2007
+ caps = g.STANDARD | g.DISTANCE_IN;
2008
+ r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC);
2009
+ azi1 = m.atan2d(r.salp1, r.calp1);
2010
+ if (caps & (g.OUT_MASK & g.DISTANCE_IN))
2011
+ caps |= g.DISTANCE;
2012
+ t = new l.GeodesicLine(this, lat1, lon1, azi1, caps, r.salp1, r.calp1);
2013
+ t.SetArc(r.vals.a12);
2014
+ return t;
2015
+ };
2016
+ g.Geodesic.prototype.Polygon = function(polyline) {
2017
+ return new p.PolygonArea(this, polyline);
2018
+ };
2019
+ g.WGS84 = new g.Geodesic(c.WGS84.a, c.WGS84.f);
2020
+ })(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.PolygonArea, geodesic.Math, geodesic.Constants);
2021
+ (function(g, l, m) {
2022
+ "use strict";
2023
+ l.GeodesicLine = function(geod, lat1, lon1, azi1, caps, salp1, calp1) {
2024
+ var t, cbet1, sbet1, eps, s, c;
2025
+ if (!caps)
2026
+ caps = g.STANDARD | g.DISTANCE_IN;
2027
+ this.a = geod.a;
2028
+ this.f = geod.f;
2029
+ this._b = geod._b;
2030
+ this._c2 = geod._c2;
2031
+ this._f1 = geod._f1;
2032
+ this.caps = caps | g.LATITUDE | g.AZIMUTH | g.LONG_UNROLL;
2033
+ this.lat1 = m.LatFix(lat1);
2034
+ this.lon1 = lon1;
2035
+ if (typeof salp1 === "undefined" || typeof calp1 === "undefined") {
2036
+ this.azi1 = m.AngNormalize(azi1);
2037
+ t = m.sincosd(m.AngRound(this.azi1));
2038
+ this.salp1 = t.s;
2039
+ this.calp1 = t.c;
2040
+ } else {
2041
+ this.azi1 = azi1;
2042
+ this.salp1 = salp1;
2043
+ this.calp1 = calp1;
2044
+ }
2045
+ t = m.sincosd(m.AngRound(this.lat1));
2046
+ sbet1 = this._f1 * t.s;
2047
+ cbet1 = t.c;
2048
+ t = m.hypot(sbet1, cbet1);
2049
+ sbet1 /= t;
2050
+ cbet1 /= t;
2051
+ cbet1 = Math.max(g.tiny_, cbet1);
2052
+ this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1));
2053
+ this._salp0 = this.salp1 * cbet1;
2054
+ this._calp0 = m.hypot(this.calp1, this.salp1 * sbet1);
2055
+ this._ssig1 = sbet1;
2056
+ this._somg1 = this._salp0 * sbet1;
2057
+ this._csig1 = this._comg1 = sbet1 !== 0 || this.calp1 !== 0 ? cbet1 * this.calp1 : 1;
2058
+ t = m.hypot(this._ssig1, this._csig1);
2059
+ this._ssig1 /= t;
2060
+ this._csig1 /= t;
2061
+ this._k2 = m.sq(this._calp0) * geod._ep2;
2062
+ eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2);
2063
+ if (this.caps & g.CAP_C1) {
2064
+ this._A1m1 = g.A1m1f(eps);
2065
+ this._C1a = new Array(g.nC1_ + 1);
2066
+ g.C1f(eps, this._C1a);
2067
+ this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C1a);
2068
+ s = Math.sin(this._B11);
2069
+ c = Math.cos(this._B11);
2070
+ this._stau1 = this._ssig1 * c + this._csig1 * s;
2071
+ this._ctau1 = this._csig1 * c - this._ssig1 * s;
2072
+ }
2073
+ if (this.caps & g.CAP_C1p) {
2074
+ this._C1pa = new Array(g.nC1p_ + 1);
2075
+ g.C1pf(eps, this._C1pa);
2076
+ }
2077
+ if (this.caps & g.CAP_C2) {
2078
+ this._A2m1 = g.A2m1f(eps);
2079
+ this._C2a = new Array(g.nC2_ + 1);
2080
+ g.C2f(eps, this._C2a);
2081
+ this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C2a);
2082
+ }
2083
+ if (this.caps & g.CAP_C3) {
2084
+ this._C3a = new Array(g.nC3_);
2085
+ geod.C3f(eps, this._C3a);
2086
+ this._A3c = -this.f * this._salp0 * geod.A3f(eps);
2087
+ this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C3a);
2088
+ }
2089
+ if (this.caps & g.CAP_C4) {
2090
+ this._C4a = new Array(g.nC4_);
2091
+ geod.C4f(eps, this._C4a);
2092
+ this._A4 = m.sq(this.a) * this._calp0 * this._salp0 * geod._e2;
2093
+ this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a);
2094
+ }
2095
+ this.a13 = this.s13 = NaN;
2096
+ };
2097
+ l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12, outmask) {
2098
+ 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;
2099
+ if (!outmask)
2100
+ outmask = g.STANDARD;
2101
+ else if (outmask === g.LONG_UNROLL)
2102
+ outmask |= g.STANDARD;
2103
+ outmask &= this.caps & g.OUT_MASK;
2104
+ vals.lat1 = this.lat1;
2105
+ vals.azi1 = this.azi1;
2106
+ vals.lon1 = outmask & g.LONG_UNROLL ? this.lon1 : m.AngNormalize(this.lon1);
2107
+ if (arcmode)
2108
+ vals.a12 = s12_a12;
2109
+ else
2110
+ vals.s12 = s12_a12;
2111
+ if (!(arcmode || this.caps & g.DISTANCE_IN & g.OUT_MASK)) {
2112
+ vals.a12 = NaN;
2113
+ return vals;
2114
+ }
2115
+ B12 = 0;
2116
+ AB1 = 0;
2117
+ if (arcmode) {
2118
+ sig12 = s12_a12 * m.degree;
2119
+ t = m.sincosd(s12_a12);
2120
+ ssig12 = t.s;
2121
+ csig12 = t.c;
2122
+ } else {
2123
+ tau12 = s12_a12 / (this._b * (1 + this._A1m1));
2124
+ s = Math.sin(tau12);
2125
+ c = Math.cos(tau12);
2126
+ B12 = -g.SinCosSeries(true, this._stau1 * c + this._ctau1 * s, this._ctau1 * c - this._stau1 * s, this._C1pa);
2127
+ sig12 = tau12 - (B12 - this._B11);
2128
+ ssig12 = Math.sin(sig12);
2129
+ csig12 = Math.cos(sig12);
2130
+ if (Math.abs(this.f) > 0.01) {
2131
+ ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
2132
+ csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
2133
+ B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
2134
+ serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) - s12_a12 / this._b;
2135
+ sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2));
2136
+ ssig12 = Math.sin(sig12);
2137
+ csig12 = Math.cos(sig12);
2138
+ }
2139
+ }
2140
+ ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
2141
+ csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
2142
+ dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2));
2143
+ if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
2144
+ if (arcmode || Math.abs(this.f) > 0.01)
2145
+ B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
2146
+ AB1 = (1 + this._A1m1) * (B12 - this._B11);
2147
+ }
2148
+ sbet2 = this._calp0 * ssig2;
2149
+ cbet2 = m.hypot(this._salp0, this._calp0 * csig2);
2150
+ if (cbet2 === 0)
2151
+ cbet2 = csig2 = g.tiny_;
2152
+ salp2 = this._salp0;
2153
+ calp2 = this._calp0 * csig2;
2154
+ if (arcmode && outmask & g.DISTANCE)
2155
+ vals.s12 = this._b * ((1 + this._A1m1) * sig12 + AB1);
2156
+ if (outmask & g.LONGITUDE) {
2157
+ somg2 = this._salp0 * ssig2;
2158
+ comg2 = csig2;
2159
+ E = m.copysign(1, this._salp0);
2160
+ omg12 = outmask & g.LONG_UNROLL ? E * (sig12 - (Math.atan2(ssig2, csig2) - Math.atan2(this._ssig1, this._csig1)) + (Math.atan2(E * somg2, comg2) - Math.atan2(E * this._somg1, this._comg1))) : Math.atan2(somg2 * this._comg1 - comg2 * this._somg1, comg2 * this._comg1 + somg2 * this._somg1);
2161
+ lam12 = omg12 + this._A3c * (sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a) - this._B31));
2162
+ lon12 = lam12 / m.degree;
2163
+ vals.lon2 = outmask & g.LONG_UNROLL ? this.lon1 + lon12 : m.AngNormalize(m.AngNormalize(this.lon1) + m.AngNormalize(lon12));
2164
+ }
2165
+ if (outmask & g.LATITUDE)
2166
+ vals.lat2 = m.atan2d(sbet2, this._f1 * cbet2);
2167
+ if (outmask & g.AZIMUTH)
2168
+ vals.azi2 = m.atan2d(salp2, calp2);
2169
+ if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
2170
+ B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a);
2171
+ AB2 = (1 + this._A2m1) * (B22 - this._B21);
2172
+ J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2);
2173
+ if (outmask & g.REDUCEDLENGTH)
2174
+ vals.m12 = this._b * (dn2 * (this._csig1 * ssig2) - this._dn1 * (this._ssig1 * csig2) - this._csig1 * csig2 * J12);
2175
+ if (outmask & g.GEODESICSCALE) {
2176
+ t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) / (this._dn1 + dn2);
2177
+ vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1;
2178
+ vals.M21 = csig12 - (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2;
2179
+ }
2180
+ }
2181
+ if (outmask & g.AREA) {
2182
+ B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a);
2183
+ if (this._calp0 === 0 || this._salp0 === 0) {
2184
+ salp12 = salp2 * this.calp1 - calp2 * this.salp1;
2185
+ calp12 = calp2 * this.calp1 + salp2 * this.salp1;
2186
+ } else {
2187
+ salp12 = this._calp0 * this._salp0 * (csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 : ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1));
2188
+ calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2;
2189
+ }
2190
+ vals.S12 = this._c2 * Math.atan2(salp12, calp12) + this._A4 * (Math.abs(sig12) < 0.01 ? g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a, sig12) : B42 - this._B41);
2191
+ }
2192
+ if (!arcmode)
2193
+ vals.a12 = sig12 / m.degree;
2194
+ return vals;
2195
+ };
2196
+ l.GeodesicLine.prototype.Position = function(s12, outmask) {
2197
+ return this.GenPosition(false, s12, outmask);
2198
+ };
2199
+ l.GeodesicLine.prototype.ArcPosition = function(a12, outmask) {
2200
+ return this.GenPosition(true, a12, outmask);
2201
+ };
2202
+ l.GeodesicLine.prototype.GenSetDistance = function(arcmode, s13_a13) {
2203
+ if (arcmode)
2204
+ this.SetArc(s13_a13);
2205
+ else
2206
+ this.SetDistance(s13_a13);
2207
+ };
2208
+ l.GeodesicLine.prototype.SetDistance = function(s13) {
2209
+ var r;
2210
+ this.s13 = s13;
2211
+ r = this.GenPosition(false, this.s13, g.ARC);
2212
+ this.a13 = 0 + r.a12;
2213
+ };
2214
+ l.GeodesicLine.prototype.SetArc = function(a13) {
2215
+ var r;
2216
+ this.a13 = a13;
2217
+ r = this.GenPosition(true, this.a13, g.DISTANCE);
2218
+ this.s13 = 0 + r.s12;
2219
+ };
2220
+ })(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.Math);
2221
+
2222
+ // dist/ellipsoid-geodesic.js
2223
+ var library = geodesic.Geodesic;
2224
+ var EllipsoidGeodesic = class {
2225
+ constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
2226
+ this.engine = createGeodesicEngine({ semiMajorAxis: a, semiMinorAxis: b });
2227
+ }
2228
+ /** Total area in squared axis units, with the same normalization as S12. */
2229
+ get surfaceArea() {
2230
+ return 4 * Math.PI * this.engine._c2;
2231
+ }
2232
+ inverse(lat1, lon1, lat2, lon2, options = {}) {
2233
+ validatePoint(lat1, lon1);
2234
+ validatePoint(lat2, lon2);
2235
+ return this.engine.Inverse(lat1, lon1, lat2, lon2, outputMask(options));
2236
+ }
2237
+ direct(latitude, longitude, azimuth, distance, options = {}) {
2238
+ return this.line(latitude, longitude, azimuth, options).position(distance);
2239
+ }
2240
+ arcDirect(latitude, longitude, azimuth, arc, options = {}) {
2241
+ return this.line(latitude, longitude, azimuth, options).arcPosition(arc);
2242
+ }
2243
+ line(latitude, longitude, azimuth, options = {}) {
2244
+ validatePoint(latitude, longitude);
2245
+ validateFinite(azimuth);
2246
+ const selectedMask = outputMask(options);
2247
+ const line = this.engine.Line(latitude, longitude, azimuth, selectedMask | library.DISTANCE_IN);
2248
+ return {
2249
+ position(distance) {
2250
+ validateFinite(distance);
2251
+ return line.Position(distance, selectedMask);
2252
+ },
2253
+ arcPosition(arc) {
2254
+ validateFinite(arc);
2255
+ return line.ArcPosition(arc, selectedMask);
2256
+ }
2257
+ };
2258
+ }
2259
+ };
2260
+ function validatePoint(latitude, longitude) {
2261
+ if (!(Number.isFinite(latitude) && Math.abs(latitude) <= 90 && Number.isFinite(longitude))) {
2262
+ throw new Error("Invalid geodesic coordinates");
2263
+ }
2264
+ }
2265
+ function outputMask(options) {
2266
+ return library.ALL & ~(options.area ? 0 : library.AREA) | (options.unrollLongitude ? library.LONG_UNROLL : 0);
2267
+ }
2268
+ function validateFinite(value) {
2269
+ if (!Number.isFinite(value))
2270
+ throw new Error("Geodesic axes, azimuth, distance and arc must be finite");
2271
+ }
2272
+ var nonAreaGeodesicMask = library.ALL & ~library.AREA;
2273
+ function createGeodesicEngine({ semiMajorAxis: a, semiMinorAxis: b }) {
2274
+ validateFinite(a);
2275
+ validateFinite(b);
2276
+ return new library.Geodesic(a, (a - b) / a);
2277
+ }
2278
+
2279
+ // dist/local-reference-frame.js
2280
+ var import_core5 = require("@math.gl/core");
2281
+ var import_local_frame = require("@math.gl/core/local-frame");
2282
+ var LocalReferenceFrame = class {
2283
+ constructor(origin, options = {}) {
2284
+ finiteCoordinate(origin);
2285
+ const ellipsoid = options.ellipsoid || Ellipsoid.WGS84;
2286
+ const { x: a, y, z: b } = ellipsoid.radii;
2287
+ if (!(a > 0 && a === y && b > 0 && b <= a && Number.isFinite(a))) {
2288
+ throw new RangeError("LocalReferenceFrame requires a positive sphere or oblate spheroid");
2289
+ }
2290
+ const llh = ellipsoid.cartesianToCartographic(origin);
2291
+ if (!llh)
2292
+ throw new RangeError("Origin has no unique geodetic frame");
2293
+ const basis = (0, import_local_frame.createLocalFrameBasis)();
2294
+ const radians = import_core5.config._cartographicRadians ? 1 : Math.PI / 180;
2295
+ if (!(0, import_local_frame.eastNorthUpBasis)(llh[0] * radians, llh[1] * radians, basis))
2296
+ throw new RangeError("Cannot resolve local geodetic basis");
2297
+ const axes = options.axes || ["east", "north", "up"];
2298
+ const matrix = [];
2299
+ if (!(0, import_local_frame.localFrameToMatrix)(basis, { x: origin[0], y: origin[1], z: origin[2] }, ...axes, matrix)) {
2300
+ throw new RangeError("Expected three right-handed geographic axes");
2301
+ }
2302
+ this.matrix = Object.freeze(matrix);
2303
+ this.up = Object.freeze([basis.upX, basis.upY, basis.upZ]);
2304
+ }
2305
+ /** Independent copies: callers cannot mutate the cached frame. */
2306
+ get localToFixedMatrix() {
2307
+ return new import_core5.Matrix4(this.matrix);
2308
+ }
2309
+ get fixedToLocalMatrix() {
2310
+ return new import_core5.Matrix4(this.matrix).invert();
2311
+ }
2312
+ localToFixedPoint(point, result = new import_core5.Vector3()) {
2313
+ return this.transform(point, result, false, true);
2314
+ }
2315
+ fixedToLocalPoint(point, result = new import_core5.Vector3()) {
2316
+ return this.transform(point, result, true, true);
2317
+ }
2318
+ localToFixedVector(vector, result = new import_core5.Vector3()) {
2319
+ return this.transform(vector, result, false, false);
2320
+ }
2321
+ fixedToLocalVector(vector, result = new import_core5.Vector3()) {
2322
+ return this.transform(vector, result, true, false);
2323
+ }
2324
+ /** Packed XYZ points. Exact in-place operation is supported; other overlap is rejected.
2325
+ * All validation and representability checks finish before writing caller storage.
2326
+ */
2327
+ localToFixedPointsFlat(input, result) {
2328
+ return this.transformFlat(input, result, false, true);
2329
+ }
2330
+ fixedToLocalPointsFlat(input, result) {
2331
+ return this.transformFlat(input, result, true, true);
2332
+ }
2333
+ localToFixedVectorsFlat(input, result) {
2334
+ return this.transformFlat(input, result, false, false);
2335
+ }
2336
+ fixedToLocalVectorsFlat(input, result) {
2337
+ return this.transformFlat(input, result, true, false);
2338
+ }
2339
+ /** Model-to-fixed affine pose, with unit scale. Angles are radians. */
2340
+ headingPitchRollToFixedFrame(attitude, result = new import_core5.Matrix4()) {
2341
+ const { heading, pitch, roll } = attitude;
2342
+ if (![heading, pitch, roll].every(Number.isFinite))
2343
+ throw new RangeError("Nonfinite attitude");
2344
+ return result.copy(this.matrix).rotateZ(-heading).rotateY(-pitch).rotateX(roll);
2345
+ }
2346
+ headingPitchRollQuaternion(attitude, result = new import_core5.Quaternion()) {
2347
+ const m = this.headingPitchRollToFixedFrame(attitude);
2348
+ return result.fromMatrix3([m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9], m[10]]).normalize();
2349
+ }
2350
+ /** Extract attitude from a rigid model-to-fixed pose. Translation is ignored.
2351
+ * Pitch is canonicalized to [-pi/2, pi/2]. At gimbal lock, roll is zero.
2352
+ */
2353
+ fixedFrameToHeadingPitchRoll(pose) {
2354
+ validateRigidPose(pose);
2355
+ const local = new import_core5.Matrix4();
2356
+ const m = this.matrix;
2357
+ for (let column = 0; column < 3; column++) {
2358
+ for (let row = 0; row < 3; row++) {
2359
+ local[column * 4 + row] = m[row * 4] * pose[column * 4] + m[row * 4 + 1] * pose[column * 4 + 1] + m[row * 4 + 2] * pose[column * 4 + 2];
2360
+ }
2361
+ }
2362
+ const pitchY = Math.atan2(-local[2], Math.hypot(local[0], local[1]));
2363
+ const locked = Math.hypot(local[0], local[1]) < 1e-12;
2364
+ const roll = locked ? 0 : Math.atan2(local[6], local[10]);
2365
+ const yaw = locked ? Math.atan2(-local[4], local[5]) : Math.atan2(local[1], local[0]);
2366
+ return { heading: -yaw, pitch: -pitchY, roll };
2367
+ }
2368
+ /** Fixed-space velocity defines model +X. +Z is as close as possible to geodetic up.
2369
+ * Returns undefined without writing result for zero or nearly vertical velocity.
2370
+ * Stateless: callers own temporal continuity across these singularities.
2371
+ */
2372
+ velocityQuaternion(velocity, result = new import_core5.Quaternion()) {
2373
+ finiteCoordinate(velocity);
2374
+ const scale = Math.max(Math.abs(velocity[0]), Math.abs(velocity[1]), Math.abs(velocity[2]));
2375
+ if (scale === 0)
2376
+ return void 0;
2377
+ const x = new import_core5.Vector3(velocity[0] / scale, velocity[1] / scale, velocity[2] / scale);
2378
+ x.scale(1 / Math.hypot(x[0], x[1], x[2]));
2379
+ const y = new import_core5.Vector3(this.up).cross(x);
2380
+ if (y.len() < 1e-12)
2381
+ return void 0;
2382
+ y.normalize();
2383
+ const z = new import_core5.Vector3(x).cross(y).normalize();
2384
+ return result.fromMatrix3([...x, ...y, ...z]).normalize();
2385
+ }
2386
+ transformFlat(input, result, inverse, position) {
2387
+ if (!Number.isSafeInteger(input.length) || input.length % 3 || result && (!(result instanceof Float64Array) || result.length !== input.length))
2388
+ throw new RangeError("Expected packed XYZ and matching Float64 output");
2389
+ if (result && input !== result && ArrayBuffer.isView(input) && input.buffer === result.buffer && input.byteOffset < result.byteOffset + result.byteLength && result.byteOffset < input.byteOffset + input.byteLength)
2390
+ throw new RangeError("Packed frame buffers overlap");
2391
+ let bounded = !position || Math.max(Math.abs(this.matrix[12]), Math.abs(this.matrix[13]), Math.abs(this.matrix[14])) <= Number.MAX_VALUE / 8;
2392
+ for (let i = 0; i < input.length; i++) {
2393
+ if (!Number.isFinite(input[i]))
2394
+ throw new RangeError("Expected finite packed coordinates");
2395
+ bounded && (bounded = Math.abs(input[i]) <= Number.MAX_VALUE / 8);
2396
+ }
2397
+ const scratch = bounded ? void 0 : new import_core5.Vector3();
2398
+ if (scratch)
2399
+ for (let i = 0; i < input.length; i += 3)
2400
+ this.transform(scratch.set(input[i], input[i + 1], input[i + 2]), scratch, inverse, position);
2401
+ const output = result || new Float64Array(input.length), [xx, xy, xz, , yx, yy, yz, , zx, zy, zz, , ox, oy, oz] = this.matrix;
2402
+ for (let i = 0; i < input.length; i += 3) {
2403
+ const x = input[i] - (inverse && position ? ox : 0), y = input[i + 1] - (inverse && position ? oy : 0), z = input[i + 2] - (inverse && position ? oz : 0);
2404
+ if (scratch) {
2405
+ this.transform(scratch.set(input[i], input[i + 1], input[i + 2]), scratch, inverse, position);
2406
+ output.set(scratch, i);
2407
+ } else {
2408
+ output[i] = inverse ? xx * x + xy * y + xz * z : xx * x + yx * y + zx * z + (position ? ox : 0);
2409
+ output[i + 1] = inverse ? yx * x + yy * y + yz * z : xy * x + yy * y + zy * z + (position ? oy : 0);
2410
+ output[i + 2] = inverse ? zx * x + zy * y + zz * z : xz * x + yz * y + zz * z + (position ? oz : 0);
2411
+ }
2412
+ }
2413
+ return output;
2414
+ }
2415
+ transform(point, result, inverse, position) {
2416
+ finiteCoordinate(point);
2417
+ const m = this.matrix;
2418
+ const x = point[0] - (inverse && position ? m[12] : 0);
2419
+ const y = point[1] - (inverse && position ? m[13] : 0);
2420
+ const z = point[2] - (inverse && position ? m[14] : 0);
2421
+ let ox = inverse ? m[0] * x + m[1] * y + m[2] * z : m[0] * x + m[4] * y + m[8] * z + (position ? m[12] : 0);
2422
+ let oy = inverse ? m[4] * x + m[5] * y + m[6] * z : m[1] * x + m[5] * y + m[9] * z + (position ? m[13] : 0);
2423
+ let oz = inverse ? m[8] * x + m[9] * y + m[10] * z : m[2] * x + m[6] * y + m[10] * z + (position ? m[14] : 0);
2424
+ if (!Number.isFinite(ox) || !Number.isFinite(oy) || !Number.isFinite(oz)) {
2425
+ const scale = Math.max(Math.abs(point[0]), Math.abs(point[1]), Math.abs(point[2]), position ? Math.abs(m[12]) : 0, position ? Math.abs(m[13]) : 0, position ? Math.abs(m[14]) : 0);
2426
+ const sx = point[0] / scale - (inverse && position ? m[12] / scale : 0);
2427
+ const sy = point[1] / scale - (inverse && position ? m[13] / scale : 0);
2428
+ const sz = point[2] / scale - (inverse && position ? m[14] / scale : 0);
2429
+ ox = (inverse ? m[0] * sx + m[1] * sy + m[2] * sz : m[0] * sx + m[4] * sy + m[8] * sz + (position ? m[12] / scale : 0)) * scale;
2430
+ oy = (inverse ? m[4] * sx + m[5] * sy + m[6] * sz : m[1] * sx + m[5] * sy + m[9] * sz + (position ? m[13] / scale : 0)) * scale;
2431
+ oz = (inverse ? m[8] * sx + m[9] * sy + m[10] * sz : m[2] * sx + m[6] * sy + m[10] * sz + (position ? m[14] / scale : 0)) * scale;
2432
+ }
2433
+ if (!Number.isFinite(ox) || !Number.isFinite(oy) || !Number.isFinite(oz))
2434
+ throw new RangeError("Frame transformation overflow");
2435
+ return result.set(ox, oy, oz);
2436
+ }
2437
+ };
2438
+ function finiteCoordinate(point) {
2439
+ if (point.length !== 3 || !Number.isFinite(point[0]) || !Number.isFinite(point[1]) || !Number.isFinite(point[2])) {
2440
+ throw new RangeError("Expected three finite coordinates");
2441
+ }
2442
+ }
2443
+ function validateRigidPose(pose) {
2444
+ if (pose.length !== 16 || !Array.from(pose).every(Number.isFinite) || pose[3] !== 0 || pose[7] !== 0 || pose[11] !== 0 || pose[15] !== 1) {
2445
+ throw new RangeError("Expected a finite affine pose");
2446
+ }
2447
+ const x = new import_core5.Vector3(pose[0], pose[1], pose[2]);
2448
+ const y = new import_core5.Vector3(pose[4], pose[5], pose[6]);
2449
+ const z = new import_core5.Vector3(pose[8], pose[9], pose[10]);
2450
+ for (const axis of [x, y, z]) {
2451
+ if (Math.abs(Math.hypot(axis[0], axis[1], axis[2]) - 1) > 1e-6) {
2452
+ throw new RangeError("Pose rotation must be orthonormal and right-handed");
2453
+ }
2454
+ }
2455
+ const errors = [
2456
+ Math.abs(x.len() - 1),
2457
+ Math.abs(y.len() - 1),
2458
+ Math.abs(z.len() - 1),
2459
+ Math.abs(x.dot(y)),
2460
+ Math.abs(x.dot(z)),
2461
+ Math.abs(y.dot(z)),
2462
+ Math.abs(new import_core5.Vector3(x).cross(y).dot(z) - 1)
2463
+ ];
2464
+ if (!errors.every(Number.isFinite) || Math.max(...errors) > 1e-6) {
2465
+ throw new RangeError("Pose rotation must be orthonormal and right-handed");
2466
+ }
2467
+ }
2468
+
2469
+ // dist/ellipsoid-metrics.js
2470
+ var DEG = Math.PI / 180;
2471
+ var NODES = [
2472
+ 0.09501250983763744,
2473
+ 0.2816035507792589,
2474
+ 0.4580167776572274,
2475
+ 0.6178762444026438,
2476
+ 0.755404408355003,
2477
+ 0.8656312023878318,
2478
+ 0.9445750230732326,
2479
+ 0.9894009349916499
2480
+ ];
2481
+ var WEIGHTS = [
2482
+ 0.1894506104550685,
2483
+ 0.1826034150449236,
2484
+ 0.16915651939500254,
2485
+ 0.14959598881657674,
2486
+ 0.12462897125553388,
2487
+ 0.09515851168249279,
2488
+ 0.06225352393864789,
2489
+ 0.027152459411754096
2490
+ ];
2491
+ var KINDS = [
2492
+ "geocentric",
2493
+ "parametric",
2494
+ "rectifying",
2495
+ "authalic",
2496
+ "conformal",
2497
+ "isometric"
2498
+ ];
2499
+ var EllipsoidMetrics = class {
2500
+ constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
2501
+ const r = b / a;
2502
+ if (!(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0 && r >= 0.5 && r <= 2)) {
2503
+ throw new Error("Ellipsoid metrics require finite positive axes with 0.5 <= b/a <= 2");
2504
+ }
2505
+ this.semiMajorAxis = a;
2506
+ this.semiMinorAxis = b;
2507
+ this.ratio = r;
2508
+ this.e2 = (1 - r) * (1 + r);
2509
+ this.qPole = 1 + r * r * this.eccentricIntegral(1);
2510
+ this.quarter = integrate((t) => this.meridianIntegrand(t), 0, Math.PI / 2);
2511
+ this.quarterMeridian = a * this.quarter;
2512
+ this.surfaceArea = 2 * Math.PI * a * a * this.qPole;
2513
+ this.volume = 4 * Math.PI / 3 * a * b * a;
2514
+ if (![this.quarterMeridian, this.surfaceArea, this.volume].every((v) => Number.isFinite(v) && v > 0)) {
2515
+ throw new Error("Ellipsoid metrics exceed representable length/area/volume range");
2516
+ }
2517
+ Object.freeze(this);
2518
+ }
2519
+ meridianDistance(latitude) {
2520
+ validateLatitude(latitude);
2521
+ return Math.sign(latitude) * this.semiMajorAxis * this.meridian(Math.abs(latitude));
2522
+ }
2523
+ meridionalCurvatureRadius(latitude) {
2524
+ validateLatitude(latitude);
2525
+ return this.semiMajorAxis * this.meridianIntegrand(latitude * DEG);
2526
+ }
2527
+ transverseCurvatureRadius(latitude) {
2528
+ validateLatitude(latitude);
2529
+ const [s, c] = sincos(latitude);
2530
+ return this.semiMajorAxis / Math.hypot(c, this.ratio * s);
2531
+ }
2532
+ normalCurvatureRadius(latitude, azimuth) {
2533
+ if (!Number.isFinite(azimuth))
2534
+ throw new Error("Azimuth must be finite");
2535
+ const [s, c] = sincos(azimuth % 180);
2536
+ return 1 / (c * c / this.meridionalCurvatureRadius(latitude) + s * s / this.transverseCurvatureRadius(latitude));
2537
+ }
2538
+ latitudeToAuxiliary(latitude, kind) {
2539
+ validateKind(kind);
2540
+ validateLatitude(latitude);
2541
+ if (latitude === 0)
2542
+ return latitude;
2543
+ if (Math.abs(latitude) === 90)
2544
+ return kind === "isometric" ? Math.sign(latitude) * Infinity : latitude;
2545
+ if (this.ratio === 1 && kind !== "isometric")
2546
+ return latitude;
2547
+ const sign = Math.sign(latitude);
2548
+ const phi = Math.abs(latitude);
2549
+ const [s, c] = sincos(phi);
2550
+ switch (kind) {
2551
+ case "geocentric":
2552
+ return sign * angle(this.ratio * this.ratio * s, c);
2553
+ case "parametric":
2554
+ return sign * angle(this.ratio * s, c);
2555
+ case "rectifying":
2556
+ return sign * (phi <= 45 ? this.meridian(phi) / this.quarter * 90 : 90 - integrate((t) => this.meridianIntegrand(Math.PI / 2 - t), 0, (90 - phi) * DEG) / this.quarter * 90);
2557
+ case "authalic": {
2558
+ if (phi <= 45) {
2559
+ const q = this.ratio ** 2 * (s / (c * c + (this.ratio * s) ** 2) + this.eccentricIntegral(s));
2560
+ return sign * Math.asin(q / this.qPole) / DEG;
2561
+ }
2562
+ const cap = integrate((t) => {
2563
+ const st = Math.sin(t), ct = Math.cos(t);
2564
+ const d = st * st + (this.ratio * ct) ** 2;
2565
+ return 2 * this.ratio ** 2 * st / (d * d);
2566
+ }, 0, (90 - phi) * DEG);
2567
+ return sign * (90 - 2 * Math.asin(Math.sqrt(cap / (2 * this.qPole))) / DEG);
2568
+ }
2569
+ default: {
2570
+ const psi = Math.asinh(s / c) - this.e2 * this.eccentricIntegral(s);
2571
+ return sign * (kind === "isometric" ? psi / DEG : psi < 1 ? Math.atan(Math.sinh(psi)) / DEG : 90 - 2 * Math.atan(Math.exp(-psi)) / DEG);
2572
+ }
2573
+ }
2574
+ }
2575
+ latitudeFromAuxiliary(latitude, kind) {
2576
+ validateKind(kind);
2577
+ if (kind === "isometric" && Math.abs(latitude) === Infinity)
2578
+ return Math.sign(latitude) * 90;
2579
+ if (kind !== "isometric")
2580
+ validateLatitude(latitude);
2581
+ else if (!Number.isFinite(latitude))
2582
+ throw new Error("Isometric latitude must be finite or a pole infinity");
2583
+ if (latitude === 0)
2584
+ return latitude;
2585
+ if (kind !== "isometric" && Math.abs(latitude) === 90)
2586
+ return latitude;
2587
+ if (this.ratio === 1 && kind !== "isometric")
2588
+ return latitude;
2589
+ const sign = Math.sign(latitude), target = Math.abs(latitude);
2590
+ if (kind === "geocentric" || kind === "parametric") {
2591
+ const [s, c] = sincos(target);
2592
+ return sign * angle(s, c * (kind === "geocentric" ? this.ratio ** 2 : this.ratio));
2593
+ }
2594
+ let lo = 0, hi = 90;
2595
+ for (let i = 0; i < 64; ++i) {
2596
+ const mid = (lo + hi) / 2;
2597
+ if (mid === lo || mid === hi)
2598
+ break;
2599
+ if (this.latitudeToAuxiliary(mid, kind) < target)
2600
+ lo = mid;
2601
+ else
2602
+ hi = mid;
2603
+ }
2604
+ return sign * ((lo + hi) / 2);
2605
+ }
2606
+ eccentricIntegral(s) {
2607
+ const e = Math.sqrt(Math.abs(this.e2));
2608
+ return e === 0 ? s : (this.e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
2609
+ }
2610
+ meridianIntegrand(t) {
2611
+ return this.ratio ** 2 / Math.hypot(Math.cos(t), this.ratio * Math.sin(t)) ** 3;
2612
+ }
2613
+ meridian(phi) {
2614
+ return phi <= 45 ? integrate((t) => this.meridianIntegrand(t), 0, phi * DEG) : this.quarter - integrate((t) => this.meridianIntegrand(Math.PI / 2 - t), 0, (90 - phi) * DEG);
2615
+ }
2616
+ };
2617
+ function validateLatitude(value) {
2618
+ if (!(Number.isFinite(value) && Math.abs(value) <= 90))
2619
+ throw new Error("Latitude must be in [-90, 90] degrees");
2620
+ }
2621
+ function validateKind(kind) {
2622
+ if (!KINDS.includes(kind))
2623
+ throw new Error("Unknown auxiliary latitude");
2624
+ }
2625
+ function sincos(degrees) {
2626
+ const a = Math.abs(degrees);
2627
+ if (a <= 45)
2628
+ return [Math.sin(degrees * DEG), Math.cos(degrees * DEG)];
2629
+ return [Math.sign(degrees) * Math.cos((90 - a) * DEG), Math.sin((90 - a) * DEG)];
2630
+ }
2631
+ function angle(s, c) {
2632
+ return s > c ? 90 - Math.atan2(c, s) / DEG : Math.atan2(s, c) / DEG;
2633
+ }
2634
+ function integrate(f, lo, hi) {
2635
+ let sum = 0;
2636
+ for (let j = 0; j < 8; ++j) {
2637
+ const h = (hi - lo) / 16, mid = lo + (2 * j + 1) * h;
2638
+ let part = 0;
2639
+ for (let i = 0; i < 8; ++i)
2640
+ part += WEIGHTS[i] * (f(mid - h * NODES[i]) + f(mid + h * NODES[i]));
2641
+ sum += h * part;
2642
+ }
2643
+ return sum;
2644
+ }
2645
+
2646
+ // dist/ellipsoid-helpers/surface-polygon.js
2647
+ var Accumulator = geodesic.Accumulator.Accumulator;
2648
+ var math = geodesic.Math;
2649
+ var SurfacePolygon = class {
2650
+ constructor(solver, options = {}) {
2651
+ this.count = 0;
2652
+ this.firstLat = 0;
2653
+ this.firstLon = 0;
2654
+ this.lastLat = 0;
2655
+ this.lastLon = 0;
2656
+ this.crossings = 0;
2657
+ this.perimeter = new Accumulator();
2658
+ this.area = new Accumulator();
2659
+ this.geodesic = solver;
2660
+ this.polyline = Boolean(options.polyline);
2661
+ this.area0 = this.geodesic.surfaceArea;
2662
+ if (!(Number.isFinite(this.area0) && this.area0 > 0)) {
2663
+ throw new Error("Polygon area exceeds representable range");
2664
+ }
2665
+ }
2666
+ get number() {
2667
+ return this.count;
2668
+ }
2669
+ clear() {
2670
+ this.count = this.crossings = 0;
2671
+ this.firstLat = this.firstLon = this.lastLat = this.lastLon = 0;
2672
+ this.perimeter = new Accumulator();
2673
+ this.area = new Accumulator();
2674
+ return this;
2675
+ }
2676
+ addPoint(latitude, longitude, options = {}) {
2677
+ if (!(Number.isFinite(latitude) && Math.abs(latitude) <= 90 && Number.isFinite(longitude))) {
2678
+ throw new Error("Polygon point requires finite longitude and latitude in [-90, 90]");
2679
+ }
2680
+ if (this.count) {
2681
+ const edge = this.geodesic.inverse(this.lastLat, this.lastLon, latitude, longitude, {
2682
+ area: !this.polyline,
2683
+ longitudeTurns: options.longitudeTurns,
2684
+ unrollLongitude: Boolean(options.longitudeTurns)
2685
+ });
2686
+ this.accumulate(edge.s12, this.polyline ? 0 : edge.S12);
2687
+ if (!this.polyline) {
2688
+ this.crossings = (this.crossings + (options.longitudeTurns ? transitDirect(this.lastLon, edge.lon2) : transit(this.lastLon, longitude))) % 2;
2689
+ }
2690
+ } else {
2691
+ this.firstLat = latitude;
2692
+ this.firstLon = longitude;
2693
+ }
2694
+ this.lastLat = latitude;
2695
+ this.lastLon = longitude;
2696
+ ++this.count;
2697
+ return this;
2698
+ }
2699
+ addEdge(azimuth, distance) {
2700
+ if (!this.count)
2701
+ throw new Error("Add a starting point before adding an edge");
2702
+ const edge = this.geodesic.direct(this.lastLat, this.lastLon, azimuth, distance, {
2703
+ area: !this.polyline,
2704
+ unrollLongitude: true
2705
+ });
2706
+ if (!(Number.isFinite(edge.lat2) && Number.isFinite(edge.lon2)))
2707
+ throw new Error("Unrepresentable geodesic edge");
2708
+ this.accumulate(distance, this.polyline ? 0 : edge.S12);
2709
+ if (!this.polyline) {
2710
+ this.crossings = (this.crossings + transitDirect(this.lastLon, edge.lon2)) % 2;
2711
+ }
2712
+ this.lastLat = edge.lat2;
2713
+ this.lastLon = edge.lon2;
2714
+ ++this.count;
2715
+ return this;
2716
+ }
2717
+ compute(options = {}) {
2718
+ if (this.count < 2)
2719
+ return this.polyline ? { number: this.count, perimeter: 0 } : { number: this.count, perimeter: 0, area: 0 };
2720
+ if (this.polyline)
2721
+ return { number: this.count, perimeter: this.perimeter.Sum() };
2722
+ const edge = this.geodesic.inverse(this.lastLat, this.lastLon, this.firstLat, this.firstLon, {
2723
+ area: true
2724
+ });
2725
+ const total = new Accumulator(this.area);
2726
+ total.Add(edge.S12);
2727
+ const area0 = this.area0;
2728
+ total.Remainder(area0);
2729
+ if ((this.crossings + transit(this.lastLon, this.firstLon)) % 2 !== 0) {
2730
+ total.Add((total.Sum() < 0 ? 1 : -1) * area0 / 2);
2731
+ }
2732
+ if (!options.reverse)
2733
+ total.Negate();
2734
+ if (options.unsigned) {
2735
+ if (total.Sum() >= area0)
2736
+ total.Add(-area0);
2737
+ else if (total.Sum() < 0)
2738
+ total.Add(area0);
2739
+ } else {
2740
+ if (total.Sum() > area0 / 2)
2741
+ total.Add(-area0);
2742
+ else if (total.Sum() <= -area0 / 2)
2743
+ total.Add(area0);
2744
+ }
2745
+ return { number: this.count, perimeter: this.perimeter.Sum(edge.s12), area: 0 + total.Sum() };
2746
+ }
2747
+ /** Nonmutating preview, with the same compensated arithmetic as insertion. */
2748
+ testPoint(latitude, longitude, options = {}) {
2749
+ return this.copy().addPoint(latitude, longitude, options).compute(options);
2750
+ }
2751
+ testEdge(azimuth, distance, options = {}) {
2752
+ return this.copy().addEdge(azimuth, distance).compute(options);
2753
+ }
2754
+ accumulate(distance, area) {
2755
+ if (![distance, area, this.perimeter.Sum(distance), this.area.Sum(area)].every(Number.isFinite)) {
2756
+ throw new Error("Unrepresentable geodesic sum");
2757
+ }
2758
+ this.perimeter.Add(distance);
2759
+ if (!this.polyline)
2760
+ this.area.Add(area);
2761
+ }
2762
+ copy() {
2763
+ const copy = Object.create(Object.getPrototypeOf(this));
2764
+ Object.assign(copy, this);
2765
+ copy.perimeter = new Accumulator(this.perimeter);
2766
+ copy.area = new Accumulator(this.area);
2767
+ return copy;
2768
+ }
2769
+ };
2770
+ function transit(a, b) {
2771
+ const delta = math.AngDiff(a, b).d;
2772
+ a = math.AngNormalize(a);
2773
+ b = math.AngNormalize(b);
2774
+ return delta > 0 && (a < 0 && b >= 0 || a > 0 && b === 0) ? 1 : delta < 0 && a >= 0 && b < 0 ? -1 : 0;
2775
+ }
2776
+ function transitDirect(a, b) {
2777
+ a %= 720;
2778
+ b %= 720;
2779
+ return (b >= 0 && b < 360 || b < -360 ? 0 : 1) - (a >= 0 && a < 360 || a < -360 ? 0 : 1);
2780
+ }
2781
+
2782
+ // dist/geodesic-polygon.js
2783
+ var GeodesicPolygon = class extends SurfacePolygon {
2784
+ constructor(parameters, options = {}) {
2785
+ super(new EllipsoidGeodesic(parameters), options);
2786
+ }
2787
+ addPoint(latitude, longitude) {
2788
+ return super.addPoint(latitude, longitude);
2789
+ }
2790
+ };
2791
+
2792
+ // dist/ellipsoid-helpers/rhumb-pole-distance.js
2793
+ var Q = 10n ** 48n;
2794
+ var PI = 3141592653589793238462643383279502884197169399375n;
2795
+ var mul = (x, y) => x * y / Q;
2796
+ var div = (x, y) => x * Q / y;
2797
+ function exact(x) {
2798
+ const bytes = new DataView(new ArrayBuffer(8));
2799
+ bytes.setFloat64(0, x);
2800
+ const bits = bytes.getBigUint64(0), exponent = Number(bits >> 52n & 2047n);
2801
+ const mantissa = bits & (1n << 52n) - 1n | (exponent ? 1n << 52n : 0n);
2802
+ const shift = exponent ? exponent - 1075 : -1074;
2803
+ const value = shift >= 0 ? mantissa * Q << BigInt(shift) : mantissa * Q >> BigInt(-shift);
2804
+ return bits >> 63n ? -value : value;
2805
+ }
2806
+ function sc(x) {
2807
+ let s = x, c = Q, ts = x, tc = Q;
2808
+ const square = mul(x, x);
2809
+ for (let n = 1n; n < 160n; n++) {
2810
+ ts = -mul(ts, square) / (2n * n * (2n * n + 1n));
2811
+ tc = -mul(tc, square) / ((2n * n - 1n) * (2n * n));
2812
+ s += ts;
2813
+ c += tc;
2814
+ if (ts === 0n && tc === 0n)
2815
+ break;
2816
+ }
2817
+ return [s, c];
2818
+ }
2819
+ function remainingPoleDistance(a, b, latitude, azimuth, distance, sign) {
2820
+ const unit = 2 ** Math.floor(Math.log2(a));
2821
+ a /= unit;
2822
+ b /= unit;
2823
+ distance /= unit;
2824
+ const ratio2 = div(exact(b), exact(a));
2825
+ const theta = mul(90n * Q - BigInt(sign) * exact(latitude), PI) / 180n;
2826
+ const [s, c] = sc(theta), prolate = ratio2 > Q;
2827
+ const square = mul(ratio2, ratio2);
2828
+ const k = prolate ? Q - div(Q, square) : Q - square;
2829
+ const z = prolate ? s : c, other = prolate ? c : s;
2830
+ const zz = mul(z, z);
2831
+ let integral = theta, total = theta, coefficient = Q, power = z;
2832
+ for (let n = 1n; n < 480n; n++) {
2833
+ integral = ((2n * n - 1n) * integral + (prolate ? -1n : 1n) * mul(power, other)) / (2n * n);
2834
+ coefficient = mul(coefficient, k) * (2n * n + 1n) / (2n * n);
2835
+ const term = mul(coefficient, integral);
2836
+ total += term;
2837
+ power = mul(power, zz);
2838
+ if (term === 0n)
2839
+ break;
2840
+ }
2841
+ const gap = prolate ? div(total, ratio2) : mul(total, square);
2842
+ const angle2 = mul(exact(azimuth % 360), PI) / 180n;
2843
+ const north = mul(div(exact(distance), exact(a)), sc(angle2)[1]);
2844
+ return Number(gap - BigInt(sign) * north) / Number(Q);
2845
+ }
2846
+
2847
+ // dist/ellipsoid-rhumb.js
2848
+ var RhumbDomainError = class extends RangeError {
2849
+ constructor(reason) {
2850
+ super(reason === "pole" ? "Rhumb longitude/bearing is undefined at an exact pole" : "Rhumb crosses a pole; continuation longitude is undefined");
2851
+ this.reason = reason;
2852
+ this.name = "RhumbDomainError";
2853
+ }
2854
+ };
2855
+ var DEG2 = Math.PI / 180;
2856
+ var EllipsoidRhumb = class {
2857
+ constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
2858
+ if (!(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0))
2859
+ throw new RangeError("Rhumbs require finite positive axes");
2860
+ this.a = a;
2861
+ this.b = b;
2862
+ this.r = b / a;
2863
+ this.metrics = new EllipsoidMetrics({ semiMajorAxis: 1, semiMinorAxis: this.r });
2864
+ this.surfaceArea = a * this.metrics.surfaceArea * a;
2865
+ if (!(Number.isFinite(this.surfaceArea) && this.surfaceArea > 0))
2866
+ throw new RangeError("Rhumb surface area is unrepresentable");
2867
+ Object.freeze(this);
2868
+ }
2869
+ inverse(lat1, lon1, lat2, lon2, options = {}) {
2870
+ validateRhumbPoint(lat1, lon1);
2871
+ validateRhumbPoint(lat2, lon2);
2872
+ const turns = options.longitudeTurns ?? 0;
2873
+ if (!Number.isSafeInteger(turns))
2874
+ throw new RangeError("Rhumb longitudeTurns must be a safe integer");
2875
+ const longitude = angleDifference(lon1, lon2) + 360 * turns;
2876
+ if (!Number.isFinite(longitude))
2877
+ throw new RangeError("Unrepresentable rhumb winding");
2878
+ const dphi = (lat2 - lat1) * DEG2;
2879
+ const [meanM, meanP] = this.means(lat1, lat2);
2880
+ const dx = longitude * DEG2 * meanM / meanP;
2881
+ const distance = this.a * Math.hypot(dphi * meanM, dx);
2882
+ const azi = Math.atan2(longitude * DEG2, dphi * meanP) / DEG2;
2883
+ const result = {
2884
+ lat1,
2885
+ lon1,
2886
+ lat2,
2887
+ lon2: options.unrollLongitude ? lon1 + longitude : normalize(lon2),
2888
+ azi12: azi,
2889
+ s12: distance
2890
+ };
2891
+ if (options.area)
2892
+ result.S12 = this.area(lat1, lat2, longitude * DEG2);
2893
+ if (!Number.isFinite(distance))
2894
+ throw new RangeError("Unrepresentable rhumb distance");
2895
+ return result;
2896
+ }
2897
+ direct(latitude, longitude, azimuth, distance, options = {}) {
2898
+ return this.line(latitude, longitude, azimuth, options).position(distance);
2899
+ }
2900
+ line(latitude, longitude, azimuth, options = {}) {
2901
+ validateRhumbPoint(latitude, longitude);
2902
+ if (!Number.isFinite(azimuth))
2903
+ throw new RangeError("Rhumb azimuth must be finite");
2904
+ const [sa, ca] = sincosDegrees(azimuth);
2905
+ const area = Boolean(options.area), unroll = Boolean(options.unrollLongitude);
2906
+ const azi = normalize(azimuth);
2907
+ return {
2908
+ position: (distance) => {
2909
+ if (!Number.isFinite(distance))
2910
+ throw new RangeError("Rhumb distance must be finite");
2911
+ const delta = distance / this.a;
2912
+ if (!Number.isFinite(delta))
2913
+ throw new RangeError("Unrepresentable rhumb distance");
2914
+ const north = delta * ca;
2915
+ let poleDistance;
2916
+ if (north !== 0) {
2917
+ const gap = north > 0 ? this.meridianDelta(latitude, 90) : this.meridianDelta(-90, latitude);
2918
+ poleDistance = gap - Math.abs(north);
2919
+ if (Math.abs(poleDistance) < 1e-4 * gap)
2920
+ poleDistance = remainingPoleDistance(this.a, this.b, latitude, azimuth, distance, Math.sign(north));
2921
+ if (poleDistance < 0)
2922
+ throw new RhumbDomainError("pole-crossing");
2923
+ if (poleDistance === 0)
2924
+ throw new RhumbDomainError("pole");
2925
+ }
2926
+ const polar = north === 0 ? void 0 : this.polarEndpoint(latitude, north, poleDistance);
2927
+ const lat2 = north === 0 ? latitude : (polar == null ? void 0 : polar.latitude) ?? this.inverseMeridian(latitude, north);
2928
+ if (Math.abs(lat2) === 90)
2929
+ throw new RhumbDomainError("pole");
2930
+ const [meanM, meanP] = (polar == null ? void 0 : polar.means) ?? this.means(latitude, lat2);
2931
+ const dlon = delta * sa * meanP / meanM / DEG2;
2932
+ const lon2 = unroll ? longitude + dlon : normalize(normalize(longitude) + dlon);
2933
+ if (!Number.isFinite(lon2))
2934
+ throw new RangeError("Unrepresentable rhumb longitude");
2935
+ const result = {
2936
+ lat1: latitude,
2937
+ lon1: longitude,
2938
+ lat2,
2939
+ lon2,
2940
+ azi12: azi,
2941
+ s12: distance
2942
+ };
2943
+ if (area)
2944
+ result.S12 = this.area(latitude, lat2, dlon * DEG2, polar == null ? void 0 : polar.psi);
2945
+ return result;
2946
+ }
2947
+ };
2948
+ }
2949
+ means(lat1, lat2) {
2950
+ const d = (lat2 - lat1) * DEG2;
2951
+ const mid = (lat1 + lat2) / 2;
2952
+ const meanM = this.meridianMean(lat1, lat2);
2953
+ const cmin = Math.min(latitudeSinCos(lat1)[1], latitudeSinCos(lat2)[1]);
2954
+ const meanP = Math.abs(d) < 0.25 * cmin ? integrate((t) => {
2955
+ const [s, c] = latitudeSinCos(mid + t * (lat2 - lat1) / 2);
2956
+ return this.r ** 2 / (c * (c * c + (this.r * s) ** 2));
2957
+ }, -1, 1) / 2 : (this.psi(lat2) - this.psi(lat1)) / d;
2958
+ return [meanM, meanP];
2959
+ }
2960
+ psi(latitude) {
2961
+ return this.metrics.latitudeToAuxiliary(latitude, "isometric") * DEG2;
2962
+ }
2963
+ polarEndpoint(latitude, north, poleDistance) {
2964
+ const sign = Math.abs(latitude) > 80 && Math.abs(north) < Math.abs(this.meridianDelta(0, latitude)) ? Math.sign(latitude) : Math.sign(north), theta1 = (90 - sign * latitude) * DEG2, limit = 10 * DEG2;
2965
+ const density = (theta2) => this.r ** 2 / Math.hypot(Math.sin(theta2), this.r * Math.cos(theta2)) ** 3;
2966
+ const gap = (theta2) => integrate(density, 0, theta2);
2967
+ const target = sign === Math.sign(north) ? poleDistance : this.meridianDelta(sign > 0 ? latitude : -90, sign > 0 ? 90 : latitude) - sign * north;
2968
+ if (!(target > 0 && target < gap(limit)))
2969
+ return void 0;
2970
+ let lo = 0, hi = limit, theta = target * this.r;
2971
+ if (!(theta > lo && theta < hi))
2972
+ theta = theta1;
2973
+ for (let i = 0; i < 64; i++) {
2974
+ const residual = gap(theta) - target;
2975
+ if (residual === 0)
2976
+ break;
2977
+ if (residual < 0)
2978
+ lo = theta;
2979
+ else
2980
+ hi = theta;
2981
+ const next = theta - residual / density(theta);
2982
+ if (next === theta)
2983
+ break;
2984
+ theta = next > lo && next < hi ? next : (lo + hi) / 2;
2985
+ if (theta === lo || theta === hi)
2986
+ break;
2987
+ if (i === 63)
2988
+ throw new Error("Rhumb polar meridian inversion did not converge");
2989
+ }
2990
+ const span = theta - theta1, mid = (theta + theta1) / 2;
2991
+ const meanM = integrate((t) => density(mid + t * span / 2), -1, 1) / 2;
2992
+ const meanP = Math.abs(span) < 0.25 * Math.min(Math.sin(theta), Math.sin(theta1)) ? integrate((t) => {
2993
+ const x = mid + t * span / 2, c = Math.sin(x), s = Math.cos(x);
2994
+ return this.r ** 2 / (c * (c * c + (this.r * s) ** 2));
2995
+ }, -1, 1) / 2 : -(this.polarPsi(theta) - this.polarPsi(theta1)) / span;
2996
+ return {
2997
+ latitude: sign * (90 - theta / DEG2),
2998
+ means: [meanM, meanP],
2999
+ psi: sign * this.polarPsi(theta)
3000
+ };
3001
+ }
3002
+ polarPsi(theta) {
3003
+ const s = Math.cos(theta), c = Math.sin(theta), e2 = (1 - this.r) * (1 + this.r), e = Math.sqrt(Math.abs(e2));
3004
+ const I = e === 0 ? s : (e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
3005
+ return Math.asinh(s / c) - e2 * I;
3006
+ }
3007
+ meridianMean(lat1, lat2) {
3008
+ const mid = (lat1 + lat2) / 2;
3009
+ return integrate((t) => {
3010
+ const [s, c] = latitudeSinCos(mid + t * (lat2 - lat1) / 2);
3011
+ return this.r ** 2 / Math.hypot(c, this.r * s) ** 3;
3012
+ }, -1, 1) / 2;
3013
+ }
3014
+ meridianDelta(lat1, lat2) {
3015
+ return (lat2 - lat1) * DEG2 * this.meridianMean(lat1, lat2);
3016
+ }
3017
+ inverseMeridian(start, displacement) {
3018
+ let lo = -90, hi = 90;
3019
+ let phi = start + displacement / this.metrics.meridionalCurvatureRadius(start) / DEG2;
3020
+ if (!(phi > lo && phi < hi))
3021
+ phi = (start + Math.sign(displacement) * 90) / 2;
3022
+ for (let i = 0; i < 64; i++) {
3023
+ const residual = this.meridianDelta(start, phi) - displacement;
3024
+ if (residual === 0)
3025
+ return phi;
3026
+ if (residual < 0)
3027
+ lo = phi;
3028
+ else
3029
+ hi = phi;
3030
+ const next = phi - residual / this.metrics.meridionalCurvatureRadius(phi) / DEG2;
3031
+ if (next === phi)
3032
+ return phi;
3033
+ phi = next > lo && next < hi ? next : (lo + hi) / 2;
3034
+ if (phi === lo || phi === hi) {
3035
+ const candidates = [lo, hi].filter((v) => Math.abs(v) < 90);
3036
+ return candidates.reduce((best, v) => Math.abs(this.meridianDelta(start, v) - displacement) < Math.abs(this.meridianDelta(start, best) - displacement) ? v : best);
3037
+ }
3038
+ }
3039
+ throw new Error("Rhumb meridian inversion did not converge");
3040
+ }
3041
+ inversePsi(psi) {
3042
+ let lo = -90, hi = 90, phi = Math.atan(Math.sinh(psi)) / DEG2;
3043
+ if (Math.abs(phi) === 90)
3044
+ phi = Math.sign(psi) * (90 - 2 ** -46);
3045
+ for (let i = 0; i < 32; i++) {
3046
+ const value = this.psi(phi) - psi;
3047
+ if (value === 0)
3048
+ return phi;
3049
+ if (value < 0)
3050
+ lo = phi;
3051
+ else
3052
+ hi = phi;
3053
+ const [s, c] = latitudeSinCos(phi);
3054
+ const next = phi - value * c * (c * c + (this.r * s) ** 2) / this.r ** 2 / DEG2;
3055
+ if (next === phi)
3056
+ return phi;
3057
+ phi = next > lo && next < hi ? next : (lo + hi) / 2;
3058
+ if (phi === lo || phi === hi)
3059
+ return phi;
3060
+ }
3061
+ throw new Error("Rhumb isometric inversion did not converge");
3062
+ }
3063
+ potential(latitude) {
3064
+ const [s, c] = latitudeSinCos(latitude), e2 = (1 - this.r) * (1 + this.r), e = Math.sqrt(Math.abs(e2));
3065
+ const I = e === 0 ? s : (e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
3066
+ return this.r ** 2 * (s / (c * c + (this.r * s) ** 2) + I) / 2;
3067
+ }
3068
+ area(lat1, lat2, dlon, endpointPsi) {
3069
+ if (dlon === 0 || lat1 === -lat2)
3070
+ return 0;
3071
+ if (lat1 === lat2) {
3072
+ const value2 = this.a * dlon * (this.a * this.potential(lat1));
3073
+ if (!Number.isFinite(value2))
3074
+ throw new RangeError("Unrepresentable rhumb area");
3075
+ return value2;
3076
+ }
3077
+ const p1 = this.psi(lat1), p2 = endpointPsi ?? this.psi(lat2), mid = (p1 + p2) / 2, half = (p2 - p1) / 2;
3078
+ const pieces = Math.max(1, Math.ceil(Math.abs(p2 - p1) / 2));
3079
+ let sum = 0;
3080
+ for (let j = 0; j < pieces; j++)
3081
+ sum += integrate((t) => this.potential(this.inversePsi(mid + half * t)), -1 + 2 * j / pieces, -1 + 2 * (j + 1) / pieces);
3082
+ const value = this.a * dlon * (this.a * (sum / 2));
3083
+ if (!Number.isFinite(value))
3084
+ throw new RangeError("Unrepresentable rhumb area");
3085
+ return value;
3086
+ }
3087
+ };
3088
+ function validateRhumbPoint(latitude, longitude) {
3089
+ if (!(Number.isFinite(latitude) && Math.abs(latitude) <= 90 && Number.isFinite(longitude)))
3090
+ throw new RangeError("Rhumb coordinates require finite longitude and latitude in [-90,90]");
3091
+ if (Math.abs(latitude) === 90)
3092
+ throw new RhumbDomainError("pole");
3093
+ }
3094
+ function latitudeSinCos(phi) {
3095
+ const p = Math.abs(phi);
3096
+ return p <= 45 ? [Math.sin(phi * DEG2), Math.cos(phi * DEG2)] : [Math.sign(phi) * Math.cos((90 - p) * DEG2), Math.sin((90 - p) * DEG2)];
3097
+ }
3098
+ function sincosDegrees(angle2) {
3099
+ const reduced = angle2 % 360, q = Math.round(reduced / 90), d = reduced - 90 * q, x = d * DEG2;
3100
+ const s = Math.sin(x), c = Math.cos(x);
3101
+ switch ((q % 4 + 4) % 4) {
3102
+ case 0:
3103
+ return [s, c];
3104
+ case 1:
3105
+ return [c, -s];
3106
+ case 2:
3107
+ return [-s, -c];
3108
+ default:
3109
+ return [-c, s];
3110
+ }
3111
+ }
3112
+ function normalize(angle2) {
3113
+ let a = angle2 % 360;
3114
+ if (a > 180)
3115
+ a -= 360;
3116
+ if (a < -180)
3117
+ a += 360;
3118
+ return a;
3119
+ }
3120
+ function angleDifference(a, b) {
3121
+ let [d, e] = twoSum(-normalize(a), normalize(b));
3122
+ [d, e] = twoSum(normalize(d), e);
3123
+ if (Math.abs(d) === 180)
3124
+ return (e === 0 ? b < a : e > 0) ? -180 : 180;
3125
+ return d === 0 ? b < a ? -0 : 0 : d;
3126
+ }
3127
+ function twoSum(a, b) {
3128
+ const s = a + b, v = s - a;
3129
+ return [s, a - (s - v) + (b - v)];
3130
+ }
3131
+
3132
+ // dist/rhumb-polygon.js
3133
+ var RhumbPolygon = class extends SurfacePolygon {
3134
+ constructor(parameters, options = {}) {
3135
+ super(new EllipsoidRhumb(parameters), options);
3136
+ }
3137
+ addPoint(latitude, longitude, options = {}) {
3138
+ validateRhumbPoint(latitude, longitude);
3139
+ if (!Number.isSafeInteger(options.longitudeTurns ?? 0))
3140
+ throw new RangeError("Rhumb longitudeTurns must be a safe integer");
3141
+ return super.addPoint(latitude, longitude, options);
3142
+ }
3143
+ };
3144
+
3145
+ // dist/ellipsoid-helpers/intersection-bounds.js
3146
+ var IntersectionBounds = class {
3147
+ constructor(solver, ratio2, radius) {
3148
+ this.solver = solver;
3149
+ this.halfCircumference = Math.PI * radius;
3150
+ this.margin = this.halfCircumference * Number.EPSILON ** (1 / 5);
3151
+ this.capture = ratio2 <= 1 ? Math.PI * ratio2 : this.polarMinimum(ratio2);
3152
+ this.spacing = this.capture - this.margin;
3153
+ if (!(Number.isFinite(this.spacing) && this.spacing > 0))
3154
+ throw new Error("Unresolved geodesic capture bound");
3155
+ }
3156
+ conjugate(line, guess, semi = false, reference = { m12: 0, M12: 1, M21: 1 }) {
3157
+ const { m12, M12, M21 } = reference;
3158
+ let s = guess;
3159
+ for (let i = 0; i < 100; i++) {
3160
+ const p = line.position(s);
3161
+ const m = p.m12 * M12 - m12 * p.M12;
3162
+ const forward = p.M12 * M21 + (m12 === 0 ? 0 : (1 - M12 * M21) * p.m12 / m12);
3163
+ const reverse = p.M21 * M12 + (p.m12 === 0 ? 0 : (1 - p.M12 * p.M21) * m12 / p.m12);
3164
+ const step = semi ? m * forward / (1 - forward * reverse) : -m / reverse;
3165
+ if (!Number.isFinite(step))
3166
+ throw new Error("Unresolved conjugate distance");
3167
+ const next = s + step;
3168
+ if (next === s || Math.abs(step) <= 5e-14)
3169
+ return next;
3170
+ s = next;
3171
+ }
3172
+ throw new Error("Conjugate distance did not converge");
3173
+ }
3174
+ polarDistance(latitude, ratio2) {
3175
+ return this.conjugate(this.solver.line(latitude, 0, 0), (1 + (1 - ratio2) / 2) * Math.PI / 2, true);
3176
+ }
3177
+ polarMinimum(ratio2) {
3178
+ let lat0 = 63, lat1 = 65, lat2 = 64;
3179
+ let s0 = this.polarDistance(lat0, ratio2), s1 = this.polarDistance(lat1, ratio2), s2 = this.polarDistance(lat2, ratio2);
3180
+ let best = s2;
3181
+ for (let i = 0; i < 10; i++) {
3182
+ const denominator = (lat1 - lat0) * s2 + (lat0 - lat2) * s1 + (lat2 - lat1) * s0;
3183
+ if (denominator === 0)
3184
+ break;
3185
+ const next = ((lat1 - lat0) * (lat1 + lat0) * s2 + (lat0 - lat2) * (lat0 + lat2) * s1 + (lat2 - lat1) * (lat2 + lat1) * s0) / (2 * denominator);
3186
+ if (!(Number.isFinite(next) && next >= 0 && next <= 90))
3187
+ break;
3188
+ lat0 = lat1;
3189
+ s0 = s1;
3190
+ lat1 = lat2;
3191
+ s1 = s2;
3192
+ lat2 = next;
3193
+ s2 = this.polarDistance(lat2, ratio2);
3194
+ best = Math.min(best, s2);
3195
+ }
3196
+ return 2 * best;
3197
+ }
3198
+ };
3199
+
3200
+ // dist/geodesic-intersections.js
3201
+ var DEG3 = Math.PI / 180;
3202
+ var EPS = 3 * Number.EPSILON;
3203
+ var math2 = geodesic.Math;
3204
+ var GeodesicIntersections = class {
3205
+ constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
3206
+ this.tolerance = 5e-14;
3207
+ const r = b / a;
3208
+ if (!(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0 && r >= 0.99 && r <= 1.01))
3209
+ throw new RangeError("Intersections require finite positive axes with 0.99 <= b/a <= 1.01");
3210
+ this.a = a;
3211
+ this.r = r;
3212
+ this.solver = new EllipsoidGeodesic({ semiMajorAxis: 1, semiMinorAxis: r });
3213
+ this.radius = Math.sqrt(this.solver.surfaceArea / (4 * Math.PI));
3214
+ this.bounds = new IntersectionBounds(this.solver, r, this.radius);
3215
+ Object.freeze(this);
3216
+ }
3217
+ /** Find all discovered roots in the L1 ball |s-originS|+|t-originT| <= maxDistance. */
3218
+ all(a, b, options) {
3219
+ return this.search(a, b, options, false);
3220
+ }
3221
+ search(a, b, options, normalized) {
3222
+ const A = this.solver.line(a.latitude, a.longitude, a.azimuth), B = this.solver.line(b.latitude, b.longitude, b.azimuth);
3223
+ const d = normalized ? options.maxDistance : options.maxDistance / this.a, origin = options.origin ?? [0, 0];
3224
+ const x = origin[0] / this.a, y = origin[1] / this.a;
3225
+ if (!(Number.isFinite(d) && d > 0 && (normalized ? d <= 4 * this.bounds.halfCircumference : options.maxDistance <= 4 * this.bounds.halfCircumference * this.a) && Number.isFinite(x) && Number.isFinite(y) && Math.max(Math.abs(origin[0]), Math.abs(origin[1])) <= 4 * this.bounds.halfCircumference * this.a))
3226
+ throw new RangeError("Intersection search requires finite bounds within four half-circumferences");
3227
+ if (this.r === 1) {
3228
+ const analytic = this.sphere(a, b, A, B, d, x, y);
3229
+ if (analytic)
3230
+ return analytic;
3231
+ }
3232
+ const extended = d + this.bounds.margin;
3233
+ const m = Math.ceil(extended / this.bounds.spacing), n = m - 1;
3234
+ const spacing = extended / m;
3235
+ const seeds = [[x, y, spacing, 0]];
3236
+ for (let i = -n; i <= n; i += 2)
3237
+ for (let j = -n; j <= n; j += 2)
3238
+ if (i || j)
3239
+ seeds.push([x + spacing * (i + j) / 2, y + spacing * (i - j) / 2, spacing, 0]);
3240
+ let failed = 0, unresolved = 0;
3241
+ const isolated = [], lines = [];
3242
+ const equal = (p, q) => Math.abs(p.x - q.x) + Math.abs(p.y - q.y) <= this.bounds.margin;
3243
+ const canonical = (p, c) => {
3244
+ const shift = (x + c * y - (p.x + c * p.y)) / 2;
3245
+ return { ...p, x: p.x + shift, y: p.y + c * shift, c };
3246
+ };
3247
+ const retry = (seed) => {
3248
+ ++failed;
3249
+ if (seed[3] === 3) {
3250
+ ++unresolved;
3251
+ return;
3252
+ }
3253
+ const half = seed[2] / 2, depth = seed[3] + 1;
3254
+ for (const [dx, dy] of [
3255
+ [half, 0],
3256
+ [-half, 0],
3257
+ [0, half],
3258
+ [0, -half]
3259
+ ])
3260
+ seeds.push([seed[0] + dx, seed[1] + dy, half, depth]);
3261
+ };
3262
+ for (const seed of seeds) {
3263
+ const root = this.refine(A, B, seed[0], seed[1]);
3264
+ if (!root) {
3265
+ retry(seed);
3266
+ continue;
3267
+ }
3268
+ if (root.c) {
3269
+ const q = canonical(root, root.c);
3270
+ if (!this.point(A, B, q)) {
3271
+ retry(seed);
3272
+ continue;
3273
+ }
3274
+ if (!lines.some((p) => p.c === q.c && equal(p, q)))
3275
+ lines.push(q);
3276
+ } else if (!isolated.some((p) => equal(p, root)))
3277
+ isolated.push(root);
3278
+ }
3279
+ const roots = [], coincidences = [];
3280
+ for (const p of isolated) {
3281
+ if (lines.some((q) => equal(canonical(p, q.c), q)))
3282
+ continue;
3283
+ if (Math.abs(p.x - x) + Math.abs(p.y - y) > d + this.tolerance)
3284
+ continue;
3285
+ const point = this.point(A, B, p);
3286
+ if (point)
3287
+ roots.push(point);
3288
+ else {
3289
+ ++failed;
3290
+ ++unresolved;
3291
+ }
3292
+ }
3293
+ for (const p of lines) {
3294
+ if (Math.abs(p.x - x) + Math.abs(p.y - y) <= d + this.tolerance)
3295
+ coincidences.push({
3296
+ s: p.x * this.a,
3297
+ t: p.y * this.a,
3298
+ direction: p.c
3299
+ });
3300
+ }
3301
+ this.sort(roots, origin);
3302
+ this.sort(coincidences, origin);
3303
+ return {
3304
+ intersections: roots,
3305
+ coincidences,
3306
+ complete: unresolved === 0,
3307
+ attemptedSeeds: seeds.length,
3308
+ failedSeeds: failed
3309
+ };
3310
+ }
3311
+ /** Without an explicit radius, search the full native global profile.
3312
+ * A returned root from any complete centered L1 search is globally closest:
3313
+ * every point outside that ball is farther from its center.
3314
+ */
3315
+ closest(a, b, options = {}) {
3316
+ const settings = {
3317
+ ...options,
3318
+ maxDistance: options.maxDistance ?? 4 * this.bounds.halfCircumference
3319
+ };
3320
+ const search = this.search(a, b, settings, options.maxDistance === void 0);
3321
+ const candidates = [...search.intersections];
3322
+ for (const c of search.coincidences) {
3323
+ const point = this.coincidencePoint(a, b, c);
3324
+ if (point)
3325
+ candidates.push(point);
3326
+ else {
3327
+ search.complete = false;
3328
+ ++search.failedSeeds;
3329
+ }
3330
+ }
3331
+ this.sort(candidates, settings.origin ?? [0, 0]);
3332
+ return { ...search, intersection: candidates[0] };
3333
+ }
3334
+ /** Global next crossing, excluding the shared parameter origin. For a
3335
+ * coincident continuum use GeographicLib's nearest-conjugate convention.
3336
+ */
3337
+ next(latitude, longitude, azimuthA, azimuthB, maxDistance) {
3338
+ const a = { latitude, longitude, azimuth: azimuthA }, b = { latitude, longitude, azimuth: azimuthB };
3339
+ const bound = maxDistance === void 0 ? 4 * this.bounds.halfCircumference : maxDistance / this.a;
3340
+ const search = this.search(a, b, { maxDistance: maxDistance ?? bound }, maxDistance === void 0);
3341
+ search.intersections = search.intersections.filter((p) => Math.abs(p.s / this.a) + Math.abs(p.t / this.a) > this.bounds.margin);
3342
+ const candidates = [...search.intersections];
3343
+ const A = this.solver.line(latitude, longitude, azimuthA);
3344
+ for (const c of search.coincidences) {
3345
+ if (Math.abs(c.s / this.a) + Math.abs(c.t / this.a) > this.bounds.margin) {
3346
+ const point = this.coincidencePoint(a, b, c);
3347
+ if (point)
3348
+ candidates.push(point);
3349
+ else {
3350
+ search.complete = false;
3351
+ ++search.failedSeeds;
3352
+ }
3353
+ } else {
3354
+ for (const sign of [-1, 1]) {
3355
+ try {
3356
+ const s = this.bounds.conjugate(A, sign * this.bounds.halfCircumference);
3357
+ const point = this.coincidencePoint(a, b, {
3358
+ s: s * this.a,
3359
+ t: c.direction * s * this.a,
3360
+ direction: c.direction
3361
+ });
3362
+ if (point)
3363
+ candidates.push(point);
3364
+ else {
3365
+ search.complete = false;
3366
+ ++search.failedSeeds;
3367
+ }
3368
+ } catch {
3369
+ search.complete = false;
3370
+ ++search.failedSeeds;
3371
+ }
3372
+ }
3373
+ }
3374
+ }
3375
+ const bounded = candidates.filter((p) => Math.abs(p.s / this.a) + Math.abs(p.t / this.a) <= bound + this.tolerance);
3376
+ this.sort(bounded, [0, 0]);
3377
+ return { ...search, intersection: bounded[0] };
3378
+ }
3379
+ coincidencePoint(a, b, c) {
3380
+ return this.point(this.solver.line(a.latitude, a.longitude, a.azimuth), this.solver.line(b.latitude, b.longitude, b.azimuth), { x: c.s / this.a, y: c.t / this.a, c: c.direction, iterations: 0 });
3381
+ }
3382
+ segments(a0, a1, b0, b1) {
3383
+ const ia = this.solver.inverse(...a0, ...a1), ib = this.solver.inverse(...b0, ...b1);
3384
+ if (this.ambiguous(a0, a1, ia) || this.ambiguous(b0, b1, ib))
3385
+ return { status: "ambiguous", complete: false };
3386
+ const sa = ia.s12, sb = ib.s12;
3387
+ if (sa === 0 || sb === 0) {
3388
+ const p = sa === 0 ? a0 : b0, start = sa === 0 ? b0 : a0, end = sa === 0 ? b1 : a1, len = sa === 0 ? sb : sa;
3389
+ const ip = this.solver.inverse(...start, ...p);
3390
+ const d0 = ip.s12;
3391
+ const route = this.solver.inverse(...start, ...end);
3392
+ const projected = this.solver.direct(start[0], start[1], route.azi1, d0);
3393
+ const residual = this.solver.inverse(projected.lat2, projected.lon2, ...p).s12;
3394
+ if (d0 > len + this.tolerance || residual > this.tolerance)
3395
+ return { status: "disjoint", complete: true };
3396
+ return {
3397
+ status: "intersection",
3398
+ complete: true,
3399
+ point: {
3400
+ s: (sa === 0 ? 0 : d0) * this.a,
3401
+ t: (sb === 0 ? 0 : d0) * this.a,
3402
+ latitude: p[0],
3403
+ longitude: p[1],
3404
+ residual: residual * this.a,
3405
+ crossingAngle: 0,
3406
+ iterations: 0
3407
+ }
3408
+ };
3409
+ }
3410
+ const search = this.all({ latitude: a0[0], longitude: a0[1], azimuth: ia.azi1 }, { latitude: b0[0], longitude: b0[1], azimuth: ib.azi1 }, {
3411
+ origin: [sa * this.a / 2, sb * this.a / 2],
3412
+ maxDistance: (sa + sb) * this.a / 2 + this.tolerance * this.a
3413
+ });
3414
+ for (const c of search.coincidences) {
3415
+ const offset2 = c.t / this.a - c.direction * c.s / this.a;
3416
+ const lo = Math.max(0, c.direction === 1 ? -offset2 : offset2 - sb), hi = Math.min(sa, c.direction === 1 ? sb - offset2 : offset2);
3417
+ if (hi >= lo - this.tolerance) {
3418
+ if (hi - lo > this.tolerance)
3419
+ return {
3420
+ status: "overlap",
3421
+ intervalA: [lo * this.a, hi * this.a],
3422
+ intervalB: [(c.direction * lo + offset2) * this.a, (c.direction * hi + offset2) * this.a],
3423
+ complete: search.complete
3424
+ };
3425
+ const s = (lo + hi) / 2, t = c.direction * s + offset2;
3426
+ const A = this.solver.line(a0[0], a0[1], ia.azi1), B = this.solver.line(b0[0], b0[1], ib.azi1);
3427
+ const point2 = this.point(A, B, { x: s, y: t, c: 0, iterations: 0 });
3428
+ if (point2)
3429
+ return { status: "intersection", point: point2, complete: search.complete };
3430
+ search.complete = false;
3431
+ ++search.failedSeeds;
3432
+ }
3433
+ }
3434
+ const point = search.intersections.find((p) => p.s / this.a >= -this.tolerance && p.s / this.a <= sa + this.tolerance && p.t / this.a >= -this.tolerance && p.t / this.a <= sb + this.tolerance);
3435
+ return point ? { status: "intersection", point, complete: search.complete } : { status: search.complete ? "disjoint" : "not-found", complete: search.complete };
3436
+ }
3437
+ ambiguous(start, end, path) {
3438
+ if (path.a12 > 180 - 1e-10)
3439
+ return true;
3440
+ if (Math.abs(start[0]) === 90 || Math.abs(end[0]) === 90)
3441
+ return false;
3442
+ if (start[0] === -end[0] && math2.AngDiff(path.azi1, path.azi2).d !== 0)
3443
+ return true;
3444
+ const longitude = math2.AngDiff(start[1], end[1]);
3445
+ return Math.abs(longitude.d) === 180 && longitude.e === 0 && path.azi1 !== 0 && Math.abs(path.azi1) !== 180;
3446
+ }
3447
+ refine(A, B, x, y) {
3448
+ for (let i = 0; i < 100; i++) {
3449
+ const a = A.position(x), b = B.position(y), v = this.solver.inverse(a.lat2, a.lon2, b.lat2, b.lon2);
3450
+ const X = math2.AngDiff(a.azi2, v.azi1), Y = math2.AngDiff(b.azi2, v.azi2), XY = math2.AngDiff(X.d, Y.d);
3451
+ const orientation = XY.d + (XY.e + Y.e - X.e) < 0 ? -1 : 1;
3452
+ const sx = math2.sincosde(orientation * X.d, orientation * X.e), sy = math2.sincosde(orientation * Y.d, orientation * Y.e);
3453
+ let dx, dy, c = 0;
3454
+ if (v.s12 <= EPS * this.radius) {
3455
+ if (Math.abs(sx.s - sy.s) <= EPS && Math.abs(sx.c - sy.c) <= EPS)
3456
+ c = 1;
3457
+ else if (Math.abs(sx.s + sy.s) <= EPS && Math.abs(sx.c + sy.c) <= EPS)
3458
+ c = -1;
3459
+ return { x, y, c, iterations: i };
3460
+ }
3461
+ if (Math.abs(sx.s) <= EPS && Math.abs(sy.s) <= EPS) {
3462
+ c = sx.c * sy.c > 0 ? 1 : -1;
3463
+ dx = sx.c * v.s12 / 2;
3464
+ dy = -sy.c * v.s12 / 2;
3465
+ } else {
3466
+ const sz = Math.sin(v.s12 / this.radius), cz = Math.cos(v.s12 / this.radius);
3467
+ dx = this.radius * Math.atan2(sy.s * sz, sy.s * sx.c * cz - sy.c * sx.s);
3468
+ dy = this.radius * Math.atan2(sx.s * sz, -sx.s * sy.c * cz + sx.c * sy.s);
3469
+ }
3470
+ if (!(Number.isFinite(dx) && Number.isFinite(dy)))
3471
+ return void 0;
3472
+ x += dx;
3473
+ y += dy;
3474
+ if (Math.max(Math.abs(x), Math.abs(y)) > 12 * Math.PI * this.radius)
3475
+ return void 0;
3476
+ if (c)
3477
+ return { x, y, c, iterations: i + 1 };
3478
+ if (Math.abs(dx) + Math.abs(dy) <= this.tolerance) {
3479
+ const root = { x, y, c, iterations: i + 1 };
3480
+ if (this.point(A, B, root))
3481
+ return root;
3482
+ }
3483
+ }
3484
+ return void 0;
3485
+ }
3486
+ point(A, B, p) {
3487
+ const s = p.x * this.a, t = p.y * this.a;
3488
+ if (!(Number.isFinite(s) && Number.isFinite(t)) || Math.abs(s / this.a - p.x) > this.tolerance || Math.abs(t / this.a - p.y) > this.tolerance)
3489
+ return void 0;
3490
+ const a = A.position(p.x), b = B.position(p.y), v = this.solver.inverse(a.lat2, a.lon2, b.lat2, b.lon2);
3491
+ if (!(Number.isFinite(v.s12) && v.s12 <= this.tolerance && Number.isFinite(p.x * this.a) && Number.isFinite(p.y * this.a)))
3492
+ return void 0;
3493
+ const ta = frame({ latitude: a.lat2, longitude: a.lon2, azimuth: a.azi2 })[1];
3494
+ const tb = frame({ latitude: b.lat2, longitude: b.lon2, azimuth: b.azi2 })[1];
3495
+ const angle2 = Math.atan2(Math.hypot(...cross(ta, tb)), Math.abs(dot(ta, tb))) / DEG3;
3496
+ return {
3497
+ s: p.x * this.a,
3498
+ t: p.y * this.a,
3499
+ latitude: a.lat2,
3500
+ longitude: a.lon2,
3501
+ residual: v.s12 * this.a,
3502
+ crossingAngle: angle2,
3503
+ iterations: p.iterations,
3504
+ ...p.c ? { coincidence: p.c } : {}
3505
+ };
3506
+ }
3507
+ sphere(a, b, A, B, d, x, y) {
3508
+ const [pa, ta, na] = frame(a), [pb, tb, nb] = frame(b), crossing = cross(na, nb), length = Math.hypot(...crossing);
3509
+ if (length > 0 && length < Math.sqrt(Number.EPSILON))
3510
+ return void 0;
3511
+ if (length <= EPS) {
3512
+ const sign = dot(na, nb) >= 0 ? 1 : -1;
3513
+ const offset2 = Math.atan2(dot(pa, tb), dot(pa, pb));
3514
+ const coincidences = [];
3515
+ for (let k = Math.ceil((y - sign * x - d - offset2) / (2 * Math.PI)); k <= Math.floor((y - sign * x + d - offset2) / (2 * Math.PI)); k++) {
3516
+ const shift = offset2 + 2 * Math.PI * k;
3517
+ const sx = (x + sign * (y - shift)) / 2;
3518
+ const sy = sign * sx + shift;
3519
+ if (Math.abs(sx - x) + Math.abs(sy - y) <= d + this.tolerance)
3520
+ coincidences.push({ s: sx * this.a, t: sy * this.a, direction: sign });
3521
+ }
3522
+ let failed2 = 0;
3523
+ const checked = coincidences.filter((c) => {
3524
+ const p = this.point(A, B, {
3525
+ x: c.s / this.a,
3526
+ y: c.t / this.a,
3527
+ c: c.direction,
3528
+ iterations: 0
3529
+ });
3530
+ if (!p)
3531
+ ++failed2;
3532
+ return Boolean(p);
3533
+ });
3534
+ return {
3535
+ intersections: [],
3536
+ coincidences: checked,
3537
+ complete: failed2 === 0,
3538
+ attemptedSeeds: 0,
3539
+ failedSeeds: failed2
3540
+ };
3541
+ }
3542
+ const result = [];
3543
+ let failed = 0;
3544
+ for (const sign of [-1, 1]) {
3545
+ const p = crossing.map((v) => sign * v / length);
3546
+ const s = Math.atan2(dot(p, ta), dot(p, pa)), t = Math.atan2(dot(p, tb), dot(p, pb));
3547
+ const k0 = Math.ceil((x - d - s) / (2 * Math.PI)), k1 = Math.floor((x + d - s) / (2 * Math.PI));
3548
+ const l0 = Math.ceil((y - d - t) / (2 * Math.PI)), l1 = Math.floor((y + d - t) / (2 * Math.PI));
3549
+ for (let k = k0; k <= k1; k++)
3550
+ for (let l = l0; l <= l1; l++) {
3551
+ const sx = s + 2 * Math.PI * k, sy = t + 2 * Math.PI * l;
3552
+ if (Math.abs(sx - x) + Math.abs(sy - y) > d + this.tolerance)
3553
+ continue;
3554
+ const point = this.point(A, B, { x: sx, y: sy, c: 0, iterations: 0 });
3555
+ if (point)
3556
+ result.push(point);
3557
+ else
3558
+ ++failed;
3559
+ }
3560
+ }
3561
+ this.sort(result, [x * this.a, y * this.a]);
3562
+ return {
3563
+ intersections: result,
3564
+ coincidences: [],
3565
+ complete: failed === 0,
3566
+ attemptedSeeds: 0,
3567
+ failedSeeds: failed
3568
+ };
3569
+ }
3570
+ sort(points, origin) {
3571
+ const x = origin[0] / this.a, y = origin[1] / this.a;
3572
+ points.sort((p, q) => Math.abs(p.s / this.a - x) + Math.abs(p.t / this.a - y) - (Math.abs(q.s / this.a - x) + Math.abs(q.t / this.a - y)) || p.s / this.a - q.s / this.a || p.t / this.a - q.t / this.a);
3573
+ }
3574
+ };
3575
+ function frame(p) {
3576
+ const [s, c] = sincos2(p.latitude), [sl, cl] = sincos2(p.longitude), [sa, ca] = sincos2(p.azimuth);
3577
+ const point = [c * cl, c * sl, s], north = [-s * cl, -s * sl, c], east = [-sl, cl, 0];
3578
+ const tangent = north.map((v, i) => ca * v + sa * east[i]);
3579
+ return [point, tangent, cross(point, tangent)];
3580
+ }
3581
+ function sincos2(degrees) {
3582
+ const a = degrees % 360, q = Math.round(a / 90), d = (a - 90 * q) * DEG3, s = Math.sin(d), c = Math.cos(d);
3583
+ switch ((q % 4 + 4) % 4) {
3584
+ case 0:
3585
+ return [s, c];
3586
+ case 1:
3587
+ return [c, -s];
3588
+ case 2:
3589
+ return [-s, -c];
3590
+ default:
3591
+ return [-c, s];
3592
+ }
3593
+ }
3594
+ function dot(a, b) {
3595
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
3596
+ }
3597
+ function cross(a, b) {
3598
+ return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]];
3599
+ }
3600
+
3601
+ // dist/geodesic-path.js
3602
+ var wgs84;
3603
+ var GeodesicPath = class {
3604
+ constructor(start, end, options = {}) {
3605
+ validateGeographicPosition(start);
3606
+ validateGeographicPosition(end);
3607
+ if (start.length !== end.length)
3608
+ throw new RangeError("Geodesic endpoint dimensions must match");
3609
+ const solver = options.geodesic || getDefaultGeodesic();
3610
+ const inverse = solver.inverse(start[1], start[0], end[1], end[0], { unrollLongitude: true });
3611
+ if (!Number.isFinite(inverse.s12) || inverse.s12 < 0 || !Number.isFinite(inverse.azi1) || !Number.isFinite(inverse.lon2)) {
3612
+ throw new RangeError("Unresolved geodesic path");
3613
+ }
3614
+ this.size = start.length;
3615
+ this.length = inverse.s12;
3616
+ this.first = Object.freeze(Array.from(start));
3617
+ const last = Array.from(end);
3618
+ last[0] = inverse.lon2;
3619
+ if (this.length === 0) {
3620
+ last[0] = start[0];
3621
+ last[1] = start[1];
3622
+ }
3623
+ this.last = Object.freeze(last);
3624
+ this.line = solver.line(start[1], start[0], inverse.azi1, { unrollLongitude: true });
3625
+ }
3626
+ get start() {
3627
+ return this.first.slice();
3628
+ }
3629
+ get end() {
3630
+ return this.last.slice();
3631
+ }
3632
+ sample(fraction, result = new Array(this.size)) {
3633
+ if (!Number.isFinite(fraction) || fraction < 0 || fraction > 1) {
3634
+ throw new RangeError("Geodesic fraction must be in [0, 1]");
3635
+ }
3636
+ if (result.length !== this.size)
3637
+ throw new RangeError("Invalid geodesic sample output length");
3638
+ let longitude;
3639
+ let latitude;
3640
+ if (fraction === 0 || this.length === 0) {
3641
+ longitude = this.first[0];
3642
+ latitude = this.first[1];
3643
+ } else if (fraction === 1) {
3644
+ longitude = this.last[0];
3645
+ latitude = this.last[1];
3646
+ } else {
3647
+ const value = this.line.position(this.length * fraction);
3648
+ longitude = value.lon2;
3649
+ latitude = value.lat2;
3650
+ }
3651
+ const height = this.size === 3 ? this.first[2] * (1 - fraction) + this.last[2] * fraction : 0;
3652
+ if (![longitude, latitude, height].every(Number.isFinite) || result instanceof Float32Array && ![longitude, latitude, height].every((value) => Number.isFinite(Math.fround(value)))) {
3653
+ throw new RangeError("Unrepresentable geodesic sample");
3654
+ }
3655
+ result[0] = longitude;
3656
+ result[1] = latitude;
3657
+ if (this.size === 3)
3658
+ result[2] = height;
3659
+ return result;
3660
+ }
3661
+ sampleByDistance(distance, result = new Array(this.size)) {
3662
+ if (!Number.isFinite(distance) || distance < 0 || distance > this.length) {
3663
+ throw new RangeError("Distance must be within the geodesic path");
3664
+ }
3665
+ return this.sample(this.length === 0 ? 0 : distance / this.length, result);
3666
+ }
3667
+ };
3668
+ function validateGeographicPosition(point) {
3669
+ if (point.length !== 2 && point.length !== 3 || !Array.from(point).every(Number.isFinite) || Math.abs(point[1]) > 90) {
3670
+ throw new RangeError("Expected finite longitude/latitude[/height], latitude in [-90, 90]");
3671
+ }
3672
+ }
3673
+ function getDefaultGeodesic() {
3674
+ if (!wgs84) {
3675
+ wgs84 = new EllipsoidGeodesic({ semiMajorAxis: WGS84_RADIUS_X, semiMinorAxis: WGS84_RADIUS_Z });
3676
+ }
3677
+ return wgs84;
3678
+ }
3679
+
3680
+ // dist/rhumb-path.js
3681
+ var wgs842;
3682
+ function getDefaultRhumb() {
3683
+ if (!wgs842)
3684
+ wgs842 = new EllipsoidRhumb({ semiMajorAxis: WGS84_RADIUS_X, semiMinorAxis: WGS84_RADIUS_Z });
3685
+ return wgs842;
3686
+ }
3687
+ var RhumbPath = class {
3688
+ constructor(start, end, options = {}) {
3689
+ validateGeographicPosition(start);
3690
+ validateGeographicPosition(end);
3691
+ if (start.length !== end.length)
3692
+ throw new RangeError("Rhumb endpoint dimensions must match");
3693
+ const solver = options.rhumb || getDefaultRhumb();
3694
+ if (options.longitudeMode !== void 0 && !["shortest", "unrolled"].includes(options.longitudeMode) || options.longitudeMode === "unrolled" && options.longitudeTurns !== void 0)
3695
+ throw new RangeError("Choose explicit turns or unrolled endpoint longitudes");
3696
+ let inverse = solver.inverse(start[1], start[0], end[1], end[0], {
3697
+ longitudeTurns: options.longitudeTurns,
3698
+ unrollLongitude: true
3699
+ });
3700
+ if (options.longitudeMode === "unrolled") {
3701
+ const turns2 = Math.round((end[0] - inverse.lon2) / 360);
3702
+ if (turns2 !== 0)
3703
+ inverse = solver.inverse(start[1], start[0], end[1], end[0], {
3704
+ longitudeTurns: turns2,
3705
+ unrollLongitude: true
3706
+ });
3707
+ }
3708
+ if (![inverse.s12, inverse.azi12, inverse.lon2].every(Number.isFinite) || inverse.s12 < 0)
3709
+ throw new RangeError("Unresolved rhumb path");
3710
+ this.size = start.length;
3711
+ this.length = inverse.s12;
3712
+ this.first = Object.freeze(Array.from(start));
3713
+ const last = Array.from(end);
3714
+ const turns = Math.round((inverse.lon2 - end[0]) / 360);
3715
+ const endpoint = end[0] + 360 * turns;
3716
+ const retainsPhase = Number.isSafeInteger(turns) && Number.isFinite(endpoint) && Math.abs(endpoint - inverse.lon2) <= 4 * Number.EPSILON * Math.max(360, Math.abs(inverse.lon2));
3717
+ last[0] = inverse.s12 === 0 ? start[0] : retainsPhase ? endpoint : inverse.lon2;
3718
+ if (inverse.s12 === 0)
3719
+ last[1] = start[1];
3720
+ this.last = Object.freeze(last);
3721
+ this.line = solver.line(start[1], start[0], inverse.azi12, { unrollLongitude: true });
3722
+ }
3723
+ get start() {
3724
+ return this.first.slice();
3725
+ }
3726
+ get end() {
3727
+ return this.last.slice();
3728
+ }
3729
+ sample(fraction, result = new Array(this.size)) {
3730
+ if (!Number.isFinite(fraction) || fraction < 0 || fraction > 1)
3731
+ throw new RangeError("Rhumb fraction must be in [0, 1]");
3732
+ if (result.length !== this.size || ArrayBuffer.isView(result) && !(result instanceof Float32Array) && !(result instanceof Float64Array))
3733
+ throw new RangeError("Expected a floating rhumb output with matching dimensions");
3734
+ let longitude = this.first[0], latitude = this.first[1];
3735
+ if (fraction === 1) {
3736
+ longitude = this.last[0];
3737
+ latitude = this.last[1];
3738
+ } else if (fraction !== 0 && this.length !== 0) {
3739
+ const p = this.line.position(this.length * fraction);
3740
+ longitude = p.lon2;
3741
+ latitude = p.lat2;
3742
+ }
3743
+ const height = this.size === 3 ? this.first[2] * (1 - fraction) + this.last[2] * fraction : 0;
3744
+ const values = [longitude, latitude, height];
3745
+ if (!values.every(Number.isFinite) || result instanceof Float32Array && !values.every((x) => Number.isFinite(Math.fround(x))))
3746
+ throw new RangeError("Unrepresentable rhumb sample");
3747
+ result[0] = longitude;
3748
+ result[1] = latitude;
3749
+ if (this.size === 3)
3750
+ result[2] = height;
3751
+ return result;
3752
+ }
3753
+ sampleByDistance(distance, result = new Array(this.size)) {
3754
+ if (!Number.isFinite(distance) || distance < 0 || distance > this.length)
3755
+ throw new RangeError("Distance must be within the rhumb path");
3756
+ return this.sample(this.length === 0 ? 0 : distance / this.length, result);
3757
+ }
3758
+ };
3759
+
3760
+ // dist/ellipsoid-transforms.js
3761
+ var import_core7 = require("@math.gl/core");
3762
+
3763
+ // dist/ellipsoid-helpers/ellipsoid-transform.js
3764
+ var import_core6 = require("@math.gl/core");
3765
+ var import_local_frame2 = require("@math.gl/core/local-frame");
3766
+ var EPSILON14 = 1e-14;
3767
+ var scratchOrigin = new import_core6.Vector3();
3768
+ var scratchBasis = (0, import_local_frame2.createLocalFrameBasis)();
3769
+ var VECTOR_PRODUCT_LOCAL_FRAME = {
3770
+ up: {
3771
+ south: "east",
3772
+ north: "west",
3773
+ west: "south",
3774
+ east: "north"
3775
+ },
3776
+ down: {
3777
+ south: "west",
3778
+ north: "east",
3779
+ west: "north",
3780
+ east: "south"
3781
+ },
3782
+ south: {
3783
+ up: "west",
3784
+ down: "east",
3785
+ west: "down",
3786
+ east: "up"
3787
+ },
3788
+ north: {
3789
+ up: "east",
3790
+ down: "west",
3791
+ west: "up",
3792
+ east: "down"
3793
+ },
3794
+ west: {
3795
+ up: "north",
3796
+ down: "south",
3797
+ north: "down",
3798
+ south: "up"
3799
+ },
3800
+ east: {
3801
+ up: "south",
3802
+ down: "north",
3803
+ north: "up",
3804
+ south: "down"
3805
+ }
3806
+ };
3807
+ var degeneratePositionLocalFrame = {
3808
+ north: [-1, 0, 0],
3809
+ east: [0, 1, 0],
3810
+ up: [0, 0, 1],
3811
+ south: [1, 0, 0],
3812
+ west: [0, -1, 0],
3813
+ down: [0, 0, -1]
3814
+ };
3815
+ var scratchAxisVectors = {
3816
+ east: new import_core6.Vector3(),
3817
+ north: new import_core6.Vector3(),
3818
+ up: new import_core6.Vector3(),
3819
+ west: new import_core6.Vector3(),
3820
+ south: new import_core6.Vector3(),
3821
+ down: new import_core6.Vector3()
3822
+ };
3823
+ var scratchVector1 = new import_core6.Vector3();
3824
+ var scratchVector22 = new import_core6.Vector3();
3825
+ var scratchVector3 = new import_core6.Vector3();
3826
+ function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
3827
+ const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
3828
+ (0, import_core6.assert)(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
3829
+ let firstAxisVector;
3830
+ let secondAxisVector;
3831
+ let thirdAxisVector;
3832
+ const origin = scratchOrigin.copy(cartesianOrigin);
3833
+ if (!Number.isFinite(origin.x) || !Number.isFinite(origin.y) || !Number.isFinite(origin.z) || !Array.isArray(result) && result.length < 16)
3834
+ throw new Error("Unsupported local frame");
3835
+ const poleTolerance = EPSILON14 * Math.min(1, ellipsoid.maximumRadius);
3836
+ const atPole = Math.abs(origin.x) <= poleTolerance && Math.abs(origin.y) <= poleTolerance;
3837
+ const radii = ellipsoid.radii;
3838
+ if (radii.x === radii.y && radii.x > 0 && radii.z > 0 && radii.z <= radii.x && (!atPole || origin.z !== 0)) {
3839
+ const { east, up } = scratchAxisVectors;
3840
+ if (atPole) {
3841
+ east.set(0, 1, 0);
3842
+ up.set(0, 0, Math.sign(origin.z));
3843
+ } else {
3844
+ const scale = Math.max(Math.abs(origin.x), Math.abs(origin.y));
3845
+ east.set(-origin.y / scale, origin.x / scale, 0).normalize();
3846
+ ellipsoid.geodeticSurfaceNormal(origin, up);
3847
+ }
3848
+ if (!(0, import_local_frame2.eastNorthUpBasisFromDirections)(east, up, scratchBasis) || !(0, import_local_frame2.localFrameToMatrix)(scratchBasis, origin, firstAxis, secondAxis, thirdAxis, result))
3849
+ throw new Error("Unsupported local frame");
3850
+ return result;
3851
+ }
3852
+ if (atPole) {
3853
+ const sign = Math.sign(origin.z);
3854
+ firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
3855
+ if (firstAxis !== "east" && firstAxis !== "west") {
3856
+ firstAxisVector.scale(sign);
3857
+ }
3858
+ secondAxisVector = scratchVector22.fromArray(degeneratePositionLocalFrame[secondAxis]);
3859
+ if (secondAxis !== "east" && secondAxis !== "west") {
3860
+ secondAxisVector.scale(sign);
3861
+ }
3862
+ thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);
3863
+ if (thirdAxis !== "east" && thirdAxis !== "west") {
3864
+ thirdAxisVector.scale(sign);
3865
+ }
3866
+ } else {
3867
+ const { up, east, north } = scratchAxisVectors;
3868
+ const scale = Math.max(Math.abs(origin.x), Math.abs(origin.y));
3869
+ east.set(-origin.y / scale, origin.x / scale, 0).normalize();
3870
+ ellipsoid.geodeticSurfaceNormal(origin, up);
3871
+ north.copy(up).cross(east);
3872
+ const { down, west, south } = scratchAxisVectors;
3873
+ down.copy(up).scale(-1);
3874
+ west.copy(east).scale(-1);
3875
+ south.copy(north).scale(-1);
3876
+ firstAxisVector = scratchAxisVectors[firstAxis];
3877
+ secondAxisVector = scratchAxisVectors[secondAxis];
3878
+ thirdAxisVector = scratchAxisVectors[thirdAxis];
3879
+ }
3880
+ const ax = firstAxisVector.x, ay = firstAxisVector.y, az = firstAxisVector.z;
3881
+ const bx = secondAxisVector.x, by = secondAxisVector.y, bz = secondAxisVector.z;
3882
+ const cx = thirdAxisVector.x, cy = thirdAxisVector.y, cz = thirdAxisVector.z;
3883
+ const x = origin.x, y = origin.y, z = origin.z;
3884
+ result[0] = ax;
3885
+ result[1] = ay;
3886
+ result[2] = az;
3887
+ result[3] = 0;
3888
+ result[4] = bx;
3889
+ result[5] = by;
3890
+ result[6] = bz;
3891
+ result[7] = 0;
3892
+ result[8] = cx;
3893
+ result[9] = cy;
3894
+ result[10] = cz;
3895
+ result[11] = 0;
3896
+ result[12] = x;
3897
+ result[13] = y;
3898
+ result[14] = z;
3899
+ result[15] = 1;
3900
+ return result;
3901
+ }
3902
+
3903
+ // dist/ellipsoid-transforms.js
3904
+ function eastNorthUpToFixedFrame(ellipsoid, origin, result = new import_core7.Matrix4()) {
3905
+ return localFrameToFixedFrame(ellipsoid, "east", "north", "up", origin, result);
3906
+ }
3907
+ function localFrameToFixedFrame2(ellipsoid, firstAxis, secondAxis, thirdAxis, origin, result = new import_core7.Matrix4()) {
3908
+ return localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, origin, result);
3909
+ }
572
3910
  //# sourceMappingURL=ellipsoid.cjs.map