@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.
- package/GEOGRAPHICLIB-LICENSE.txt +27 -0
- package/LICENSE +264 -73
- package/README.md +6 -1
- package/THIRD-PARTY-NOTICES.md +95 -0
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/discontinuous/air-ocean-mesh.d.ts +15 -0
- package/dist/discontinuous/air-ocean-mesh.d.ts.map +1 -0
- package/dist/discontinuous/air-ocean-mesh.js +75 -0
- package/dist/discontinuous/air-ocean-mesh.js.map +1 -0
- package/dist/discontinuous/albers-usa.d.ts +9 -0
- package/dist/discontinuous/albers-usa.d.ts.map +1 -0
- package/dist/discontinuous/albers-usa.js +105 -0
- package/dist/discontinuous/albers-usa.js.map +1 -0
- package/dist/discontinuous/cap-map.d.ts +23 -0
- package/dist/discontinuous/cap-map.d.ts.map +1 -0
- package/dist/discontinuous/cap-map.js +314 -0
- package/dist/discontinuous/cap-map.js.map +1 -0
- package/dist/discontinuous/elastic/data.d.ts +26 -0
- package/dist/discontinuous/elastic/data.d.ts.map +1 -0
- package/dist/discontinuous/elastic/data.js +72 -0
- package/dist/discontinuous/elastic/data.js.map +1 -0
- package/dist/discontinuous/elastic/elasticI.d.ts +3 -0
- package/dist/discontinuous/elastic/elasticI.d.ts.map +1 -0
- package/dist/discontinuous/elastic/elasticI.js +5233 -0
- package/dist/discontinuous/elastic/elasticI.js.map +1 -0
- package/dist/discontinuous/elastic/elasticII.d.ts +3 -0
- package/dist/discontinuous/elastic/elasticII.d.ts.map +1 -0
- package/dist/discontinuous/elastic/elasticII.js +18162 -0
- package/dist/discontinuous/elastic/elasticII.js.map +1 -0
- package/dist/discontinuous/elastic/elasticIII.d.ts +3 -0
- package/dist/discontinuous/elastic/elasticIII.d.ts.map +1 -0
- package/dist/discontinuous/elastic/elasticIII.js +29566 -0
- package/dist/discontinuous/elastic/elasticIII.js.map +1 -0
- package/dist/discontinuous/elastic/geometry.d.ts +22 -0
- package/dist/discontinuous/elastic/geometry.d.ts.map +1 -0
- package/dist/discontinuous/elastic/geometry.js +131 -0
- package/dist/discontinuous/elastic/geometry.js.map +1 -0
- package/dist/discontinuous/elastic/grid.d.ts +15 -0
- package/dist/discontinuous/elastic/grid.d.ts.map +1 -0
- package/dist/discontinuous/elastic/grid.js +177 -0
- package/dist/discontinuous/elastic/grid.js.map +1 -0
- package/dist/discontinuous/elastic/map.d.ts +8 -0
- package/dist/discontinuous/elastic/map.d.ts.map +1 -0
- package/dist/discontinuous/elastic/map.js +260 -0
- package/dist/discontinuous/elastic/map.js.map +1 -0
- package/dist/discontinuous/gray-fuller.d.ts +5 -0
- package/dist/discontinuous/gray-fuller.d.ts.map +1 -0
- package/dist/discontinuous/gray-fuller.js +36 -0
- package/dist/discontinuous/gray-fuller.js.map +1 -0
- package/dist/discontinuous/gringorten-kernel.d.ts +5 -0
- package/dist/discontinuous/gringorten-kernel.d.ts.map +1 -0
- package/dist/discontinuous/gringorten-kernel.js +94 -0
- package/dist/discontinuous/gringorten-kernel.js.map +1 -0
- package/dist/discontinuous/healpix.d.ts +13 -0
- package/dist/discontinuous/healpix.d.ts.map +1 -0
- package/dist/discontinuous/healpix.js +61 -0
- package/dist/discontinuous/healpix.js.map +1 -0
- package/dist/discontinuous/layout.d.ts +72 -0
- package/dist/discontinuous/layout.d.ts.map +1 -0
- package/dist/discontinuous/layout.js +114 -0
- package/dist/discontinuous/layout.js.map +1 -0
- package/dist/discontinuous/map-engine.d.ts +197 -0
- package/dist/discontinuous/map-engine.d.ts.map +1 -0
- package/dist/discontinuous/map-engine.js +356 -0
- package/dist/discontinuous/map-engine.js.map +1 -0
- package/dist/discontinuous/map-layout.d.ts +93 -0
- package/dist/discontinuous/map-layout.d.ts.map +1 -0
- package/dist/discontinuous/map-layout.js +490 -0
- package/dist/discontinuous/map-layout.js.map +1 -0
- package/dist/discontinuous/map-transition.d.ts +42 -0
- package/dist/discontinuous/map-transition.d.ts.map +1 -0
- package/dist/discontinuous/map-transition.js +283 -0
- package/dist/discontinuous/map-transition.js.map +1 -0
- package/dist/discontinuous/math.d.ts +19 -0
- package/dist/discontinuous/math.d.ts.map +1 -0
- package/dist/discontinuous/math.js +65 -0
- package/dist/discontinuous/math.js.map +1 -0
- package/dist/discontinuous/mercator-map.d.ts +22 -0
- package/dist/discontinuous/mercator-map.d.ts.map +1 -0
- package/dist/discontinuous/mercator-map.js +130 -0
- package/dist/discontinuous/mercator-map.js.map +1 -0
- package/dist/discontinuous/myriahedral/graticule.d.ts +6 -0
- package/dist/discontinuous/myriahedral/graticule.d.ts.map +1 -0
- package/dist/discontinuous/myriahedral/graticule.js +37 -0
- package/dist/discontinuous/myriahedral/graticule.js.map +1 -0
- package/dist/discontinuous/myriahedral/mesh.d.ts +18 -0
- package/dist/discontinuous/myriahedral/mesh.d.ts.map +1 -0
- package/dist/discontinuous/myriahedral/mesh.js +131 -0
- package/dist/discontinuous/myriahedral/mesh.js.map +1 -0
- package/dist/discontinuous/myriahedral/unfold.d.ts +36 -0
- package/dist/discontinuous/myriahedral/unfold.d.ts.map +1 -0
- package/dist/discontinuous/myriahedral/unfold.js +172 -0
- package/dist/discontinuous/myriahedral/unfold.js.map +1 -0
- package/dist/discontinuous/myriahedral.d.ts +56 -0
- package/dist/discontinuous/myriahedral.d.ts.map +1 -0
- package/dist/discontinuous/myriahedral.js +204 -0
- package/dist/discontinuous/myriahedral.js.map +1 -0
- package/dist/discontinuous/petroff.d.ts +8 -0
- package/dist/discontinuous/petroff.d.ts.map +1 -0
- package/dist/discontinuous/petroff.js +159 -0
- package/dist/discontinuous/petroff.js.map +1 -0
- package/dist/discontinuous/polyhedral.d.ts +8 -0
- package/dist/discontinuous/polyhedral.d.ts.map +1 -0
- package/dist/discontinuous/polyhedral.js +117 -0
- package/dist/discontinuous/polyhedral.js.map +1 -0
- package/dist/discontinuous/prepare-features.d.ts +78 -0
- package/dist/discontinuous/prepare-features.d.ts.map +1 -0
- package/dist/discontinuous/prepare-features.js +146 -0
- package/dist/discontinuous/prepare-features.js.map +1 -0
- package/dist/discontinuous/presets.d.ts +71 -0
- package/dist/discontinuous/presets.d.ts.map +1 -0
- package/dist/discontinuous/presets.js +372 -0
- package/dist/discontinuous/presets.js.map +1 -0
- package/dist/discontinuous/projection-catalog.d.ts +33 -0
- package/dist/discontinuous/projection-catalog.d.ts.map +1 -0
- package/dist/discontinuous/projection-catalog.js +96 -0
- package/dist/discontinuous/projection-catalog.js.map +1 -0
- package/dist/discontinuous/quincuncial-kernel.d.ts +9 -0
- package/dist/discontinuous/quincuncial-kernel.d.ts.map +1 -0
- package/dist/discontinuous/quincuncial-kernel.js +139 -0
- package/dist/discontinuous/quincuncial-kernel.js.map +1 -0
- package/dist/discontinuous/quincuncial-star.d.ts +29 -0
- package/dist/discontinuous/quincuncial-star.d.ts.map +1 -0
- package/dist/discontinuous/quincuncial-star.js +307 -0
- package/dist/discontinuous/quincuncial-star.js.map +1 -0
- package/dist/discontinuous/regional-map.d.ts +18 -0
- package/dist/discontinuous/regional-map.d.ts.map +1 -0
- package/dist/discontinuous/regional-map.js +193 -0
- package/dist/discontinuous/regional-map.js.map +1 -0
- package/dist/discontinuous/retroazimuthal-map.d.ts +6 -0
- package/dist/discontinuous/retroazimuthal-map.d.ts.map +1 -0
- package/dist/discontinuous/retroazimuthal-map.js +52 -0
- package/dist/discontinuous/retroazimuthal-map.js.map +1 -0
- package/dist/discontinuous/rotated-map.d.ts +31 -0
- package/dist/discontinuous/rotated-map.d.ts.map +1 -0
- package/dist/discontinuous/rotated-map.js +66 -0
- package/dist/discontinuous/rotated-map.js.map +1 -0
- package/dist/discontinuous/snyder-mesh.d.ts +11 -0
- package/dist/discontinuous/snyder-mesh.d.ts.map +1 -0
- package/dist/discontinuous/snyder-mesh.js +88 -0
- package/dist/discontinuous/snyder-mesh.js.map +1 -0
- package/dist/discontinuous/snyder.d.ts +16 -0
- package/dist/discontinuous/snyder.d.ts.map +1 -0
- package/dist/discontinuous/snyder.js +153 -0
- package/dist/discontinuous/snyder.js.map +1 -0
- package/dist/discontinuous/spherical-clip/cartesian.d.ts +8 -0
- package/dist/discontinuous/spherical-clip/cartesian.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/cartesian.js +34 -0
- package/dist/discontinuous/spherical-clip/cartesian.js.map +1 -0
- package/dist/discontinuous/spherical-clip/circle.d.ts +2 -0
- package/dist/discontinuous/spherical-clip/circle.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/circle.js +34 -0
- package/dist/discontinuous/spherical-clip/circle.js.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-buffer.d.ts +9 -0
- package/dist/discontinuous/spherical-clip/clip-buffer.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-buffer.js +28 -0
- package/dist/discontinuous/spherical-clip/clip-buffer.js.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-circle.d.ts +9 -0
- package/dist/discontinuous/spherical-clip/clip-circle.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-circle.js +160 -0
- package/dist/discontinuous/spherical-clip/clip-circle.js.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-index.d.ts +9 -0
- package/dist/discontinuous/spherical-clip/clip-index.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-index.js +117 -0
- package/dist/discontinuous/spherical-clip/clip-index.js.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-rejoin.d.ts +2 -0
- package/dist/discontinuous/spherical-clip/clip-rejoin.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/clip-rejoin.js +99 -0
- package/dist/discontinuous/spherical-clip/clip-rejoin.js.map +1 -0
- package/dist/discontinuous/spherical-clip/helpers.d.ts +8 -0
- package/dist/discontinuous/spherical-clip/helpers.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/helpers.js +21 -0
- package/dist/discontinuous/spherical-clip/helpers.js.map +1 -0
- package/dist/discontinuous/spherical-clip/math.d.ts +26 -0
- package/dist/discontinuous/spherical-clip/math.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/math.js +39 -0
- package/dist/discontinuous/spherical-clip/math.js.map +1 -0
- package/dist/discontinuous/spherical-clip/noop.d.ts +2 -0
- package/dist/discontinuous/spherical-clip/noop.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/noop.js +6 -0
- package/dist/discontinuous/spherical-clip/noop.js.map +1 -0
- package/dist/discontinuous/spherical-clip/pointEqual.d.ts +2 -0
- package/dist/discontinuous/spherical-clip/pointEqual.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/pointEqual.js +9 -0
- package/dist/discontinuous/spherical-clip/pointEqual.js.map +1 -0
- package/dist/discontinuous/spherical-clip/polygonContains.d.ts +2 -0
- package/dist/discontinuous/spherical-clip/polygonContains.d.ts.map +1 -0
- package/dist/discontinuous/spherical-clip/polygonContains.js +52 -0
- package/dist/discontinuous/spherical-clip/polygonContains.js.map +1 -0
- package/dist/discontinuous/world-composite-kernels.d.ts +11 -0
- package/dist/discontinuous/world-composite-kernels.d.ts.map +1 -0
- package/dist/discontinuous/world-composite-kernels.js +30 -0
- package/dist/discontinuous/world-composite-kernels.js.map +1 -0
- package/dist/discontinuous/world-kernels/airy.d.ts +5 -0
- package/dist/discontinuous/world-kernels/airy.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/airy.js +28 -0
- package/dist/discontinuous/world-kernels/airy.js.map +1 -0
- package/dist/discontinuous/world-kernels/aitoff.d.ts +5 -0
- package/dist/discontinuous/world-kernels/aitoff.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/aitoff.js +26 -0
- package/dist/discontinuous/world-kernels/aitoff.js.map +1 -0
- package/dist/discontinuous/world-kernels/armadillo.d.ts +5 -0
- package/dist/discontinuous/world-kernels/armadillo.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/armadillo.js +28 -0
- package/dist/discontinuous/world-kernels/armadillo.js.map +1 -0
- package/dist/discontinuous/world-kernels/august.d.ts +5 -0
- package/dist/discontinuous/world-kernels/august.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/august.js +21 -0
- package/dist/discontinuous/world-kernels/august.js.map +1 -0
- package/dist/discontinuous/world-kernels/baker.d.ts +5 -0
- package/dist/discontinuous/world-kernels/baker.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/baker.js +29 -0
- package/dist/discontinuous/world-kernels/baker.js.map +1 -0
- package/dist/discontinuous/world-kernels/bertin.d.ts +5 -0
- package/dist/discontinuous/world-kernels/bertin.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/bertin.js +32 -0
- package/dist/discontinuous/world-kernels/bertin.js.map +1 -0
- package/dist/discontinuous/world-kernels/boggs.d.ts +5 -0
- package/dist/discontinuous/world-kernels/boggs.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/boggs.js +24 -0
- package/dist/discontinuous/world-kernels/boggs.js.map +1 -0
- package/dist/discontinuous/world-kernels/bonne.d.ts +3 -0
- package/dist/discontinuous/world-kernels/bonne.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/bonne.js +22 -0
- package/dist/discontinuous/world-kernels/bonne.js.map +1 -0
- package/dist/discontinuous/world-kernels/bottomley.d.ts +5 -0
- package/dist/discontinuous/world-kernels/bottomley.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/bottomley.js +18 -0
- package/dist/discontinuous/world-kernels/bottomley.js.map +1 -0
- package/dist/discontinuous/world-kernels/bromley.d.ts +5 -0
- package/dist/discontinuous/world-kernels/bromley.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/bromley.js +9 -0
- package/dist/discontinuous/world-kernels/bromley.js.map +1 -0
- package/dist/discontinuous/world-kernels/chamberlin.d.ts +2 -0
- package/dist/discontinuous/world-kernels/chamberlin.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/chamberlin.js +81 -0
- package/dist/discontinuous/world-kernels/chamberlin.js.map +1 -0
- package/dist/discontinuous/world-kernels/collignon.d.ts +5 -0
- package/dist/discontinuous/world-kernels/collignon.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/collignon.js +15 -0
- package/dist/discontinuous/world-kernels/collignon.js.map +1 -0
- package/dist/discontinuous/world-kernels/craig.d.ts +5 -0
- package/dist/discontinuous/world-kernels/craig.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/craig.js +30 -0
- package/dist/discontinuous/world-kernels/craig.js.map +1 -0
- package/dist/discontinuous/world-kernels/craster.d.ts +5 -0
- package/dist/discontinuous/world-kernels/craster.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/craster.js +15 -0
- package/dist/discontinuous/world-kernels/craster.js.map +1 -0
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.d.ts +5 -0
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.js +17 -0
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.js.map +1 -0
- package/dist/discontinuous/world-kernels/cylindricalStereographic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/cylindricalStereographic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/cylindricalStereographic.js +17 -0
- package/dist/discontinuous/world-kernels/cylindricalStereographic.js.map +1 -0
- package/dist/discontinuous/world-kernels/d3-geo-raw.d.ts +9 -0
- package/dist/discontinuous/world-kernels/d3-geo-raw.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/d3-geo-raw.js +21 -0
- package/dist/discontinuous/world-kernels/d3-geo-raw.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert1.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert1.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert1.js +15 -0
- package/dist/discontinuous/world-kernels/eckert1.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert2.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert2.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert2.js +15 -0
- package/dist/discontinuous/world-kernels/eckert2.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert3.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert3.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert3.js +15 -0
- package/dist/discontinuous/world-kernels/eckert3.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert4.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert4.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert4.js +20 -0
- package/dist/discontinuous/world-kernels/eckert4.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert5.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert5.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert5.js +14 -0
- package/dist/discontinuous/world-kernels/eckert5.js.map +1 -0
- package/dist/discontinuous/world-kernels/eckert6.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eckert6.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eckert6.js +19 -0
- package/dist/discontinuous/world-kernels/eckert6.js.map +1 -0
- package/dist/discontinuous/world-kernels/eisenlohr.d.ts +5 -0
- package/dist/discontinuous/world-kernels/eisenlohr.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/eisenlohr.js +41 -0
- package/dist/discontinuous/world-kernels/eisenlohr.js.map +1 -0
- package/dist/discontinuous/world-kernels/fahey.d.ts +5 -0
- package/dist/discontinuous/world-kernels/fahey.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/fahey.js +16 -0
- package/dist/discontinuous/world-kernels/fahey.js.map +1 -0
- package/dist/discontinuous/world-kernels/foucaut.d.ts +5 -0
- package/dist/discontinuous/world-kernels/foucaut.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/foucaut.js +15 -0
- package/dist/discontinuous/world-kernels/foucaut.js.map +1 -0
- package/dist/discontinuous/world-kernels/foucautSinusoidal.d.ts +5 -0
- package/dist/discontinuous/world-kernels/foucautSinusoidal.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/foucautSinusoidal.js +27 -0
- package/dist/discontinuous/world-kernels/foucautSinusoidal.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg4.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburg4.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg4.js +8 -0
- package/dist/discontinuous/world-kernels/ginzburg4.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg5.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburg5.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg5.js +8 -0
- package/dist/discontinuous/world-kernels/ginzburg5.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg6.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburg6.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg6.js +9 -0
- package/dist/discontinuous/world-kernels/ginzburg6.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg8.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburg8.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg8.js +28 -0
- package/dist/discontinuous/world-kernels/ginzburg8.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg9.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburg9.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburg9.js +8 -0
- package/dist/discontinuous/world-kernels/ginzburg9.js.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.js +29 -0
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.js.map +1 -0
- package/dist/discontinuous/world-kernels/hammer.d.ts +3 -0
- package/dist/discontinuous/world-kernels/hammer.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/hammer.js +34 -0
- package/dist/discontinuous/world-kernels/hammer.js.map +1 -0
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.d.ts +5 -0
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.js +37 -0
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.js.map +1 -0
- package/dist/discontinuous/world-kernels/hill.d.ts +5 -0
- package/dist/discontinuous/world-kernels/hill.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/hill.js +36 -0
- package/dist/discontinuous/world-kernels/hill.js.map +1 -0
- package/dist/discontinuous/world-kernels/homolosine.d.ts +5 -0
- package/dist/discontinuous/world-kernels/homolosine.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/homolosine.js +22 -0
- package/dist/discontinuous/world-kernels/homolosine.js.map +1 -0
- package/dist/discontinuous/world-kernels/hufnagel.d.ts +5 -0
- package/dist/discontinuous/world-kernels/hufnagel.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/hufnagel.js +53 -0
- package/dist/discontinuous/world-kernels/hufnagel.js.map +1 -0
- package/dist/discontinuous/world-kernels/hyperelliptical.d.ts +5 -0
- package/dist/discontinuous/world-kernels/hyperelliptical.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/hyperelliptical.js +47 -0
- package/dist/discontinuous/world-kernels/hyperelliptical.js.map +1 -0
- package/dist/discontinuous/world-kernels/integrate.d.ts +2 -0
- package/dist/discontinuous/world-kernels/integrate.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/integrate.js +82 -0
- package/dist/discontinuous/world-kernels/integrate.js.map +1 -0
- package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts +5 -0
- package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/kavrayskiy7.js +13 -0
- package/dist/discontinuous/world-kernels/kavrayskiy7.js.map +1 -0
- package/dist/discontinuous/world-kernels/lagrange.d.ts +5 -0
- package/dist/discontinuous/world-kernels/lagrange.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/lagrange.js +27 -0
- package/dist/discontinuous/world-kernels/lagrange.js.map +1 -0
- package/dist/discontinuous/world-kernels/larrivee.d.ts +5 -0
- package/dist/discontinuous/world-kernels/larrivee.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/larrivee.js +26 -0
- package/dist/discontinuous/world-kernels/larrivee.js.map +1 -0
- package/dist/discontinuous/world-kernels/laskowski.d.ts +5 -0
- package/dist/discontinuous/world-kernels/laskowski.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/laskowski.js +31 -0
- package/dist/discontinuous/world-kernels/laskowski.js.map +1 -0
- package/dist/discontinuous/world-kernels/littrow.d.ts +5 -0
- package/dist/discontinuous/world-kernels/littrow.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/littrow.js +13 -0
- package/dist/discontinuous/world-kernels/littrow.js.map +1 -0
- package/dist/discontinuous/world-kernels/loximuthal.d.ts +5 -0
- package/dist/discontinuous/world-kernels/loximuthal.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/loximuthal.js +30 -0
- package/dist/discontinuous/world-kernels/loximuthal.js.map +1 -0
- package/dist/discontinuous/world-kernels/math.d.ts +36 -0
- package/dist/discontinuous/world-kernels/math.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/math.js +63 -0
- package/dist/discontinuous/world-kernels/math.js.map +1 -0
- package/dist/discontinuous/world-kernels/miller.d.ts +5 -0
- package/dist/discontinuous/world-kernels/miller.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/miller.js +13 -0
- package/dist/discontinuous/world-kernels/miller.js.map +1 -0
- package/dist/discontinuous/world-kernels/modifiedStereographic.d.ts +18 -0
- package/dist/discontinuous/world-kernels/modifiedStereographic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/modifiedStereographic.js +79 -0
- package/dist/discontinuous/world-kernels/modifiedStereographic.js.map +1 -0
- package/dist/discontinuous/world-kernels/mollweide.d.ts +10 -0
- package/dist/discontinuous/world-kernels/mollweide.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/mollweide.js +24 -0
- package/dist/discontinuous/world-kernels/mollweide.js.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.js +19 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.js.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.js +26 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.js.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.d.ts +5 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.js +22 -0
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.js.map +1 -0
- package/dist/discontinuous/world-kernels/naturalEarth2.d.ts +5 -0
- package/dist/discontinuous/world-kernels/naturalEarth2.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/naturalEarth2.js +37 -0
- package/dist/discontinuous/world-kernels/naturalEarth2.js.map +1 -0
- package/dist/discontinuous/world-kernels/nellHammer.d.ts +5 -0
- package/dist/discontinuous/world-kernels/nellHammer.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/nellHammer.js +18 -0
- package/dist/discontinuous/world-kernels/nellHammer.js.map +1 -0
- package/dist/discontinuous/world-kernels/newton.d.ts +3 -0
- package/dist/discontinuous/world-kernels/newton.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/newton.js +65 -0
- package/dist/discontinuous/world-kernels/newton.js.map +1 -0
- package/dist/discontinuous/world-kernels/nicolosi.d.ts +5 -0
- package/dist/discontinuous/world-kernels/nicolosi.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/nicolosi.js +38 -0
- package/dist/discontinuous/world-kernels/nicolosi.js.map +1 -0
- package/dist/discontinuous/world-kernels/patterson.d.ts +5 -0
- package/dist/discontinuous/world-kernels/patterson.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/patterson.js +32 -0
- package/dist/discontinuous/world-kernels/patterson.js.map +1 -0
- package/dist/discontinuous/world-kernels/polyconic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/polyconic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/polyconic.js +30 -0
- package/dist/discontinuous/world-kernels/polyconic.js.map +1 -0
- package/dist/discontinuous/world-kernels/rectangularPolyconic.d.ts +5 -0
- package/dist/discontinuous/world-kernels/rectangularPolyconic.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/rectangularPolyconic.js +31 -0
- package/dist/discontinuous/world-kernels/rectangularPolyconic.js.map +1 -0
- package/dist/discontinuous/world-kernels/robinson.d.ts +5 -0
- package/dist/discontinuous/world-kernels/robinson.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/robinson.js +63 -0
- package/dist/discontinuous/world-kernels/robinson.js.map +1 -0
- package/dist/discontinuous/world-kernels/satellite.d.ts +5 -0
- package/dist/discontinuous/world-kernels/satellite.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/satellite.js +32 -0
- package/dist/discontinuous/world-kernels/satellite.js.map +1 -0
- package/dist/discontinuous/world-kernels/sinuMollweide.d.ts +7 -0
- package/dist/discontinuous/world-kernels/sinuMollweide.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/sinuMollweide.js +20 -0
- package/dist/discontinuous/world-kernels/sinuMollweide.js.map +1 -0
- package/dist/discontinuous/world-kernels/sinusoidal.d.ts +5 -0
- package/dist/discontinuous/world-kernels/sinusoidal.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/sinusoidal.js +13 -0
- package/dist/discontinuous/world-kernels/sinusoidal.js.map +1 -0
- package/dist/discontinuous/world-kernels/times.d.ts +5 -0
- package/dist/discontinuous/world-kernels/times.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/times.js +15 -0
- package/dist/discontinuous/world-kernels/times.js.map +1 -0
- package/dist/discontinuous/world-kernels/twoPointEquidistant.d.ts +3 -0
- package/dist/discontinuous/world-kernels/twoPointEquidistant.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/twoPointEquidistant.js +28 -0
- package/dist/discontinuous/world-kernels/twoPointEquidistant.js.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten.d.ts +5 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten.js +30 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten.js.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten2.d.ts +5 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten2.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten2.js +25 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten2.js.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten3.d.ts +5 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten3.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten3.js +22 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten3.js.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten4.d.ts +5 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten4.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten4.js +38 -0
- package/dist/discontinuous/world-kernels/vanDerGrinten4.js.map +1 -0
- package/dist/discontinuous/world-kernels/wagner.d.ts +5 -0
- package/dist/discontinuous/world-kernels/wagner.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/wagner.js +44 -0
- package/dist/discontinuous/world-kernels/wagner.js.map +1 -0
- package/dist/discontinuous/world-kernels/wagner4.d.ts +5 -0
- package/dist/discontinuous/world-kernels/wagner4.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/wagner4.js +10 -0
- package/dist/discontinuous/world-kernels/wagner4.js.map +1 -0
- package/dist/discontinuous/world-kernels/wagner6.d.ts +5 -0
- package/dist/discontinuous/world-kernels/wagner6.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/wagner6.js +13 -0
- package/dist/discontinuous/world-kernels/wagner6.js.map +1 -0
- package/dist/discontinuous/world-kernels/wiechel.d.ts +5 -0
- package/dist/discontinuous/world-kernels/wiechel.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/wiechel.js +15 -0
- package/dist/discontinuous/world-kernels/wiechel.js.map +1 -0
- package/dist/discontinuous/world-kernels/winkel3.d.ts +5 -0
- package/dist/discontinuous/world-kernels/winkel3.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels/winkel3.js +20 -0
- package/dist/discontinuous/world-kernels/winkel3.js.map +1 -0
- package/dist/discontinuous/world-kernels.d.ts +150 -0
- package/dist/discontinuous/world-kernels.d.ts.map +1 -0
- package/dist/discontinuous/world-kernels.js +215 -0
- package/dist/discontinuous/world-kernels.js.map +1 -0
- package/dist/discontinuous/world-map.d.ts +25 -0
- package/dist/discontinuous/world-map.d.ts.map +1 -0
- package/dist/discontinuous/world-map.js +187 -0
- package/dist/discontinuous/world-map.js.map +1 -0
- package/dist/discontinuous.cjs +7037 -0
- package/dist/discontinuous.cjs.map +6 -0
- package/dist/discontinuous.d.ts +50 -0
- package/dist/discontinuous.d.ts.map +1 -0
- package/dist/discontinuous.js +35 -0
- package/dist/discontinuous.js.map +1 -0
- package/dist/elastic.cjs +52991 -0
- package/dist/elastic.cjs.map +6 -0
- package/dist/elastic.d.ts +5 -0
- package/dist/elastic.d.ts.map +1 -0
- package/dist/elastic.js +8 -0
- package/dist/elastic.js.map +1 -0
- package/dist/ellipsoid-geodesic.d.ts +62 -0
- package/dist/ellipsoid-geodesic.d.ts.map +1 -0
- package/dist/ellipsoid-geodesic.js +69 -0
- package/dist/ellipsoid-geodesic.js.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.js +15 -5
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
- package/dist/ellipsoid-helpers/exact-nearest-surface.d.ts +16 -0
- package/dist/ellipsoid-helpers/exact-nearest-surface.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/exact-nearest-surface.js +108 -0
- package/dist/ellipsoid-helpers/exact-nearest-surface.js.map +1 -0
- package/dist/ellipsoid-helpers/intersection-bounds.d.ts +18 -0
- package/dist/ellipsoid-helpers/intersection-bounds.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/intersection-bounds.js +60 -0
- package/dist/ellipsoid-helpers/intersection-bounds.js.map +1 -0
- package/dist/ellipsoid-helpers/nearest-surface.d.ts +12 -0
- package/dist/ellipsoid-helpers/nearest-surface.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/nearest-surface.js +127 -0
- package/dist/ellipsoid-helpers/nearest-surface.js.map +1 -0
- package/dist/ellipsoid-helpers/rhumb-pole-distance.d.ts +3 -0
- package/dist/ellipsoid-helpers/rhumb-pole-distance.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/rhumb-pole-distance.js +63 -0
- package/dist/ellipsoid-helpers/rhumb-pole-distance.js.map +1 -0
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +14 -78
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
- package/dist/ellipsoid-helpers/surface-polygon.d.ts +65 -0
- package/dist/ellipsoid-helpers/surface-polygon.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/surface-polygon.js +159 -0
- package/dist/ellipsoid-helpers/surface-polygon.js.map +1 -0
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +7 -0
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -0
- package/dist/ellipsoid-helpers/tangent-plane-numerics.js +88 -0
- package/dist/ellipsoid-helpers/tangent-plane-numerics.js.map +1 -0
- package/dist/ellipsoid-metrics.d.ts +31 -0
- package/dist/ellipsoid-metrics.d.ts.map +1 -0
- package/dist/ellipsoid-metrics.js +186 -0
- package/dist/ellipsoid-metrics.js.map +1 -0
- package/dist/ellipsoid-rhumb.d.ts +52 -0
- package/dist/ellipsoid-rhumb.d.ts.map +1 -0
- package/dist/ellipsoid-rhumb.js +321 -0
- package/dist/ellipsoid-rhumb.js.map +1 -0
- package/dist/ellipsoid-tangent-plane.d.ts +29 -7
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.js +177 -29
- package/dist/ellipsoid-tangent-plane.js.map +1 -1
- package/dist/ellipsoid-transforms.d.ts +12 -0
- package/dist/ellipsoid-transforms.d.ts.map +1 -0
- package/dist/ellipsoid-transforms.js +15 -0
- package/dist/ellipsoid-transforms.js.map +1 -0
- package/dist/ellipsoid.d.ts +2 -12
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +167 -73
- package/dist/ellipsoid.js.map +1 -1
- package/dist/entries/ellipsoid.cjs +3640 -302
- package/dist/entries/ellipsoid.cjs.map +3 -3
- package/dist/entries/ellipsoid.d.ts +21 -0
- package/dist/entries/ellipsoid.d.ts.map +1 -1
- package/dist/entries/ellipsoid.js +10 -0
- package/dist/entries/ellipsoid.js.map +1 -1
- package/dist/expressions.cjs +442 -244
- package/dist/expressions.cjs.map +3 -3
- package/dist/expressions.d.ts.map +1 -1
- package/dist/expressions.js +2 -1
- package/dist/expressions.js.map +1 -1
- package/dist/geoarrow/builder-entry.cjs.map +1 -1
- package/dist/geoarrow/codecs.d.ts.map +1 -1
- package/dist/geoarrow/codecs.js +3 -8
- package/dist/geoarrow/codecs.js.map +1 -1
- package/dist/geoarrow/index.cjs +34 -9
- package/dist/geoarrow/index.cjs.map +1 -1
- package/dist/geoarrow/index.d.ts +1 -1
- package/dist/geoarrow/index.d.ts.map +1 -1
- package/dist/geoarrow/index.js +1 -1
- package/dist/geoarrow/index.js.map +1 -1
- package/dist/geoarrow/tessellation-entry.cjs.map +1 -1
- package/dist/geoarrow/types.d.ts +8 -0
- package/dist/geoarrow/types.d.ts.map +1 -1
- package/dist/geoarrow/types.js +30 -0
- package/dist/geoarrow/types.js.map +1 -1
- package/dist/geoarrow/wkb-entry.cjs +14 -9
- package/dist/geoarrow/wkb-entry.cjs.map +1 -1
- package/dist/geodesic-exact/area.d.ts +5 -0
- package/dist/geodesic-exact/area.d.ts.map +1 -0
- package/dist/geodesic-exact/area.js +56 -0
- package/dist/geodesic-exact/area.js.map +1 -0
- package/dist/geodesic-exact/inverse-engine.d.ts +57 -0
- package/dist/geodesic-exact/inverse-engine.d.ts.map +1 -0
- package/dist/geodesic-exact/inverse-engine.js +56 -0
- package/dist/geodesic-exact/inverse-engine.js.map +1 -0
- package/dist/geodesic-exact/polygon.d.ts +12 -0
- package/dist/geodesic-exact/polygon.d.ts.map +1 -0
- package/dist/geodesic-exact/polygon.js +27 -0
- package/dist/geodesic-exact/polygon.js.map +1 -0
- package/dist/geodesic-exact/quadrature.d.ts +9 -0
- package/dist/geodesic-exact/quadrature.d.ts.map +1 -0
- package/dist/geodesic-exact/quadrature.js +62 -0
- package/dist/geodesic-exact/quadrature.js.map +1 -0
- package/dist/geodesic-exact.cjs +1871 -0
- package/dist/geodesic-exact.cjs.map +6 -0
- package/dist/geodesic-exact.d.ts +23 -0
- package/dist/geodesic-exact.d.ts.map +1 -0
- package/dist/geodesic-exact.js +210 -0
- package/dist/geodesic-exact.js.map +1 -0
- package/dist/geodesic-intersections.d.ts +83 -0
- package/dist/geodesic-intersections.d.ts.map +1 -0
- package/dist/geodesic-intersections.js +451 -0
- package/dist/geodesic-intersections.js.map +1 -0
- package/dist/geodesic-path.d.ts +28 -0
- package/dist/geodesic-path.d.ts.map +1 -0
- package/dist/geodesic-path.js +102 -0
- package/dist/geodesic-path.js.map +1 -0
- package/dist/geodesic-polygon.d.ts +11 -0
- package/dist/geodesic-polygon.d.ts.map +1 -0
- package/dist/geodesic-polygon.js +16 -0
- package/dist/geodesic-polygon.js.map +1 -0
- package/dist/geographic-seams/edge.d.ts +46 -0
- package/dist/geographic-seams/edge.d.ts.map +1 -0
- package/dist/geographic-seams/edge.js +362 -0
- package/dist/geographic-seams/edge.js.map +1 -0
- package/dist/geographic-seams/polygon.d.ts +8 -0
- package/dist/geographic-seams/polygon.d.ts.map +1 -0
- package/dist/geographic-seams/polygon.js +381 -0
- package/dist/geographic-seams/polygon.js.map +1 -0
- package/dist/geographic-seams/types.d.ts +59 -0
- package/dist/geographic-seams/types.d.ts.map +1 -0
- package/dist/geographic-seams/types.js +8 -0
- package/dist/geographic-seams/types.js.map +1 -0
- package/dist/geographic-seams.d.ts +12 -0
- package/dist/geographic-seams.d.ts.map +1 -0
- package/dist/geographic-seams.js +54 -0
- package/dist/geographic-seams.js.map +1 -0
- package/dist/globe.cjs +3520 -367
- package/dist/globe.cjs.map +3 -3
- package/dist/globe.d.ts +6 -0
- package/dist/globe.d.ts.map +1 -1
- package/dist/globe.js +3 -0
- package/dist/globe.js.map +1 -1
- package/dist/index.cjs +4495 -378
- package/dist/index.cjs.map +3 -3
- package/dist/lng-lat-rectangle.js +1 -1
- package/dist/lng-lat-rectangle.js.map +1 -1
- package/dist/local-reference-frame.d.ts +57 -0
- package/dist/local-reference-frame.d.ts.map +1 -0
- package/dist/local-reference-frame.js +247 -0
- package/dist/local-reference-frame.js.map +1 -0
- package/dist/make-obb-from-region.js +1 -1
- package/dist/make-obb-from-region.js.map +1 -1
- package/dist/projection/experimental/authalic-latitude.d.ts +7 -0
- package/dist/projection/experimental/authalic-latitude.d.ts.map +1 -0
- package/dist/projection/experimental/authalic-latitude.js +51 -0
- package/dist/projection/experimental/authalic-latitude.js.map +1 -0
- package/dist/projection/experimental/common/adjust_lat.js +2 -2
- package/dist/projection/experimental/common/adjust_lat.js.map +1 -1
- package/dist/projection/experimental/common/adjust_lon.js +1 -1
- package/dist/projection/experimental/common/adjust_lon.js.map +1 -1
- package/dist/projection/experimental/common/asinhy.js +1 -1
- package/dist/projection/experimental/common/asinhy.js.map +1 -1
- package/dist/projection/experimental/common/asinz.js +1 -1
- package/dist/projection/experimental/common/asinz.js.map +1 -1
- package/dist/projection/experimental/common/authlat.js +1 -1
- package/dist/projection/experimental/common/authlat.js.map +1 -1
- package/dist/projection/experimental/common/authset.js +1 -1
- package/dist/projection/experimental/common/authset.js.map +1 -1
- package/dist/projection/experimental/common/clens.js +1 -1
- package/dist/projection/experimental/common/clens.js.map +1 -1
- package/dist/projection/experimental/common/clens_cmplx.js +1 -1
- package/dist/projection/experimental/common/clens_cmplx.js.map +1 -1
- package/dist/projection/experimental/common/constants.js +1 -1
- package/dist/projection/experimental/common/constants.js.map +1 -1
- package/dist/projection/experimental/common/cosh.js +1 -1
- package/dist/projection/experimental/common/cosh.js.map +1 -1
- package/dist/projection/experimental/common/e0fn.js +1 -1
- package/dist/projection/experimental/common/e0fn.js.map +1 -1
- package/dist/projection/experimental/common/e1fn.js +1 -1
- package/dist/projection/experimental/common/e1fn.js.map +1 -1
- package/dist/projection/experimental/common/e2fn.js +1 -1
- package/dist/projection/experimental/common/e2fn.js.map +1 -1
- package/dist/projection/experimental/common/e3fn.js +1 -1
- package/dist/projection/experimental/common/e3fn.js.map +1 -1
- package/dist/projection/experimental/common/fL.js +1 -1
- package/dist/projection/experimental/common/fL.js.map +1 -1
- package/dist/projection/experimental/common/gN.js +1 -1
- package/dist/projection/experimental/common/gN.js.map +1 -1
- package/dist/projection/experimental/common/gatg.js +1 -1
- package/dist/projection/experimental/common/gatg.js.map +1 -1
- package/dist/projection/experimental/common/hypot.js +1 -1
- package/dist/projection/experimental/common/hypot.js.map +1 -1
- package/dist/projection/experimental/common/imlfn.js +1 -1
- package/dist/projection/experimental/common/imlfn.js.map +1 -1
- package/dist/projection/experimental/common/invlatiso.js +1 -1
- package/dist/projection/experimental/common/invlatiso.js.map +1 -1
- package/dist/projection/experimental/common/iqsfnz.js +1 -1
- package/dist/projection/experimental/common/iqsfnz.js.map +1 -1
- package/dist/projection/experimental/common/latiso.js +1 -1
- package/dist/projection/experimental/common/latiso.js.map +1 -1
- package/dist/projection/experimental/common/log1py.js +1 -1
- package/dist/projection/experimental/common/log1py.js.map +1 -1
- package/dist/projection/experimental/common/mlfn.js +1 -1
- package/dist/projection/experimental/common/mlfn.js.map +1 -1
- package/dist/projection/experimental/common/msfnz.js +1 -1
- package/dist/projection/experimental/common/msfnz.js.map +1 -1
- package/dist/projection/experimental/common/phi2z.js +1 -1
- package/dist/projection/experimental/common/phi2z.js.map +1 -1
- package/dist/projection/experimental/common/pj_enfn.js +1 -1
- package/dist/projection/experimental/common/pj_enfn.js.map +1 -1
- package/dist/projection/experimental/common/pj_inv_mlfn.js +1 -1
- package/dist/projection/experimental/common/pj_inv_mlfn.js.map +1 -1
- package/dist/projection/experimental/common/pj_mlfn.js +1 -1
- package/dist/projection/experimental/common/pj_mlfn.js.map +1 -1
- package/dist/projection/experimental/common/qsfnz.js +1 -1
- package/dist/projection/experimental/common/qsfnz.js.map +1 -1
- package/dist/projection/experimental/common/sign.js +1 -1
- package/dist/projection/experimental/common/sign.js.map +1 -1
- package/dist/projection/experimental/common/sinh.js +1 -1
- package/dist/projection/experimental/common/sinh.js.map +1 -1
- package/dist/projection/experimental/common/srat.js +1 -1
- package/dist/projection/experimental/common/srat.js.map +1 -1
- package/dist/projection/experimental/common/tsfnz.d.ts.map +1 -1
- package/dist/projection/experimental/common/tsfnz.js +6 -6
- package/dist/projection/experimental/common/tsfnz.js.map +1 -1
- package/dist/projection/experimental/common/vincenty.js +1 -1
- package/dist/projection/experimental/common/vincenty.js.map +1 -1
- package/dist/projection/experimental/crs/datum-table.js +1 -1
- package/dist/projection/experimental/crs/datum-table.js.map +1 -1
- package/dist/projection/experimental/crs/ellipsoid-table.js +1 -1
- package/dist/projection/experimental/crs/ellipsoid-table.js.map +1 -1
- package/dist/projection/experimental/crs/primemeridian-table.js +1 -1
- package/dist/projection/experimental/crs/primemeridian-table.js.map +1 -1
- package/dist/projection/experimental/crs/structured.js +1 -1
- package/dist/projection/experimental/crs/structured.js.map +1 -1
- package/dist/projection/experimental/crs/wkt.js +1 -1
- package/dist/projection/experimental/crs/wkt.js.map +1 -1
- package/dist/projection/experimental/datum.js +1 -1
- package/dist/projection/experimental/datum.js.map +1 -1
- package/dist/projection/experimental/ellipsoidal-gnomonic.d.ts +10 -0
- package/dist/projection/experimental/ellipsoidal-gnomonic.d.ts.map +1 -0
- package/dist/projection/experimental/ellipsoidal-gnomonic.js +59 -0
- package/dist/projection/experimental/ellipsoidal-gnomonic.js.map +1 -0
- package/dist/projection/experimental/entries/projections/aea.cjs +34 -27
- package/dist/projection/experimental/entries/projections/aea.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/aeqd.cjs +9 -9
- package/dist/projection/experimental/entries/projections/aeqd.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/bonne.cjs +1 -1
- package/dist/projection/experimental/entries/projections/bonne.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/cass.cjs +1 -1
- package/dist/projection/experimental/entries/projections/cass.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/eck6.cjs +5 -2
- package/dist/projection/experimental/entries/projections/eck6.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/eqdc.cjs +1 -1
- package/dist/projection/experimental/entries/projections/eqdc.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/eqearth.cjs +10 -1
- package/dist/projection/experimental/entries/projections/eqearth.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/equi.cjs +2 -0
- package/dist/projection/experimental/entries/projections/equi.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/gnom.cjs +1461 -4
- package/dist/projection/experimental/entries/projections/gnom.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/krovak.cjs +1 -1
- package/dist/projection/experimental/entries/projections/krovak.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/laea.cjs +82 -46
- package/dist/projection/experimental/entries/projections/laea.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/lcc.cjs +7 -12
- package/dist/projection/experimental/entries/projections/lcc.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/moll.cjs +46 -39
- package/dist/projection/experimental/entries/projections/moll.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/omerc.cjs +6 -8
- package/dist/projection/experimental/entries/projections/omerc.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/ortho.cjs +52 -106
- package/dist/projection/experimental/entries/projections/ortho.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/poly.cjs +83 -49
- package/dist/projection/experimental/entries/projections/poly.cjs.map +3 -3
- package/dist/projection/experimental/entries/projections/qsc.cjs +31 -50
- package/dist/projection/experimental/entries/projections/qsc.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/sinu.cjs +5 -2
- package/dist/projection/experimental/entries/projections/sinu.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/somerc.cjs +22 -29
- package/dist/projection/experimental/entries/projections/somerc.cjs.map +1 -1
- package/dist/projection/experimental/entries/projections/stere.cjs +19 -6
- package/dist/projection/experimental/entries/projections/stere.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/sterea.cjs +9 -1
- package/dist/projection/experimental/entries/projections/sterea.cjs.map +2 -2
- package/dist/projection/experimental/entries/projections/tpers.cjs.map +1 -1
- package/dist/projection/experimental/grids/geotiff.js +1 -1
- package/dist/projection/experimental/grids/geotiff.js.map +1 -1
- package/dist/projection/experimental/grids/ntv2.js +1 -1
- package/dist/projection/experimental/grids/ntv2.js.map +1 -1
- package/dist/projection/experimental/index.cjs +1870 -365
- package/dist/projection/experimental/index.cjs.map +3 -3
- package/dist/projection/experimental/inverse-spherical-latitude.d.ts +2 -0
- package/dist/projection/experimental/inverse-spherical-latitude.d.ts.map +1 -0
- package/dist/projection/experimental/inverse-spherical-latitude.js +11 -0
- package/dist/projection/experimental/inverse-spherical-latitude.js.map +1 -0
- package/dist/projection/experimental/kernels/aea.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/aea.js +11 -29
- package/dist/projection/experimental/kernels/aea.js.map +1 -1
- package/dist/projection/experimental/kernels/aeqd.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/aeqd.js +3 -3
- package/dist/projection/experimental/kernels/aeqd.js.map +1 -1
- package/dist/projection/experimental/kernels/bonne.js +1 -1
- package/dist/projection/experimental/kernels/bonne.js.map +1 -1
- package/dist/projection/experimental/kernels/cass.js +1 -1
- package/dist/projection/experimental/kernels/cass.js.map +1 -1
- package/dist/projection/experimental/kernels/cea.js +1 -1
- package/dist/projection/experimental/kernels/cea.js.map +1 -1
- package/dist/projection/experimental/kernels/eck6.js +1 -1
- package/dist/projection/experimental/kernels/eck6.js.map +1 -1
- package/dist/projection/experimental/kernels/eqdc.js +1 -1
- package/dist/projection/experimental/kernels/eqdc.js.map +1 -1
- package/dist/projection/experimental/kernels/eqearth.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/eqearth.js +13 -2
- package/dist/projection/experimental/kernels/eqearth.js.map +1 -1
- package/dist/projection/experimental/kernels/equi.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/equi.js +3 -1
- package/dist/projection/experimental/kernels/equi.js.map +1 -1
- package/dist/projection/experimental/kernels/etmerc.js +1 -1
- package/dist/projection/experimental/kernels/etmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/gauss.js +1 -1
- package/dist/projection/experimental/kernels/gauss.js.map +1 -1
- package/dist/projection/experimental/kernels/geos.js +1 -1
- package/dist/projection/experimental/kernels/geos.js.map +1 -1
- package/dist/projection/experimental/kernels/gnom.d.ts +2 -0
- package/dist/projection/experimental/kernels/gnom.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/gnom.js +8 -1
- package/dist/projection/experimental/kernels/gnom.js.map +1 -1
- package/dist/projection/experimental/kernels/gstmerc.js +1 -1
- package/dist/projection/experimental/kernels/gstmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/krovak.js +2 -2
- package/dist/projection/experimental/kernels/krovak.js.map +1 -1
- package/dist/projection/experimental/kernels/laea.d.ts +0 -1
- package/dist/projection/experimental/kernels/laea.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/laea.js +33 -15
- package/dist/projection/experimental/kernels/laea.js.map +1 -1
- package/dist/projection/experimental/kernels/lcc.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/lcc.js +2 -7
- package/dist/projection/experimental/kernels/lcc.js.map +1 -1
- package/dist/projection/experimental/kernels/mill.js +1 -1
- package/dist/projection/experimental/kernels/mill.js.map +1 -1
- package/dist/projection/experimental/kernels/moll.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/moll.js +65 -50
- package/dist/projection/experimental/kernels/moll.js.map +1 -1
- package/dist/projection/experimental/kernels/nzmg.js +1 -1
- package/dist/projection/experimental/kernels/nzmg.js.map +1 -1
- package/dist/projection/experimental/kernels/omerc.js +1 -1
- package/dist/projection/experimental/kernels/omerc.js.map +1 -1
- package/dist/projection/experimental/kernels/ortho.d.ts +6 -5
- package/dist/projection/experimental/kernels/ortho.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/ortho.js +35 -83
- package/dist/projection/experimental/kernels/ortho.js.map +1 -1
- package/dist/projection/experimental/kernels/poly.d.ts +2 -5
- package/dist/projection/experimental/kernels/poly.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/poly.js +83 -31
- package/dist/projection/experimental/kernels/poly.js.map +1 -1
- package/dist/projection/experimental/kernels/qsc.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/qsc.js +37 -52
- package/dist/projection/experimental/kernels/qsc.js.map +1 -1
- package/dist/projection/experimental/kernels/robin.js +1 -1
- package/dist/projection/experimental/kernels/robin.js.map +1 -1
- package/dist/projection/experimental/kernels/sinu.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/sinu.js +5 -2
- package/dist/projection/experimental/kernels/sinu.js.map +1 -1
- package/dist/projection/experimental/kernels/somerc.d.ts +2 -2
- package/dist/projection/experimental/kernels/somerc.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/somerc.js +35 -37
- package/dist/projection/experimental/kernels/somerc.js.map +1 -1
- package/dist/projection/experimental/kernels/stere.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/stere.js +15 -3
- package/dist/projection/experimental/kernels/stere.js.map +1 -1
- package/dist/projection/experimental/kernels/sterea.d.ts.map +1 -1
- package/dist/projection/experimental/kernels/sterea.js +4 -2
- package/dist/projection/experimental/kernels/sterea.js.map +1 -1
- package/dist/projection/experimental/kernels/tmerc.js +1 -1
- package/dist/projection/experimental/kernels/tmerc.js.map +1 -1
- package/dist/projection/experimental/kernels/tpers.js +1 -1
- package/dist/projection/experimental/kernels/tpers.js.map +1 -1
- package/dist/projection/experimental/kernels/vandg.js +1 -1
- package/dist/projection/experimental/kernels/vandg.js.map +1 -1
- package/dist/projection/experimental/kinematic-helmert.js +1 -1
- package/dist/projection/experimental/kinematic-helmert.js.map +1 -1
- package/dist/projection/experimental/projections/gnom.d.ts.map +1 -1
- package/dist/projection/experimental/projections/gnom.js +4 -2
- package/dist/projection/experimental/projections/gnom.js.map +1 -1
- package/dist/projection/experimental/projections/laea.js +3 -3
- package/dist/projection/experimental/projections/laea.js.map +1 -1
- package/dist/projection/experimental/projections/ortho.js +4 -4
- package/dist/projection/experimental/projections/ortho.js.map +1 -1
- package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts +7 -0
- package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.d.ts.map +1 -1
- package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js +42 -2
- package/dist/projection/experimental/rendering-profile/azimuthal-rendering-bounds.js.map +1 -1
- package/dist/projection/index.cjs +1870 -365
- package/dist/projection/index.cjs.map +3 -3
- package/dist/rhumb-path.d.ts +28 -0
- package/dist/rhumb-path.d.ts.map +1 -0
- package/dist/rhumb-path.js +100 -0
- package/dist/rhumb-path.js.map +1 -0
- package/dist/rhumb-polygon.d.ts +11 -0
- package/dist/rhumb-polygon.d.ts.map +1 -0
- package/dist/rhumb-polygon.js +19 -0
- package/dist/rhumb-polygon.js.map +1 -0
- package/dist/subdivide-geodesic-polyline.d.ts +15 -0
- package/dist/subdivide-geodesic-polyline.d.ts.map +1 -0
- package/dist/subdivide-geodesic-polyline.js +52 -0
- package/dist/subdivide-geodesic-polyline.js.map +1 -0
- package/dist/subdivide-rhumb-polyline.d.ts +12 -0
- package/dist/subdivide-rhumb-polyline.d.ts.map +1 -0
- package/dist/subdivide-rhumb-polyline.js +82 -0
- package/dist/subdivide-rhumb-polyline.js.map +1 -0
- package/dist/triaxial/integrate.d.ts +2 -0
- package/dist/triaxial/integrate.d.ts.map +1 -0
- package/dist/triaxial/integrate.js +76 -0
- package/dist/triaxial/integrate.js.map +1 -0
- package/dist/triaxial.cjs +204 -0
- package/dist/triaxial.cjs.map +6 -0
- package/dist/triaxial.d.ts +38 -0
- package/dist/triaxial.d.ts.map +1 -0
- package/dist/triaxial.js +121 -0
- package/dist/triaxial.js.map +1 -0
- package/dist/vendor/geographiclib-geodesic/runtime.d.ts +9 -0
- package/dist/vendor/geographiclib-geodesic/runtime.d.ts.map +1 -0
- package/dist/vendor/geographiclib-geodesic/runtime.js +2244 -0
- package/dist/vendor/geographiclib-geodesic/runtime.js.map +1 -0
- package/dist/wkb/index.cjs +7 -2
- package/dist/wkb/index.cjs.map +1 -1
- package/dist/wkb/wkb-builder.d.ts.map +1 -1
- package/dist/wkb/wkb-builder.js +9 -2
- package/dist/wkb/wkb-builder.js.map +1 -1
- package/package.json +30 -6
- package/projection/THIRD-PARTY-NOTICES.md +58 -11
- package/src/constants.ts +1 -1
- package/src/discontinuous/AIR-OCEAN-LICENSE.txt +26 -0
- package/src/discontinuous/D3-LICENSE.txt +37 -0
- package/src/discontinuous/PETROFF-LICENSE.txt +55 -0
- package/src/discontinuous/PROJ-LICENSE.txt +34 -0
- package/src/discontinuous/air-ocean-mesh.ts +86 -0
- package/src/discontinuous/albers-usa.ts +181 -0
- package/src/discontinuous/cap-map.ts +406 -0
- package/src/discontinuous/elastic/README.md +20 -0
- package/src/discontinuous/elastic/UNLICENSE.txt +24 -0
- package/src/discontinuous/elastic/data.ts +86 -0
- package/src/discontinuous/elastic/elasticI.ts +5238 -0
- package/src/discontinuous/elastic/elasticII.ts +18167 -0
- package/src/discontinuous/elastic/elasticIII.ts +29571 -0
- package/src/discontinuous/elastic/geometry.ts +172 -0
- package/src/discontinuous/elastic/grid.ts +194 -0
- package/src/discontinuous/elastic/map.ts +317 -0
- package/src/discontinuous/gray-fuller.ts +38 -0
- package/src/discontinuous/gringorten-kernel.ts +160 -0
- package/src/discontinuous/healpix.ts +61 -0
- package/src/discontinuous/layout.ts +177 -0
- package/src/discontinuous/map-engine.ts +528 -0
- package/src/discontinuous/map-layout.ts +605 -0
- package/src/discontinuous/map-transition.ts +339 -0
- package/src/discontinuous/math.ts +67 -0
- package/src/discontinuous/mercator-map.ts +155 -0
- package/src/discontinuous/myriahedral/graticule.ts +40 -0
- package/src/discontinuous/myriahedral/mesh.ts +138 -0
- package/src/discontinuous/myriahedral/unfold.ts +208 -0
- package/src/discontinuous/myriahedral.ts +285 -0
- package/src/discontinuous/petroff.ts +178 -0
- package/src/discontinuous/polyhedral.ts +138 -0
- package/src/discontinuous/prepare-features.ts +239 -0
- package/src/discontinuous/presets.ts +450 -0
- package/src/discontinuous/projection-catalog.ts +132 -0
- package/src/discontinuous/quincuncial-kernel.ts +173 -0
- package/src/discontinuous/quincuncial-star.ts +328 -0
- package/src/discontinuous/regional-map.ts +228 -0
- package/src/discontinuous/retroazimuthal-map.ts +52 -0
- package/src/discontinuous/rotated-map.ts +86 -0
- package/src/discontinuous/snyder-mesh.ts +88 -0
- package/src/discontinuous/snyder.ts +171 -0
- package/src/discontinuous/spherical-clip/D3-GEO-LICENSE.txt +34 -0
- package/src/discontinuous/spherical-clip/README.md +16 -0
- package/src/discontinuous/spherical-clip/cartesian.js +43 -0
- package/src/discontinuous/spherical-clip/circle.js +35 -0
- package/src/discontinuous/spherical-clip/clip-buffer.js +29 -0
- package/src/discontinuous/spherical-clip/clip-circle.js +197 -0
- package/src/discontinuous/spherical-clip/clip-index.js +140 -0
- package/src/discontinuous/spherical-clip/clip-rejoin.js +111 -0
- package/src/discontinuous/spherical-clip/helpers.js +20 -0
- package/src/discontinuous/spherical-clip/math.js +45 -0
- package/src/discontinuous/spherical-clip/noop.js +6 -0
- package/src/discontinuous/spherical-clip/pointEqual.js +10 -0
- package/src/discontinuous/spherical-clip/polygonContains.js +96 -0
- package/src/discontinuous/world-composite-kernels.ts +30 -0
- package/src/discontinuous/world-kernels/INTEGRATE-LICENSE.txt +21 -0
- package/src/discontinuous/world-kernels/README.md +24 -0
- package/src/discontinuous/world-kernels/airy.js +43 -0
- package/src/discontinuous/world-kernels/aitoff.js +48 -0
- package/src/discontinuous/world-kernels/armadillo.js +51 -0
- package/src/discontinuous/world-kernels/august.js +36 -0
- package/src/discontinuous/world-kernels/baker.js +50 -0
- package/src/discontinuous/world-kernels/bertin.js +41 -0
- package/src/discontinuous/world-kernels/boggs.js +32 -0
- package/src/discontinuous/world-kernels/bonne.js +27 -0
- package/src/discontinuous/world-kernels/bottomley.js +25 -0
- package/src/discontinuous/world-kernels/bromley.js +10 -0
- package/src/discontinuous/world-kernels/chamberlin.js +97 -0
- package/src/discontinuous/world-kernels/collignon.js +17 -0
- package/src/discontinuous/world-kernels/craig.js +33 -0
- package/src/discontinuous/world-kernels/craster.js +18 -0
- package/src/discontinuous/world-kernels/cylindricalEqualArea.js +21 -0
- package/src/discontinuous/world-kernels/cylindricalStereographic.js +21 -0
- package/src/discontinuous/world-kernels/d3-geo-raw.js +26 -0
- package/src/discontinuous/world-kernels/eckert1.js +18 -0
- package/src/discontinuous/world-kernels/eckert2.js +17 -0
- package/src/discontinuous/world-kernels/eckert3.js +17 -0
- package/src/discontinuous/world-kernels/eckert4.js +24 -0
- package/src/discontinuous/world-kernels/eckert5.js +17 -0
- package/src/discontinuous/world-kernels/eckert6.js +22 -0
- package/src/discontinuous/world-kernels/eisenlohr.js +88 -0
- package/src/discontinuous/world-kernels/fahey.js +19 -0
- package/src/discontinuous/world-kernels/foucaut.js +20 -0
- package/src/discontinuous/world-kernels/foucautSinusoidal.js +38 -0
- package/src/discontinuous/world-kernels/ginzburg4.js +17 -0
- package/src/discontinuous/world-kernels/ginzburg5.js +17 -0
- package/src/discontinuous/world-kernels/ginzburg6.js +19 -0
- package/src/discontinuous/world-kernels/ginzburg8.js +34 -0
- package/src/discontinuous/world-kernels/ginzburg9.js +17 -0
- package/src/discontinuous/world-kernels/ginzburgPolyconic.js +64 -0
- package/src/discontinuous/world-kernels/hammer.js +37 -0
- package/src/discontinuous/world-kernels/hammerRetroazimuthal.js +63 -0
- package/src/discontinuous/world-kernels/hill.js +57 -0
- package/src/discontinuous/world-kernels/homolosine.js +24 -0
- package/src/discontinuous/world-kernels/hufnagel.js +68 -0
- package/src/discontinuous/world-kernels/hyperelliptical.js +56 -0
- package/src/discontinuous/world-kernels/integrate.js +99 -0
- package/src/discontinuous/world-kernels/kavrayskiy7.js +15 -0
- package/src/discontinuous/world-kernels/lagrange.js +32 -0
- package/src/discontinuous/world-kernels/larrivee.js +43 -0
- package/src/discontinuous/world-kernels/laskowski.js +50 -0
- package/src/discontinuous/world-kernels/littrow.js +19 -0
- package/src/discontinuous/world-kernels/loximuthal.js +38 -0
- package/src/discontinuous/world-kernels/math.js +98 -0
- package/src/discontinuous/world-kernels/miller.js +15 -0
- package/src/discontinuous/world-kernels/modifiedStereographic.js +112 -0
- package/src/discontinuous/world-kernels/mollweide.js +30 -0
- package/src/discontinuous/world-kernels/mtFlatPolarParabolic.js +23 -0
- package/src/discontinuous/world-kernels/mtFlatPolarQuartic.js +29 -0
- package/src/discontinuous/world-kernels/mtFlatPolarSinusoidal.js +25 -0
- package/src/discontinuous/world-kernels/naturalEarth2.js +46 -0
- package/src/discontinuous/world-kernels/nellHammer.js +20 -0
- package/src/discontinuous/world-kernels/newton.js +77 -0
- package/src/discontinuous/world-kernels/nicolosi.js +60 -0
- package/src/discontinuous/world-kernels/patterson.js +45 -0
- package/src/discontinuous/world-kernels/polyconic.js +36 -0
- package/src/discontinuous/world-kernels/rectangularPolyconic.js +41 -0
- package/src/discontinuous/world-kernels/robinson.js +88 -0
- package/src/discontinuous/world-kernels/satellite.js +44 -0
- package/src/discontinuous/world-kernels/sinuMollweide.js +24 -0
- package/src/discontinuous/world-kernels/sinusoidal.js +15 -0
- package/src/discontinuous/world-kernels/times.js +19 -0
- package/src/discontinuous/world-kernels/twoPointEquidistant.js +41 -0
- package/src/discontinuous/world-kernels/vanDerGrinten.js +48 -0
- package/src/discontinuous/world-kernels/vanDerGrinten2.js +32 -0
- package/src/discontinuous/world-kernels/vanDerGrinten3.js +24 -0
- package/src/discontinuous/world-kernels/vanDerGrinten4.js +70 -0
- package/src/discontinuous/world-kernels/wagner.js +61 -0
- package/src/discontinuous/world-kernels/wagner4.js +13 -0
- package/src/discontinuous/world-kernels/wagner6.js +15 -0
- package/src/discontinuous/world-kernels/wiechel.js +25 -0
- package/src/discontinuous/world-kernels/winkel3.js +45 -0
- package/src/discontinuous/world-kernels.ts +249 -0
- package/src/discontinuous/world-map.ts +257 -0
- package/src/discontinuous.ts +134 -0
- package/src/elastic.ts +7 -0
- package/src/ellipsoid-geodesic.ts +159 -0
- package/src/ellipsoid-helpers/ellipsoid-transform.ts +17 -5
- package/src/ellipsoid-helpers/exact-nearest-surface.ts +118 -0
- package/src/ellipsoid-helpers/intersection-bounds.ts +85 -0
- package/src/ellipsoid-helpers/nearest-surface.ts +157 -0
- package/src/ellipsoid-helpers/rhumb-pole-distance.ts +76 -0
- package/src/ellipsoid-helpers/scale-to-geodetic-surface.ts +14 -107
- package/src/ellipsoid-helpers/surface-polygon.ts +210 -0
- package/src/ellipsoid-helpers/tangent-plane-numerics.ts +124 -0
- package/src/ellipsoid-metrics.ts +225 -0
- package/src/ellipsoid-rhumb.ts +404 -0
- package/src/ellipsoid-tangent-plane.ts +232 -36
- package/src/ellipsoid-transforms.ts +61 -0
- package/src/ellipsoid.ts +210 -126
- package/src/entries/ellipsoid.ts +36 -0
- package/src/expressions.ts +2 -1
- package/src/geoarrow/codecs.ts +3 -9
- package/src/geoarrow/index.ts +3 -1
- package/src/geoarrow/types.ts +40 -0
- package/src/geodesic-exact/area.ts +70 -0
- package/src/geodesic-exact/inverse-engine.ts +166 -0
- package/src/geodesic-exact/polygon.ts +36 -0
- package/src/geodesic-exact/quadrature.ts +60 -0
- package/src/geodesic-exact.ts +290 -0
- package/src/geodesic-intersections.ts +598 -0
- package/src/geodesic-path.ts +128 -0
- package/src/geodesic-polygon.ts +19 -0
- package/src/geographic-seams/edge.ts +406 -0
- package/src/geographic-seams/polygon.ts +478 -0
- package/src/geographic-seams/types.ts +67 -0
- package/src/geographic-seams.ts +81 -0
- package/src/globe.ts +17 -0
- package/src/lng-lat-rectangle.ts +1 -1
- package/src/local-reference-frame.ts +320 -0
- package/src/make-obb-from-region.ts +1 -1
- package/src/projection/experimental/authalic-latitude.ts +49 -0
- package/src/projection/experimental/common/adjust_lat.ts +2 -2
- package/src/projection/experimental/common/adjust_lon.ts +1 -1
- package/src/projection/experimental/common/asinhy.ts +1 -1
- package/src/projection/experimental/common/asinz.ts +1 -1
- package/src/projection/experimental/common/authlat.ts +1 -1
- package/src/projection/experimental/common/authset.ts +1 -1
- package/src/projection/experimental/common/clens.ts +1 -1
- package/src/projection/experimental/common/clens_cmplx.ts +1 -1
- package/src/projection/experimental/common/constants.ts +1 -1
- package/src/projection/experimental/common/cosh.ts +1 -1
- package/src/projection/experimental/common/e0fn.ts +1 -1
- package/src/projection/experimental/common/e1fn.ts +1 -1
- package/src/projection/experimental/common/e2fn.ts +1 -1
- package/src/projection/experimental/common/e3fn.ts +1 -1
- package/src/projection/experimental/common/fL.ts +1 -1
- package/src/projection/experimental/common/gN.ts +1 -1
- package/src/projection/experimental/common/gatg.ts +1 -1
- package/src/projection/experimental/common/hypot.ts +1 -1
- package/src/projection/experimental/common/imlfn.ts +1 -1
- package/src/projection/experimental/common/invlatiso.ts +1 -1
- package/src/projection/experimental/common/iqsfnz.ts +1 -1
- package/src/projection/experimental/common/latiso.ts +1 -1
- package/src/projection/experimental/common/log1py.ts +1 -1
- package/src/projection/experimental/common/mlfn.ts +1 -1
- package/src/projection/experimental/common/msfnz.ts +1 -1
- package/src/projection/experimental/common/phi2z.ts +1 -1
- package/src/projection/experimental/common/pj_enfn.ts +1 -1
- package/src/projection/experimental/common/pj_inv_mlfn.ts +1 -1
- package/src/projection/experimental/common/pj_mlfn.ts +1 -1
- package/src/projection/experimental/common/qsfnz.ts +1 -1
- package/src/projection/experimental/common/sign.ts +1 -1
- package/src/projection/experimental/common/sinh.ts +1 -1
- package/src/projection/experimental/common/srat.ts +1 -1
- package/src/projection/experimental/common/tsfnz.ts +8 -7
- package/src/projection/experimental/common/vincenty.ts +1 -1
- package/src/projection/experimental/crs/datum-table.ts +1 -1
- package/src/projection/experimental/crs/ellipsoid-table.ts +1 -1
- package/src/projection/experimental/crs/primemeridian-table.ts +1 -1
- package/src/projection/experimental/crs/structured.ts +1 -1
- package/src/projection/experimental/crs/wkt.ts +1 -1
- package/src/projection/experimental/datum.ts +1 -1
- package/src/projection/experimental/ellipsoidal-gnomonic.ts +83 -0
- package/src/projection/experimental/exact-helmert.ts +1 -1
- package/src/projection/experimental/grids/geotiff.ts +1 -1
- package/src/projection/experimental/grids/grid.ts +1 -1
- package/src/projection/experimental/grids/ntv2.ts +1 -1
- package/src/projection/experimental/helmert-flat.ts +1 -1
- package/src/projection/experimental/inverse-spherical-latitude.ts +19 -0
- package/src/projection/experimental/kernels/aea.ts +10 -31
- package/src/projection/experimental/kernels/aeqd.ts +3 -3
- package/src/projection/experimental/kernels/bonne.ts +1 -1
- package/src/projection/experimental/kernels/cass.ts +1 -1
- package/src/projection/experimental/kernels/cea.ts +1 -1
- package/src/projection/experimental/kernels/eck6.ts +1 -1
- package/src/projection/experimental/kernels/eqdc.ts +1 -1
- package/src/projection/experimental/kernels/eqearth.ts +12 -2
- package/src/projection/experimental/kernels/equi.ts +3 -1
- package/src/projection/experimental/kernels/etmerc.ts +1 -1
- package/src/projection/experimental/kernels/gauss.ts +1 -1
- package/src/projection/experimental/kernels/geos.ts +1 -1
- package/src/projection/experimental/kernels/gnom.ts +11 -1
- package/src/projection/experimental/kernels/gstmerc.ts +1 -1
- package/src/projection/experimental/kernels/krovak.ts +2 -2
- package/src/projection/experimental/kernels/laea.ts +39 -16
- package/src/projection/experimental/kernels/lcc.ts +2 -8
- package/src/projection/experimental/kernels/mill.ts +1 -1
- package/src/projection/experimental/kernels/moll.ts +62 -58
- package/src/projection/experimental/kernels/nzmg.ts +1 -1
- package/src/projection/experimental/kernels/omerc.ts +1 -1
- package/src/projection/experimental/kernels/ortho.ts +38 -92
- package/src/projection/experimental/kernels/poly.ts +97 -36
- package/src/projection/experimental/kernels/qsc.ts +40 -50
- package/src/projection/experimental/kernels/robin.ts +1 -1
- package/src/projection/experimental/kernels/sinu.ts +4 -2
- package/src/projection/experimental/kernels/somerc.ts +45 -55
- package/src/projection/experimental/kernels/stere.ts +31 -3
- package/src/projection/experimental/kernels/sterea.ts +4 -2
- package/src/projection/experimental/kernels/tmerc.ts +1 -1
- package/src/projection/experimental/kernels/tpers.ts +1 -1
- package/src/projection/experimental/kernels/vandg.ts +1 -1
- package/src/projection/experimental/kinematic-helmert-flat.ts +1 -1
- package/src/projection/experimental/kinematic-helmert.ts +1 -1
- package/src/projection/experimental/projection-pipeline.ts +1 -1
- package/src/projection/experimental/projections/gnom.ts +22 -5
- package/src/projection/experimental/projections/laea.ts +3 -3
- package/src/projection/experimental/projections/ob-tran.ts +1 -1
- package/src/projection/experimental/projections/ortho.ts +4 -4
- package/src/projection/experimental/rendering-profile/azimuthal-rendering-bounds.ts +72 -2
- package/src/rhumb-path.ts +128 -0
- package/src/rhumb-polygon.ts +24 -0
- package/src/subdivide-geodesic-polyline.ts +74 -0
- package/src/subdivide-rhumb-polyline.ts +108 -0
- package/src/triaxial/integrate.ts +82 -0
- package/src/triaxial.ts +172 -0
- package/src/type-utils.ts +1 -1
- package/src/vendor/geographiclib-geodesic/README.md +21 -0
- package/src/vendor/geographiclib-geodesic/runtime.js +2338 -0
- package/src/wkb/wkb-builder.ts +11 -2
package/dist/globe.cjs
CHANGED
|
@@ -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,25 +14,22 @@ 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/globe.js
|
|
30
20
|
var globe_exports = {};
|
|
31
21
|
__export(globe_exports, {
|
|
32
22
|
EllipsoidOccluder: () => EllipsoidOccluder,
|
|
23
|
+
GeographicSeamError: () => GeographicSeamError,
|
|
33
24
|
LngLatRectangle: () => LngLatRectangle,
|
|
34
25
|
getGlobeHorizonBounds: () => getGlobeHorizonBounds,
|
|
35
26
|
makeOBBFromRegion: () => makeOBBFromRegion,
|
|
27
|
+
splitGeographicPolygon: () => splitGeographicPolygon,
|
|
28
|
+
splitGeographicPolyline: () => splitGeographicPolyline,
|
|
36
29
|
splitGlobeBounds: () => splitGlobeBounds,
|
|
37
|
-
|
|
30
|
+
subdivideGeodesicPolyline: () => subdivideGeodesicPolyline,
|
|
31
|
+
subdivideGlobeMesh: () => subdivideGlobeMesh,
|
|
32
|
+
subdivideRhumbPolyline: () => subdivideRhumbPolyline
|
|
38
33
|
});
|
|
39
34
|
module.exports = __toCommonJS(globe_exports);
|
|
40
35
|
|
|
@@ -88,13 +83,12 @@ var LngLatRectangle = class {
|
|
|
88
83
|
};
|
|
89
84
|
|
|
90
85
|
// dist/make-obb-from-region.js
|
|
91
|
-
var
|
|
86
|
+
var import_core6 = require("@math.gl/core");
|
|
92
87
|
var import_culling2 = require("@math.gl/geometry/culling");
|
|
93
88
|
|
|
94
89
|
// dist/ellipsoid.js
|
|
95
|
-
var
|
|
90
|
+
var import_core4 = require("@math.gl/core");
|
|
96
91
|
var import_spheroid = require("@math.gl/core/spheroid");
|
|
97
|
-
var vec3 = __toESM(require("@math.gl/core/vec3"), 1);
|
|
98
92
|
|
|
99
93
|
// dist/constants.js
|
|
100
94
|
var WGS84_RADIUS_X = 6378137;
|
|
@@ -162,212 +156,220 @@ function toCartographicFromRadiansComponents(longitude, latitude, height, cartog
|
|
|
162
156
|
return cartographic;
|
|
163
157
|
}
|
|
164
158
|
|
|
165
|
-
// dist/ellipsoid-helpers/
|
|
159
|
+
// dist/ellipsoid-helpers/scale-to-geodetic-surface.js
|
|
166
160
|
var import_core3 = require("@math.gl/core");
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
east: "down"
|
|
195
|
-
},
|
|
196
|
-
west: {
|
|
197
|
-
up: "north",
|
|
198
|
-
down: "south",
|
|
199
|
-
north: "down",
|
|
200
|
-
south: "up"
|
|
201
|
-
},
|
|
202
|
-
east: {
|
|
203
|
-
up: "south",
|
|
204
|
-
down: "north",
|
|
205
|
-
north: "up",
|
|
206
|
-
south: "down"
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
var degeneratePositionLocalFrame = {
|
|
210
|
-
north: [-1, 0, 0],
|
|
211
|
-
east: [0, 1, 0],
|
|
212
|
-
up: [0, 0, 1],
|
|
213
|
-
south: [1, 0, 0],
|
|
214
|
-
west: [0, -1, 0],
|
|
215
|
-
down: [0, 0, -1]
|
|
216
|
-
};
|
|
217
|
-
var scratchAxisVectors = {
|
|
218
|
-
east: new import_core3.Vector3(),
|
|
219
|
-
north: new import_core3.Vector3(),
|
|
220
|
-
up: new import_core3.Vector3(),
|
|
221
|
-
west: new import_core3.Vector3(),
|
|
222
|
-
south: new import_core3.Vector3(),
|
|
223
|
-
down: new import_core3.Vector3()
|
|
224
|
-
};
|
|
225
|
-
var scratchVector1 = new import_core3.Vector3();
|
|
226
|
-
var scratchVector2 = new import_core3.Vector3();
|
|
227
|
-
var scratchVector3 = new import_core3.Vector3();
|
|
228
|
-
function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
|
|
229
|
-
const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
|
|
230
|
-
(0, import_core3.assert)(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
|
|
231
|
-
let firstAxisVector;
|
|
232
|
-
let secondAxisVector;
|
|
233
|
-
let thirdAxisVector;
|
|
234
|
-
const origin = scratchOrigin.copy(cartesianOrigin);
|
|
235
|
-
const atPole = (0, import_core3.equals)(origin.x, 0, EPSILON14) && (0, import_core3.equals)(origin.y, 0, EPSILON14);
|
|
236
|
-
const radii = ellipsoid.radii;
|
|
237
|
-
if (radii.x === radii.y && radii.x > 0 && radii.z > 0 && radii.z <= radii.x && (!atPole || origin.z !== 0)) {
|
|
238
|
-
const { east, up } = scratchAxisVectors;
|
|
239
|
-
if (atPole) {
|
|
240
|
-
east.set(0, 1, 0);
|
|
241
|
-
up.set(0, 0, Math.sign(origin.z));
|
|
242
|
-
} else {
|
|
243
|
-
east.set(-origin.y, origin.x, 0).normalize();
|
|
244
|
-
ellipsoid.geodeticSurfaceNormal(origin, up);
|
|
161
|
+
|
|
162
|
+
// dist/ellipsoid-helpers/exact-nearest-surface.js
|
|
163
|
+
function exactNearestSurface(x, y, z, a, b, c, result) {
|
|
164
|
+
const values = [a, b, c, Math.abs(x), Math.abs(y), Math.abs(z)];
|
|
165
|
+
const parts = values.map((value) => {
|
|
166
|
+
const bits = value.toString(2);
|
|
167
|
+
const dot = bits.indexOf(".");
|
|
168
|
+
return {
|
|
169
|
+
integer: BigInt("0b" + bits.replace(".", "")),
|
|
170
|
+
exponent: dot < 0 ? 0 : dot + 1 - bits.length
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
const exponent = Math.min(...parts.filter((p) => p.integer !== 0n).map((p) => p.exponent));
|
|
174
|
+
const integers = parts.map((p) => p.integer << BigInt(p.exponent - exponent));
|
|
175
|
+
const squares = integers.slice(0, 3).map((v) => v * v);
|
|
176
|
+
const minimum = squares.reduce((p, v) => p < v ? p : v);
|
|
177
|
+
const offsets = squares.map((v) => v - minimum);
|
|
178
|
+
const products = squares.map((_, i) => integers[i] * integers[i + 3]);
|
|
179
|
+
let precision = 64;
|
|
180
|
+
if (!products.some((u3, i) => offsets[i] === 0n && u3 !== 0n)) {
|
|
181
|
+
let numerator = -1n, denominator = 1n;
|
|
182
|
+
for (let i = 0; i < 3; i++) {
|
|
183
|
+
if (offsets[i] === 0n)
|
|
184
|
+
continue;
|
|
185
|
+
const d2 = offsets[i] * offsets[i];
|
|
186
|
+
numerator = numerator * d2 + products[i] * products[i] * denominator;
|
|
187
|
+
denominator *= d2;
|
|
245
188
|
}
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (atPole) {
|
|
251
|
-
const sign = Math.sign(origin.z);
|
|
252
|
-
firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
|
|
253
|
-
if (firstAxis !== "east" && firstAxis !== "west") {
|
|
254
|
-
firstAxisVector.scale(sign);
|
|
189
|
+
if (numerator < 0n)
|
|
190
|
+
return false;
|
|
191
|
+
if (numerator === 0n) {
|
|
192
|
+
return commit(0n, 1n);
|
|
255
193
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
194
|
+
const positive = offsets.filter((d2) => d2 > 0n);
|
|
195
|
+
const least = positive.reduce((p, v) => p < v ? p : v);
|
|
196
|
+
precision = Math.max(64, (2n * (denominator + numerator)).toString(2).length - (numerator * least).toString(2).length + 128);
|
|
197
|
+
}
|
|
198
|
+
const unit = 1n << BigInt(precision);
|
|
199
|
+
const d = offsets.map((v) => v * unit);
|
|
200
|
+
const u = products.map((v) => v * unit);
|
|
201
|
+
const u2 = u.map((v) => v * v);
|
|
202
|
+
let lower = 0n, upper = u.reduce((sum, v) => sum + v, 0n);
|
|
203
|
+
if (upper === 0n)
|
|
204
|
+
return false;
|
|
205
|
+
for (let iteration = 0; iteration < 4096; iteration++) {
|
|
206
|
+
const t = lower + upper >> 1n;
|
|
207
|
+
if (t === lower)
|
|
208
|
+
return false;
|
|
209
|
+
const dx = d[0] + t, dy = d[1] + t, dz = d[2] + t;
|
|
210
|
+
const xx = dx * dx, yy = dy * dy, zz = dz * dz;
|
|
211
|
+
const sign = u2[0] * yy * zz + u2[1] * xx * zz + u2[2] * xx * yy - xx * yy * zz;
|
|
212
|
+
if (sign === 0n)
|
|
213
|
+
return commit(t, unit);
|
|
214
|
+
if (sign > 0n)
|
|
215
|
+
lower = t;
|
|
216
|
+
else
|
|
217
|
+
upper = t;
|
|
218
|
+
if (lower > 0n && upper - lower <= lower >> 60n)
|
|
219
|
+
return commit(lower + upper >> 1n, unit);
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
function commit(t, unit2) {
|
|
223
|
+
const output2 = squares.map((r2, i) => {
|
|
224
|
+
const denominator = offsets[i] * unit2 + t;
|
|
225
|
+
return denominator === 0n ? 0 : ratio(r2 * integers[i + 3] * unit2, denominator, exponent);
|
|
226
|
+
});
|
|
227
|
+
if (!output2.every(Number.isFinite))
|
|
228
|
+
return false;
|
|
229
|
+
const qx = Math.sign(x) * output2[0], qy = Math.sign(y) * output2[1], qz = Math.sign(z) * output2[2];
|
|
230
|
+
result.x = qx;
|
|
231
|
+
result.y = qy;
|
|
232
|
+
result.z = qz;
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function ratio(n, d, exponent) {
|
|
237
|
+
if (n === 0n)
|
|
238
|
+
return 0;
|
|
239
|
+
const shift2 = 52 - (n.toString(2).length - d.toString(2).length);
|
|
240
|
+
const numerator = shift2 >= 0 ? n << BigInt(shift2) : n;
|
|
241
|
+
const denominator = shift2 >= 0 ? d : d << BigInt(-shift2);
|
|
242
|
+
let quotient = numerator / denominator;
|
|
243
|
+
const remainder = numerator % denominator;
|
|
244
|
+
if (2n * remainder > denominator || 2n * remainder === denominator && quotient & 1n)
|
|
245
|
+
quotient++;
|
|
246
|
+
const power = exponent - shift2;
|
|
247
|
+
const first = Math.max(-1022, Math.min(1023, power));
|
|
248
|
+
return Number(quotient) * 2 ** first * 2 ** (power - first);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// dist/ellipsoid-helpers/nearest-surface.js
|
|
252
|
+
function nearestSurface(x, y, z, a, b, c, result) {
|
|
253
|
+
const minimum = Math.min(a, b, c);
|
|
254
|
+
const minimumSquared = minimum * minimum;
|
|
255
|
+
const aa = a * a, bb = b * b, cc = c * c;
|
|
256
|
+
if (!(minimum > 0) || !(minimumSquared > 0) || !Number.isFinite(Math.max(aa, bb, cc)))
|
|
257
|
+
return false;
|
|
258
|
+
const minimumError = productError(minimum, minimum, minimumSquared);
|
|
259
|
+
const dx = aa - minimumSquared, dy = bb - minimumSquared, dz = cc - minimumSquared;
|
|
260
|
+
const ex = sumError(aa, -minimumSquared, dx) + productError(a, a, aa) - minimumError;
|
|
261
|
+
const ey = sumError(bb, -minimumSquared, dy) + productError(b, b, bb) - minimumError;
|
|
262
|
+
const ez = sumError(cc, -minimumSquared, dz) + productError(c, c, cc) - minimumError;
|
|
263
|
+
const ux = a * Math.abs(x), uy = b * Math.abs(y), uz = c * Math.abs(z);
|
|
264
|
+
if (minimumSquared < 2 ** -1022 || x !== 0 && ux < 2 ** -1022 || y !== 0 && uy < 2 ** -1022 || z !== 0 && uz < 2 ** -1022)
|
|
265
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
266
|
+
const fx = productError(a, Math.abs(x), ux);
|
|
267
|
+
const fy = productError(b, Math.abs(y), uy);
|
|
268
|
+
const fz = productError(c, Math.abs(z), uz);
|
|
269
|
+
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));
|
|
270
|
+
if (limit <= 1 + 64 * Number.EPSILON)
|
|
271
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
272
|
+
if ((x !== 0 ? 1 : 0) + (y !== 0 ? 1 : 0) + (z !== 0 ? 1 : 0) === 1) {
|
|
273
|
+
result.x = x === 0 ? x : Math.sign(x) * a;
|
|
274
|
+
result.y = y === 0 ? y : Math.sign(y) * b;
|
|
275
|
+
result.z = z === 0 ? z : Math.sign(z) * c;
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
let lower = Math.hypot(dx === 0 ? ux : 0, dy === 0 ? uy : 0, dz === 0 ? uz : 0);
|
|
279
|
+
let upper = Math.hypot(ux, uy, uz);
|
|
280
|
+
if (!(upper > 0) || !Number.isFinite(upper))
|
|
281
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
282
|
+
let t = lower > 0 ? lower : upper;
|
|
283
|
+
for (let iteration = 0; iteration < 512; iteration++) {
|
|
284
|
+
const hx = dx + t, hy = dy + t, hz = dz + t;
|
|
285
|
+
const lx = sumError(dx, t, hx) + ex;
|
|
286
|
+
const ly = sumError(dy, t, hy) + ey;
|
|
287
|
+
const lz = sumError(dz, t, hz) + ez;
|
|
288
|
+
const vx = ux / hx, vy = uy / hy, vz = uz / hz;
|
|
289
|
+
let term, rest;
|
|
290
|
+
if (vx >= vy && vx >= vz) {
|
|
291
|
+
term = offset(ux, fx, dx, ex, t, hx) * (vx + 1);
|
|
292
|
+
rest = (vy * (1 - ly / hy)) ** 2 + (vz * (1 - lz / hz)) ** 2;
|
|
293
|
+
} else if (vy >= vz) {
|
|
294
|
+
term = offset(uy, fy, dy, ey, t, hy) * (vy + 1);
|
|
295
|
+
rest = (vx * (1 - lx / hx)) ** 2 + (vz * (1 - lz / hz)) ** 2;
|
|
296
|
+
} else {
|
|
297
|
+
term = offset(uz, fz, dz, ez, t, hz) * (vz + 1);
|
|
298
|
+
rest = (vx * (1 - lx / hx)) ** 2 + (vy * (1 - ly / hy)) ** 2;
|
|
259
299
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
300
|
+
const derivative = -2 * (vx * vx / hx + vy * vy / hy + vz * vz / hz);
|
|
301
|
+
const roundoff = 4 * Number.EPSILON * (Math.abs(term) + rest);
|
|
302
|
+
const residual = term + rest;
|
|
303
|
+
if (!Number.isFinite(residual))
|
|
304
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
305
|
+
if (Math.abs(residual) <= 4 * Number.EPSILON * (Math.abs(term) + rest) || upper - lower <= 4 * Number.EPSILON * t) {
|
|
306
|
+
const uncertainty = roundoff / Math.abs(derivative);
|
|
307
|
+
if (!Number.isFinite(derivative) || !(Math.abs(derivative) > 0) || uncertainty > 2e-13 * t)
|
|
308
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
309
|
+
const qx = Math.sign(x) * a * (vx * (1 - lx / hx));
|
|
310
|
+
const qy = Math.sign(y) * b * (vy * (1 - ly / hy));
|
|
311
|
+
const qz = Math.sign(z) * c * (vz * (1 - lz / hz));
|
|
312
|
+
const displacement = 2 * uncertainty * Math.max(Math.abs(qx / hx), Math.abs(qy / hy), Math.abs(qz / hz));
|
|
313
|
+
if (!Number.isFinite(displacement) || displacement > 2e-13 * Math.max(a, b, c))
|
|
314
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
315
|
+
if (!Number.isFinite(qx) || !Number.isFinite(qy) || !Number.isFinite(qz))
|
|
316
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
317
|
+
result.x = qx;
|
|
318
|
+
result.y = qy;
|
|
319
|
+
result.z = qz;
|
|
320
|
+
return true;
|
|
263
321
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
result[14] = z;
|
|
296
|
-
result[15] = 1;
|
|
297
|
-
return result;
|
|
322
|
+
if (residual > 0)
|
|
323
|
+
lower = t;
|
|
324
|
+
else
|
|
325
|
+
upper = t;
|
|
326
|
+
const candidate = t - residual / derivative;
|
|
327
|
+
const next = candidate > lower && candidate < upper ? candidate : lower + (upper - lower) / 2;
|
|
328
|
+
if (next === t)
|
|
329
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
330
|
+
t = next;
|
|
331
|
+
}
|
|
332
|
+
return exactNearestSurface(x, y, z, a, b, c, result);
|
|
333
|
+
}
|
|
334
|
+
function offset(u, error, d, dError, t, denominator) {
|
|
335
|
+
const difference = u - d;
|
|
336
|
+
const correction = sumError(u, -d, difference) + error - dError;
|
|
337
|
+
const base = difference + correction;
|
|
338
|
+
const low = sumError(difference, correction, base);
|
|
339
|
+
const shifted = base - t;
|
|
340
|
+
return (shifted + (sumError(base, -t, shifted) + low)) / denominator;
|
|
341
|
+
}
|
|
342
|
+
function sumError(x, y, sum) {
|
|
343
|
+
const part = sum - x;
|
|
344
|
+
return x - (sum - part) + (y - part);
|
|
345
|
+
}
|
|
346
|
+
function productError(x, y, product) {
|
|
347
|
+
const sx = 134217729 * x, sy = 134217729 * y;
|
|
348
|
+
if (!Number.isFinite(sx) || !Number.isFinite(sy))
|
|
349
|
+
return 0;
|
|
350
|
+
const hx = sx - (sx - x), hy = sy - (sy - y);
|
|
351
|
+
const lx = x - hx, ly = y - hy;
|
|
352
|
+
return hx * hy - product + hx * ly + lx * hy + lx * ly;
|
|
298
353
|
}
|
|
299
354
|
|
|
300
355
|
// dist/ellipsoid-helpers/scale-to-geodetic-surface.js
|
|
301
|
-
var
|
|
302
|
-
var scratchVector4 = new import_core4.Vector3();
|
|
303
|
-
var scaleToGeodeticSurfaceIntersection = new import_core4.Vector3();
|
|
304
|
-
var scaleToGeodeticSurfaceGradient = new import_core4.Vector3();
|
|
356
|
+
var surface = { x: 0, y: 0, z: 0 };
|
|
305
357
|
function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
|
|
306
|
-
const { oneOverRadii, oneOverRadiiSquared, centerToleranceSquared } = ellipsoid;
|
|
307
358
|
const object = cartesian;
|
|
308
|
-
const
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
if (!Number.isFinite(
|
|
359
|
+
const x = "x" in cartesian ? object.x : cartesian[0];
|
|
360
|
+
const y = "x" in cartesian ? object.y : cartesian[1];
|
|
361
|
+
const z = "x" in cartesian ? object.z : cartesian[2];
|
|
362
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
|
|
312
363
|
return void 0;
|
|
313
|
-
|
|
314
|
-
scratchVector4.set(positionX, positionY, positionZ);
|
|
315
|
-
const oneOverRadiiX = oneOverRadii.x;
|
|
316
|
-
const oneOverRadiiY = oneOverRadii.y;
|
|
317
|
-
const oneOverRadiiZ = oneOverRadii.z;
|
|
318
|
-
const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
|
|
319
|
-
const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
|
|
320
|
-
const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
|
|
321
|
-
const squaredNorm = x2 + y2 + z2;
|
|
322
|
-
const ratio = Math.sqrt(1 / squaredNorm);
|
|
323
|
-
if (!Number.isFinite(ratio) || !Number.isFinite(squaredNorm)) {
|
|
364
|
+
if (!Number.isFinite(x * x + y * y + z * z))
|
|
324
365
|
return void 0;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return writeResult(result, intersection.x, intersection.y, intersection.z);
|
|
330
|
-
}
|
|
331
|
-
const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
|
|
332
|
-
const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
|
|
333
|
-
const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
|
|
334
|
-
const gradient = scaleToGeodeticSurfaceGradient;
|
|
335
|
-
gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
|
|
336
|
-
let lambda = (1 - ratio) * scratchVector4.len() / (0.5 * gradient.len());
|
|
337
|
-
let correction = 0;
|
|
338
|
-
let xMultiplier;
|
|
339
|
-
let yMultiplier;
|
|
340
|
-
let zMultiplier;
|
|
341
|
-
let func;
|
|
342
|
-
for (let iteration = 0; iteration < 64; iteration++) {
|
|
343
|
-
lambda -= correction;
|
|
344
|
-
xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
|
|
345
|
-
yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
|
|
346
|
-
zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
|
|
347
|
-
const xMultiplier2 = xMultiplier * xMultiplier;
|
|
348
|
-
const yMultiplier2 = yMultiplier * yMultiplier;
|
|
349
|
-
const zMultiplier2 = zMultiplier * zMultiplier;
|
|
350
|
-
const xMultiplier3 = xMultiplier2 * xMultiplier;
|
|
351
|
-
const yMultiplier3 = yMultiplier2 * yMultiplier;
|
|
352
|
-
const zMultiplier3 = zMultiplier2 * zMultiplier;
|
|
353
|
-
func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
|
|
354
|
-
if (!Number.isFinite(func))
|
|
355
|
-
return void 0;
|
|
356
|
-
if (Math.abs(func) <= import_core4._MathUtils.EPSILON12) {
|
|
357
|
-
return writeResult(result, positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);
|
|
358
|
-
}
|
|
359
|
-
const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
|
|
360
|
-
const derivative = -2 * denominator;
|
|
361
|
-
if (!Number.isFinite(derivative) || derivative === 0)
|
|
362
|
-
return void 0;
|
|
363
|
-
correction = func / derivative;
|
|
364
|
-
if (!Number.isFinite(correction))
|
|
365
|
-
return void 0;
|
|
366
|
-
}
|
|
367
|
-
return void 0;
|
|
366
|
+
const { radii } = ellipsoid;
|
|
367
|
+
if (!nearestSurface(x, y, z, radii.x, radii.y, radii.z, surface))
|
|
368
|
+
return void 0;
|
|
369
|
+
return writeResult(result, surface.x, surface.y, surface.z);
|
|
368
370
|
}
|
|
369
371
|
function writeResult(result, x, y, z) {
|
|
370
|
-
if ((0,
|
|
372
|
+
if ((0, import_core3.isArray)(result)) {
|
|
371
373
|
result[0] = x;
|
|
372
374
|
result[1] = y;
|
|
373
375
|
result[2] = z;
|
|
@@ -382,12 +384,10 @@ function writeResult(result, x, y, z) {
|
|
|
382
384
|
|
|
383
385
|
// dist/ellipsoid.js
|
|
384
386
|
var spheroidScratch = { x: 0, y: 0, z: 0 };
|
|
385
|
-
var
|
|
386
|
-
var scratchNormal = new
|
|
387
|
-
var
|
|
388
|
-
var
|
|
389
|
-
var scratchHeight = new import_core5.Vector3();
|
|
390
|
-
var scratchCartesian = new import_core5.Vector3();
|
|
387
|
+
var scratchVector2 = new import_core4.Vector3();
|
|
388
|
+
var scratchNormal = new import_core4.Vector3();
|
|
389
|
+
var scratchPosition = new import_core4.Vector3();
|
|
390
|
+
var scratchCartesian = new import_core4.Vector3();
|
|
391
391
|
var Ellipsoid = class _Ellipsoid {
|
|
392
392
|
/** Construct from two-axis geometry, including normalized projection ellipsoids.
|
|
393
393
|
* The equatorial X/Y radii are equal; no CRS or datum information is inferred.
|
|
@@ -398,26 +398,31 @@ var Ellipsoid = class _Ellipsoid {
|
|
|
398
398
|
return new _Ellipsoid(semiMajorAxis, semiMajorAxis, semiMinorAxis);
|
|
399
399
|
}
|
|
400
400
|
constructor(x = 0, y = 0, z = 0) {
|
|
401
|
-
this.centerToleranceSquared =
|
|
402
|
-
(0,
|
|
403
|
-
(0,
|
|
404
|
-
(0,
|
|
405
|
-
this.radii = new
|
|
406
|
-
this.radiiSquared = new
|
|
407
|
-
this.radiiToTheFourth = new
|
|
408
|
-
this.oneOverRadii = new
|
|
409
|
-
this.oneOverRadiiSquared = new
|
|
401
|
+
this.centerToleranceSquared = import_core4._MathUtils.EPSILON1;
|
|
402
|
+
(0, import_core4.assert)(Number.isFinite(x) && x >= 0);
|
|
403
|
+
(0, import_core4.assert)(Number.isFinite(y) && y >= 0);
|
|
404
|
+
(0, import_core4.assert)(Number.isFinite(z) && z >= 0);
|
|
405
|
+
this.radii = new import_core4.Vector3(x, y, z);
|
|
406
|
+
this.radiiSquared = new import_core4.Vector3(x * x, y * y, z * z);
|
|
407
|
+
this.radiiToTheFourth = new import_core4.Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
|
|
408
|
+
this.oneOverRadii = new import_core4.Vector3(x === 0 ? 0 : 1 / x, y === 0 ? 0 : 1 / y, z === 0 ? 0 : 1 / z);
|
|
409
|
+
this.oneOverRadiiSquared = new import_core4.Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
|
|
410
410
|
this.minimumRadius = Math.min(x, y, z);
|
|
411
411
|
this.maximumRadius = Math.max(x, y, z);
|
|
412
|
-
if (
|
|
413
|
-
this.squaredXOverSquaredZ =
|
|
412
|
+
if (z !== 0) {
|
|
413
|
+
this.squaredXOverSquaredZ = (x / z) ** 2;
|
|
414
414
|
}
|
|
415
415
|
if (x === y && z > 0 && z <= x && Number.isFinite(this.radiiSquared.x) && this.radiiSquared.z > 0)
|
|
416
416
|
this.spheroidGeometry = Object.freeze({
|
|
417
417
|
semiMajorAxis: x,
|
|
418
418
|
semiMinorAxis: z,
|
|
419
|
-
eccentricitySquared: 1 -
|
|
419
|
+
eccentricitySquared: 1 - (z / x) ** 2
|
|
420
420
|
});
|
|
421
|
+
Object.freeze(this.radii);
|
|
422
|
+
Object.freeze(this.radiiSquared);
|
|
423
|
+
Object.freeze(this.radiiToTheFourth);
|
|
424
|
+
Object.freeze(this.oneOverRadii);
|
|
425
|
+
Object.freeze(this.oneOverRadiiSquared);
|
|
421
426
|
Object.freeze(this);
|
|
422
427
|
}
|
|
423
428
|
/** Return an owned geometry snapshot for a sphere or oblate spheroid.
|
|
@@ -435,30 +440,34 @@ var Ellipsoid = class _Ellipsoid {
|
|
|
435
440
|
equals(right) {
|
|
436
441
|
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
437
442
|
}
|
|
438
|
-
/** Creates a string representing this Ellipsoid in the format '
|
|
443
|
+
/** Creates a string representing this Ellipsoid in the format '[radii.x, radii.y, radii.z]'. */
|
|
439
444
|
toString() {
|
|
440
445
|
return this.radii.toString();
|
|
441
446
|
}
|
|
442
447
|
cartographicToCartesian(cartographic, result = [0, 0, 0]) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
+
const llh = fromCartographicToRadians(cartographic, scratchCartesian);
|
|
449
|
+
const longitude = llh[0], latitude = llh[1], height = llh[2];
|
|
450
|
+
if (!Number.isFinite(longitude) || !Number.isFinite(latitude) || !Number.isFinite(height) || !(this.minimumRadius > 0) || !Number.isFinite(this.maximumRadius * this.maximumRadius))
|
|
451
|
+
return void 0;
|
|
452
|
+
if (this.spheroidGeometry && (import_core4.config._cartographicRadians || Math.abs(latitude) <= Math.PI / 4)) {
|
|
453
|
+
spheroidScratch.x = longitude;
|
|
454
|
+
spheroidScratch.y = latitude;
|
|
455
|
+
spheroidScratch.z = height;
|
|
448
456
|
if (!(0, import_spheroid.spheroidToCartesian)(spheroidScratch, this.spheroidGeometry))
|
|
449
457
|
return void 0;
|
|
450
458
|
return writeResult(result, spheroidScratch.x, spheroidScratch.y, spheroidScratch.z);
|
|
451
459
|
}
|
|
452
460
|
const normal = scratchNormal;
|
|
453
|
-
const k = scratchK;
|
|
454
|
-
const [, , height] = cartographic;
|
|
455
461
|
this.geodeticSurfaceNormalCartographic(cartographic, normal);
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
const nx = normal.x, ny = normal.y, nz = normal.z;
|
|
463
|
+
const rx = this.radii.x, ry = this.radii.y, rz = this.radii.z;
|
|
464
|
+
const gamma = Math.hypot(rx * nx, ry * ny, rz * nz);
|
|
465
|
+
const x = rx * (rx * nx / gamma) + height * nx;
|
|
466
|
+
const y = ry * (ry * ny / gamma) + height * ny;
|
|
467
|
+
const z = rz * (rz * nz / gamma) + height * nz;
|
|
468
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
|
|
469
|
+
return void 0;
|
|
470
|
+
return writeResult(result, x, y, z);
|
|
462
471
|
}
|
|
463
472
|
cartesianToCartographic(cartesian, result = [0, 0, 0]) {
|
|
464
473
|
const object = cartesian;
|
|
@@ -471,45 +480,68 @@ var Ellipsoid = class _Ellipsoid {
|
|
|
471
480
|
spheroidScratch.x = x;
|
|
472
481
|
spheroidScratch.y = y;
|
|
473
482
|
spheroidScratch.z = z;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
483
|
+
const shape = this.spheroidGeometry;
|
|
484
|
+
const nearBoundary = z === 0 && shape.semiMinorAxis < shape.semiMajorAxis && Math.abs(Math.hypot(x, y) - shape.semiMajorAxis * shape.eccentricitySquared) <= 64 * Number.EPSILON * shape.semiMajorAxis;
|
|
485
|
+
if (!nearBoundary && (0, import_spheroid.cartesianToSpheroid)(spheroidScratch, shape)) {
|
|
486
|
+
const longitude2 = x === 0 && y === 0 ? Math.atan2(y, x) : spheroidScratch.x;
|
|
487
|
+
return toCartographicFromRadiansComponents(longitude2, spheroidScratch.y, spheroidScratch.z, result);
|
|
488
|
+
}
|
|
478
489
|
}
|
|
490
|
+
if (!(this.minimumRadius > 0) || !Number.isFinite(this.maximumRadius * this.maximumRadius) || !Number.isFinite(1 / (this.minimumRadius * this.minimumRadius)))
|
|
491
|
+
return void 0;
|
|
479
492
|
scratchCartesian.set(x, y, z);
|
|
480
493
|
const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
|
|
481
494
|
if (!point) {
|
|
482
495
|
return void 0;
|
|
483
496
|
}
|
|
484
|
-
const
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
|
|
497
|
+
const gx = point[0] * this.oneOverRadiiSquared.x;
|
|
498
|
+
const gy = point[1] * this.oneOverRadiiSquared.y;
|
|
499
|
+
const gz = point[2] * this.oneOverRadiiSquared.z;
|
|
500
|
+
const length = Math.hypot(gx, gy, gz);
|
|
501
|
+
if (!(length > 0) || !Number.isFinite(length))
|
|
502
|
+
return void 0;
|
|
503
|
+
const nx = gx / length, ny = gy / length, nz = gz / length;
|
|
504
|
+
const longitude = Math.atan2(ny, nx);
|
|
505
|
+
const latitude = Math.atan2(nz, Math.hypot(nx, ny));
|
|
506
|
+
const height = (x - point[0]) * nx + (y - point[1]) * ny + (z - point[2]) * nz;
|
|
490
507
|
return toCartographicFromRadiansComponents(longitude, latitude, height, result);
|
|
491
508
|
}
|
|
492
|
-
eastNorthUpToFixedFrame(origin, result = new import_core5.Matrix4()) {
|
|
493
|
-
return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
|
|
494
|
-
}
|
|
495
|
-
// Computes a 4x4 transformation matrix from a reference frame centered at
|
|
496
|
-
// the provided origin to the ellipsoid's fixed reference frame.
|
|
497
|
-
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new import_core5.Matrix4()) {
|
|
498
|
-
return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
|
|
499
|
-
}
|
|
500
509
|
geocentricSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
501
|
-
|
|
510
|
+
fromCartographic(cartesian, scratchVector2);
|
|
511
|
+
const point = scratchVector2;
|
|
512
|
+
return normalResult(point.x, point.y, point.z, result);
|
|
502
513
|
}
|
|
503
514
|
geodeticSurfaceNormalCartographic(cartographic, result = [0, 0, 0]) {
|
|
504
|
-
const
|
|
505
|
-
const longitude =
|
|
506
|
-
const latitude =
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
515
|
+
const point = fromCartographic(cartographic, scratchCartesian);
|
|
516
|
+
const longitude = import_core4.config._cartographicRadians ? point[0] : point[0] * Math.PI / 180;
|
|
517
|
+
const latitude = import_core4.config._cartographicRadians ? point[1] : point[1] * Math.PI / 180;
|
|
518
|
+
const polarDegrees = !import_core4.config._cartographicRadians && Math.abs(point[1]) > 45;
|
|
519
|
+
const complement = (90 - Math.abs(point[1])) * Math.PI / 180;
|
|
520
|
+
const cosLatitude = polarDegrees ? Math.sin(complement) : Math.abs(latitude) === Math.PI / 2 ? 0 : Math.cos(latitude);
|
|
521
|
+
const sinLatitude = polarDegrees ? Math.sign(point[1]) * Math.cos(complement) : Math.sin(latitude);
|
|
522
|
+
return normalResult(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), sinLatitude, result);
|
|
510
523
|
}
|
|
511
524
|
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
512
|
-
|
|
525
|
+
if (!(this.minimumRadius > 0))
|
|
526
|
+
return void 0;
|
|
527
|
+
fromCartographic(cartesian, scratchVector2);
|
|
528
|
+
const point = scratchVector2;
|
|
529
|
+
const scale = Math.max(Math.abs(point.x), Math.abs(point.y), Math.abs(point.z));
|
|
530
|
+
if (!(scale > 0) || !Number.isFinite(scale))
|
|
531
|
+
return void 0;
|
|
532
|
+
const nx = point.x / scale * (this.minimumRadius / this.radii.x) ** 2;
|
|
533
|
+
const ny = point.y / scale * (this.minimumRadius / this.radii.y) ** 2;
|
|
534
|
+
const nz = point.z / scale * (this.minimumRadius / this.radii.z) ** 2;
|
|
535
|
+
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))
|
|
536
|
+
return normalResult(nx, ny, nz, result);
|
|
537
|
+
const ex = point.x === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.x))));
|
|
538
|
+
const ey = point.y === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.y))));
|
|
539
|
+
const ez = point.z === 0 ? 0 : Math.min(1023, Math.floor(Math.log2(Math.abs(point.z))));
|
|
540
|
+
const ax = Math.min(1023, Math.floor(Math.log2(this.radii.x)));
|
|
541
|
+
const ay = Math.min(1023, Math.floor(Math.log2(this.radii.y)));
|
|
542
|
+
const az = Math.min(1023, Math.floor(Math.log2(this.radii.z)));
|
|
543
|
+
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);
|
|
544
|
+
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);
|
|
513
545
|
}
|
|
514
546
|
/** Scales the provided Cartesian position along the geodetic surface normal
|
|
515
547
|
* so that it is on the surface of this ellipsoid. If the position is
|
|
@@ -520,34 +552,49 @@ var Ellipsoid = class _Ellipsoid {
|
|
|
520
552
|
/** Scales the provided Cartesian position along the geocentric surface normal
|
|
521
553
|
* so that it is on the surface of this ellipsoid. */
|
|
522
554
|
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
|
|
555
|
+
fromCartographic(cartesian, scratchPosition);
|
|
556
|
+
const point = scratchPosition;
|
|
557
|
+
const scale = Math.max(Math.abs(point.x), Math.abs(point.y), Math.abs(point.z));
|
|
558
|
+
if (!(this.minimumRadius > 0) || !(scale > 0) || !Number.isFinite(scale))
|
|
559
|
+
return void 0;
|
|
560
|
+
const squared = point.x * point.x * this.oneOverRadiiSquared.x + point.y * point.y * this.oneOverRadiiSquared.y + point.z * point.z * this.oneOverRadiiSquared.z;
|
|
561
|
+
if (squared >= 2 ** -1022 && Number.isFinite(squared) && scale * scale >= 2 ** -1022 && Number.isFinite(scale * scale)) {
|
|
562
|
+
const beta = 1 / Math.sqrt(squared);
|
|
563
|
+
return writeResult(result, point.x * beta, point.y * beta, point.z * beta);
|
|
564
|
+
}
|
|
565
|
+
const x = point.x / scale, y = point.y / scale, z = point.z / scale;
|
|
566
|
+
const norm = Math.hypot(x / this.radii.x, y / this.radii.y, z / this.radii.z);
|
|
567
|
+
if (!(norm > 0) || !Number.isFinite(norm))
|
|
568
|
+
return void 0;
|
|
569
|
+
return writeResult(result, x / norm, y / norm, z / norm);
|
|
530
570
|
}
|
|
531
571
|
/** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
|
|
532
572
|
* its components by the result of `Ellipsoid#oneOverRadii` */
|
|
533
573
|
transformPositionToScaledSpace(position, result = [0, 0, 0]) {
|
|
534
|
-
|
|
574
|
+
fromCartographic(position, scratchPosition);
|
|
575
|
+
const point = scratchPosition.scale(this.oneOverRadii);
|
|
576
|
+
return writeResult(result, point.x, point.y, point.z);
|
|
535
577
|
}
|
|
536
578
|
/** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
|
|
537
579
|
* its components by the result of `Ellipsoid#radii`. */
|
|
538
580
|
transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
|
|
539
|
-
|
|
581
|
+
fromCartographic(position, scratchPosition);
|
|
582
|
+
const point = scratchPosition.scale(this.radii);
|
|
583
|
+
return writeResult(result, point.x, point.y, point.z);
|
|
540
584
|
}
|
|
541
585
|
/** Computes a point which is the intersection of the surface normal with the z-axis. */
|
|
542
586
|
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
|
|
543
|
-
(0,
|
|
544
|
-
(
|
|
545
|
-
scratchPosition.
|
|
587
|
+
(0, import_core4.assert)(this.radii.x === this.radii.y && this.minimumRadius > 0);
|
|
588
|
+
fromCartographic(position, scratchPosition);
|
|
589
|
+
if (!Number.isFinite(scratchPosition.x) || !Number.isFinite(scratchPosition.y) || !Number.isFinite(scratchPosition.z) || !Number.isFinite(buffer))
|
|
590
|
+
return void 0;
|
|
546
591
|
const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
|
|
592
|
+
if (!Number.isFinite(z))
|
|
593
|
+
return void 0;
|
|
547
594
|
if (Math.abs(z) >= this.radii.z - buffer) {
|
|
548
595
|
return void 0;
|
|
549
596
|
}
|
|
550
|
-
return
|
|
597
|
+
return writeResult(result, 0, 0, z);
|
|
551
598
|
}
|
|
552
599
|
};
|
|
553
600
|
Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
|
|
@@ -555,99 +602,316 @@ function validateSpheroid(a, b) {
|
|
|
555
602
|
if (!Number.isFinite(a) || !Number.isFinite(b) || a <= 0 || b <= 0 || b > a)
|
|
556
603
|
throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis");
|
|
557
604
|
}
|
|
605
|
+
function normalResult(x, y, z, result) {
|
|
606
|
+
const scale = Math.max(Math.abs(x), Math.abs(y), Math.abs(z));
|
|
607
|
+
if (!(scale > 0) || !Number.isFinite(scale))
|
|
608
|
+
return void 0;
|
|
609
|
+
const nx = x / scale, ny = y / scale, nz = z / scale;
|
|
610
|
+
const length = Math.hypot(nx, ny, nz);
|
|
611
|
+
return writeResult(result, nx / length, ny / length, nz / length);
|
|
612
|
+
}
|
|
558
613
|
|
|
559
614
|
// dist/ellipsoid-tangent-plane.js
|
|
560
|
-
var
|
|
615
|
+
var import_core5 = require("@math.gl/core");
|
|
561
616
|
var import_culling = require("@math.gl/geometry/culling");
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
var
|
|
565
|
-
|
|
617
|
+
|
|
618
|
+
// dist/ellipsoid-helpers/tangent-plane-numerics.js
|
|
619
|
+
var SPLITTER = 134217729;
|
|
620
|
+
function productError2(a, b, product) {
|
|
621
|
+
const ca = SPLITTER * a, cb = SPLITTER * b;
|
|
622
|
+
const ah = ca - (ca - a), al = a - ah;
|
|
623
|
+
const bh = cb - (cb - b), bl = b - bh;
|
|
624
|
+
return ah * bh - product + ah * bl + al * bh + al * bl;
|
|
625
|
+
}
|
|
626
|
+
function sumError2(a, b, sum) {
|
|
627
|
+
const v = sum - a;
|
|
628
|
+
return a - (sum - v) + (b - v);
|
|
629
|
+
}
|
|
630
|
+
function binaryScale(value) {
|
|
631
|
+
return 2 ** Math.min(1023, Math.floor(Math.log2(value)));
|
|
632
|
+
}
|
|
633
|
+
function compensatedDot3(x, y, z, a, b, c) {
|
|
634
|
+
const magnitude = Math.max(Math.abs(x), Math.abs(y), Math.abs(z));
|
|
635
|
+
if (magnitude === 0)
|
|
636
|
+
return 0;
|
|
637
|
+
const scale = binaryScale(magnitude);
|
|
638
|
+
const sx = x / scale, sy = y / scale, sz = z / scale;
|
|
639
|
+
const p = sx * a, q = sy * b, r = sz * c;
|
|
640
|
+
const s = p + q, t = s + r;
|
|
641
|
+
return (t + (sumError2(p, q, s) + sumError2(s, r, t) + productError2(sx, a, p) + productError2(sy, b, q) + productError2(sz, c, r))) * scale;
|
|
642
|
+
}
|
|
643
|
+
function exactNormalIntersection(radii, origin, east, north, normal, point, sphereRadius) {
|
|
644
|
+
const values = sphereRadius ? [
|
|
645
|
+
sphereRadius,
|
|
646
|
+
sphereRadius,
|
|
647
|
+
sphereRadius,
|
|
648
|
+
sphereRadius,
|
|
649
|
+
0,
|
|
650
|
+
0,
|
|
651
|
+
0,
|
|
652
|
+
1,
|
|
653
|
+
0,
|
|
654
|
+
0,
|
|
655
|
+
0,
|
|
656
|
+
1,
|
|
657
|
+
1,
|
|
658
|
+
0,
|
|
659
|
+
0,
|
|
660
|
+
point[0],
|
|
661
|
+
point[1]
|
|
662
|
+
] : [...radii, ...origin, ...east, ...north, ...normal, ...point];
|
|
663
|
+
const v = values.map((value2) => {
|
|
664
|
+
const [whole, fraction = ""] = Math.abs(value2).toString(2).split(".");
|
|
665
|
+
return (value2 < 0 ? -1n : 1n) * BigInt("0b" + whole + fraction) << BigInt(1074 - fraction.length);
|
|
666
|
+
});
|
|
667
|
+
const unit = 1n << 1074n, q = 1n << 64n;
|
|
668
|
+
const factors = [v[1] * v[2], v[0] * v[2], v[0] * v[1]];
|
|
669
|
+
const p = [0, 1, 2].map((i) => (v[3 + i] * unit + v[6 + i] * v[15] + v[9 + i] * v[16]) * factors[i]);
|
|
670
|
+
const n = v.slice(12, 15).map((x, i) => x * factors[i]);
|
|
671
|
+
const dot = (x, y) => x.reduce((s, v2, i) => s + v2 * y[i], 0n);
|
|
672
|
+
const a = dot(n, n), b = dot(n, p), c = dot(p, p) - (v[0] * v[1] * v[2] * unit) ** 2n;
|
|
673
|
+
const discriminant = b * b - a * c;
|
|
674
|
+
if (a === 0n || discriminant < 0n)
|
|
675
|
+
return void 0;
|
|
676
|
+
const value = discriminant << 128n;
|
|
677
|
+
let root2 = value === 0n ? 0n : 1n << BigInt(Math.ceil(value.toString(2).length / 2));
|
|
678
|
+
if (root2)
|
|
679
|
+
for (; ; ) {
|
|
680
|
+
const next = root2 + value / root2 >> 1n;
|
|
681
|
+
if (next >= root2)
|
|
682
|
+
break;
|
|
683
|
+
root2 = next;
|
|
684
|
+
}
|
|
685
|
+
const output2 = p.map((x, i) => signedRatio(x * a * q + n[i] * (root2 - b * q), a * q * factors[i]));
|
|
686
|
+
return sphereRadius ? output2.map((_, i) => east[i] * output2[1] + north[i] * output2[2] + normal[i] * output2[0]) : output2;
|
|
687
|
+
}
|
|
688
|
+
function signedRatio(n, d) {
|
|
689
|
+
return Math.sign(Number(n)) * ratio(n < 0n ? -n : n, d, -2148);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// dist/ellipsoid-tangent-plane.js
|
|
566
693
|
var EllipsoidTangentPlane = class {
|
|
567
694
|
/**
|
|
568
|
-
* Creates a new plane tangent to
|
|
695
|
+
* Creates a new plane tangent to an ellipsoid at the provided origin.
|
|
569
696
|
* If origin is not on the surface of the ellipsoid, its surface projection will be used.
|
|
570
697
|
*
|
|
571
698
|
* @param origin A nonzero Cartesian point on or near the ellipsoid.
|
|
572
699
|
* @param ellipsoid The ellipsoid to which the origin belongs. Defaults to WGS84.
|
|
573
700
|
*/
|
|
574
701
|
constructor(origin, ellipsoid = Ellipsoid.WGS84) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
this.
|
|
578
|
-
|
|
579
|
-
this.
|
|
580
|
-
|
|
581
|
-
|
|
702
|
+
finiteInput(origin, 3);
|
|
703
|
+
this.radii = Object.freeze(Array.from(ellipsoid.radii));
|
|
704
|
+
if (this.radii[0] === this.radii[1] && this.radii[1] === this.radii[2])
|
|
705
|
+
this.radius = this.radii[0];
|
|
706
|
+
if (!this.radii.every((radius) => radius > 0 && Number.isFinite(radius))) {
|
|
707
|
+
throw new RangeError("Tangent plane requires positive finite ellipsoid radii");
|
|
708
|
+
}
|
|
709
|
+
const originOnSurface = ellipsoid.scaleToGeodeticSurface(Array.from(origin), new import_core5.Vector3());
|
|
710
|
+
if (!originOnSurface)
|
|
711
|
+
throw new RangeError("Origin has no unique ellipsoid surface point");
|
|
712
|
+
this.anchor = new import_core5.Vector3(originOnSurface);
|
|
713
|
+
const normal = new import_core5.Vector3(ellipsoid.geodeticSurfaceNormal(originOnSurface));
|
|
714
|
+
if (!normal.every(Number.isFinite) || !(normal.len() > 0)) {
|
|
715
|
+
throw new RangeError("Cannot resolve tangent-plane normal");
|
|
716
|
+
}
|
|
717
|
+
normal.normalize();
|
|
718
|
+
const horizontal = Math.hypot(normal[0], normal[1]);
|
|
719
|
+
this.east = horizontal > 0 ? new import_core5.Vector3(-normal[1] / horizontal, normal[0] / horizontal, 0) : new import_core5.Vector3(0, 1, 0);
|
|
720
|
+
this.north = new import_core5.Vector3(normal).cross(this.east).normalize();
|
|
721
|
+
this._plane = new import_culling.Plane().fromPointNormal(this.anchor, normal);
|
|
582
722
|
}
|
|
583
723
|
/**
|
|
584
724
|
* Computes the projection of the provided 3D position onto the 2D plane, along the plane normal.
|
|
585
725
|
*
|
|
586
|
-
* @param cartesian The
|
|
726
|
+
* @param cartesian The fixed Cartesian point to project.
|
|
587
727
|
* @param result The optional object in which to store the local east-north coordinates.
|
|
588
728
|
* @returns The supplied result or a new Vector2.
|
|
589
729
|
*/
|
|
590
|
-
projectPointToNearestOnPlane(cartesian, result) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
const
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
730
|
+
projectPointToNearestOnPlane(cartesian, result = new import_core5.Vector2()) {
|
|
731
|
+
finiteInput(cartesian, 3);
|
|
732
|
+
const x = cartesian[0] - this.anchor[0];
|
|
733
|
+
const y = cartesian[1] - this.anchor[1];
|
|
734
|
+
const z = cartesian[2] - this.anchor[2];
|
|
735
|
+
const projected = writePlanePoint(this, x, y, z, result, this.radius);
|
|
736
|
+
if (!projected)
|
|
737
|
+
throw new RangeError("Tangent-plane projection overflow");
|
|
738
|
+
return projected;
|
|
739
|
+
}
|
|
740
|
+
/** Project along the outward ray from the ellipsoid center.
|
|
741
|
+
* Back-facing, horizon and nonfinite intersections return undefined without writing result.
|
|
742
|
+
*/
|
|
743
|
+
projectPointRadiallyOntoPlane(cartesian, result = new import_core5.Vector2()) {
|
|
744
|
+
finiteInput(cartesian, 3);
|
|
745
|
+
const scale = Math.max(Math.abs(cartesian[0]), Math.abs(cartesian[1]), Math.abs(cartesian[2]));
|
|
746
|
+
if (scale === 0)
|
|
747
|
+
return void 0;
|
|
748
|
+
const sx = cartesian[0] / scale, sy = cartesian[1] / scale, sz = cartesian[2] / scale;
|
|
749
|
+
const length = Math.hypot(sx, sy, sz);
|
|
750
|
+
const x = sx / length;
|
|
751
|
+
const y = sy / length;
|
|
752
|
+
const z = sz / length;
|
|
753
|
+
const n = this.zAxis;
|
|
754
|
+
const denominator = x * n[0] + y * n[1] + z * n[2];
|
|
755
|
+
if (denominator <= 1e-14)
|
|
756
|
+
return void 0;
|
|
757
|
+
const distance = this.anchor.dot(n) / denominator;
|
|
758
|
+
return writePlanePoint(this, x * distance - this.anchor[0], y * distance - this.anchor[1], z * distance - this.anchor[2], result, this.radius);
|
|
759
|
+
}
|
|
760
|
+
/** Lift a local east/north point to the ellipsoid. Radial is the inverse of radial
|
|
761
|
+
* projection. Normal selects the nearest-facing line intersection and can miss.
|
|
762
|
+
* Neither operation restores a source point's height. Failure leaves result untouched.
|
|
763
|
+
*/
|
|
764
|
+
projectPointOntoEllipsoid(point, mode = "radial", result = new import_core5.Vector3()) {
|
|
765
|
+
finiteInput(point, 2);
|
|
766
|
+
checkMode(mode);
|
|
767
|
+
const [rx, ry, rz] = this.radii;
|
|
768
|
+
if (mode === "radial") {
|
|
769
|
+
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]));
|
|
770
|
+
const u = point[0] / scale, v = point[1] / scale;
|
|
771
|
+
const x = this.anchor[0] / scale + this.east[0] * u + this.north[0] * v;
|
|
772
|
+
const y = this.anchor[1] / scale + this.east[1] * u + this.north[1] * v;
|
|
773
|
+
const z = this.anchor[2] / scale + this.east[2] * u + this.north[2] * v;
|
|
774
|
+
const minimum = Math.min(rx, ry, rz);
|
|
775
|
+
const ax2 = x * (minimum / rx), ay2 = y * (minimum / ry), az2 = z * (minimum / rz);
|
|
776
|
+
const length = Math.hypot(ax2, ay2, az2);
|
|
777
|
+
if (!(length > 0 && Number.isFinite(length)))
|
|
778
|
+
return void 0;
|
|
779
|
+
return writeSurfacePoint(rx * (ax2 / length), ry * (ay2 / length), rz * (az2 / length), result);
|
|
780
|
+
}
|
|
781
|
+
const n = this.zAxis;
|
|
782
|
+
const p = [
|
|
783
|
+
this.anchor[0] + this.east[0] * point[0] + this.north[0] * point[1],
|
|
784
|
+
this.anchor[1] + this.east[1] * point[0] + this.north[1] * point[1],
|
|
785
|
+
this.anchor[2] + this.east[2] * point[0] + this.north[2] * point[1]
|
|
786
|
+
];
|
|
787
|
+
if (!p.every(Number.isFinite))
|
|
788
|
+
return void 0;
|
|
789
|
+
const ax = n[0] / rx, ay = n[1] / ry, az = n[2] / rz;
|
|
790
|
+
const px = p[0] / rx, py = p[1] / ry, pz = p[2] / rz;
|
|
791
|
+
const a = ax * ax + ay * ay + az * az;
|
|
792
|
+
const b = ax * px + ay * py + az * pz;
|
|
793
|
+
const c = px * px + py * py + pz * pz - 1;
|
|
794
|
+
const squaredB = b * b, ac = a * c;
|
|
795
|
+
const error = 1e-6 * (Math.abs(squaredB) + Math.abs(ac));
|
|
796
|
+
const discriminant = squaredB - ac;
|
|
797
|
+
if (!(a > 0) || !Number.isFinite(discriminant) || Math.abs(discriminant) <= error) {
|
|
798
|
+
const exact2 = exactNormalIntersection(this.radii, this.anchor, this.east, this.north, n, point, this.radius);
|
|
799
|
+
return exact2 && writeSurfacePoint(exact2[0], exact2[1], exact2[2], result);
|
|
800
|
+
}
|
|
801
|
+
if (discriminant < 0)
|
|
802
|
+
return void 0;
|
|
803
|
+
const root2 = Math.sqrt(Math.max(0, discriminant));
|
|
804
|
+
const t = b > 0 ? -c / (b + root2) : (-b + root2) / a;
|
|
805
|
+
return writeSurfacePoint(p[0] + t * n[0], p[1] + t * n[1], p[2] + t * n[2], result);
|
|
806
|
+
}
|
|
807
|
+
/** Packed XYZ to packed east/north. Invalid radial points produce NaN pairs and a zero mask.
|
|
808
|
+
* Optional output must have exactly two components per point and must not overlap input.
|
|
809
|
+
*/
|
|
810
|
+
projectPointsFlat(input, mode = "normal", output2) {
|
|
811
|
+
checkMode(mode);
|
|
812
|
+
if (input.length % 3)
|
|
813
|
+
throw new RangeError("Expected packed XYZ coordinates");
|
|
814
|
+
const count = input.length / 3;
|
|
815
|
+
const positions = output2 || new Float64Array(count * 2);
|
|
816
|
+
if (positions.length !== count * 2)
|
|
817
|
+
throw new RangeError("Invalid tangent-plane output length");
|
|
818
|
+
if (ArrayBuffer.isView(input) && input.buffer === positions.buffer && input.byteOffset < positions.byteOffset + positions.byteLength && positions.byteOffset < input.byteOffset + input.byteLength) {
|
|
819
|
+
throw new RangeError("Input and output buffers must not overlap");
|
|
820
|
+
}
|
|
821
|
+
for (let i = 0; i < input.length; i++) {
|
|
822
|
+
if (!Number.isFinite(input[i]))
|
|
823
|
+
throw new RangeError("Expected finite coordinates");
|
|
824
|
+
}
|
|
825
|
+
const valid = new Uint8Array(count);
|
|
826
|
+
const point = new import_core5.Vector3();
|
|
827
|
+
const projected = new import_core5.Vector2();
|
|
828
|
+
for (let i = 0; i < count; i++) {
|
|
829
|
+
point.set(input[i * 3], input[i * 3 + 1], input[i * 3 + 2]);
|
|
830
|
+
const value = mode === "normal" ? this.projectPointToNearestOnPlane(point, projected) : this.projectPointRadiallyOntoPlane(point, projected);
|
|
831
|
+
valid[i] = value ? 1 : 0;
|
|
832
|
+
positions[i * 2] = value ? value[0] : NaN;
|
|
833
|
+
positions[i * 2 + 1] = value ? value[1] : NaN;
|
|
834
|
+
}
|
|
835
|
+
return { positions, valid };
|
|
600
836
|
}
|
|
601
837
|
get plane() {
|
|
602
838
|
return this._plane;
|
|
603
839
|
}
|
|
604
840
|
get origin() {
|
|
605
|
-
return this.
|
|
841
|
+
return this.anchor;
|
|
606
842
|
}
|
|
607
843
|
get xAxis() {
|
|
608
|
-
return this.
|
|
844
|
+
return this.east;
|
|
609
845
|
}
|
|
610
846
|
get yAxis() {
|
|
611
|
-
return this.
|
|
847
|
+
return this.north;
|
|
612
848
|
}
|
|
613
849
|
get zAxis() {
|
|
614
850
|
return this._plane.normal;
|
|
615
851
|
}
|
|
616
852
|
};
|
|
853
|
+
function finiteInput(point, length) {
|
|
854
|
+
if (point.length !== length)
|
|
855
|
+
throw new RangeError(`Expected ${length} finite coordinates`);
|
|
856
|
+
for (let i = 0; i < length; i++) {
|
|
857
|
+
if (!Number.isFinite(point[i]))
|
|
858
|
+
throw new RangeError(`Expected ${length} finite coordinates`);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
function checkMode(mode) {
|
|
862
|
+
if (mode !== "normal" && mode !== "radial")
|
|
863
|
+
throw new RangeError("Invalid tangent-plane mode");
|
|
864
|
+
}
|
|
865
|
+
function writePlanePoint(plane, x, y, z, result, radius) {
|
|
866
|
+
let east = x * plane.xAxis[0] + y * plane.xAxis[1] + z * plane.xAxis[2];
|
|
867
|
+
let north = x * plane.yAxis[0] + y * plane.yAxis[1] + z * plane.yAxis[2];
|
|
868
|
+
if (radius !== void 0 && Math.abs((east / radius) ** 2 + (north / radius) ** 2 - 1) <= 32 * Number.EPSILON) {
|
|
869
|
+
east = compensatedDot3(x, y, z, plane.xAxis[0], plane.xAxis[1], plane.xAxis[2]);
|
|
870
|
+
north = compensatedDot3(x, y, z, plane.yAxis[0], plane.yAxis[1], plane.yAxis[2]);
|
|
871
|
+
}
|
|
872
|
+
if (!Number.isFinite(east) || !Number.isFinite(north))
|
|
873
|
+
return void 0;
|
|
874
|
+
return result.set(east, north);
|
|
875
|
+
}
|
|
876
|
+
function writeSurfacePoint(x, y, z, result) {
|
|
877
|
+
if (![x, y, z].every(Number.isFinite))
|
|
878
|
+
return void 0;
|
|
879
|
+
return result.set(x, y, z);
|
|
880
|
+
}
|
|
617
881
|
|
|
618
882
|
// dist/make-obb-from-region.js
|
|
619
|
-
var scratchOffset = new
|
|
620
|
-
var scratchTangentPoint = new
|
|
621
|
-
var scratchPerimeterCartographicNC = new
|
|
622
|
-
var scratchPerimeterCartographicNW = new
|
|
623
|
-
var scratchPerimeterCartographicCW = new
|
|
624
|
-
var scratchPerimeterCartographicSW = new
|
|
625
|
-
var scratchPerimeterCartographicSC = new
|
|
626
|
-
var scratchPerimeterCartesianNC = new
|
|
627
|
-
var scratchPerimeterCartesianNW = new
|
|
628
|
-
var scratchPerimeterCartesianCW = new
|
|
629
|
-
var scratchPerimeterCartesianSW = new
|
|
630
|
-
var scratchPerimeterCartesianSC = new
|
|
631
|
-
var scratchPerimeterProjectedNC = new
|
|
632
|
-
var scratchPerimeterProjectedNW = new
|
|
633
|
-
var scratchPerimeterProjectedCW = new
|
|
634
|
-
var scratchPerimeterProjectedSW = new
|
|
635
|
-
var scratchPerimeterProjectedSC = new
|
|
883
|
+
var scratchOffset = new import_core6.Vector3();
|
|
884
|
+
var scratchTangentPoint = new import_core6.Vector3();
|
|
885
|
+
var scratchPerimeterCartographicNC = new import_core6.Vector3();
|
|
886
|
+
var scratchPerimeterCartographicNW = new import_core6.Vector3();
|
|
887
|
+
var scratchPerimeterCartographicCW = new import_core6.Vector3();
|
|
888
|
+
var scratchPerimeterCartographicSW = new import_core6.Vector3();
|
|
889
|
+
var scratchPerimeterCartographicSC = new import_core6.Vector3();
|
|
890
|
+
var scratchPerimeterCartesianNC = new import_core6.Vector3();
|
|
891
|
+
var scratchPerimeterCartesianNW = new import_core6.Vector3();
|
|
892
|
+
var scratchPerimeterCartesianCW = new import_core6.Vector3();
|
|
893
|
+
var scratchPerimeterCartesianSW = new import_core6.Vector3();
|
|
894
|
+
var scratchPerimeterCartesianSC = new import_core6.Vector3();
|
|
895
|
+
var scratchPerimeterProjectedNC = new import_core6.Vector2();
|
|
896
|
+
var scratchPerimeterProjectedNW = new import_core6.Vector2();
|
|
897
|
+
var scratchPerimeterProjectedCW = new import_core6.Vector2();
|
|
898
|
+
var scratchPerimeterProjectedSW = new import_core6.Vector2();
|
|
899
|
+
var scratchPerimeterProjectedSC = new import_core6.Vector2();
|
|
636
900
|
var scratchPlane = new import_culling2.Plane();
|
|
637
|
-
var scratchPlaneOrigin = new
|
|
638
|
-
var scratchPlaneNormal = new
|
|
639
|
-
var scratchPlaneXAxis = new
|
|
640
|
-
var scratchHorizonCartesian = new
|
|
641
|
-
var scratchHorizonProjected = new
|
|
642
|
-
var scratchMaxY = new
|
|
643
|
-
var scratchZ = new
|
|
644
|
-
var VECTOR3_UNIT_X = new
|
|
645
|
-
var VECTOR3_UNIT_Z = new
|
|
901
|
+
var scratchPlaneOrigin = new import_core6.Vector3();
|
|
902
|
+
var scratchPlaneNormal = new import_core6.Vector3();
|
|
903
|
+
var scratchPlaneXAxis = new import_core6.Vector3();
|
|
904
|
+
var scratchHorizonCartesian = new import_core6.Vector3();
|
|
905
|
+
var scratchHorizonProjected = new import_core6.Vector2();
|
|
906
|
+
var scratchMaxY = new import_core6.Vector3();
|
|
907
|
+
var scratchZ = new import_core6.Vector3();
|
|
908
|
+
var VECTOR3_UNIT_X = new import_core6.Vector3(1, 0, 0);
|
|
909
|
+
var VECTOR3_UNIT_Z = new import_core6.Vector3(0, 0, 1);
|
|
646
910
|
function makeOBBFromRegion(region, ellipsoid = Ellipsoid.WGS84, options = {}) {
|
|
647
911
|
if (!region || region.length !== 6 || region.some((value) => !Number.isFinite(value))) {
|
|
648
912
|
throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");
|
|
649
913
|
}
|
|
650
|
-
const unitScale = options.units === "degrees" ? (0,
|
|
914
|
+
const unitScale = options.units === "degrees" ? (0, import_core6.radians)(1) : 1;
|
|
651
915
|
const [rawWest, rawSouth, rawEast, rawNorth, minimumHeight, maximumHeight] = region;
|
|
652
916
|
if (minimumHeight > maximumHeight) {
|
|
653
917
|
throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");
|
|
@@ -657,26 +921,26 @@ function makeOBBFromRegion(region, ellipsoid = Ellipsoid.WGS84, options = {}) {
|
|
|
657
921
|
const west = normalizeLongitude(rawWest * unitScale);
|
|
658
922
|
let east = normalizeLongitude(rawEast * unitScale);
|
|
659
923
|
const directedSpan = rawEast * unitScale - rawWest * unitScale;
|
|
660
|
-
if (directedSpan >=
|
|
661
|
-
east = west +
|
|
924
|
+
if (directedSpan >= import_core6._MathUtils.TWO_PI - 1e-12) {
|
|
925
|
+
east = west + import_core6._MathUtils.TWO_PI;
|
|
662
926
|
}
|
|
663
927
|
const latitudeTolerance = 1e-12;
|
|
664
|
-
if (south > north || south < -
|
|
928
|
+
if (south > north || south < -import_core6._MathUtils.PI_OVER_TWO - latitudeTolerance || north > import_core6._MathUtils.PI_OVER_TWO + latitudeTolerance) {
|
|
665
929
|
throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");
|
|
666
930
|
}
|
|
667
|
-
const clampedSouth = Math.max(-
|
|
668
|
-
const clampedNorth = Math.max(-
|
|
931
|
+
const clampedSouth = Math.max(-import_core6._MathUtils.PI_OVER_TWO, Math.min(import_core6._MathUtils.PI_OVER_TWO, south));
|
|
932
|
+
const clampedNorth = Math.max(-import_core6._MathUtils.PI_OVER_TWO, Math.min(import_core6._MathUtils.PI_OVER_TWO, north));
|
|
669
933
|
return makeOBBFromNormalizedRegion([west, clampedSouth, east, clampedNorth, minimumHeight, maximumHeight], ellipsoid, options.transform);
|
|
670
934
|
}
|
|
671
935
|
function normalizeLongitude(value) {
|
|
672
|
-
const normalized = ((value + Math.PI) %
|
|
936
|
+
const normalized = ((value + Math.PI) % import_core6._MathUtils.TWO_PI + import_core6._MathUtils.TWO_PI) % import_core6._MathUtils.TWO_PI - Math.PI;
|
|
673
937
|
return normalized === -Math.PI && value > 0 ? Math.PI : normalized;
|
|
674
938
|
}
|
|
675
939
|
function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
|
|
676
940
|
const obb = new import_culling2.OrientedBoundingBox();
|
|
677
941
|
const [west, south, east, north, minimumHeight, maximumHeight] = region;
|
|
678
|
-
const northDeg = (0,
|
|
679
|
-
const southDeg = (0,
|
|
942
|
+
const northDeg = (0, import_core6.degrees)(north);
|
|
943
|
+
const southDeg = (0, import_core6.degrees)(south);
|
|
680
944
|
let maxX;
|
|
681
945
|
let maxY;
|
|
682
946
|
let maxZ;
|
|
@@ -686,15 +950,15 @@ function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
|
|
|
686
950
|
let plane;
|
|
687
951
|
const rectangle = new LngLatRectangle(west, south, east, north);
|
|
688
952
|
const tangentPoint = LngLatRectangle.center(rectangle, scratchTangentPoint);
|
|
689
|
-
const tangentPointCartographic = new
|
|
690
|
-
(0,
|
|
691
|
-
(0,
|
|
953
|
+
const tangentPointCartographic = new import_core6.Vector3([
|
|
954
|
+
(0, import_core6.degrees)(tangentPoint.x),
|
|
955
|
+
(0, import_core6.degrees)(tangentPoint.y),
|
|
692
956
|
0
|
|
693
957
|
]);
|
|
694
958
|
const lonCenter = tangentPoint.x;
|
|
695
959
|
const lonCenterDeg = tangentPointCartographic.x;
|
|
696
|
-
if (rectangle.width <=
|
|
697
|
-
const westDeg = (0,
|
|
960
|
+
if (rectangle.width <= import_core6._MathUtils.PI) {
|
|
961
|
+
const westDeg = (0, import_core6.degrees)(west);
|
|
698
962
|
const tangentPoint2 = ellipsoid.cartographicToCartesian(tangentPointCartographic);
|
|
699
963
|
const ellipsoidTangentPlane = new EllipsoidTangentPlane(tangentPoint2, ellipsoid);
|
|
700
964
|
const latCenter = southDeg < 0 && northDeg > 0 ? 0 : tangentPointCartographic.y;
|
|
@@ -745,18 +1009,18 @@ function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
|
|
|
745
1009
|
maxZ = maximumHeight;
|
|
746
1010
|
return applyTransform(fromPlaneExtents(ellipsoidTangentPlane.origin, ellipsoidTangentPlane.xAxis, ellipsoidTangentPlane.yAxis, ellipsoidTangentPlane.zAxis, minX, maxX, minY, maxY, minZ, maxZ, obb), transform);
|
|
747
1011
|
}
|
|
748
|
-
const eastDeg = (0,
|
|
1012
|
+
const eastDeg = (0, import_core6.degrees)(east);
|
|
749
1013
|
const fullyAboveEquator = south > 0;
|
|
750
1014
|
const fullyBelowEquator = north < 0;
|
|
751
1015
|
const latitudeNearestToEquator = fullyAboveEquator ? southDeg : fullyBelowEquator ? northDeg : 0;
|
|
752
1016
|
const planeOrigin = ellipsoid.cartographicToCartesian([lonCenterDeg, latitudeNearestToEquator, maximumHeight], scratchPlaneOrigin);
|
|
753
1017
|
planeOrigin.z = 0;
|
|
754
|
-
const isPole = Math.abs(planeOrigin.x) <
|
|
1018
|
+
const isPole = Math.abs(planeOrigin.x) < import_core6._MathUtils.EPSILON10 && Math.abs(planeOrigin.y) < import_core6._MathUtils.EPSILON10;
|
|
755
1019
|
const planeNormal = !isPole ? scratchPlaneNormal.copy(planeOrigin).normalize() : VECTOR3_UNIT_X;
|
|
756
1020
|
const planeYAxis = VECTOR3_UNIT_Z;
|
|
757
1021
|
const planeXAxis = scratchPlaneXAxis.copy(planeNormal).cross(planeYAxis);
|
|
758
1022
|
plane = scratchPlane.fromPointNormal(planeOrigin, planeNormal);
|
|
759
|
-
const horizonCartesian = ellipsoid.cartographicToCartesian([(0,
|
|
1023
|
+
const horizonCartesian = ellipsoid.cartographicToCartesian([(0, import_core6.degrees)(lonCenter + import_core6._MathUtils.PI_OVER_TWO), latitudeNearestToEquator, maximumHeight], scratchHorizonCartesian);
|
|
760
1024
|
const projectedPoint = plane.projectPointOntoPlane(horizonCartesian, scratchHorizonProjected);
|
|
761
1025
|
maxX = projectedPoint.dot(planeXAxis);
|
|
762
1026
|
minX = -maxX;
|
|
@@ -772,15 +1036,15 @@ function makeOBBFromNormalizedRegion(region, ellipsoid, transform) {
|
|
|
772
1036
|
function applyTransform(obb, transform) {
|
|
773
1037
|
if (!transform)
|
|
774
1038
|
return obb;
|
|
775
|
-
const axes = [0, 1, 2].map((column) => obb.halfAxes.getColumn(column, new
|
|
1039
|
+
const axes = [0, 1, 2].map((column) => obb.halfAxes.getColumn(column, new import_core6.Vector3()));
|
|
776
1040
|
const center = transform.transformAsPoint(obb.center);
|
|
777
1041
|
const minimum = [Infinity, Infinity, Infinity];
|
|
778
1042
|
const maximum = [-Infinity, -Infinity, -Infinity];
|
|
779
1043
|
for (let mask = 0; mask < 8; mask++) {
|
|
780
|
-
const corner = new
|
|
1044
|
+
const corner = new import_core6.Vector3(center);
|
|
781
1045
|
for (let axis = 0; axis < 3; axis++) {
|
|
782
1046
|
const transformedAxis = transform.transformAsVector(axes[axis]);
|
|
783
|
-
corner.add(new
|
|
1047
|
+
corner.add(new import_core6.Vector3(transformedAxis).scale((mask & 1 << axis) === 0 ? -1 : 1));
|
|
784
1048
|
}
|
|
785
1049
|
for (let component = 0; component < 3; component++) {
|
|
786
1050
|
minimum[component] = Math.min(minimum[component], corner[component]);
|
|
@@ -788,8 +1052,8 @@ function applyTransform(obb, transform) {
|
|
|
788
1052
|
}
|
|
789
1053
|
}
|
|
790
1054
|
obb.center.copy(minimum).add(maximum).scale(0.5);
|
|
791
|
-
const halfSize = new
|
|
792
|
-
obb.halfAxes = new
|
|
1055
|
+
const halfSize = new import_core6.Vector3(maximum).subtract(minimum).scale(0.5);
|
|
1056
|
+
obb.halfAxes = new import_core6.Matrix3().set(halfSize.x, 0, 0, 0, halfSize.y, 0, 0, 0, halfSize.z);
|
|
793
1057
|
return obb;
|
|
794
1058
|
}
|
|
795
1059
|
function latitudeZExtent(ellipsoid, latitude, height, maximum) {
|
|
@@ -845,10 +1109,10 @@ var EllipsoidOccluder = class {
|
|
|
845
1109
|
const dx = direction[0] / this.radii[0];
|
|
846
1110
|
const dy = direction[1] / this.radii[1];
|
|
847
1111
|
const dz = direction[2] / this.radii[2];
|
|
848
|
-
const
|
|
849
|
-
if (
|
|
1112
|
+
const length = Math.hypot(dx, dy, dz);
|
|
1113
|
+
if (length === 0 || !Number.isFinite(length))
|
|
850
1114
|
return void 0;
|
|
851
|
-
const ux = dx /
|
|
1115
|
+
const ux = dx / length, uy = dy / length, uz = dz / length;
|
|
852
1116
|
const along = -(x * ux + y * uy + z * uz);
|
|
853
1117
|
const perpendicular = Math.hypot(y * uz - z * uy, z * ux - x * uz, x * uy - y * ux);
|
|
854
1118
|
if (perpendicular > 1)
|
|
@@ -865,8 +1129,8 @@ var EllipsoidOccluder = class {
|
|
|
865
1129
|
far = (radius - 1) / near * (radius + 1);
|
|
866
1130
|
if (far < 0)
|
|
867
1131
|
return void 0;
|
|
868
|
-
result[0] = Math.max(0, Math.min(near, far)) /
|
|
869
|
-
result[1] = Math.max(0, far) /
|
|
1132
|
+
result[0] = Math.max(0, Math.min(near, far)) / length;
|
|
1133
|
+
result[1] = Math.max(0, far) / length;
|
|
870
1134
|
return result;
|
|
871
1135
|
}
|
|
872
1136
|
/** True if the finite camera-to-point segment enters the solid interior.
|
|
@@ -882,13 +1146,13 @@ var EllipsoidOccluder = class {
|
|
|
882
1146
|
const a = this.scalePoint(camera);
|
|
883
1147
|
const b = this.scalePoint(point);
|
|
884
1148
|
const dx = b[0] - a[0], dy = b[1] - a[1], dz = b[2] - a[2];
|
|
885
|
-
const
|
|
886
|
-
if (!Number.isFinite(
|
|
1149
|
+
const length = Math.hypot(dx, dy, dz);
|
|
1150
|
+
if (!Number.isFinite(length))
|
|
887
1151
|
throw new RangeError("Segment magnitude must be finite");
|
|
888
|
-
if (
|
|
1152
|
+
if (length === 0)
|
|
889
1153
|
return Math.hypot(...a) ** 2 < 1 - tolerance;
|
|
890
|
-
const ux = dx /
|
|
891
|
-
const distance = Math.max(0, Math.min(
|
|
1154
|
+
const ux = dx / length, uy = dy / length, uz = dz / length;
|
|
1155
|
+
const distance = Math.max(0, Math.min(length, -(a[0] * ux + a[1] * uy + a[2] * uz)));
|
|
892
1156
|
return Math.hypot(a[0] + distance * ux, a[1] + distance * uy, a[2] + distance * uz) ** 2 < 1 - tolerance;
|
|
893
1157
|
}
|
|
894
1158
|
/** Exact apparent limb ellipse for an exterior camera; undefined on/inside surface. */
|
|
@@ -938,14 +1202,14 @@ function getGlobeHorizonBounds(camera, radius) {
|
|
|
938
1202
|
return void 0;
|
|
939
1203
|
const latitude = Math.atan2(camera[2], Math.hypot(camera[0], camera[1]));
|
|
940
1204
|
const longitude = Math.atan2(camera[1], camera[0]);
|
|
941
|
-
const
|
|
1205
|
+
const angle2 = Math.acos(radius / distance);
|
|
942
1206
|
const degrees2 = 180 / Math.PI;
|
|
943
1207
|
const padding = 1e-10;
|
|
944
|
-
const south = Math.max(-90, (latitude -
|
|
945
|
-
const north = Math.min(90, (latitude +
|
|
946
|
-
if (Math.abs(latitude) +
|
|
1208
|
+
const south = Math.max(-90, (latitude - angle2) * degrees2 - padding);
|
|
1209
|
+
const north = Math.min(90, (latitude + angle2) * degrees2 + padding);
|
|
1210
|
+
if (Math.abs(latitude) + angle2 >= Math.PI / 2 - 1e-12)
|
|
947
1211
|
return [-180, south, 180, north];
|
|
948
|
-
const extent = Math.asin(Math.min(1, Math.sin(
|
|
1212
|
+
const extent = Math.asin(Math.min(1, Math.sin(angle2) / Math.cos(latitude))) * degrees2 + padding;
|
|
949
1213
|
return [wrap(longitude * degrees2 - extent), south, wrap(longitude * degrees2 + extent), north];
|
|
950
1214
|
}
|
|
951
1215
|
function splitGlobeBounds(bounds) {
|
|
@@ -999,4 +1263,2893 @@ function subdivideGlobeMesh(mesh, options) {
|
|
|
999
1263
|
}
|
|
1000
1264
|
});
|
|
1001
1265
|
}
|
|
1266
|
+
|
|
1267
|
+
// dist/subdivide-geodesic-polyline.js
|
|
1268
|
+
var import_polygon2 = require("@math.gl/geometry/polygon");
|
|
1269
|
+
|
|
1270
|
+
// dist/vendor/geographiclib-geodesic/runtime.js
|
|
1271
|
+
var geodesic = {};
|
|
1272
|
+
geodesic.Constants = {};
|
|
1273
|
+
geodesic.Math = {};
|
|
1274
|
+
geodesic.Accumulator = {};
|
|
1275
|
+
(function(c) {
|
|
1276
|
+
"use strict";
|
|
1277
|
+
c.WGS84 = { a: 6378137, f: 1 / 298.257223563 };
|
|
1278
|
+
c.version = {
|
|
1279
|
+
major: 2,
|
|
1280
|
+
minor: 2,
|
|
1281
|
+
patch: 0
|
|
1282
|
+
};
|
|
1283
|
+
c.version_string = "2.2.0";
|
|
1284
|
+
})(geodesic.Constants);
|
|
1285
|
+
(function(m) {
|
|
1286
|
+
"use strict";
|
|
1287
|
+
m.digits = 53;
|
|
1288
|
+
m.epsilon = Math.pow(0.5, m.digits - 1);
|
|
1289
|
+
m.degree = Math.PI / 180;
|
|
1290
|
+
m.sq = function(x) {
|
|
1291
|
+
return x * x;
|
|
1292
|
+
};
|
|
1293
|
+
m.hypot = function(x, y) {
|
|
1294
|
+
return Math.sqrt(x * x + y * y);
|
|
1295
|
+
};
|
|
1296
|
+
m.cbrt = Math.cbrt || function(x) {
|
|
1297
|
+
var y = Math.pow(Math.abs(x), 1 / 3);
|
|
1298
|
+
return x > 0 ? y : x < 0 ? -y : x;
|
|
1299
|
+
};
|
|
1300
|
+
m.log1p = Math.log1p || function(x) {
|
|
1301
|
+
var y = 1 + x, z = y - 1;
|
|
1302
|
+
return z === 0 ? x : x * Math.log(y) / z;
|
|
1303
|
+
};
|
|
1304
|
+
m.atanh = Math.atanh || function(x) {
|
|
1305
|
+
var y = Math.abs(x);
|
|
1306
|
+
y = m.log1p(2 * y / (1 - y)) / 2;
|
|
1307
|
+
return x > 0 ? y : x < 0 ? -y : x;
|
|
1308
|
+
};
|
|
1309
|
+
m.copysign = function(x, y) {
|
|
1310
|
+
return Math.abs(x) * (y < 0 || y === 0 && 1 / y < 0 ? -1 : 1);
|
|
1311
|
+
};
|
|
1312
|
+
m.sum = function(u, v) {
|
|
1313
|
+
var s = u + v, up = s - v, vpp = s - up, t;
|
|
1314
|
+
up -= u;
|
|
1315
|
+
vpp -= v;
|
|
1316
|
+
t = s ? 0 - (up + vpp) : s;
|
|
1317
|
+
return { s, t };
|
|
1318
|
+
};
|
|
1319
|
+
m.polyval = function(N, p, s, x) {
|
|
1320
|
+
var y = N < 0 ? 0 : p[s++];
|
|
1321
|
+
while (--N >= 0)
|
|
1322
|
+
y = y * x + p[s++];
|
|
1323
|
+
return y;
|
|
1324
|
+
};
|
|
1325
|
+
m.AngRound = function(x) {
|
|
1326
|
+
var z = 1 / 16, y = Math.abs(x);
|
|
1327
|
+
y = y < z ? z - (z - y) : y;
|
|
1328
|
+
return m.copysign(y, x);
|
|
1329
|
+
};
|
|
1330
|
+
m.remainder = function(x, y) {
|
|
1331
|
+
x %= y;
|
|
1332
|
+
return x < -y / 2 ? x + y : x < y / 2 ? x : x - y;
|
|
1333
|
+
};
|
|
1334
|
+
m.AngNormalize = function(x) {
|
|
1335
|
+
var y = m.remainder(x, 360);
|
|
1336
|
+
return Math.abs(y) === 180 ? m.copysign(180, x) : y;
|
|
1337
|
+
};
|
|
1338
|
+
m.LatFix = function(x) {
|
|
1339
|
+
return Math.abs(x) > 90 ? NaN : x;
|
|
1340
|
+
};
|
|
1341
|
+
m.AngDiff = function(x, y) {
|
|
1342
|
+
var r = m.sum(m.remainder(-x, 360), m.remainder(y, 360)), d, e;
|
|
1343
|
+
r = m.sum(m.remainder(r.s, 360), r.t);
|
|
1344
|
+
d = r.s;
|
|
1345
|
+
e = r.t;
|
|
1346
|
+
if (d === 0 || Math.abs(d) === 180)
|
|
1347
|
+
d = m.copysign(d, e === 0 ? y - x : -e);
|
|
1348
|
+
return { d, e };
|
|
1349
|
+
};
|
|
1350
|
+
m.sincosd = function(x) {
|
|
1351
|
+
var d, r, q, s, c, sinx, cosx;
|
|
1352
|
+
d = x % 360;
|
|
1353
|
+
q = Math.round(d / 90);
|
|
1354
|
+
d -= 90 * q;
|
|
1355
|
+
r = d * this.degree;
|
|
1356
|
+
s = Math.sin(r);
|
|
1357
|
+
c = Math.cos(r);
|
|
1358
|
+
if (Math.abs(d) === 45) {
|
|
1359
|
+
c = Math.sqrt(0.5);
|
|
1360
|
+
s = m.copysign(c, r);
|
|
1361
|
+
} else if (Math.abs(d) === 30) {
|
|
1362
|
+
c = Math.sqrt(0.75);
|
|
1363
|
+
s = m.copysign(0.5, r);
|
|
1364
|
+
}
|
|
1365
|
+
switch (q & 3) {
|
|
1366
|
+
case 0:
|
|
1367
|
+
sinx = s;
|
|
1368
|
+
cosx = c;
|
|
1369
|
+
break;
|
|
1370
|
+
case 1:
|
|
1371
|
+
sinx = c;
|
|
1372
|
+
cosx = -s;
|
|
1373
|
+
break;
|
|
1374
|
+
case 2:
|
|
1375
|
+
sinx = -s;
|
|
1376
|
+
cosx = -c;
|
|
1377
|
+
break;
|
|
1378
|
+
default:
|
|
1379
|
+
sinx = -c;
|
|
1380
|
+
cosx = s;
|
|
1381
|
+
break;
|
|
1382
|
+
}
|
|
1383
|
+
cosx += 0;
|
|
1384
|
+
if (sinx === 0)
|
|
1385
|
+
sinx = m.copysign(sinx, x);
|
|
1386
|
+
return { s: sinx, c: cosx };
|
|
1387
|
+
};
|
|
1388
|
+
m.sincosde = function(x, t) {
|
|
1389
|
+
var d, r, q, s, c, sinx, cosx;
|
|
1390
|
+
d = x % 360;
|
|
1391
|
+
q = Math.round(d / 90);
|
|
1392
|
+
d = m.AngRound(d - 90 * q + t);
|
|
1393
|
+
r = d * this.degree;
|
|
1394
|
+
s = Math.sin(r);
|
|
1395
|
+
c = Math.cos(r);
|
|
1396
|
+
if (Math.abs(d) === 45) {
|
|
1397
|
+
c = Math.sqrt(0.5);
|
|
1398
|
+
s = m.copysign(c, r);
|
|
1399
|
+
} else if (Math.abs(d) === 30) {
|
|
1400
|
+
c = Math.sqrt(0.75);
|
|
1401
|
+
s = m.copysign(0.5, r);
|
|
1402
|
+
}
|
|
1403
|
+
switch (q & 3) {
|
|
1404
|
+
case 0:
|
|
1405
|
+
sinx = s;
|
|
1406
|
+
cosx = c;
|
|
1407
|
+
break;
|
|
1408
|
+
case 1:
|
|
1409
|
+
sinx = c;
|
|
1410
|
+
cosx = -s;
|
|
1411
|
+
break;
|
|
1412
|
+
case 2:
|
|
1413
|
+
sinx = -s;
|
|
1414
|
+
cosx = -c;
|
|
1415
|
+
break;
|
|
1416
|
+
default:
|
|
1417
|
+
sinx = -c;
|
|
1418
|
+
cosx = s;
|
|
1419
|
+
break;
|
|
1420
|
+
}
|
|
1421
|
+
cosx += 0;
|
|
1422
|
+
if (sinx === 0)
|
|
1423
|
+
sinx = m.copysign(sinx, x + t);
|
|
1424
|
+
return { s: sinx, c: cosx };
|
|
1425
|
+
};
|
|
1426
|
+
m.atan2d = function(y, x) {
|
|
1427
|
+
var q = 0, ang;
|
|
1428
|
+
if (Math.abs(y) > Math.abs(x)) {
|
|
1429
|
+
[y, x] = [x, y];
|
|
1430
|
+
q = 2;
|
|
1431
|
+
}
|
|
1432
|
+
if (m.copysign(1, x) < 0) {
|
|
1433
|
+
x = -x;
|
|
1434
|
+
++q;
|
|
1435
|
+
}
|
|
1436
|
+
ang = Math.atan2(y, x) / this.degree;
|
|
1437
|
+
switch (q) {
|
|
1438
|
+
// Note that atan2d(-0.0, 1.0) will return -0. However, we expect that
|
|
1439
|
+
// atan2d will not be called with y = -0. If need be, include
|
|
1440
|
+
//
|
|
1441
|
+
// case 0: ang = 0 + ang; break;
|
|
1442
|
+
//
|
|
1443
|
+
// and handle mpfr as in AngRound.
|
|
1444
|
+
case 1:
|
|
1445
|
+
ang = m.copysign(180, y) - ang;
|
|
1446
|
+
break;
|
|
1447
|
+
case 2:
|
|
1448
|
+
ang = 90 - ang;
|
|
1449
|
+
break;
|
|
1450
|
+
case 3:
|
|
1451
|
+
ang = -90 + ang;
|
|
1452
|
+
break;
|
|
1453
|
+
default:
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
return ang;
|
|
1457
|
+
};
|
|
1458
|
+
})(geodesic.Math);
|
|
1459
|
+
(function(a, m) {
|
|
1460
|
+
"use strict";
|
|
1461
|
+
a.Accumulator = function(y) {
|
|
1462
|
+
this.Set(y);
|
|
1463
|
+
};
|
|
1464
|
+
a.Accumulator.prototype.Set = function(y) {
|
|
1465
|
+
if (!y)
|
|
1466
|
+
y = 0;
|
|
1467
|
+
if (y.constructor === a.Accumulator) {
|
|
1468
|
+
this._s = y._s;
|
|
1469
|
+
this._t = y._t;
|
|
1470
|
+
} else {
|
|
1471
|
+
this._s = y;
|
|
1472
|
+
this._t = 0;
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
a.Accumulator.prototype.Add = function(y) {
|
|
1476
|
+
var u = m.sum(y, this._t), v = m.sum(u.s, this._s);
|
|
1477
|
+
u = u.t;
|
|
1478
|
+
this._s = v.s;
|
|
1479
|
+
this._t = v.t;
|
|
1480
|
+
if (this._s === 0)
|
|
1481
|
+
this._s = u;
|
|
1482
|
+
else
|
|
1483
|
+
this._t += u;
|
|
1484
|
+
};
|
|
1485
|
+
a.Accumulator.prototype.Sum = function(y) {
|
|
1486
|
+
var b;
|
|
1487
|
+
if (!y)
|
|
1488
|
+
return this._s;
|
|
1489
|
+
else {
|
|
1490
|
+
b = new a.Accumulator(this);
|
|
1491
|
+
b.Add(y);
|
|
1492
|
+
return b._s;
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
a.Accumulator.prototype.Negate = function() {
|
|
1496
|
+
this._s *= -1;
|
|
1497
|
+
this._t *= -1;
|
|
1498
|
+
};
|
|
1499
|
+
a.Accumulator.prototype.Remainder = function(y) {
|
|
1500
|
+
this._s = m.remainder(this._s, y);
|
|
1501
|
+
this.Add(0);
|
|
1502
|
+
};
|
|
1503
|
+
})(geodesic.Accumulator, geodesic.Math);
|
|
1504
|
+
geodesic.Geodesic = {};
|
|
1505
|
+
geodesic.GeodesicLine = {};
|
|
1506
|
+
geodesic.PolygonArea = {};
|
|
1507
|
+
(function(g, l, p, m, c) {
|
|
1508
|
+
"use strict";
|
|
1509
|
+
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;
|
|
1510
|
+
g.tiny_ = Math.sqrt(Number.MIN_VALUE / Number.EPSILON);
|
|
1511
|
+
g.nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1512
|
+
g.nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1513
|
+
g.nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1514
|
+
g.nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1515
|
+
g.nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER;
|
|
1516
|
+
nC3x_ = g.nC3_ * (g.nC3_ - 1) / 2;
|
|
1517
|
+
nC4x_ = g.nC4_ * (g.nC4_ + 1) / 2;
|
|
1518
|
+
g.CAP_C1 = 1 << 0;
|
|
1519
|
+
g.CAP_C1p = 1 << 1;
|
|
1520
|
+
g.CAP_C2 = 1 << 2;
|
|
1521
|
+
g.CAP_C3 = 1 << 3;
|
|
1522
|
+
g.CAP_C4 = 1 << 4;
|
|
1523
|
+
g.NONE = 0;
|
|
1524
|
+
g.ARC = 1 << 6;
|
|
1525
|
+
g.LATITUDE = 1 << 7 | CAP_NONE;
|
|
1526
|
+
g.LONGITUDE = 1 << 8 | g.CAP_C3;
|
|
1527
|
+
g.AZIMUTH = 1 << 9 | CAP_NONE;
|
|
1528
|
+
g.DISTANCE = 1 << 10 | g.CAP_C1;
|
|
1529
|
+
g.STANDARD = g.LATITUDE | g.LONGITUDE | g.AZIMUTH | g.DISTANCE;
|
|
1530
|
+
g.DISTANCE_IN = 1 << 11 | g.CAP_C1 | g.CAP_C1p;
|
|
1531
|
+
g.REDUCEDLENGTH = 1 << 12 | g.CAP_C1 | g.CAP_C2;
|
|
1532
|
+
g.GEODESICSCALE = 1 << 13 | g.CAP_C1 | g.CAP_C2;
|
|
1533
|
+
g.AREA = 1 << 14 | g.CAP_C4;
|
|
1534
|
+
g.ALL = OUT_ALL | CAP_ALL;
|
|
1535
|
+
g.LONG_UNROLL = 1 << 15;
|
|
1536
|
+
g.OUT_MASK = OUT_ALL | g.LONG_UNROLL;
|
|
1537
|
+
g.SinCosSeries = function(sinp, sinx, cosx, c2, delta) {
|
|
1538
|
+
if (delta !== void 0) {
|
|
1539
|
+
var h = delta / 2, sh = Math.sin(h), ch = Math.cos(h);
|
|
1540
|
+
return -2 * g.SinCosSeries(false, cosx * ch - sinx * sh, sinx * ch + cosx * sh, c2.map(function(v, i) {
|
|
1541
|
+
return (i % 2 ? -v : v) * Math.sin((2 * i + 1) * h);
|
|
1542
|
+
}));
|
|
1543
|
+
}
|
|
1544
|
+
var k = c2.length, n = k - (sinp ? 1 : 0), ar = 2 * (cosx - sinx) * (cosx + sinx), y0 = n & 1 ? c2[--k] : 0, y1 = 0;
|
|
1545
|
+
n = Math.floor(n / 2);
|
|
1546
|
+
while (n--) {
|
|
1547
|
+
y1 = ar * y0 - y1 + c2[--k];
|
|
1548
|
+
y0 = ar * y1 - y0 + c2[--k];
|
|
1549
|
+
}
|
|
1550
|
+
return sinp ? 2 * sinx * cosx * y0 : (
|
|
1551
|
+
// sin(2 * x) * y0
|
|
1552
|
+
cosx * (y0 - y1)
|
|
1553
|
+
);
|
|
1554
|
+
};
|
|
1555
|
+
astroid = function(x, y) {
|
|
1556
|
+
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;
|
|
1557
|
+
if (!(q === 0 && r <= 0)) {
|
|
1558
|
+
S = p2 * q / 4;
|
|
1559
|
+
r2 = m.sq(r);
|
|
1560
|
+
r3 = r * r2;
|
|
1561
|
+
disc = S * (S + 2 * r3);
|
|
1562
|
+
u = r;
|
|
1563
|
+
if (disc >= 0) {
|
|
1564
|
+
T3 = S + r3;
|
|
1565
|
+
T3 += T3 < 0 ? -Math.sqrt(disc) : Math.sqrt(disc);
|
|
1566
|
+
T = m.cbrt(T3);
|
|
1567
|
+
u += T + (T !== 0 ? r2 / T : 0);
|
|
1568
|
+
} else {
|
|
1569
|
+
ang = Math.atan2(Math.sqrt(-disc), -(S + r3));
|
|
1570
|
+
u += 2 * r * Math.cos(ang / 3);
|
|
1571
|
+
}
|
|
1572
|
+
v = Math.sqrt(m.sq(u) + q);
|
|
1573
|
+
uv = u < 0 ? q / (v - u) : u + v;
|
|
1574
|
+
w = (uv - q) / (2 * v);
|
|
1575
|
+
k = uv / (Math.sqrt(uv + m.sq(w)) + w);
|
|
1576
|
+
} else {
|
|
1577
|
+
k = 0;
|
|
1578
|
+
}
|
|
1579
|
+
return k;
|
|
1580
|
+
};
|
|
1581
|
+
A1m1f_coeff = [
|
|
1582
|
+
// (1-eps)*A1-1, polynomial in eps2 of order 3
|
|
1583
|
+
1,
|
|
1584
|
+
4,
|
|
1585
|
+
64,
|
|
1586
|
+
0,
|
|
1587
|
+
256
|
|
1588
|
+
];
|
|
1589
|
+
g.A1m1f = function(eps) {
|
|
1590
|
+
var p2 = Math.floor(nA1_ / 2), t = m.polyval(p2, A1m1f_coeff, 0, m.sq(eps)) / A1m1f_coeff[p2 + 1];
|
|
1591
|
+
return (t + eps) / (1 - eps);
|
|
1592
|
+
};
|
|
1593
|
+
C1f_coeff = [
|
|
1594
|
+
// C1[1]/eps^1, polynomial in eps2 of order 2
|
|
1595
|
+
-1,
|
|
1596
|
+
6,
|
|
1597
|
+
-16,
|
|
1598
|
+
32,
|
|
1599
|
+
// C1[2]/eps^2, polynomial in eps2 of order 2
|
|
1600
|
+
-9,
|
|
1601
|
+
64,
|
|
1602
|
+
-128,
|
|
1603
|
+
2048,
|
|
1604
|
+
// C1[3]/eps^3, polynomial in eps2 of order 1
|
|
1605
|
+
9,
|
|
1606
|
+
-16,
|
|
1607
|
+
768,
|
|
1608
|
+
// C1[4]/eps^4, polynomial in eps2 of order 1
|
|
1609
|
+
3,
|
|
1610
|
+
-5,
|
|
1611
|
+
512,
|
|
1612
|
+
// C1[5]/eps^5, polynomial in eps2 of order 0
|
|
1613
|
+
-7,
|
|
1614
|
+
1280,
|
|
1615
|
+
// C1[6]/eps^6, polynomial in eps2 of order 0
|
|
1616
|
+
-7,
|
|
1617
|
+
2048
|
|
1618
|
+
];
|
|
1619
|
+
g.C1f = function(eps, c2) {
|
|
1620
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1621
|
+
for (l2 = 1; l2 <= g.nC1_; ++l2) {
|
|
1622
|
+
p2 = Math.floor((g.nC1_ - l2) / 2);
|
|
1623
|
+
c2[l2] = d * m.polyval(p2, C1f_coeff, o, eps2) / C1f_coeff[o + p2 + 1];
|
|
1624
|
+
o += p2 + 2;
|
|
1625
|
+
d *= eps;
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
C1pf_coeff = [
|
|
1629
|
+
// C1p[1]/eps^1, polynomial in eps2 of order 2
|
|
1630
|
+
205,
|
|
1631
|
+
-432,
|
|
1632
|
+
768,
|
|
1633
|
+
1536,
|
|
1634
|
+
// C1p[2]/eps^2, polynomial in eps2 of order 2
|
|
1635
|
+
4005,
|
|
1636
|
+
-4736,
|
|
1637
|
+
3840,
|
|
1638
|
+
12288,
|
|
1639
|
+
// C1p[3]/eps^3, polynomial in eps2 of order 1
|
|
1640
|
+
-225,
|
|
1641
|
+
116,
|
|
1642
|
+
384,
|
|
1643
|
+
// C1p[4]/eps^4, polynomial in eps2 of order 1
|
|
1644
|
+
-7173,
|
|
1645
|
+
2695,
|
|
1646
|
+
7680,
|
|
1647
|
+
// C1p[5]/eps^5, polynomial in eps2 of order 0
|
|
1648
|
+
3467,
|
|
1649
|
+
7680,
|
|
1650
|
+
// C1p[6]/eps^6, polynomial in eps2 of order 0
|
|
1651
|
+
38081,
|
|
1652
|
+
61440
|
|
1653
|
+
];
|
|
1654
|
+
g.C1pf = function(eps, c2) {
|
|
1655
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1656
|
+
for (l2 = 1; l2 <= g.nC1p_; ++l2) {
|
|
1657
|
+
p2 = Math.floor((g.nC1p_ - l2) / 2);
|
|
1658
|
+
c2[l2] = d * m.polyval(p2, C1pf_coeff, o, eps2) / C1pf_coeff[o + p2 + 1];
|
|
1659
|
+
o += p2 + 2;
|
|
1660
|
+
d *= eps;
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
A2m1f_coeff = [
|
|
1664
|
+
// (eps+1)*A2-1, polynomial in eps2 of order 3
|
|
1665
|
+
-11,
|
|
1666
|
+
-28,
|
|
1667
|
+
-192,
|
|
1668
|
+
0,
|
|
1669
|
+
256
|
|
1670
|
+
];
|
|
1671
|
+
g.A2m1f = function(eps) {
|
|
1672
|
+
var p2 = Math.floor(nA2_ / 2), t = m.polyval(p2, A2m1f_coeff, 0, m.sq(eps)) / A2m1f_coeff[p2 + 1];
|
|
1673
|
+
return (t - eps) / (1 + eps);
|
|
1674
|
+
};
|
|
1675
|
+
C2f_coeff = [
|
|
1676
|
+
// C2[1]/eps^1, polynomial in eps2 of order 2
|
|
1677
|
+
1,
|
|
1678
|
+
2,
|
|
1679
|
+
16,
|
|
1680
|
+
32,
|
|
1681
|
+
// C2[2]/eps^2, polynomial in eps2 of order 2
|
|
1682
|
+
35,
|
|
1683
|
+
64,
|
|
1684
|
+
384,
|
|
1685
|
+
2048,
|
|
1686
|
+
// C2[3]/eps^3, polynomial in eps2 of order 1
|
|
1687
|
+
15,
|
|
1688
|
+
80,
|
|
1689
|
+
768,
|
|
1690
|
+
// C2[4]/eps^4, polynomial in eps2 of order 1
|
|
1691
|
+
7,
|
|
1692
|
+
35,
|
|
1693
|
+
512,
|
|
1694
|
+
// C2[5]/eps^5, polynomial in eps2 of order 0
|
|
1695
|
+
63,
|
|
1696
|
+
1280,
|
|
1697
|
+
// C2[6]/eps^6, polynomial in eps2 of order 0
|
|
1698
|
+
77,
|
|
1699
|
+
2048
|
|
1700
|
+
];
|
|
1701
|
+
g.C2f = function(eps, c2) {
|
|
1702
|
+
var eps2 = m.sq(eps), d = eps, o = 0, l2, p2;
|
|
1703
|
+
for (l2 = 1; l2 <= g.nC2_; ++l2) {
|
|
1704
|
+
p2 = Math.floor((g.nC2_ - l2) / 2);
|
|
1705
|
+
c2[l2] = d * m.polyval(p2, C2f_coeff, o, eps2) / C2f_coeff[o + p2 + 1];
|
|
1706
|
+
o += p2 + 2;
|
|
1707
|
+
d *= eps;
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
g.Geodesic = function(a, f) {
|
|
1711
|
+
this.a = a;
|
|
1712
|
+
this.f = f;
|
|
1713
|
+
this._f1 = 1 - this.f;
|
|
1714
|
+
this._e2 = this.f * (2 - this.f);
|
|
1715
|
+
this._ep2 = this._e2 / m.sq(this._f1);
|
|
1716
|
+
this._n = this.f / (2 - this.f);
|
|
1717
|
+
this._b = this.a * this._f1;
|
|
1718
|
+
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;
|
|
1719
|
+
this._etol2 = 0.1 * tol2_ / Math.sqrt(Math.max(1e-3, Math.abs(this.f)) * Math.min(1, 1 - this.f / 2) / 2);
|
|
1720
|
+
if (!(isFinite(this.a) && this.a > 0))
|
|
1721
|
+
throw new Error("Equatorial radius is not positive");
|
|
1722
|
+
if (!(isFinite(this._b) && this._b > 0))
|
|
1723
|
+
throw new Error("Polar semi-axis is not positive");
|
|
1724
|
+
this._A3x = new Array(nA3x_);
|
|
1725
|
+
this._C3x = new Array(nC3x_);
|
|
1726
|
+
this._C4x = new Array(nC4x_);
|
|
1727
|
+
this.A3coeff();
|
|
1728
|
+
this.C3coeff();
|
|
1729
|
+
this.C4coeff();
|
|
1730
|
+
};
|
|
1731
|
+
A3_coeff = [
|
|
1732
|
+
// A3, coeff of eps^5, polynomial in n of order 0
|
|
1733
|
+
-3,
|
|
1734
|
+
128,
|
|
1735
|
+
// A3, coeff of eps^4, polynomial in n of order 1
|
|
1736
|
+
-2,
|
|
1737
|
+
-3,
|
|
1738
|
+
64,
|
|
1739
|
+
// A3, coeff of eps^3, polynomial in n of order 2
|
|
1740
|
+
-1,
|
|
1741
|
+
-3,
|
|
1742
|
+
-1,
|
|
1743
|
+
16,
|
|
1744
|
+
// A3, coeff of eps^2, polynomial in n of order 2
|
|
1745
|
+
3,
|
|
1746
|
+
-1,
|
|
1747
|
+
-2,
|
|
1748
|
+
8,
|
|
1749
|
+
// A3, coeff of eps^1, polynomial in n of order 1
|
|
1750
|
+
1,
|
|
1751
|
+
-1,
|
|
1752
|
+
2,
|
|
1753
|
+
// A3, coeff of eps^0, polynomial in n of order 0
|
|
1754
|
+
1,
|
|
1755
|
+
1
|
|
1756
|
+
];
|
|
1757
|
+
g.Geodesic.prototype.A3coeff = function() {
|
|
1758
|
+
var o = 0, k = 0, j, p2;
|
|
1759
|
+
for (j = nA3_ - 1; j >= 0; --j) {
|
|
1760
|
+
p2 = Math.min(nA3_ - j - 1, j);
|
|
1761
|
+
this._A3x[k++] = m.polyval(p2, A3_coeff, o, this._n) / A3_coeff[o + p2 + 1];
|
|
1762
|
+
o += p2 + 2;
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
C3_coeff = [
|
|
1766
|
+
// C3[1], coeff of eps^5, polynomial in n of order 0
|
|
1767
|
+
3,
|
|
1768
|
+
128,
|
|
1769
|
+
// C3[1], coeff of eps^4, polynomial in n of order 1
|
|
1770
|
+
2,
|
|
1771
|
+
5,
|
|
1772
|
+
128,
|
|
1773
|
+
// C3[1], coeff of eps^3, polynomial in n of order 2
|
|
1774
|
+
-1,
|
|
1775
|
+
3,
|
|
1776
|
+
3,
|
|
1777
|
+
64,
|
|
1778
|
+
// C3[1], coeff of eps^2, polynomial in n of order 2
|
|
1779
|
+
-1,
|
|
1780
|
+
0,
|
|
1781
|
+
1,
|
|
1782
|
+
8,
|
|
1783
|
+
// C3[1], coeff of eps^1, polynomial in n of order 1
|
|
1784
|
+
-1,
|
|
1785
|
+
1,
|
|
1786
|
+
4,
|
|
1787
|
+
// C3[2], coeff of eps^5, polynomial in n of order 0
|
|
1788
|
+
5,
|
|
1789
|
+
256,
|
|
1790
|
+
// C3[2], coeff of eps^4, polynomial in n of order 1
|
|
1791
|
+
1,
|
|
1792
|
+
3,
|
|
1793
|
+
128,
|
|
1794
|
+
// C3[2], coeff of eps^3, polynomial in n of order 2
|
|
1795
|
+
-3,
|
|
1796
|
+
-2,
|
|
1797
|
+
3,
|
|
1798
|
+
64,
|
|
1799
|
+
// C3[2], coeff of eps^2, polynomial in n of order 2
|
|
1800
|
+
1,
|
|
1801
|
+
-3,
|
|
1802
|
+
2,
|
|
1803
|
+
32,
|
|
1804
|
+
// C3[3], coeff of eps^5, polynomial in n of order 0
|
|
1805
|
+
7,
|
|
1806
|
+
512,
|
|
1807
|
+
// C3[3], coeff of eps^4, polynomial in n of order 1
|
|
1808
|
+
-10,
|
|
1809
|
+
9,
|
|
1810
|
+
384,
|
|
1811
|
+
// C3[3], coeff of eps^3, polynomial in n of order 2
|
|
1812
|
+
5,
|
|
1813
|
+
-9,
|
|
1814
|
+
5,
|
|
1815
|
+
192,
|
|
1816
|
+
// C3[4], coeff of eps^5, polynomial in n of order 0
|
|
1817
|
+
7,
|
|
1818
|
+
512,
|
|
1819
|
+
// C3[4], coeff of eps^4, polynomial in n of order 1
|
|
1820
|
+
-14,
|
|
1821
|
+
7,
|
|
1822
|
+
512,
|
|
1823
|
+
// C3[5], coeff of eps^5, polynomial in n of order 0
|
|
1824
|
+
21,
|
|
1825
|
+
2560
|
|
1826
|
+
];
|
|
1827
|
+
g.Geodesic.prototype.C3coeff = function() {
|
|
1828
|
+
var o = 0, k = 0, l2, j, p2;
|
|
1829
|
+
for (l2 = 1; l2 < g.nC3_; ++l2) {
|
|
1830
|
+
for (j = g.nC3_ - 1; j >= l2; --j) {
|
|
1831
|
+
p2 = Math.min(g.nC3_ - j - 1, j);
|
|
1832
|
+
this._C3x[k++] = m.polyval(p2, C3_coeff, o, this._n) / C3_coeff[o + p2 + 1];
|
|
1833
|
+
o += p2 + 2;
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
C4_coeff = [
|
|
1838
|
+
// C4[0], coeff of eps^5, polynomial in n of order 0
|
|
1839
|
+
97,
|
|
1840
|
+
15015,
|
|
1841
|
+
// C4[0], coeff of eps^4, polynomial in n of order 1
|
|
1842
|
+
1088,
|
|
1843
|
+
156,
|
|
1844
|
+
45045,
|
|
1845
|
+
// C4[0], coeff of eps^3, polynomial in n of order 2
|
|
1846
|
+
-224,
|
|
1847
|
+
-4784,
|
|
1848
|
+
1573,
|
|
1849
|
+
45045,
|
|
1850
|
+
// C4[0], coeff of eps^2, polynomial in n of order 3
|
|
1851
|
+
-10656,
|
|
1852
|
+
14144,
|
|
1853
|
+
-4576,
|
|
1854
|
+
-858,
|
|
1855
|
+
45045,
|
|
1856
|
+
// C4[0], coeff of eps^1, polynomial in n of order 4
|
|
1857
|
+
64,
|
|
1858
|
+
624,
|
|
1859
|
+
-4576,
|
|
1860
|
+
6864,
|
|
1861
|
+
-3003,
|
|
1862
|
+
15015,
|
|
1863
|
+
// C4[0], coeff of eps^0, polynomial in n of order 5
|
|
1864
|
+
100,
|
|
1865
|
+
208,
|
|
1866
|
+
572,
|
|
1867
|
+
3432,
|
|
1868
|
+
-12012,
|
|
1869
|
+
30030,
|
|
1870
|
+
45045,
|
|
1871
|
+
// C4[1], coeff of eps^5, polynomial in n of order 0
|
|
1872
|
+
1,
|
|
1873
|
+
9009,
|
|
1874
|
+
// C4[1], coeff of eps^4, polynomial in n of order 1
|
|
1875
|
+
-2944,
|
|
1876
|
+
468,
|
|
1877
|
+
135135,
|
|
1878
|
+
// C4[1], coeff of eps^3, polynomial in n of order 2
|
|
1879
|
+
5792,
|
|
1880
|
+
1040,
|
|
1881
|
+
-1287,
|
|
1882
|
+
135135,
|
|
1883
|
+
// C4[1], coeff of eps^2, polynomial in n of order 3
|
|
1884
|
+
5952,
|
|
1885
|
+
-11648,
|
|
1886
|
+
9152,
|
|
1887
|
+
-2574,
|
|
1888
|
+
135135,
|
|
1889
|
+
// C4[1], coeff of eps^1, polynomial in n of order 4
|
|
1890
|
+
-64,
|
|
1891
|
+
-624,
|
|
1892
|
+
4576,
|
|
1893
|
+
-6864,
|
|
1894
|
+
3003,
|
|
1895
|
+
135135,
|
|
1896
|
+
// C4[2], coeff of eps^5, polynomial in n of order 0
|
|
1897
|
+
8,
|
|
1898
|
+
10725,
|
|
1899
|
+
// C4[2], coeff of eps^4, polynomial in n of order 1
|
|
1900
|
+
1856,
|
|
1901
|
+
-936,
|
|
1902
|
+
225225,
|
|
1903
|
+
// C4[2], coeff of eps^3, polynomial in n of order 2
|
|
1904
|
+
-8448,
|
|
1905
|
+
4992,
|
|
1906
|
+
-1144,
|
|
1907
|
+
225225,
|
|
1908
|
+
// C4[2], coeff of eps^2, polynomial in n of order 3
|
|
1909
|
+
-1440,
|
|
1910
|
+
4160,
|
|
1911
|
+
-4576,
|
|
1912
|
+
1716,
|
|
1913
|
+
225225,
|
|
1914
|
+
// C4[3], coeff of eps^5, polynomial in n of order 0
|
|
1915
|
+
-136,
|
|
1916
|
+
63063,
|
|
1917
|
+
// C4[3], coeff of eps^4, polynomial in n of order 1
|
|
1918
|
+
1024,
|
|
1919
|
+
-208,
|
|
1920
|
+
105105,
|
|
1921
|
+
// C4[3], coeff of eps^3, polynomial in n of order 2
|
|
1922
|
+
3584,
|
|
1923
|
+
-3328,
|
|
1924
|
+
1144,
|
|
1925
|
+
315315,
|
|
1926
|
+
// C4[4], coeff of eps^5, polynomial in n of order 0
|
|
1927
|
+
-128,
|
|
1928
|
+
135135,
|
|
1929
|
+
// C4[4], coeff of eps^4, polynomial in n of order 1
|
|
1930
|
+
-2560,
|
|
1931
|
+
832,
|
|
1932
|
+
405405,
|
|
1933
|
+
// C4[5], coeff of eps^5, polynomial in n of order 0
|
|
1934
|
+
128,
|
|
1935
|
+
99099
|
|
1936
|
+
];
|
|
1937
|
+
g.Geodesic.prototype.C4coeff = function() {
|
|
1938
|
+
var o = 0, k = 0, l2, j, p2;
|
|
1939
|
+
for (l2 = 0; l2 < g.nC4_; ++l2) {
|
|
1940
|
+
for (j = g.nC4_ - 1; j >= l2; --j) {
|
|
1941
|
+
p2 = g.nC4_ - j - 1;
|
|
1942
|
+
this._C4x[k++] = m.polyval(p2, C4_coeff, o, this._n) / C4_coeff[o + p2 + 1];
|
|
1943
|
+
o += p2 + 2;
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
g.Geodesic.prototype.A3f = function(eps) {
|
|
1948
|
+
return m.polyval(nA3x_ - 1, this._A3x, 0, eps);
|
|
1949
|
+
};
|
|
1950
|
+
g.Geodesic.prototype.C3f = function(eps, c2) {
|
|
1951
|
+
var mult = 1, o = 0, l2, p2;
|
|
1952
|
+
for (l2 = 1; l2 < g.nC3_; ++l2) {
|
|
1953
|
+
p2 = g.nC3_ - l2 - 1;
|
|
1954
|
+
mult *= eps;
|
|
1955
|
+
c2[l2] = mult * m.polyval(p2, this._C3x, o, eps);
|
|
1956
|
+
o += p2 + 1;
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
g.Geodesic.prototype.C4f = function(eps, c2) {
|
|
1960
|
+
var mult = 1, o = 0, l2, p2;
|
|
1961
|
+
for (l2 = 0; l2 < g.nC4_; ++l2) {
|
|
1962
|
+
p2 = g.nC4_ - l2 - 1;
|
|
1963
|
+
c2[l2] = mult * m.polyval(p2, this._C4x, o, eps);
|
|
1964
|
+
o += p2 + 1;
|
|
1965
|
+
mult *= eps;
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
g.Geodesic.prototype.Lengths = function(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask, C1a, C2a) {
|
|
1969
|
+
outmask &= g.OUT_MASK;
|
|
1970
|
+
var vals = {}, m0x = 0, J12 = 0, A1 = 0, A2 = 0, B1, B2, l2, csig12, t;
|
|
1971
|
+
if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
1972
|
+
A1 = g.A1m1f(eps);
|
|
1973
|
+
g.C1f(eps, C1a);
|
|
1974
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
1975
|
+
A2 = g.A2m1f(eps);
|
|
1976
|
+
g.C2f(eps, C2a);
|
|
1977
|
+
m0x = A1 - A2;
|
|
1978
|
+
A2 = 1 + A2;
|
|
1979
|
+
}
|
|
1980
|
+
A1 = 1 + A1;
|
|
1981
|
+
}
|
|
1982
|
+
if (outmask & g.DISTANCE) {
|
|
1983
|
+
B1 = g.SinCosSeries(true, ssig2, csig2, C1a) - g.SinCosSeries(true, ssig1, csig1, C1a);
|
|
1984
|
+
vals.s12b = A1 * (sig12 + B1);
|
|
1985
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
1986
|
+
B2 = g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a);
|
|
1987
|
+
J12 = m0x * sig12 + (A1 * B1 - A2 * B2);
|
|
1988
|
+
}
|
|
1989
|
+
} else if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
1990
|
+
for (l2 = 1; l2 <= g.nC2_; ++l2)
|
|
1991
|
+
C2a[l2] = A1 * C1a[l2] - A2 * C2a[l2];
|
|
1992
|
+
J12 = m0x * sig12 + (g.SinCosSeries(true, ssig2, csig2, C2a) - g.SinCosSeries(true, ssig1, csig1, C2a));
|
|
1993
|
+
}
|
|
1994
|
+
if (outmask & g.REDUCEDLENGTH) {
|
|
1995
|
+
vals.m0 = m0x;
|
|
1996
|
+
vals.m12b = dn2 * (csig1 * ssig2) - dn1 * (ssig1 * csig2) - csig1 * csig2 * J12;
|
|
1997
|
+
} else
|
|
1998
|
+
vals.m12b = NaN;
|
|
1999
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2000
|
+
csig12 = csig1 * csig2 + ssig1 * ssig2;
|
|
2001
|
+
t = this._ep2 * (cbet1 - cbet2) * (cbet1 + cbet2) / (dn1 + dn2);
|
|
2002
|
+
vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * ssig1 / dn1;
|
|
2003
|
+
vals.M21 = csig12 - (t * ssig1 - csig1 * J12) * ssig2 / dn2;
|
|
2004
|
+
}
|
|
2005
|
+
return vals;
|
|
2006
|
+
};
|
|
2007
|
+
g.Geodesic.prototype.InverseStart = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a) {
|
|
2008
|
+
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;
|
|
2009
|
+
vals.sig12 = -1;
|
|
2010
|
+
sbet12a = sbet2 * cbet1;
|
|
2011
|
+
sbet12a += cbet2 * sbet1;
|
|
2012
|
+
shortline = cbet12 >= 0 && sbet12 < 0.5 && cbet2 * lam12 < 0.5;
|
|
2013
|
+
if (shortline) {
|
|
2014
|
+
sbetm2 = m.sq(sbet1 + sbet2);
|
|
2015
|
+
sbetm2 /= sbetm2 + m.sq(cbet1 + cbet2);
|
|
2016
|
+
vals.dnm = Math.sqrt(1 + this._ep2 * sbetm2);
|
|
2017
|
+
omg12 = lam12 / (this._f1 * vals.dnm);
|
|
2018
|
+
somg12 = Math.sin(omg12);
|
|
2019
|
+
comg12 = Math.cos(omg12);
|
|
2020
|
+
} else {
|
|
2021
|
+
somg12 = slam12;
|
|
2022
|
+
comg12 = clam12;
|
|
2023
|
+
}
|
|
2024
|
+
vals.salp1 = cbet2 * somg12;
|
|
2025
|
+
vals.calp1 = comg12 >= 0 ? sbet12 + cbet2 * sbet1 * m.sq(somg12) / (1 + comg12) : sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
|
|
2026
|
+
ssig12 = m.hypot(vals.salp1, vals.calp1);
|
|
2027
|
+
csig12 = sbet1 * sbet2 + cbet1 * cbet2 * comg12;
|
|
2028
|
+
if (shortline && ssig12 < this._etol2) {
|
|
2029
|
+
vals.salp2 = cbet1 * somg12;
|
|
2030
|
+
vals.calp2 = sbet12 - cbet1 * sbet2 * (comg12 >= 0 ? m.sq(somg12) / (1 + comg12) : 1 - comg12);
|
|
2031
|
+
t = m.hypot(vals.salp2, vals.calp2);
|
|
2032
|
+
vals.salp2 /= t;
|
|
2033
|
+
vals.calp2 /= t;
|
|
2034
|
+
vals.sig12 = Math.atan2(ssig12, csig12);
|
|
2035
|
+
} else if (Math.abs(this._n) > 0.1 || // Skip astroid calc if too eccentric
|
|
2036
|
+
csig12 >= 0 || ssig12 >= 6 * Math.abs(this._n) * Math.PI * m.sq(cbet1)) {
|
|
2037
|
+
} else {
|
|
2038
|
+
lam12x = Math.atan2(-slam12, -clam12);
|
|
2039
|
+
if (this.f >= 0) {
|
|
2040
|
+
k2 = m.sq(sbet1) * this._ep2;
|
|
2041
|
+
eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2042
|
+
lamscale = this.f * cbet1 * this.A3f(eps) * Math.PI;
|
|
2043
|
+
betscale = lamscale * cbet1;
|
|
2044
|
+
x = lam12x / lamscale;
|
|
2045
|
+
y = sbet12a / betscale;
|
|
2046
|
+
} else {
|
|
2047
|
+
cbet12a = cbet2 * cbet1 - sbet2 * sbet1;
|
|
2048
|
+
bet12a = Math.atan2(sbet12a, cbet12a);
|
|
2049
|
+
nvals = this.Lengths(this._n, Math.PI + bet12a, sbet1, -cbet1, dn1, sbet2, cbet2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
|
|
2050
|
+
m12b = nvals.m12b;
|
|
2051
|
+
m0 = nvals.m0;
|
|
2052
|
+
x = -1 + m12b / (cbet1 * cbet2 * m0 * Math.PI);
|
|
2053
|
+
betscale = x < -0.01 ? sbet12a / x : -this.f * m.sq(cbet1) * Math.PI;
|
|
2054
|
+
lamscale = betscale / cbet1;
|
|
2055
|
+
y = lam12 / lamscale;
|
|
2056
|
+
}
|
|
2057
|
+
if (y > -tol1_ && x > -1 - xthresh_) {
|
|
2058
|
+
if (this.f >= 0) {
|
|
2059
|
+
vals.salp1 = Math.min(1, -x);
|
|
2060
|
+
vals.calp1 = -Math.sqrt(1 - m.sq(vals.salp1));
|
|
2061
|
+
} else {
|
|
2062
|
+
vals.calp1 = Math.max(x > -tol1_ ? 0 : -1, x);
|
|
2063
|
+
vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1));
|
|
2064
|
+
}
|
|
2065
|
+
} else {
|
|
2066
|
+
k = astroid(x, y);
|
|
2067
|
+
omg12a = lamscale * (this.f >= 0 ? -x * k / (1 + k) : -y * (1 + k) / k);
|
|
2068
|
+
somg12 = Math.sin(omg12a);
|
|
2069
|
+
comg12 = -Math.cos(omg12a);
|
|
2070
|
+
vals.salp1 = cbet2 * somg12;
|
|
2071
|
+
vals.calp1 = sbet12a - cbet2 * sbet1 * m.sq(somg12) / (1 - comg12);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
if (!(vals.salp1 <= 0)) {
|
|
2075
|
+
t = m.hypot(vals.salp1, vals.calp1);
|
|
2076
|
+
vals.salp1 /= t;
|
|
2077
|
+
vals.calp1 /= t;
|
|
2078
|
+
} else {
|
|
2079
|
+
vals.salp1 = 1;
|
|
2080
|
+
vals.calp1 = 0;
|
|
2081
|
+
}
|
|
2082
|
+
return vals;
|
|
2083
|
+
};
|
|
2084
|
+
g.Geodesic.prototype.Lambda12 = function(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam120, clam120, diffp, C1a, C2a, C3a) {
|
|
2085
|
+
var vals = {}, t, salp0, calp0, somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals;
|
|
2086
|
+
if (sbet1 === 0 && calp1 === 0)
|
|
2087
|
+
calp1 = -g.tiny_;
|
|
2088
|
+
salp0 = salp1 * cbet1;
|
|
2089
|
+
calp0 = m.hypot(calp1, salp1 * sbet1);
|
|
2090
|
+
vals.ssig1 = sbet1;
|
|
2091
|
+
somg1 = salp0 * sbet1;
|
|
2092
|
+
vals.csig1 = comg1 = calp1 * cbet1;
|
|
2093
|
+
t = m.hypot(vals.ssig1, vals.csig1);
|
|
2094
|
+
vals.ssig1 /= t;
|
|
2095
|
+
vals.csig1 /= t;
|
|
2096
|
+
vals.salp2 = cbet2 !== cbet1 ? salp0 / cbet2 : salp1;
|
|
2097
|
+
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);
|
|
2098
|
+
vals.ssig2 = sbet2;
|
|
2099
|
+
somg2 = salp0 * sbet2;
|
|
2100
|
+
vals.csig2 = comg2 = vals.calp2 * cbet2;
|
|
2101
|
+
t = m.hypot(vals.ssig2, vals.csig2);
|
|
2102
|
+
vals.ssig2 /= t;
|
|
2103
|
+
vals.csig2 /= t;
|
|
2104
|
+
vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 - vals.ssig1 * vals.csig2), vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2);
|
|
2105
|
+
somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
|
|
2106
|
+
comg12 = comg1 * comg2 + somg1 * somg2;
|
|
2107
|
+
eta = Math.atan2(somg12 * clam120 - comg12 * slam120, comg12 * clam120 + somg12 * slam120);
|
|
2108
|
+
k2 = m.sq(calp0) * this._ep2;
|
|
2109
|
+
vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2110
|
+
this.C3f(vals.eps, C3a);
|
|
2111
|
+
B312 = g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a) - g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a);
|
|
2112
|
+
vals.domg12 = -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312);
|
|
2113
|
+
vals.lam12 = eta + vals.domg12;
|
|
2114
|
+
if (diffp) {
|
|
2115
|
+
if (vals.calp2 === 0)
|
|
2116
|
+
vals.dlam12 = -2 * this._f1 * dn1 / sbet1;
|
|
2117
|
+
else {
|
|
2118
|
+
nvals = this.Lengths(vals.eps, vals.sig12, vals.ssig1, vals.csig1, dn1, vals.ssig2, vals.csig2, dn2, cbet1, cbet2, g.REDUCEDLENGTH, C1a, C2a);
|
|
2119
|
+
vals.dlam12 = nvals.m12b;
|
|
2120
|
+
vals.dlam12 *= this._f1 / (vals.calp2 * cbet2);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
return vals;
|
|
2124
|
+
};
|
|
2125
|
+
g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) {
|
|
2126
|
+
var r, vals;
|
|
2127
|
+
if (!outmask)
|
|
2128
|
+
outmask = g.STANDARD;
|
|
2129
|
+
if (outmask === g.LONG_UNROLL)
|
|
2130
|
+
outmask |= g.STANDARD;
|
|
2131
|
+
outmask &= g.OUT_MASK;
|
|
2132
|
+
r = this.InverseInt(lat1, lon1, lat2, lon2, outmask);
|
|
2133
|
+
vals = r.vals;
|
|
2134
|
+
if (outmask & g.AZIMUTH) {
|
|
2135
|
+
vals.azi1 = m.atan2d(r.salp1, r.calp1);
|
|
2136
|
+
vals.azi2 = m.atan2d(r.salp2, r.calp2);
|
|
2137
|
+
}
|
|
2138
|
+
return vals;
|
|
2139
|
+
};
|
|
2140
|
+
g.Geodesic.prototype.InverseInt = function(lat1, lon1, lat2, lon2, outmask) {
|
|
2141
|
+
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;
|
|
2142
|
+
vals.lat1 = lat1 = m.LatFix(lat1);
|
|
2143
|
+
vals.lat2 = lat2 = m.LatFix(lat2);
|
|
2144
|
+
lat1 = m.AngRound(lat1);
|
|
2145
|
+
lat2 = m.AngRound(lat2);
|
|
2146
|
+
lon12 = m.AngDiff(lon1, lon2);
|
|
2147
|
+
lon12s = lon12.e;
|
|
2148
|
+
lon12 = lon12.d;
|
|
2149
|
+
if (outmask & g.LONG_UNROLL) {
|
|
2150
|
+
vals.lon1 = lon1;
|
|
2151
|
+
vals.lon2 = lon1 + lon12 + lon12s;
|
|
2152
|
+
} else {
|
|
2153
|
+
vals.lon1 = m.AngNormalize(lon1);
|
|
2154
|
+
vals.lon2 = m.AngNormalize(lon2);
|
|
2155
|
+
}
|
|
2156
|
+
lonsign = m.copysign(1, lon12);
|
|
2157
|
+
lon12 *= lonsign;
|
|
2158
|
+
lon12s *= lonsign;
|
|
2159
|
+
lam12 = lon12 * m.degree;
|
|
2160
|
+
t = m.sincosde(lon12, lon12s);
|
|
2161
|
+
slam12 = t.s;
|
|
2162
|
+
clam12 = t.c;
|
|
2163
|
+
lon12s = 180 - lon12 - lon12s;
|
|
2164
|
+
swapp = Math.abs(lat1) < Math.abs(lat2) || isNaN(lat2) ? -1 : 1;
|
|
2165
|
+
if (swapp < 0) {
|
|
2166
|
+
lonsign *= -1;
|
|
2167
|
+
[lat2, lat1] = [lat1, lat2];
|
|
2168
|
+
}
|
|
2169
|
+
latsign = m.copysign(1, -lat1);
|
|
2170
|
+
lat1 *= latsign;
|
|
2171
|
+
lat2 *= latsign;
|
|
2172
|
+
t = m.sincosd(lat1);
|
|
2173
|
+
sbet1 = this._f1 * t.s;
|
|
2174
|
+
cbet1 = t.c;
|
|
2175
|
+
t = m.hypot(sbet1, cbet1);
|
|
2176
|
+
sbet1 /= t;
|
|
2177
|
+
cbet1 /= t;
|
|
2178
|
+
cbet1 = Math.max(g.tiny_, cbet1);
|
|
2179
|
+
t = m.sincosd(lat2);
|
|
2180
|
+
sbet2 = this._f1 * t.s;
|
|
2181
|
+
cbet2 = t.c;
|
|
2182
|
+
t = m.hypot(sbet2, cbet2);
|
|
2183
|
+
sbet2 /= t;
|
|
2184
|
+
cbet2 /= t;
|
|
2185
|
+
cbet2 = Math.max(g.tiny_, cbet2);
|
|
2186
|
+
if (cbet1 < -sbet1) {
|
|
2187
|
+
if (cbet2 === cbet1)
|
|
2188
|
+
sbet2 = m.copysign(sbet1, sbet2);
|
|
2189
|
+
} else {
|
|
2190
|
+
if (Math.abs(sbet2) === -sbet1)
|
|
2191
|
+
cbet2 = cbet1;
|
|
2192
|
+
}
|
|
2193
|
+
dn1 = Math.sqrt(1 + this._ep2 * m.sq(sbet1));
|
|
2194
|
+
dn2 = Math.sqrt(1 + this._ep2 * m.sq(sbet2));
|
|
2195
|
+
C1a = new Array(g.nC1_ + 1);
|
|
2196
|
+
C2a = new Array(g.nC2_ + 1);
|
|
2197
|
+
C3a = new Array(g.nC3_);
|
|
2198
|
+
meridian = lat1 === -90 || slam12 === 0;
|
|
2199
|
+
if (meridian) {
|
|
2200
|
+
calp1 = clam12;
|
|
2201
|
+
salp1 = slam12;
|
|
2202
|
+
calp2 = 1;
|
|
2203
|
+
salp2 = 0;
|
|
2204
|
+
ssig1 = sbet1;
|
|
2205
|
+
csig1 = calp1 * cbet1;
|
|
2206
|
+
ssig2 = sbet2;
|
|
2207
|
+
csig2 = calp2 * cbet2;
|
|
2208
|
+
sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2), csig1 * csig2 + ssig1 * ssig2);
|
|
2209
|
+
nvals = this.Lengths(this._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask | g.DISTANCE | g.REDUCEDLENGTH, C1a, C2a);
|
|
2210
|
+
s12x = nvals.s12b;
|
|
2211
|
+
m12x = nvals.m12b;
|
|
2212
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2213
|
+
vals.M12 = nvals.M12;
|
|
2214
|
+
vals.M21 = nvals.M21;
|
|
2215
|
+
}
|
|
2216
|
+
if (sig12 < tol2_ || m12x >= 0) {
|
|
2217
|
+
if (sig12 < 3 * g.tiny_ || // Prevent negative s12 or m12 for short lines
|
|
2218
|
+
sig12 < tol0_ && (s12x < 0 || m12x < 0))
|
|
2219
|
+
sig12 = m12x = s12x = 0;
|
|
2220
|
+
m12x *= this._b;
|
|
2221
|
+
s12x *= this._b;
|
|
2222
|
+
vals.a12 = sig12 / m.degree;
|
|
2223
|
+
} else
|
|
2224
|
+
meridian = false;
|
|
2225
|
+
}
|
|
2226
|
+
somg12 = 2;
|
|
2227
|
+
if (!meridian && sbet1 === 0 && // and sbet2 == 0
|
|
2228
|
+
(this.f <= 0 || lon12s >= this.f * 180)) {
|
|
2229
|
+
calp1 = calp2 = 0;
|
|
2230
|
+
salp1 = salp2 = 1;
|
|
2231
|
+
s12x = this.a * lam12;
|
|
2232
|
+
sig12 = omg12 = lam12 / this._f1;
|
|
2233
|
+
m12x = this._b * Math.sin(sig12);
|
|
2234
|
+
if (outmask & g.GEODESICSCALE)
|
|
2235
|
+
vals.M12 = vals.M21 = Math.cos(sig12);
|
|
2236
|
+
vals.a12 = lon12 / this._f1;
|
|
2237
|
+
} else if (!meridian) {
|
|
2238
|
+
nvals = this.InverseStart(sbet1, cbet1, dn1, sbet2, cbet2, dn2, lam12, slam12, clam12, C1a, C2a);
|
|
2239
|
+
sig12 = nvals.sig12;
|
|
2240
|
+
salp1 = nvals.salp1;
|
|
2241
|
+
calp1 = nvals.calp1;
|
|
2242
|
+
if (sig12 >= 0) {
|
|
2243
|
+
salp2 = nvals.salp2;
|
|
2244
|
+
calp2 = nvals.calp2;
|
|
2245
|
+
dnm = nvals.dnm;
|
|
2246
|
+
s12x = sig12 * this._b * dnm;
|
|
2247
|
+
m12x = m.sq(dnm) * this._b * Math.sin(sig12 / dnm);
|
|
2248
|
+
if (outmask & g.GEODESICSCALE)
|
|
2249
|
+
vals.M12 = vals.M21 = Math.cos(sig12 / dnm);
|
|
2250
|
+
vals.a12 = sig12 / m.degree;
|
|
2251
|
+
omg12 = lam12 / (this._f1 * dnm);
|
|
2252
|
+
} else {
|
|
2253
|
+
numit = 0;
|
|
2254
|
+
salp1a = g.tiny_;
|
|
2255
|
+
calp1a = 1;
|
|
2256
|
+
salp1b = g.tiny_;
|
|
2257
|
+
calp1b = -1;
|
|
2258
|
+
for (tripn = false, tripb = false; ; ++numit) {
|
|
2259
|
+
nvals = this.Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, slam12, clam12, numit < maxit1_, C1a, C2a, C3a);
|
|
2260
|
+
v = nvals.lam12;
|
|
2261
|
+
salp2 = nvals.salp2;
|
|
2262
|
+
calp2 = nvals.calp2;
|
|
2263
|
+
sig12 = nvals.sig12;
|
|
2264
|
+
ssig1 = nvals.ssig1;
|
|
2265
|
+
csig1 = nvals.csig1;
|
|
2266
|
+
ssig2 = nvals.ssig2;
|
|
2267
|
+
csig2 = nvals.csig2;
|
|
2268
|
+
eps = nvals.eps;
|
|
2269
|
+
domg12 = nvals.domg12;
|
|
2270
|
+
dv = nvals.dlam12;
|
|
2271
|
+
if (tripb || !(Math.abs(v) >= (tripn ? 8 : 1) * tol0_) || numit == maxit2_)
|
|
2272
|
+
break;
|
|
2273
|
+
if (v > 0 && (numit < maxit1_ || calp1 / salp1 > calp1b / salp1b)) {
|
|
2274
|
+
salp1b = salp1;
|
|
2275
|
+
calp1b = calp1;
|
|
2276
|
+
} else if (v < 0 && (numit < maxit1_ || calp1 / salp1 < calp1a / salp1a)) {
|
|
2277
|
+
salp1a = salp1;
|
|
2278
|
+
calp1a = calp1;
|
|
2279
|
+
}
|
|
2280
|
+
if (numit < maxit1_ && dv > 0) {
|
|
2281
|
+
dalp1 = -v / dv;
|
|
2282
|
+
if (Math.abs(dalp1) < Math.PI) {
|
|
2283
|
+
sdalp1 = Math.sin(dalp1);
|
|
2284
|
+
cdalp1 = Math.cos(dalp1);
|
|
2285
|
+
nsalp1 = salp1 * cdalp1 + calp1 * sdalp1;
|
|
2286
|
+
if (nsalp1 > 0) {
|
|
2287
|
+
calp1 = calp1 * cdalp1 - salp1 * sdalp1;
|
|
2288
|
+
salp1 = nsalp1;
|
|
2289
|
+
t = m.hypot(salp1, calp1);
|
|
2290
|
+
salp1 /= t;
|
|
2291
|
+
calp1 /= t;
|
|
2292
|
+
tripn = Math.abs(v) <= 16 * tol0_;
|
|
2293
|
+
continue;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
salp1 = (salp1a + salp1b) / 2;
|
|
2298
|
+
calp1 = (calp1a + calp1b) / 2;
|
|
2299
|
+
t = m.hypot(salp1, calp1);
|
|
2300
|
+
salp1 /= t;
|
|
2301
|
+
calp1 /= t;
|
|
2302
|
+
tripn = false;
|
|
2303
|
+
tripb = Math.abs(salp1a - salp1) + (calp1a - calp1) < tolb_ || Math.abs(salp1 - salp1b) + (calp1 - calp1b) < tolb_;
|
|
2304
|
+
}
|
|
2305
|
+
lengthmask = outmask | (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE) ? g.DISTANCE : g.NONE);
|
|
2306
|
+
nvals = this.Lengths(eps, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, lengthmask, C1a, C2a);
|
|
2307
|
+
s12x = nvals.s12b;
|
|
2308
|
+
m12x = nvals.m12b;
|
|
2309
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2310
|
+
vals.M12 = nvals.M12;
|
|
2311
|
+
vals.M21 = nvals.M21;
|
|
2312
|
+
}
|
|
2313
|
+
m12x *= this._b;
|
|
2314
|
+
s12x *= this._b;
|
|
2315
|
+
vals.a12 = sig12 / m.degree;
|
|
2316
|
+
if (outmask & g.AREA) {
|
|
2317
|
+
sdomg12 = Math.sin(domg12);
|
|
2318
|
+
cdomg12 = Math.cos(domg12);
|
|
2319
|
+
somg12 = slam12 * cdomg12 - clam12 * sdomg12;
|
|
2320
|
+
comg12 = clam12 * cdomg12 + slam12 * sdomg12;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
if (outmask & g.DISTANCE)
|
|
2325
|
+
vals.s12 = 0 + s12x;
|
|
2326
|
+
if (outmask & g.REDUCEDLENGTH)
|
|
2327
|
+
vals.m12 = 0 + m12x;
|
|
2328
|
+
if (outmask & g.AREA) {
|
|
2329
|
+
salp0 = salp1 * cbet1;
|
|
2330
|
+
calp0 = m.hypot(calp1, salp1 * sbet1);
|
|
2331
|
+
if (calp0 !== 0 && salp0 !== 0) {
|
|
2332
|
+
ssig1 = sbet1;
|
|
2333
|
+
csig1 = calp1 * cbet1;
|
|
2334
|
+
ssig2 = sbet2;
|
|
2335
|
+
csig2 = calp2 * cbet2;
|
|
2336
|
+
k2 = m.sq(calp0) * this._ep2;
|
|
2337
|
+
eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
|
|
2338
|
+
A4 = m.sq(this.a) * calp0 * salp0 * this._e2;
|
|
2339
|
+
t = m.hypot(ssig1, csig1);
|
|
2340
|
+
ssig1 /= t;
|
|
2341
|
+
csig1 /= t;
|
|
2342
|
+
t = m.hypot(ssig2, csig2);
|
|
2343
|
+
ssig2 /= t;
|
|
2344
|
+
csig2 /= t;
|
|
2345
|
+
C4a = new Array(g.nC4_);
|
|
2346
|
+
this.C4f(eps, C4a);
|
|
2347
|
+
B41 = g.SinCosSeries(false, ssig1, csig1, C4a);
|
|
2348
|
+
B42 = g.SinCosSeries(false, ssig2, csig2, C4a);
|
|
2349
|
+
vals.S12 = A4 * (sig12 < 0.01 ? g.SinCosSeries(false, ssig1, csig1, C4a, sig12) : B42 - B41);
|
|
2350
|
+
} else
|
|
2351
|
+
vals.S12 = 0;
|
|
2352
|
+
if (!meridian && somg12 == 2) {
|
|
2353
|
+
somg12 = Math.sin(omg12);
|
|
2354
|
+
comg12 = Math.cos(omg12);
|
|
2355
|
+
}
|
|
2356
|
+
if (!meridian && comg12 > -0.7071 && // Long difference not too big
|
|
2357
|
+
sbet2 - sbet1 < 1.75) {
|
|
2358
|
+
domg12 = 1 + comg12;
|
|
2359
|
+
dbet1 = 1 + cbet1;
|
|
2360
|
+
dbet2 = 1 + cbet2;
|
|
2361
|
+
alp12 = 2 * Math.atan2(somg12 * (sbet1 * dbet2 + sbet2 * dbet1), domg12 * (sbet1 * sbet2 + dbet1 * dbet2));
|
|
2362
|
+
} else {
|
|
2363
|
+
salp12 = salp2 * calp1 - calp2 * salp1;
|
|
2364
|
+
calp12 = calp2 * calp1 + salp2 * salp1;
|
|
2365
|
+
if (salp12 === 0 && calp12 < 0) {
|
|
2366
|
+
salp12 = g.tiny_ * calp1;
|
|
2367
|
+
calp12 = -1;
|
|
2368
|
+
}
|
|
2369
|
+
alp12 = Math.atan2(salp12, calp12);
|
|
2370
|
+
}
|
|
2371
|
+
vals.S12 += this._c2 * alp12;
|
|
2372
|
+
vals.S12 *= swapp * lonsign * latsign;
|
|
2373
|
+
vals.S12 += 0;
|
|
2374
|
+
}
|
|
2375
|
+
if (swapp < 0) {
|
|
2376
|
+
[salp2, salp1] = [salp1, salp2];
|
|
2377
|
+
[calp2, calp1] = [calp1, calp2];
|
|
2378
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2379
|
+
[vals.M21, vals.M12] = [vals.M12, vals.M21];
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
salp1 *= swapp * lonsign;
|
|
2383
|
+
calp1 *= swapp * latsign;
|
|
2384
|
+
salp2 *= swapp * lonsign;
|
|
2385
|
+
calp2 *= swapp * latsign;
|
|
2386
|
+
return {
|
|
2387
|
+
vals,
|
|
2388
|
+
salp1,
|
|
2389
|
+
calp1,
|
|
2390
|
+
salp2,
|
|
2391
|
+
calp2
|
|
2392
|
+
};
|
|
2393
|
+
};
|
|
2394
|
+
g.Geodesic.prototype.GenDirect = function(lat1, lon1, azi1, arcmode, s12_a12, outmask) {
|
|
2395
|
+
var line;
|
|
2396
|
+
if (!outmask)
|
|
2397
|
+
outmask = g.STANDARD;
|
|
2398
|
+
else if (outmask === g.LONG_UNROLL)
|
|
2399
|
+
outmask |= g.STANDARD;
|
|
2400
|
+
if (!arcmode)
|
|
2401
|
+
outmask |= g.DISTANCE_IN;
|
|
2402
|
+
line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask);
|
|
2403
|
+
return line.GenPosition(arcmode, s12_a12, outmask);
|
|
2404
|
+
};
|
|
2405
|
+
g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) {
|
|
2406
|
+
return this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
|
|
2407
|
+
};
|
|
2408
|
+
g.Geodesic.prototype.ArcDirect = function(lat1, lon1, azi1, a12, outmask) {
|
|
2409
|
+
return this.GenDirect(lat1, lon1, azi1, true, a12, outmask);
|
|
2410
|
+
};
|
|
2411
|
+
g.Geodesic.prototype.Line = function(lat1, lon1, azi1, caps) {
|
|
2412
|
+
return new l.GeodesicLine(this, lat1, lon1, azi1, caps);
|
|
2413
|
+
};
|
|
2414
|
+
g.Geodesic.prototype.DirectLine = function(lat1, lon1, azi1, s12, caps) {
|
|
2415
|
+
return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps);
|
|
2416
|
+
};
|
|
2417
|
+
g.Geodesic.prototype.ArcDirectLine = function(lat1, lon1, azi1, a12, caps) {
|
|
2418
|
+
return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps);
|
|
2419
|
+
};
|
|
2420
|
+
g.Geodesic.prototype.GenDirectLine = function(lat1, lon1, azi1, arcmode, s12_a12, caps) {
|
|
2421
|
+
var t;
|
|
2422
|
+
if (!caps)
|
|
2423
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2424
|
+
if (!arcmode)
|
|
2425
|
+
caps |= g.DISTANCE_IN;
|
|
2426
|
+
t = new l.GeodesicLine(this, lat1, lon1, azi1, caps);
|
|
2427
|
+
t.GenSetDistance(arcmode, s12_a12);
|
|
2428
|
+
return t;
|
|
2429
|
+
};
|
|
2430
|
+
g.Geodesic.prototype.InverseLine = function(lat1, lon1, lat2, lon2, caps) {
|
|
2431
|
+
var r, t, azi1;
|
|
2432
|
+
if (!caps)
|
|
2433
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2434
|
+
r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC);
|
|
2435
|
+
azi1 = m.atan2d(r.salp1, r.calp1);
|
|
2436
|
+
if (caps & (g.OUT_MASK & g.DISTANCE_IN))
|
|
2437
|
+
caps |= g.DISTANCE;
|
|
2438
|
+
t = new l.GeodesicLine(this, lat1, lon1, azi1, caps, r.salp1, r.calp1);
|
|
2439
|
+
t.SetArc(r.vals.a12);
|
|
2440
|
+
return t;
|
|
2441
|
+
};
|
|
2442
|
+
g.Geodesic.prototype.Polygon = function(polyline) {
|
|
2443
|
+
return new p.PolygonArea(this, polyline);
|
|
2444
|
+
};
|
|
2445
|
+
g.WGS84 = new g.Geodesic(c.WGS84.a, c.WGS84.f);
|
|
2446
|
+
})(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.PolygonArea, geodesic.Math, geodesic.Constants);
|
|
2447
|
+
(function(g, l, m) {
|
|
2448
|
+
"use strict";
|
|
2449
|
+
l.GeodesicLine = function(geod, lat1, lon1, azi1, caps, salp1, calp1) {
|
|
2450
|
+
var t, cbet1, sbet1, eps, s, c;
|
|
2451
|
+
if (!caps)
|
|
2452
|
+
caps = g.STANDARD | g.DISTANCE_IN;
|
|
2453
|
+
this.a = geod.a;
|
|
2454
|
+
this.f = geod.f;
|
|
2455
|
+
this._b = geod._b;
|
|
2456
|
+
this._c2 = geod._c2;
|
|
2457
|
+
this._f1 = geod._f1;
|
|
2458
|
+
this.caps = caps | g.LATITUDE | g.AZIMUTH | g.LONG_UNROLL;
|
|
2459
|
+
this.lat1 = m.LatFix(lat1);
|
|
2460
|
+
this.lon1 = lon1;
|
|
2461
|
+
if (typeof salp1 === "undefined" || typeof calp1 === "undefined") {
|
|
2462
|
+
this.azi1 = m.AngNormalize(azi1);
|
|
2463
|
+
t = m.sincosd(m.AngRound(this.azi1));
|
|
2464
|
+
this.salp1 = t.s;
|
|
2465
|
+
this.calp1 = t.c;
|
|
2466
|
+
} else {
|
|
2467
|
+
this.azi1 = azi1;
|
|
2468
|
+
this.salp1 = salp1;
|
|
2469
|
+
this.calp1 = calp1;
|
|
2470
|
+
}
|
|
2471
|
+
t = m.sincosd(m.AngRound(this.lat1));
|
|
2472
|
+
sbet1 = this._f1 * t.s;
|
|
2473
|
+
cbet1 = t.c;
|
|
2474
|
+
t = m.hypot(sbet1, cbet1);
|
|
2475
|
+
sbet1 /= t;
|
|
2476
|
+
cbet1 /= t;
|
|
2477
|
+
cbet1 = Math.max(g.tiny_, cbet1);
|
|
2478
|
+
this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1));
|
|
2479
|
+
this._salp0 = this.salp1 * cbet1;
|
|
2480
|
+
this._calp0 = m.hypot(this.calp1, this.salp1 * sbet1);
|
|
2481
|
+
this._ssig1 = sbet1;
|
|
2482
|
+
this._somg1 = this._salp0 * sbet1;
|
|
2483
|
+
this._csig1 = this._comg1 = sbet1 !== 0 || this.calp1 !== 0 ? cbet1 * this.calp1 : 1;
|
|
2484
|
+
t = m.hypot(this._ssig1, this._csig1);
|
|
2485
|
+
this._ssig1 /= t;
|
|
2486
|
+
this._csig1 /= t;
|
|
2487
|
+
this._k2 = m.sq(this._calp0) * geod._ep2;
|
|
2488
|
+
eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2);
|
|
2489
|
+
if (this.caps & g.CAP_C1) {
|
|
2490
|
+
this._A1m1 = g.A1m1f(eps);
|
|
2491
|
+
this._C1a = new Array(g.nC1_ + 1);
|
|
2492
|
+
g.C1f(eps, this._C1a);
|
|
2493
|
+
this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C1a);
|
|
2494
|
+
s = Math.sin(this._B11);
|
|
2495
|
+
c = Math.cos(this._B11);
|
|
2496
|
+
this._stau1 = this._ssig1 * c + this._csig1 * s;
|
|
2497
|
+
this._ctau1 = this._csig1 * c - this._ssig1 * s;
|
|
2498
|
+
}
|
|
2499
|
+
if (this.caps & g.CAP_C1p) {
|
|
2500
|
+
this._C1pa = new Array(g.nC1p_ + 1);
|
|
2501
|
+
g.C1pf(eps, this._C1pa);
|
|
2502
|
+
}
|
|
2503
|
+
if (this.caps & g.CAP_C2) {
|
|
2504
|
+
this._A2m1 = g.A2m1f(eps);
|
|
2505
|
+
this._C2a = new Array(g.nC2_ + 1);
|
|
2506
|
+
g.C2f(eps, this._C2a);
|
|
2507
|
+
this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C2a);
|
|
2508
|
+
}
|
|
2509
|
+
if (this.caps & g.CAP_C3) {
|
|
2510
|
+
this._C3a = new Array(g.nC3_);
|
|
2511
|
+
geod.C3f(eps, this._C3a);
|
|
2512
|
+
this._A3c = -this.f * this._salp0 * geod.A3f(eps);
|
|
2513
|
+
this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1, this._C3a);
|
|
2514
|
+
}
|
|
2515
|
+
if (this.caps & g.CAP_C4) {
|
|
2516
|
+
this._C4a = new Array(g.nC4_);
|
|
2517
|
+
geod.C4f(eps, this._C4a);
|
|
2518
|
+
this._A4 = m.sq(this.a) * this._calp0 * this._salp0 * geod._e2;
|
|
2519
|
+
this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1, this._C4a);
|
|
2520
|
+
}
|
|
2521
|
+
this.a13 = this.s13 = NaN;
|
|
2522
|
+
};
|
|
2523
|
+
l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12, outmask) {
|
|
2524
|
+
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;
|
|
2525
|
+
if (!outmask)
|
|
2526
|
+
outmask = g.STANDARD;
|
|
2527
|
+
else if (outmask === g.LONG_UNROLL)
|
|
2528
|
+
outmask |= g.STANDARD;
|
|
2529
|
+
outmask &= this.caps & g.OUT_MASK;
|
|
2530
|
+
vals.lat1 = this.lat1;
|
|
2531
|
+
vals.azi1 = this.azi1;
|
|
2532
|
+
vals.lon1 = outmask & g.LONG_UNROLL ? this.lon1 : m.AngNormalize(this.lon1);
|
|
2533
|
+
if (arcmode)
|
|
2534
|
+
vals.a12 = s12_a12;
|
|
2535
|
+
else
|
|
2536
|
+
vals.s12 = s12_a12;
|
|
2537
|
+
if (!(arcmode || this.caps & g.DISTANCE_IN & g.OUT_MASK)) {
|
|
2538
|
+
vals.a12 = NaN;
|
|
2539
|
+
return vals;
|
|
2540
|
+
}
|
|
2541
|
+
B12 = 0;
|
|
2542
|
+
AB1 = 0;
|
|
2543
|
+
if (arcmode) {
|
|
2544
|
+
sig12 = s12_a12 * m.degree;
|
|
2545
|
+
t = m.sincosd(s12_a12);
|
|
2546
|
+
ssig12 = t.s;
|
|
2547
|
+
csig12 = t.c;
|
|
2548
|
+
} else {
|
|
2549
|
+
tau12 = s12_a12 / (this._b * (1 + this._A1m1));
|
|
2550
|
+
s = Math.sin(tau12);
|
|
2551
|
+
c = Math.cos(tau12);
|
|
2552
|
+
B12 = -g.SinCosSeries(true, this._stau1 * c + this._ctau1 * s, this._ctau1 * c - this._stau1 * s, this._C1pa);
|
|
2553
|
+
sig12 = tau12 - (B12 - this._B11);
|
|
2554
|
+
ssig12 = Math.sin(sig12);
|
|
2555
|
+
csig12 = Math.cos(sig12);
|
|
2556
|
+
if (Math.abs(this.f) > 0.01) {
|
|
2557
|
+
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
|
|
2558
|
+
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
|
|
2559
|
+
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
|
|
2560
|
+
serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) - s12_a12 / this._b;
|
|
2561
|
+
sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2));
|
|
2562
|
+
ssig12 = Math.sin(sig12);
|
|
2563
|
+
csig12 = Math.cos(sig12);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
|
|
2567
|
+
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
|
|
2568
|
+
dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2));
|
|
2569
|
+
if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2570
|
+
if (arcmode || Math.abs(this.f) > 0.01)
|
|
2571
|
+
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a);
|
|
2572
|
+
AB1 = (1 + this._A1m1) * (B12 - this._B11);
|
|
2573
|
+
}
|
|
2574
|
+
sbet2 = this._calp0 * ssig2;
|
|
2575
|
+
cbet2 = m.hypot(this._salp0, this._calp0 * csig2);
|
|
2576
|
+
if (cbet2 === 0)
|
|
2577
|
+
cbet2 = csig2 = g.tiny_;
|
|
2578
|
+
salp2 = this._salp0;
|
|
2579
|
+
calp2 = this._calp0 * csig2;
|
|
2580
|
+
if (arcmode && outmask & g.DISTANCE)
|
|
2581
|
+
vals.s12 = this._b * ((1 + this._A1m1) * sig12 + AB1);
|
|
2582
|
+
if (outmask & g.LONGITUDE) {
|
|
2583
|
+
somg2 = this._salp0 * ssig2;
|
|
2584
|
+
comg2 = csig2;
|
|
2585
|
+
E = m.copysign(1, this._salp0);
|
|
2586
|
+
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);
|
|
2587
|
+
lam12 = omg12 + this._A3c * (sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a) - this._B31));
|
|
2588
|
+
lon12 = lam12 / m.degree;
|
|
2589
|
+
vals.lon2 = outmask & g.LONG_UNROLL ? this.lon1 + lon12 : m.AngNormalize(m.AngNormalize(this.lon1) + m.AngNormalize(lon12));
|
|
2590
|
+
}
|
|
2591
|
+
if (outmask & g.LATITUDE)
|
|
2592
|
+
vals.lat2 = m.atan2d(sbet2, this._f1 * cbet2);
|
|
2593
|
+
if (outmask & g.AZIMUTH)
|
|
2594
|
+
vals.azi2 = m.atan2d(salp2, calp2);
|
|
2595
|
+
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
|
|
2596
|
+
B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a);
|
|
2597
|
+
AB2 = (1 + this._A2m1) * (B22 - this._B21);
|
|
2598
|
+
J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2);
|
|
2599
|
+
if (outmask & g.REDUCEDLENGTH)
|
|
2600
|
+
vals.m12 = this._b * (dn2 * (this._csig1 * ssig2) - this._dn1 * (this._ssig1 * csig2) - this._csig1 * csig2 * J12);
|
|
2601
|
+
if (outmask & g.GEODESICSCALE) {
|
|
2602
|
+
t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) / (this._dn1 + dn2);
|
|
2603
|
+
vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1;
|
|
2604
|
+
vals.M21 = csig12 - (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
if (outmask & g.AREA) {
|
|
2608
|
+
B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a);
|
|
2609
|
+
if (this._calp0 === 0 || this._salp0 === 0) {
|
|
2610
|
+
salp12 = salp2 * this.calp1 - calp2 * this.salp1;
|
|
2611
|
+
calp12 = calp2 * this.calp1 + salp2 * this.salp1;
|
|
2612
|
+
} else {
|
|
2613
|
+
salp12 = this._calp0 * this._salp0 * (csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 : ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1));
|
|
2614
|
+
calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2;
|
|
2615
|
+
}
|
|
2616
|
+
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);
|
|
2617
|
+
}
|
|
2618
|
+
if (!arcmode)
|
|
2619
|
+
vals.a12 = sig12 / m.degree;
|
|
2620
|
+
return vals;
|
|
2621
|
+
};
|
|
2622
|
+
l.GeodesicLine.prototype.Position = function(s12, outmask) {
|
|
2623
|
+
return this.GenPosition(false, s12, outmask);
|
|
2624
|
+
};
|
|
2625
|
+
l.GeodesicLine.prototype.ArcPosition = function(a12, outmask) {
|
|
2626
|
+
return this.GenPosition(true, a12, outmask);
|
|
2627
|
+
};
|
|
2628
|
+
l.GeodesicLine.prototype.GenSetDistance = function(arcmode, s13_a13) {
|
|
2629
|
+
if (arcmode)
|
|
2630
|
+
this.SetArc(s13_a13);
|
|
2631
|
+
else
|
|
2632
|
+
this.SetDistance(s13_a13);
|
|
2633
|
+
};
|
|
2634
|
+
l.GeodesicLine.prototype.SetDistance = function(s13) {
|
|
2635
|
+
var r;
|
|
2636
|
+
this.s13 = s13;
|
|
2637
|
+
r = this.GenPosition(false, this.s13, g.ARC);
|
|
2638
|
+
this.a13 = 0 + r.a12;
|
|
2639
|
+
};
|
|
2640
|
+
l.GeodesicLine.prototype.SetArc = function(a13) {
|
|
2641
|
+
var r;
|
|
2642
|
+
this.a13 = a13;
|
|
2643
|
+
r = this.GenPosition(true, this.a13, g.DISTANCE);
|
|
2644
|
+
this.s13 = 0 + r.s12;
|
|
2645
|
+
};
|
|
2646
|
+
})(geodesic.Geodesic, geodesic.GeodesicLine, geodesic.Math);
|
|
2647
|
+
|
|
2648
|
+
// dist/ellipsoid-geodesic.js
|
|
2649
|
+
var library = geodesic.Geodesic;
|
|
2650
|
+
var EllipsoidGeodesic = class {
|
|
2651
|
+
constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
|
|
2652
|
+
this.engine = createGeodesicEngine({ semiMajorAxis: a, semiMinorAxis: b });
|
|
2653
|
+
}
|
|
2654
|
+
/** Total area in squared axis units, with the same normalization as S12. */
|
|
2655
|
+
get surfaceArea() {
|
|
2656
|
+
return 4 * Math.PI * this.engine._c2;
|
|
2657
|
+
}
|
|
2658
|
+
inverse(lat1, lon1, lat2, lon2, options = {}) {
|
|
2659
|
+
validatePoint(lat1, lon1);
|
|
2660
|
+
validatePoint(lat2, lon2);
|
|
2661
|
+
return this.engine.Inverse(lat1, lon1, lat2, lon2, outputMask(options));
|
|
2662
|
+
}
|
|
2663
|
+
direct(latitude, longitude, azimuth, distance, options = {}) {
|
|
2664
|
+
return this.line(latitude, longitude, azimuth, options).position(distance);
|
|
2665
|
+
}
|
|
2666
|
+
arcDirect(latitude, longitude, azimuth, arc, options = {}) {
|
|
2667
|
+
return this.line(latitude, longitude, azimuth, options).arcPosition(arc);
|
|
2668
|
+
}
|
|
2669
|
+
line(latitude, longitude, azimuth, options = {}) {
|
|
2670
|
+
validatePoint(latitude, longitude);
|
|
2671
|
+
validateFinite(azimuth);
|
|
2672
|
+
const selectedMask = outputMask(options);
|
|
2673
|
+
const line = this.engine.Line(latitude, longitude, azimuth, selectedMask | library.DISTANCE_IN);
|
|
2674
|
+
return {
|
|
2675
|
+
position(distance) {
|
|
2676
|
+
validateFinite(distance);
|
|
2677
|
+
return line.Position(distance, selectedMask);
|
|
2678
|
+
},
|
|
2679
|
+
arcPosition(arc) {
|
|
2680
|
+
validateFinite(arc);
|
|
2681
|
+
return line.ArcPosition(arc, selectedMask);
|
|
2682
|
+
}
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
};
|
|
2686
|
+
function validatePoint(latitude, longitude) {
|
|
2687
|
+
if (!(Number.isFinite(latitude) && Math.abs(latitude) <= 90 && Number.isFinite(longitude))) {
|
|
2688
|
+
throw new Error("Invalid geodesic coordinates");
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
function outputMask(options) {
|
|
2692
|
+
return library.ALL & ~(options.area ? 0 : library.AREA) | (options.unrollLongitude ? library.LONG_UNROLL : 0);
|
|
2693
|
+
}
|
|
2694
|
+
function validateFinite(value) {
|
|
2695
|
+
if (!Number.isFinite(value))
|
|
2696
|
+
throw new Error("Geodesic axes, azimuth, distance and arc must be finite");
|
|
2697
|
+
}
|
|
2698
|
+
var nonAreaGeodesicMask = library.ALL & ~library.AREA;
|
|
2699
|
+
function createGeodesicEngine({ semiMajorAxis: a, semiMinorAxis: b }) {
|
|
2700
|
+
validateFinite(a);
|
|
2701
|
+
validateFinite(b);
|
|
2702
|
+
return new library.Geodesic(a, (a - b) / a);
|
|
2703
|
+
}
|
|
2704
|
+
|
|
2705
|
+
// dist/geodesic-path.js
|
|
2706
|
+
var wgs84;
|
|
2707
|
+
var GeodesicPath = class {
|
|
2708
|
+
constructor(start, end, options = {}) {
|
|
2709
|
+
validateGeographicPosition(start);
|
|
2710
|
+
validateGeographicPosition(end);
|
|
2711
|
+
if (start.length !== end.length)
|
|
2712
|
+
throw new RangeError("Geodesic endpoint dimensions must match");
|
|
2713
|
+
const solver = options.geodesic || getDefaultGeodesic();
|
|
2714
|
+
const inverse = solver.inverse(start[1], start[0], end[1], end[0], { unrollLongitude: true });
|
|
2715
|
+
if (!Number.isFinite(inverse.s12) || inverse.s12 < 0 || !Number.isFinite(inverse.azi1) || !Number.isFinite(inverse.lon2)) {
|
|
2716
|
+
throw new RangeError("Unresolved geodesic path");
|
|
2717
|
+
}
|
|
2718
|
+
this.size = start.length;
|
|
2719
|
+
this.length = inverse.s12;
|
|
2720
|
+
this.first = Object.freeze(Array.from(start));
|
|
2721
|
+
const last = Array.from(end);
|
|
2722
|
+
last[0] = inverse.lon2;
|
|
2723
|
+
if (this.length === 0) {
|
|
2724
|
+
last[0] = start[0];
|
|
2725
|
+
last[1] = start[1];
|
|
2726
|
+
}
|
|
2727
|
+
this.last = Object.freeze(last);
|
|
2728
|
+
this.line = solver.line(start[1], start[0], inverse.azi1, { unrollLongitude: true });
|
|
2729
|
+
}
|
|
2730
|
+
get start() {
|
|
2731
|
+
return this.first.slice();
|
|
2732
|
+
}
|
|
2733
|
+
get end() {
|
|
2734
|
+
return this.last.slice();
|
|
2735
|
+
}
|
|
2736
|
+
sample(fraction, result = new Array(this.size)) {
|
|
2737
|
+
if (!Number.isFinite(fraction) || fraction < 0 || fraction > 1) {
|
|
2738
|
+
throw new RangeError("Geodesic fraction must be in [0, 1]");
|
|
2739
|
+
}
|
|
2740
|
+
if (result.length !== this.size)
|
|
2741
|
+
throw new RangeError("Invalid geodesic sample output length");
|
|
2742
|
+
let longitude;
|
|
2743
|
+
let latitude;
|
|
2744
|
+
if (fraction === 0 || this.length === 0) {
|
|
2745
|
+
longitude = this.first[0];
|
|
2746
|
+
latitude = this.first[1];
|
|
2747
|
+
} else if (fraction === 1) {
|
|
2748
|
+
longitude = this.last[0];
|
|
2749
|
+
latitude = this.last[1];
|
|
2750
|
+
} else {
|
|
2751
|
+
const value = this.line.position(this.length * fraction);
|
|
2752
|
+
longitude = value.lon2;
|
|
2753
|
+
latitude = value.lat2;
|
|
2754
|
+
}
|
|
2755
|
+
const height = this.size === 3 ? this.first[2] * (1 - fraction) + this.last[2] * fraction : 0;
|
|
2756
|
+
if (![longitude, latitude, height].every(Number.isFinite) || result instanceof Float32Array && ![longitude, latitude, height].every((value) => Number.isFinite(Math.fround(value)))) {
|
|
2757
|
+
throw new RangeError("Unrepresentable geodesic sample");
|
|
2758
|
+
}
|
|
2759
|
+
result[0] = longitude;
|
|
2760
|
+
result[1] = latitude;
|
|
2761
|
+
if (this.size === 3)
|
|
2762
|
+
result[2] = height;
|
|
2763
|
+
return result;
|
|
2764
|
+
}
|
|
2765
|
+
sampleByDistance(distance, result = new Array(this.size)) {
|
|
2766
|
+
if (!Number.isFinite(distance) || distance < 0 || distance > this.length) {
|
|
2767
|
+
throw new RangeError("Distance must be within the geodesic path");
|
|
2768
|
+
}
|
|
2769
|
+
return this.sample(this.length === 0 ? 0 : distance / this.length, result);
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
function validateGeographicPosition(point) {
|
|
2773
|
+
if (point.length !== 2 && point.length !== 3 || !Array.from(point).every(Number.isFinite) || Math.abs(point[1]) > 90) {
|
|
2774
|
+
throw new RangeError("Expected finite longitude/latitude[/height], latitude in [-90, 90]");
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
function getDefaultGeodesic() {
|
|
2778
|
+
if (!wgs84) {
|
|
2779
|
+
wgs84 = new EllipsoidGeodesic({ semiMajorAxis: WGS84_RADIUS_X, semiMinorAxis: WGS84_RADIUS_Z });
|
|
2780
|
+
}
|
|
2781
|
+
return wgs84;
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
// dist/subdivide-geodesic-polyline.js
|
|
2785
|
+
function subdivideGeodesicPolyline(input, options) {
|
|
2786
|
+
const { geodesic: geodesic2, size = 2, maxSurfaceDistance = Infinity, ...subdivision } = options;
|
|
2787
|
+
if (size !== 2 && size !== 3 || !Number.isSafeInteger(input.length) || input.length < 0 || input.length % size !== 0) {
|
|
2788
|
+
throw new RangeError("Expected packed longitude/latitude[/height] positions");
|
|
2789
|
+
}
|
|
2790
|
+
const maxVertices = subdivision.maxVertices ?? 65536;
|
|
2791
|
+
if (!Number.isSafeInteger(maxVertices) || maxVertices < 1 || maxVertices > 4294967295 || input.length / size > maxVertices) {
|
|
2792
|
+
throw new RangeError("Invalid or exceeded maxVertices");
|
|
2793
|
+
}
|
|
2794
|
+
if (!(maxSurfaceDistance > 0) || maxSurfaceDistance !== Infinity && !Number.isFinite(maxSurfaceDistance)) {
|
|
2795
|
+
throw new RangeError("maxSurfaceDistance must be positive");
|
|
2796
|
+
}
|
|
2797
|
+
const positions = Array.from(input);
|
|
2798
|
+
for (let i = 0; i < positions.length; i += size)
|
|
2799
|
+
validateGeographicPosition(positions.slice(i, i + size));
|
|
2800
|
+
const paths = [];
|
|
2801
|
+
for (let i = size; i < positions.length; i += size) {
|
|
2802
|
+
const path = new GeodesicPath(positions.slice(i - size, i), positions.slice(i, i + size), {
|
|
2803
|
+
geodesic: geodesic2
|
|
2804
|
+
});
|
|
2805
|
+
paths.push(path);
|
|
2806
|
+
const end = path.end;
|
|
2807
|
+
for (let component = 0; component < size; component++)
|
|
2808
|
+
positions[i + component] = end[component];
|
|
2809
|
+
}
|
|
2810
|
+
return (0, import_polygon2.subdividePolyline)(positions, {
|
|
2811
|
+
...subdivision,
|
|
2812
|
+
size,
|
|
2813
|
+
maxSegmentLength: maxSurfaceDistance,
|
|
2814
|
+
createEdgeSampler: (_start, _end, index) => paths[index]
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
// dist/subdivide-rhumb-polyline.js
|
|
2819
|
+
var import_polygon3 = require("@math.gl/geometry/polygon");
|
|
2820
|
+
|
|
2821
|
+
// dist/ellipsoid-helpers/rhumb-pole-distance.js
|
|
2822
|
+
var Q = 10n ** 48n;
|
|
2823
|
+
var PI = 3141592653589793238462643383279502884197169399375n;
|
|
2824
|
+
var mul = (x, y) => x * y / Q;
|
|
2825
|
+
var div = (x, y) => x * Q / y;
|
|
2826
|
+
function exact(x) {
|
|
2827
|
+
const bytes = new DataView(new ArrayBuffer(8));
|
|
2828
|
+
bytes.setFloat64(0, x);
|
|
2829
|
+
const bits = bytes.getBigUint64(0), exponent = Number(bits >> 52n & 2047n);
|
|
2830
|
+
const mantissa = bits & (1n << 52n) - 1n | (exponent ? 1n << 52n : 0n);
|
|
2831
|
+
const shift2 = exponent ? exponent - 1075 : -1074;
|
|
2832
|
+
const value = shift2 >= 0 ? mantissa * Q << BigInt(shift2) : mantissa * Q >> BigInt(-shift2);
|
|
2833
|
+
return bits >> 63n ? -value : value;
|
|
2834
|
+
}
|
|
2835
|
+
function sc(x) {
|
|
2836
|
+
let s = x, c = Q, ts = x, tc = Q;
|
|
2837
|
+
const square = mul(x, x);
|
|
2838
|
+
for (let n = 1n; n < 160n; n++) {
|
|
2839
|
+
ts = -mul(ts, square) / (2n * n * (2n * n + 1n));
|
|
2840
|
+
tc = -mul(tc, square) / ((2n * n - 1n) * (2n * n));
|
|
2841
|
+
s += ts;
|
|
2842
|
+
c += tc;
|
|
2843
|
+
if (ts === 0n && tc === 0n)
|
|
2844
|
+
break;
|
|
2845
|
+
}
|
|
2846
|
+
return [s, c];
|
|
2847
|
+
}
|
|
2848
|
+
function remainingPoleDistance(a, b, latitude, azimuth, distance, sign) {
|
|
2849
|
+
const unit = 2 ** Math.floor(Math.log2(a));
|
|
2850
|
+
a /= unit;
|
|
2851
|
+
b /= unit;
|
|
2852
|
+
distance /= unit;
|
|
2853
|
+
const ratio2 = div(exact(b), exact(a));
|
|
2854
|
+
const theta = mul(90n * Q - BigInt(sign) * exact(latitude), PI) / 180n;
|
|
2855
|
+
const [s, c] = sc(theta), prolate = ratio2 > Q;
|
|
2856
|
+
const square = mul(ratio2, ratio2);
|
|
2857
|
+
const k = prolate ? Q - div(Q, square) : Q - square;
|
|
2858
|
+
const z = prolate ? s : c, other = prolate ? c : s;
|
|
2859
|
+
const zz = mul(z, z);
|
|
2860
|
+
let integral = theta, total = theta, coefficient = Q, power = z;
|
|
2861
|
+
for (let n = 1n; n < 480n; n++) {
|
|
2862
|
+
integral = ((2n * n - 1n) * integral + (prolate ? -1n : 1n) * mul(power, other)) / (2n * n);
|
|
2863
|
+
coefficient = mul(coefficient, k) * (2n * n + 1n) / (2n * n);
|
|
2864
|
+
const term = mul(coefficient, integral);
|
|
2865
|
+
total += term;
|
|
2866
|
+
power = mul(power, zz);
|
|
2867
|
+
if (term === 0n)
|
|
2868
|
+
break;
|
|
2869
|
+
}
|
|
2870
|
+
const gap = prolate ? div(total, ratio2) : mul(total, square);
|
|
2871
|
+
const angle2 = mul(exact(azimuth % 360), PI) / 180n;
|
|
2872
|
+
const north = mul(div(exact(distance), exact(a)), sc(angle2)[1]);
|
|
2873
|
+
return Number(gap - BigInt(sign) * north) / Number(Q);
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
// dist/ellipsoid-metrics.js
|
|
2877
|
+
var DEG = Math.PI / 180;
|
|
2878
|
+
var NODES = [
|
|
2879
|
+
0.09501250983763744,
|
|
2880
|
+
0.2816035507792589,
|
|
2881
|
+
0.4580167776572274,
|
|
2882
|
+
0.6178762444026438,
|
|
2883
|
+
0.755404408355003,
|
|
2884
|
+
0.8656312023878318,
|
|
2885
|
+
0.9445750230732326,
|
|
2886
|
+
0.9894009349916499
|
|
2887
|
+
];
|
|
2888
|
+
var WEIGHTS = [
|
|
2889
|
+
0.1894506104550685,
|
|
2890
|
+
0.1826034150449236,
|
|
2891
|
+
0.16915651939500254,
|
|
2892
|
+
0.14959598881657674,
|
|
2893
|
+
0.12462897125553388,
|
|
2894
|
+
0.09515851168249279,
|
|
2895
|
+
0.06225352393864789,
|
|
2896
|
+
0.027152459411754096
|
|
2897
|
+
];
|
|
2898
|
+
var KINDS = [
|
|
2899
|
+
"geocentric",
|
|
2900
|
+
"parametric",
|
|
2901
|
+
"rectifying",
|
|
2902
|
+
"authalic",
|
|
2903
|
+
"conformal",
|
|
2904
|
+
"isometric"
|
|
2905
|
+
];
|
|
2906
|
+
var EllipsoidMetrics = class {
|
|
2907
|
+
constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
|
|
2908
|
+
const r = b / a;
|
|
2909
|
+
if (!(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0 && r >= 0.5 && r <= 2)) {
|
|
2910
|
+
throw new Error("Ellipsoid metrics require finite positive axes with 0.5 <= b/a <= 2");
|
|
2911
|
+
}
|
|
2912
|
+
this.semiMajorAxis = a;
|
|
2913
|
+
this.semiMinorAxis = b;
|
|
2914
|
+
this.ratio = r;
|
|
2915
|
+
this.e2 = (1 - r) * (1 + r);
|
|
2916
|
+
this.qPole = 1 + r * r * this.eccentricIntegral(1);
|
|
2917
|
+
this.quarter = integrate((t) => this.meridianIntegrand(t), 0, Math.PI / 2);
|
|
2918
|
+
this.quarterMeridian = a * this.quarter;
|
|
2919
|
+
this.surfaceArea = 2 * Math.PI * a * a * this.qPole;
|
|
2920
|
+
this.volume = 4 * Math.PI / 3 * a * b * a;
|
|
2921
|
+
if (![this.quarterMeridian, this.surfaceArea, this.volume].every((v) => Number.isFinite(v) && v > 0)) {
|
|
2922
|
+
throw new Error("Ellipsoid metrics exceed representable length/area/volume range");
|
|
2923
|
+
}
|
|
2924
|
+
Object.freeze(this);
|
|
2925
|
+
}
|
|
2926
|
+
meridianDistance(latitude) {
|
|
2927
|
+
validateLatitude(latitude);
|
|
2928
|
+
return Math.sign(latitude) * this.semiMajorAxis * this.meridian(Math.abs(latitude));
|
|
2929
|
+
}
|
|
2930
|
+
meridionalCurvatureRadius(latitude) {
|
|
2931
|
+
validateLatitude(latitude);
|
|
2932
|
+
return this.semiMajorAxis * this.meridianIntegrand(latitude * DEG);
|
|
2933
|
+
}
|
|
2934
|
+
transverseCurvatureRadius(latitude) {
|
|
2935
|
+
validateLatitude(latitude);
|
|
2936
|
+
const [s, c] = sincos(latitude);
|
|
2937
|
+
return this.semiMajorAxis / Math.hypot(c, this.ratio * s);
|
|
2938
|
+
}
|
|
2939
|
+
normalCurvatureRadius(latitude, azimuth) {
|
|
2940
|
+
if (!Number.isFinite(azimuth))
|
|
2941
|
+
throw new Error("Azimuth must be finite");
|
|
2942
|
+
const [s, c] = sincos(azimuth % 180);
|
|
2943
|
+
return 1 / (c * c / this.meridionalCurvatureRadius(latitude) + s * s / this.transverseCurvatureRadius(latitude));
|
|
2944
|
+
}
|
|
2945
|
+
latitudeToAuxiliary(latitude, kind) {
|
|
2946
|
+
validateKind(kind);
|
|
2947
|
+
validateLatitude(latitude);
|
|
2948
|
+
if (latitude === 0)
|
|
2949
|
+
return latitude;
|
|
2950
|
+
if (Math.abs(latitude) === 90)
|
|
2951
|
+
return kind === "isometric" ? Math.sign(latitude) * Infinity : latitude;
|
|
2952
|
+
if (this.ratio === 1 && kind !== "isometric")
|
|
2953
|
+
return latitude;
|
|
2954
|
+
const sign = Math.sign(latitude);
|
|
2955
|
+
const phi = Math.abs(latitude);
|
|
2956
|
+
const [s, c] = sincos(phi);
|
|
2957
|
+
switch (kind) {
|
|
2958
|
+
case "geocentric":
|
|
2959
|
+
return sign * angle(this.ratio * this.ratio * s, c);
|
|
2960
|
+
case "parametric":
|
|
2961
|
+
return sign * angle(this.ratio * s, c);
|
|
2962
|
+
case "rectifying":
|
|
2963
|
+
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);
|
|
2964
|
+
case "authalic": {
|
|
2965
|
+
if (phi <= 45) {
|
|
2966
|
+
const q = this.ratio ** 2 * (s / (c * c + (this.ratio * s) ** 2) + this.eccentricIntegral(s));
|
|
2967
|
+
return sign * Math.asin(q / this.qPole) / DEG;
|
|
2968
|
+
}
|
|
2969
|
+
const cap = integrate((t) => {
|
|
2970
|
+
const st = Math.sin(t), ct = Math.cos(t);
|
|
2971
|
+
const d = st * st + (this.ratio * ct) ** 2;
|
|
2972
|
+
return 2 * this.ratio ** 2 * st / (d * d);
|
|
2973
|
+
}, 0, (90 - phi) * DEG);
|
|
2974
|
+
return sign * (90 - 2 * Math.asin(Math.sqrt(cap / (2 * this.qPole))) / DEG);
|
|
2975
|
+
}
|
|
2976
|
+
default: {
|
|
2977
|
+
const psi = Math.asinh(s / c) - this.e2 * this.eccentricIntegral(s);
|
|
2978
|
+
return sign * (kind === "isometric" ? psi / DEG : psi < 1 ? Math.atan(Math.sinh(psi)) / DEG : 90 - 2 * Math.atan(Math.exp(-psi)) / DEG);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
latitudeFromAuxiliary(latitude, kind) {
|
|
2983
|
+
validateKind(kind);
|
|
2984
|
+
if (kind === "isometric" && Math.abs(latitude) === Infinity)
|
|
2985
|
+
return Math.sign(latitude) * 90;
|
|
2986
|
+
if (kind !== "isometric")
|
|
2987
|
+
validateLatitude(latitude);
|
|
2988
|
+
else if (!Number.isFinite(latitude))
|
|
2989
|
+
throw new Error("Isometric latitude must be finite or a pole infinity");
|
|
2990
|
+
if (latitude === 0)
|
|
2991
|
+
return latitude;
|
|
2992
|
+
if (kind !== "isometric" && Math.abs(latitude) === 90)
|
|
2993
|
+
return latitude;
|
|
2994
|
+
if (this.ratio === 1 && kind !== "isometric")
|
|
2995
|
+
return latitude;
|
|
2996
|
+
const sign = Math.sign(latitude), target = Math.abs(latitude);
|
|
2997
|
+
if (kind === "geocentric" || kind === "parametric") {
|
|
2998
|
+
const [s, c] = sincos(target);
|
|
2999
|
+
return sign * angle(s, c * (kind === "geocentric" ? this.ratio ** 2 : this.ratio));
|
|
3000
|
+
}
|
|
3001
|
+
let lo = 0, hi = 90;
|
|
3002
|
+
for (let i = 0; i < 64; ++i) {
|
|
3003
|
+
const mid = (lo + hi) / 2;
|
|
3004
|
+
if (mid === lo || mid === hi)
|
|
3005
|
+
break;
|
|
3006
|
+
if (this.latitudeToAuxiliary(mid, kind) < target)
|
|
3007
|
+
lo = mid;
|
|
3008
|
+
else
|
|
3009
|
+
hi = mid;
|
|
3010
|
+
}
|
|
3011
|
+
return sign * ((lo + hi) / 2);
|
|
3012
|
+
}
|
|
3013
|
+
eccentricIntegral(s) {
|
|
3014
|
+
const e = Math.sqrt(Math.abs(this.e2));
|
|
3015
|
+
return e === 0 ? s : (this.e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
|
|
3016
|
+
}
|
|
3017
|
+
meridianIntegrand(t) {
|
|
3018
|
+
return this.ratio ** 2 / Math.hypot(Math.cos(t), this.ratio * Math.sin(t)) ** 3;
|
|
3019
|
+
}
|
|
3020
|
+
meridian(phi) {
|
|
3021
|
+
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);
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
function validateLatitude(value) {
|
|
3025
|
+
if (!(Number.isFinite(value) && Math.abs(value) <= 90))
|
|
3026
|
+
throw new Error("Latitude must be in [-90, 90] degrees");
|
|
3027
|
+
}
|
|
3028
|
+
function validateKind(kind) {
|
|
3029
|
+
if (!KINDS.includes(kind))
|
|
3030
|
+
throw new Error("Unknown auxiliary latitude");
|
|
3031
|
+
}
|
|
3032
|
+
function sincos(degrees2) {
|
|
3033
|
+
const a = Math.abs(degrees2);
|
|
3034
|
+
if (a <= 45)
|
|
3035
|
+
return [Math.sin(degrees2 * DEG), Math.cos(degrees2 * DEG)];
|
|
3036
|
+
return [Math.sign(degrees2) * Math.cos((90 - a) * DEG), Math.sin((90 - a) * DEG)];
|
|
3037
|
+
}
|
|
3038
|
+
function angle(s, c) {
|
|
3039
|
+
return s > c ? 90 - Math.atan2(c, s) / DEG : Math.atan2(s, c) / DEG;
|
|
3040
|
+
}
|
|
3041
|
+
function integrate(f, lo, hi) {
|
|
3042
|
+
let sum = 0;
|
|
3043
|
+
for (let j = 0; j < 8; ++j) {
|
|
3044
|
+
const h = (hi - lo) / 16, mid = lo + (2 * j + 1) * h;
|
|
3045
|
+
let part = 0;
|
|
3046
|
+
for (let i = 0; i < 8; ++i)
|
|
3047
|
+
part += WEIGHTS[i] * (f(mid - h * NODES[i]) + f(mid + h * NODES[i]));
|
|
3048
|
+
sum += h * part;
|
|
3049
|
+
}
|
|
3050
|
+
return sum;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
// dist/ellipsoid-rhumb.js
|
|
3054
|
+
var RhumbDomainError = class extends RangeError {
|
|
3055
|
+
constructor(reason) {
|
|
3056
|
+
super(reason === "pole" ? "Rhumb longitude/bearing is undefined at an exact pole" : "Rhumb crosses a pole; continuation longitude is undefined");
|
|
3057
|
+
this.reason = reason;
|
|
3058
|
+
this.name = "RhumbDomainError";
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
var DEG2 = Math.PI / 180;
|
|
3062
|
+
var EllipsoidRhumb = class {
|
|
3063
|
+
constructor({ semiMajorAxis: a, semiMinorAxis: b }) {
|
|
3064
|
+
if (!(Number.isFinite(a) && Number.isFinite(b) && a > 0 && b > 0))
|
|
3065
|
+
throw new RangeError("Rhumbs require finite positive axes");
|
|
3066
|
+
this.a = a;
|
|
3067
|
+
this.b = b;
|
|
3068
|
+
this.r = b / a;
|
|
3069
|
+
this.metrics = new EllipsoidMetrics({ semiMajorAxis: 1, semiMinorAxis: this.r });
|
|
3070
|
+
this.surfaceArea = a * this.metrics.surfaceArea * a;
|
|
3071
|
+
if (!(Number.isFinite(this.surfaceArea) && this.surfaceArea > 0))
|
|
3072
|
+
throw new RangeError("Rhumb surface area is unrepresentable");
|
|
3073
|
+
Object.freeze(this);
|
|
3074
|
+
}
|
|
3075
|
+
inverse(lat1, lon1, lat2, lon2, options = {}) {
|
|
3076
|
+
validateRhumbPoint(lat1, lon1);
|
|
3077
|
+
validateRhumbPoint(lat2, lon2);
|
|
3078
|
+
const turns = options.longitudeTurns ?? 0;
|
|
3079
|
+
if (!Number.isSafeInteger(turns))
|
|
3080
|
+
throw new RangeError("Rhumb longitudeTurns must be a safe integer");
|
|
3081
|
+
const longitude = angleDifference(lon1, lon2) + 360 * turns;
|
|
3082
|
+
if (!Number.isFinite(longitude))
|
|
3083
|
+
throw new RangeError("Unrepresentable rhumb winding");
|
|
3084
|
+
const dphi = (lat2 - lat1) * DEG2;
|
|
3085
|
+
const [meanM, meanP] = this.means(lat1, lat2);
|
|
3086
|
+
const dx = longitude * DEG2 * meanM / meanP;
|
|
3087
|
+
const distance = this.a * Math.hypot(dphi * meanM, dx);
|
|
3088
|
+
const azi = Math.atan2(longitude * DEG2, dphi * meanP) / DEG2;
|
|
3089
|
+
const result = {
|
|
3090
|
+
lat1,
|
|
3091
|
+
lon1,
|
|
3092
|
+
lat2,
|
|
3093
|
+
lon2: options.unrollLongitude ? lon1 + longitude : normalize(lon2),
|
|
3094
|
+
azi12: azi,
|
|
3095
|
+
s12: distance
|
|
3096
|
+
};
|
|
3097
|
+
if (options.area)
|
|
3098
|
+
result.S12 = this.area(lat1, lat2, longitude * DEG2);
|
|
3099
|
+
if (!Number.isFinite(distance))
|
|
3100
|
+
throw new RangeError("Unrepresentable rhumb distance");
|
|
3101
|
+
return result;
|
|
3102
|
+
}
|
|
3103
|
+
direct(latitude, longitude, azimuth, distance, options = {}) {
|
|
3104
|
+
return this.line(latitude, longitude, azimuth, options).position(distance);
|
|
3105
|
+
}
|
|
3106
|
+
line(latitude, longitude, azimuth, options = {}) {
|
|
3107
|
+
validateRhumbPoint(latitude, longitude);
|
|
3108
|
+
if (!Number.isFinite(azimuth))
|
|
3109
|
+
throw new RangeError("Rhumb azimuth must be finite");
|
|
3110
|
+
const [sa, ca] = sincosDegrees(azimuth);
|
|
3111
|
+
const area = Boolean(options.area), unroll = Boolean(options.unrollLongitude);
|
|
3112
|
+
const azi = normalize(azimuth);
|
|
3113
|
+
return {
|
|
3114
|
+
position: (distance) => {
|
|
3115
|
+
if (!Number.isFinite(distance))
|
|
3116
|
+
throw new RangeError("Rhumb distance must be finite");
|
|
3117
|
+
const delta = distance / this.a;
|
|
3118
|
+
if (!Number.isFinite(delta))
|
|
3119
|
+
throw new RangeError("Unrepresentable rhumb distance");
|
|
3120
|
+
const north = delta * ca;
|
|
3121
|
+
let poleDistance;
|
|
3122
|
+
if (north !== 0) {
|
|
3123
|
+
const gap = north > 0 ? this.meridianDelta(latitude, 90) : this.meridianDelta(-90, latitude);
|
|
3124
|
+
poleDistance = gap - Math.abs(north);
|
|
3125
|
+
if (Math.abs(poleDistance) < 1e-4 * gap)
|
|
3126
|
+
poleDistance = remainingPoleDistance(this.a, this.b, latitude, azimuth, distance, Math.sign(north));
|
|
3127
|
+
if (poleDistance < 0)
|
|
3128
|
+
throw new RhumbDomainError("pole-crossing");
|
|
3129
|
+
if (poleDistance === 0)
|
|
3130
|
+
throw new RhumbDomainError("pole");
|
|
3131
|
+
}
|
|
3132
|
+
const polar = north === 0 ? void 0 : this.polarEndpoint(latitude, north, poleDistance);
|
|
3133
|
+
const lat2 = north === 0 ? latitude : (polar == null ? void 0 : polar.latitude) ?? this.inverseMeridian(latitude, north);
|
|
3134
|
+
if (Math.abs(lat2) === 90)
|
|
3135
|
+
throw new RhumbDomainError("pole");
|
|
3136
|
+
const [meanM, meanP] = (polar == null ? void 0 : polar.means) ?? this.means(latitude, lat2);
|
|
3137
|
+
const dlon = delta * sa * meanP / meanM / DEG2;
|
|
3138
|
+
const lon2 = unroll ? longitude + dlon : normalize(normalize(longitude) + dlon);
|
|
3139
|
+
if (!Number.isFinite(lon2))
|
|
3140
|
+
throw new RangeError("Unrepresentable rhumb longitude");
|
|
3141
|
+
const result = {
|
|
3142
|
+
lat1: latitude,
|
|
3143
|
+
lon1: longitude,
|
|
3144
|
+
lat2,
|
|
3145
|
+
lon2,
|
|
3146
|
+
azi12: azi,
|
|
3147
|
+
s12: distance
|
|
3148
|
+
};
|
|
3149
|
+
if (area)
|
|
3150
|
+
result.S12 = this.area(latitude, lat2, dlon * DEG2, polar == null ? void 0 : polar.psi);
|
|
3151
|
+
return result;
|
|
3152
|
+
}
|
|
3153
|
+
};
|
|
3154
|
+
}
|
|
3155
|
+
means(lat1, lat2) {
|
|
3156
|
+
const d = (lat2 - lat1) * DEG2;
|
|
3157
|
+
const mid = (lat1 + lat2) / 2;
|
|
3158
|
+
const meanM = this.meridianMean(lat1, lat2);
|
|
3159
|
+
const cmin = Math.min(latitudeSinCos(lat1)[1], latitudeSinCos(lat2)[1]);
|
|
3160
|
+
const meanP = Math.abs(d) < 0.25 * cmin ? integrate((t) => {
|
|
3161
|
+
const [s, c] = latitudeSinCos(mid + t * (lat2 - lat1) / 2);
|
|
3162
|
+
return this.r ** 2 / (c * (c * c + (this.r * s) ** 2));
|
|
3163
|
+
}, -1, 1) / 2 : (this.psi(lat2) - this.psi(lat1)) / d;
|
|
3164
|
+
return [meanM, meanP];
|
|
3165
|
+
}
|
|
3166
|
+
psi(latitude) {
|
|
3167
|
+
return this.metrics.latitudeToAuxiliary(latitude, "isometric") * DEG2;
|
|
3168
|
+
}
|
|
3169
|
+
polarEndpoint(latitude, north, poleDistance) {
|
|
3170
|
+
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;
|
|
3171
|
+
const density = (theta2) => this.r ** 2 / Math.hypot(Math.sin(theta2), this.r * Math.cos(theta2)) ** 3;
|
|
3172
|
+
const gap = (theta2) => integrate(density, 0, theta2);
|
|
3173
|
+
const target = sign === Math.sign(north) ? poleDistance : this.meridianDelta(sign > 0 ? latitude : -90, sign > 0 ? 90 : latitude) - sign * north;
|
|
3174
|
+
if (!(target > 0 && target < gap(limit)))
|
|
3175
|
+
return void 0;
|
|
3176
|
+
let lo = 0, hi = limit, theta = target * this.r;
|
|
3177
|
+
if (!(theta > lo && theta < hi))
|
|
3178
|
+
theta = theta1;
|
|
3179
|
+
for (let i = 0; i < 64; i++) {
|
|
3180
|
+
const residual = gap(theta) - target;
|
|
3181
|
+
if (residual === 0)
|
|
3182
|
+
break;
|
|
3183
|
+
if (residual < 0)
|
|
3184
|
+
lo = theta;
|
|
3185
|
+
else
|
|
3186
|
+
hi = theta;
|
|
3187
|
+
const next = theta - residual / density(theta);
|
|
3188
|
+
if (next === theta)
|
|
3189
|
+
break;
|
|
3190
|
+
theta = next > lo && next < hi ? next : (lo + hi) / 2;
|
|
3191
|
+
if (theta === lo || theta === hi)
|
|
3192
|
+
break;
|
|
3193
|
+
if (i === 63)
|
|
3194
|
+
throw new Error("Rhumb polar meridian inversion did not converge");
|
|
3195
|
+
}
|
|
3196
|
+
const span = theta - theta1, mid = (theta + theta1) / 2;
|
|
3197
|
+
const meanM = integrate((t) => density(mid + t * span / 2), -1, 1) / 2;
|
|
3198
|
+
const meanP = Math.abs(span) < 0.25 * Math.min(Math.sin(theta), Math.sin(theta1)) ? integrate((t) => {
|
|
3199
|
+
const x = mid + t * span / 2, c = Math.sin(x), s = Math.cos(x);
|
|
3200
|
+
return this.r ** 2 / (c * (c * c + (this.r * s) ** 2));
|
|
3201
|
+
}, -1, 1) / 2 : -(this.polarPsi(theta) - this.polarPsi(theta1)) / span;
|
|
3202
|
+
return {
|
|
3203
|
+
latitude: sign * (90 - theta / DEG2),
|
|
3204
|
+
means: [meanM, meanP],
|
|
3205
|
+
psi: sign * this.polarPsi(theta)
|
|
3206
|
+
};
|
|
3207
|
+
}
|
|
3208
|
+
polarPsi(theta) {
|
|
3209
|
+
const s = Math.cos(theta), c = Math.sin(theta), e2 = (1 - this.r) * (1 + this.r), e = Math.sqrt(Math.abs(e2));
|
|
3210
|
+
const I = e === 0 ? s : (e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
|
|
3211
|
+
return Math.asinh(s / c) - e2 * I;
|
|
3212
|
+
}
|
|
3213
|
+
meridianMean(lat1, lat2) {
|
|
3214
|
+
const mid = (lat1 + lat2) / 2;
|
|
3215
|
+
return integrate((t) => {
|
|
3216
|
+
const [s, c] = latitudeSinCos(mid + t * (lat2 - lat1) / 2);
|
|
3217
|
+
return this.r ** 2 / Math.hypot(c, this.r * s) ** 3;
|
|
3218
|
+
}, -1, 1) / 2;
|
|
3219
|
+
}
|
|
3220
|
+
meridianDelta(lat1, lat2) {
|
|
3221
|
+
return (lat2 - lat1) * DEG2 * this.meridianMean(lat1, lat2);
|
|
3222
|
+
}
|
|
3223
|
+
inverseMeridian(start, displacement) {
|
|
3224
|
+
let lo = -90, hi = 90;
|
|
3225
|
+
let phi = start + displacement / this.metrics.meridionalCurvatureRadius(start) / DEG2;
|
|
3226
|
+
if (!(phi > lo && phi < hi))
|
|
3227
|
+
phi = (start + Math.sign(displacement) * 90) / 2;
|
|
3228
|
+
for (let i = 0; i < 64; i++) {
|
|
3229
|
+
const residual = this.meridianDelta(start, phi) - displacement;
|
|
3230
|
+
if (residual === 0)
|
|
3231
|
+
return phi;
|
|
3232
|
+
if (residual < 0)
|
|
3233
|
+
lo = phi;
|
|
3234
|
+
else
|
|
3235
|
+
hi = phi;
|
|
3236
|
+
const next = phi - residual / this.metrics.meridionalCurvatureRadius(phi) / DEG2;
|
|
3237
|
+
if (next === phi)
|
|
3238
|
+
return phi;
|
|
3239
|
+
phi = next > lo && next < hi ? next : (lo + hi) / 2;
|
|
3240
|
+
if (phi === lo || phi === hi) {
|
|
3241
|
+
const candidates = [lo, hi].filter((v) => Math.abs(v) < 90);
|
|
3242
|
+
return candidates.reduce((best, v) => Math.abs(this.meridianDelta(start, v) - displacement) < Math.abs(this.meridianDelta(start, best) - displacement) ? v : best);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
throw new Error("Rhumb meridian inversion did not converge");
|
|
3246
|
+
}
|
|
3247
|
+
inversePsi(psi) {
|
|
3248
|
+
let lo = -90, hi = 90, phi = Math.atan(Math.sinh(psi)) / DEG2;
|
|
3249
|
+
if (Math.abs(phi) === 90)
|
|
3250
|
+
phi = Math.sign(psi) * (90 - 2 ** -46);
|
|
3251
|
+
for (let i = 0; i < 32; i++) {
|
|
3252
|
+
const value = this.psi(phi) - psi;
|
|
3253
|
+
if (value === 0)
|
|
3254
|
+
return phi;
|
|
3255
|
+
if (value < 0)
|
|
3256
|
+
lo = phi;
|
|
3257
|
+
else
|
|
3258
|
+
hi = phi;
|
|
3259
|
+
const [s, c] = latitudeSinCos(phi);
|
|
3260
|
+
const next = phi - value * c * (c * c + (this.r * s) ** 2) / this.r ** 2 / DEG2;
|
|
3261
|
+
if (next === phi)
|
|
3262
|
+
return phi;
|
|
3263
|
+
phi = next > lo && next < hi ? next : (lo + hi) / 2;
|
|
3264
|
+
if (phi === lo || phi === hi)
|
|
3265
|
+
return phi;
|
|
3266
|
+
}
|
|
3267
|
+
throw new Error("Rhumb isometric inversion did not converge");
|
|
3268
|
+
}
|
|
3269
|
+
potential(latitude) {
|
|
3270
|
+
const [s, c] = latitudeSinCos(latitude), e2 = (1 - this.r) * (1 + this.r), e = Math.sqrt(Math.abs(e2));
|
|
3271
|
+
const I = e === 0 ? s : (e2 > 0 ? Math.atanh(e * s) : Math.atan(e * s)) / e;
|
|
3272
|
+
return this.r ** 2 * (s / (c * c + (this.r * s) ** 2) + I) / 2;
|
|
3273
|
+
}
|
|
3274
|
+
area(lat1, lat2, dlon, endpointPsi) {
|
|
3275
|
+
if (dlon === 0 || lat1 === -lat2)
|
|
3276
|
+
return 0;
|
|
3277
|
+
if (lat1 === lat2) {
|
|
3278
|
+
const value2 = this.a * dlon * (this.a * this.potential(lat1));
|
|
3279
|
+
if (!Number.isFinite(value2))
|
|
3280
|
+
throw new RangeError("Unrepresentable rhumb area");
|
|
3281
|
+
return value2;
|
|
3282
|
+
}
|
|
3283
|
+
const p1 = this.psi(lat1), p2 = endpointPsi ?? this.psi(lat2), mid = (p1 + p2) / 2, half = (p2 - p1) / 2;
|
|
3284
|
+
const pieces = Math.max(1, Math.ceil(Math.abs(p2 - p1) / 2));
|
|
3285
|
+
let sum = 0;
|
|
3286
|
+
for (let j = 0; j < pieces; j++)
|
|
3287
|
+
sum += integrate((t) => this.potential(this.inversePsi(mid + half * t)), -1 + 2 * j / pieces, -1 + 2 * (j + 1) / pieces);
|
|
3288
|
+
const value = this.a * dlon * (this.a * (sum / 2));
|
|
3289
|
+
if (!Number.isFinite(value))
|
|
3290
|
+
throw new RangeError("Unrepresentable rhumb area");
|
|
3291
|
+
return value;
|
|
3292
|
+
}
|
|
3293
|
+
};
|
|
3294
|
+
function validateRhumbPoint(latitude, longitude) {
|
|
3295
|
+
if (!(Number.isFinite(latitude) && Math.abs(latitude) <= 90 && Number.isFinite(longitude)))
|
|
3296
|
+
throw new RangeError("Rhumb coordinates require finite longitude and latitude in [-90,90]");
|
|
3297
|
+
if (Math.abs(latitude) === 90)
|
|
3298
|
+
throw new RhumbDomainError("pole");
|
|
3299
|
+
}
|
|
3300
|
+
function latitudeSinCos(phi) {
|
|
3301
|
+
const p = Math.abs(phi);
|
|
3302
|
+
return p <= 45 ? [Math.sin(phi * DEG2), Math.cos(phi * DEG2)] : [Math.sign(phi) * Math.cos((90 - p) * DEG2), Math.sin((90 - p) * DEG2)];
|
|
3303
|
+
}
|
|
3304
|
+
function sincosDegrees(angle2) {
|
|
3305
|
+
const reduced = angle2 % 360, q = Math.round(reduced / 90), d = reduced - 90 * q, x = d * DEG2;
|
|
3306
|
+
const s = Math.sin(x), c = Math.cos(x);
|
|
3307
|
+
switch ((q % 4 + 4) % 4) {
|
|
3308
|
+
case 0:
|
|
3309
|
+
return [s, c];
|
|
3310
|
+
case 1:
|
|
3311
|
+
return [c, -s];
|
|
3312
|
+
case 2:
|
|
3313
|
+
return [-s, -c];
|
|
3314
|
+
default:
|
|
3315
|
+
return [-c, s];
|
|
3316
|
+
}
|
|
3317
|
+
}
|
|
3318
|
+
function normalize(angle2) {
|
|
3319
|
+
let a = angle2 % 360;
|
|
3320
|
+
if (a > 180)
|
|
3321
|
+
a -= 360;
|
|
3322
|
+
if (a < -180)
|
|
3323
|
+
a += 360;
|
|
3324
|
+
return a;
|
|
3325
|
+
}
|
|
3326
|
+
function angleDifference(a, b) {
|
|
3327
|
+
let [d, e] = twoSum(-normalize(a), normalize(b));
|
|
3328
|
+
[d, e] = twoSum(normalize(d), e);
|
|
3329
|
+
if (Math.abs(d) === 180)
|
|
3330
|
+
return (e === 0 ? b < a : e > 0) ? -180 : 180;
|
|
3331
|
+
return d === 0 ? b < a ? -0 : 0 : d;
|
|
3332
|
+
}
|
|
3333
|
+
function twoSum(a, b) {
|
|
3334
|
+
const s = a + b, v = s - a;
|
|
3335
|
+
return [s, a - (s - v) + (b - v)];
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
// dist/rhumb-path.js
|
|
3339
|
+
var wgs842;
|
|
3340
|
+
function getDefaultRhumb() {
|
|
3341
|
+
if (!wgs842)
|
|
3342
|
+
wgs842 = new EllipsoidRhumb({ semiMajorAxis: WGS84_RADIUS_X, semiMinorAxis: WGS84_RADIUS_Z });
|
|
3343
|
+
return wgs842;
|
|
3344
|
+
}
|
|
3345
|
+
var RhumbPath = class {
|
|
3346
|
+
constructor(start, end, options = {}) {
|
|
3347
|
+
validateGeographicPosition(start);
|
|
3348
|
+
validateGeographicPosition(end);
|
|
3349
|
+
if (start.length !== end.length)
|
|
3350
|
+
throw new RangeError("Rhumb endpoint dimensions must match");
|
|
3351
|
+
const solver = options.rhumb || getDefaultRhumb();
|
|
3352
|
+
if (options.longitudeMode !== void 0 && !["shortest", "unrolled"].includes(options.longitudeMode) || options.longitudeMode === "unrolled" && options.longitudeTurns !== void 0)
|
|
3353
|
+
throw new RangeError("Choose explicit turns or unrolled endpoint longitudes");
|
|
3354
|
+
let inverse = solver.inverse(start[1], start[0], end[1], end[0], {
|
|
3355
|
+
longitudeTurns: options.longitudeTurns,
|
|
3356
|
+
unrollLongitude: true
|
|
3357
|
+
});
|
|
3358
|
+
if (options.longitudeMode === "unrolled") {
|
|
3359
|
+
const turns2 = Math.round((end[0] - inverse.lon2) / 360);
|
|
3360
|
+
if (turns2 !== 0)
|
|
3361
|
+
inverse = solver.inverse(start[1], start[0], end[1], end[0], {
|
|
3362
|
+
longitudeTurns: turns2,
|
|
3363
|
+
unrollLongitude: true
|
|
3364
|
+
});
|
|
3365
|
+
}
|
|
3366
|
+
if (![inverse.s12, inverse.azi12, inverse.lon2].every(Number.isFinite) || inverse.s12 < 0)
|
|
3367
|
+
throw new RangeError("Unresolved rhumb path");
|
|
3368
|
+
this.size = start.length;
|
|
3369
|
+
this.length = inverse.s12;
|
|
3370
|
+
this.first = Object.freeze(Array.from(start));
|
|
3371
|
+
const last = Array.from(end);
|
|
3372
|
+
const turns = Math.round((inverse.lon2 - end[0]) / 360);
|
|
3373
|
+
const endpoint = end[0] + 360 * turns;
|
|
3374
|
+
const retainsPhase = Number.isSafeInteger(turns) && Number.isFinite(endpoint) && Math.abs(endpoint - inverse.lon2) <= 4 * Number.EPSILON * Math.max(360, Math.abs(inverse.lon2));
|
|
3375
|
+
last[0] = inverse.s12 === 0 ? start[0] : retainsPhase ? endpoint : inverse.lon2;
|
|
3376
|
+
if (inverse.s12 === 0)
|
|
3377
|
+
last[1] = start[1];
|
|
3378
|
+
this.last = Object.freeze(last);
|
|
3379
|
+
this.line = solver.line(start[1], start[0], inverse.azi12, { unrollLongitude: true });
|
|
3380
|
+
}
|
|
3381
|
+
get start() {
|
|
3382
|
+
return this.first.slice();
|
|
3383
|
+
}
|
|
3384
|
+
get end() {
|
|
3385
|
+
return this.last.slice();
|
|
3386
|
+
}
|
|
3387
|
+
sample(fraction, result = new Array(this.size)) {
|
|
3388
|
+
if (!Number.isFinite(fraction) || fraction < 0 || fraction > 1)
|
|
3389
|
+
throw new RangeError("Rhumb fraction must be in [0, 1]");
|
|
3390
|
+
if (result.length !== this.size || ArrayBuffer.isView(result) && !(result instanceof Float32Array) && !(result instanceof Float64Array))
|
|
3391
|
+
throw new RangeError("Expected a floating rhumb output with matching dimensions");
|
|
3392
|
+
let longitude = this.first[0], latitude = this.first[1];
|
|
3393
|
+
if (fraction === 1) {
|
|
3394
|
+
longitude = this.last[0];
|
|
3395
|
+
latitude = this.last[1];
|
|
3396
|
+
} else if (fraction !== 0 && this.length !== 0) {
|
|
3397
|
+
const p = this.line.position(this.length * fraction);
|
|
3398
|
+
longitude = p.lon2;
|
|
3399
|
+
latitude = p.lat2;
|
|
3400
|
+
}
|
|
3401
|
+
const height = this.size === 3 ? this.first[2] * (1 - fraction) + this.last[2] * fraction : 0;
|
|
3402
|
+
const values = [longitude, latitude, height];
|
|
3403
|
+
if (!values.every(Number.isFinite) || result instanceof Float32Array && !values.every((x) => Number.isFinite(Math.fround(x))))
|
|
3404
|
+
throw new RangeError("Unrepresentable rhumb sample");
|
|
3405
|
+
result[0] = longitude;
|
|
3406
|
+
result[1] = latitude;
|
|
3407
|
+
if (this.size === 3)
|
|
3408
|
+
result[2] = height;
|
|
3409
|
+
return result;
|
|
3410
|
+
}
|
|
3411
|
+
sampleByDistance(distance, result = new Array(this.size)) {
|
|
3412
|
+
if (!Number.isFinite(distance) || distance < 0 || distance > this.length)
|
|
3413
|
+
throw new RangeError("Distance must be within the rhumb path");
|
|
3414
|
+
return this.sample(this.length === 0 ? 0 : distance / this.length, result);
|
|
3415
|
+
}
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
// dist/subdivide-rhumb-polyline.js
|
|
3419
|
+
function subdivideRhumbPolyline(input, options) {
|
|
3420
|
+
const { rhumb, longitudeTurns, longitudeMode, size = 2, maxSurfaceDistance = Infinity, ...subdivision } = options;
|
|
3421
|
+
const maxVertices = subdivision.maxVertices ?? 65536;
|
|
3422
|
+
if (longitudeMode !== void 0 && !["shortest", "unrolled"].includes(longitudeMode) || longitudeMode === "unrolled" && longitudeTurns !== void 0 || size !== 2 && size !== 3 || !Number.isSafeInteger(input.length) || input.length < 0 || input.length % size !== 0 || !Number.isSafeInteger(maxVertices) || maxVertices < 1 || maxVertices > 4294967295 || input.length / size > maxVertices || !(maxSurfaceDistance > 0) || maxSurfaceDistance !== Infinity && !Number.isFinite(maxSurfaceDistance))
|
|
3423
|
+
throw new RangeError("Invalid rhumb subdivision dimensions or limits");
|
|
3424
|
+
const count = Math.max(0, input.length / size - 1);
|
|
3425
|
+
const turns = longitudeTurns ? Array.from(longitudeTurns) : void 0;
|
|
3426
|
+
if (turns && (turns.length !== count || !turns.every(Number.isSafeInteger)))
|
|
3427
|
+
throw new RangeError("Expected one integer longitudeTurns value per rhumb edge");
|
|
3428
|
+
const positions = Array.from(input);
|
|
3429
|
+
for (let i = 0; i < positions.length; i += size)
|
|
3430
|
+
validateGeographicPosition(positions.slice(i, i + size));
|
|
3431
|
+
const original = positions.slice();
|
|
3432
|
+
const paths = [];
|
|
3433
|
+
for (let i = size; i < positions.length; i += size) {
|
|
3434
|
+
const path = new RhumbPath(original.slice(i - size, i), original.slice(i, i + size), {
|
|
3435
|
+
rhumb,
|
|
3436
|
+
longitudeMode,
|
|
3437
|
+
longitudeTurns: turns == null ? void 0 : turns[paths.length]
|
|
3438
|
+
});
|
|
3439
|
+
const first = positions.slice(i - size, i);
|
|
3440
|
+
const worldTurns = Math.round((first[0] - original[i - size]) / 360);
|
|
3441
|
+
const offset2 = 360 * worldTurns;
|
|
3442
|
+
if (!Number.isSafeInteger(worldTurns) || original[i - size] + offset2 !== first[0])
|
|
3443
|
+
throw new RangeError("Unrepresentable rhumb longitude chart");
|
|
3444
|
+
const last = path.end;
|
|
3445
|
+
const endTurns = Math.round((last[0] - original[i]) / 360);
|
|
3446
|
+
const translated = last[0] + offset2;
|
|
3447
|
+
const endpoint = original[i] + (offset2 + 360 * endTurns);
|
|
3448
|
+
last[0] = Number.isSafeInteger(endTurns) && Number.isFinite(endpoint) && Math.abs(endpoint - translated) <= 4 * Number.EPSILON * Math.max(360, Math.abs(translated)) ? endpoint : translated;
|
|
3449
|
+
if (path.length === 0) {
|
|
3450
|
+
last[0] = first[0];
|
|
3451
|
+
last[1] = first[1];
|
|
3452
|
+
}
|
|
3453
|
+
const sample = (fraction) => {
|
|
3454
|
+
if (fraction === 0)
|
|
3455
|
+
return first.slice();
|
|
3456
|
+
if (fraction === 1)
|
|
3457
|
+
return last.slice();
|
|
3458
|
+
const p = path.sample(fraction);
|
|
3459
|
+
p[0] += offset2;
|
|
3460
|
+
return p;
|
|
3461
|
+
};
|
|
3462
|
+
paths.push({ length: path.length, sample });
|
|
3463
|
+
positions.splice(i, size, ...sample(1));
|
|
3464
|
+
}
|
|
3465
|
+
return (0, import_polygon3.subdividePolyline)(positions, {
|
|
3466
|
+
...subdivision,
|
|
3467
|
+
size,
|
|
3468
|
+
maxSegmentLength: maxSurfaceDistance,
|
|
3469
|
+
createEdgeSampler: (_start, _end, index) => paths[index]
|
|
3470
|
+
});
|
|
3471
|
+
}
|
|
3472
|
+
|
|
3473
|
+
// dist/geographic-seams/types.js
|
|
3474
|
+
var GeographicSeamError = class extends RangeError {
|
|
3475
|
+
constructor(reason, message) {
|
|
3476
|
+
super(message);
|
|
3477
|
+
this.reason = reason;
|
|
3478
|
+
this.name = "GeographicSeamError";
|
|
3479
|
+
}
|
|
3480
|
+
};
|
|
3481
|
+
|
|
3482
|
+
// dist/geographic-seams/edge.js
|
|
3483
|
+
var ANGULAR_TOLERANCE = 1e-10;
|
|
3484
|
+
var MAX_LONGITUDE = 65536;
|
|
3485
|
+
var wgs843;
|
|
3486
|
+
function getDefaultGeodesic2() {
|
|
3487
|
+
if (!wgs843)
|
|
3488
|
+
wgs843 = new EllipsoidGeodesic({ semiMajorAxis: WGS84_RADIUS_X, semiMinorAxis: WGS84_RADIUS_Z });
|
|
3489
|
+
return wgs843;
|
|
3490
|
+
}
|
|
3491
|
+
var Context = class {
|
|
3492
|
+
constructor(options) {
|
|
3493
|
+
this.options = options;
|
|
3494
|
+
this.work = 0;
|
|
3495
|
+
this.vertices = 0;
|
|
3496
|
+
this.longitudeAliases = /* @__PURE__ */ new Map();
|
|
3497
|
+
this.options = { ...options };
|
|
3498
|
+
this.size = this.options.size ?? 2;
|
|
3499
|
+
this.right = this.options.seamLongitude ?? 180;
|
|
3500
|
+
this.left = this.right - 360;
|
|
3501
|
+
this.iterations = this.options.maxIterations ?? 64;
|
|
3502
|
+
this.maxVertices = this.options.maxVertices ?? 65536;
|
|
3503
|
+
this.maxWork = this.options.maxWork ?? 1e6;
|
|
3504
|
+
if (!["linear", "geodesic", "rhumb"].includes(this.options.edgeModel) || this.options.linearLongitude !== void 0 && !["supplied", "shortest"].includes(this.options.linearLongitude) || !Number.isSafeInteger(this.size) || this.size < 2 || this.size > 64 || !Number.isFinite(this.right) || Math.abs(this.right) > MAX_LONGITUDE || !Number.isSafeInteger(this.maxVertices) || this.maxVertices < 1 || this.maxVertices > 4294967295 || !Number.isSafeInteger(this.maxWork) || this.maxWork < 1 || this.maxWork > 1e8 || !Number.isInteger(this.iterations) || this.iterations < 1 || this.iterations > 128)
|
|
3505
|
+
throw new GeographicSeamError("input", "Invalid seam model, dimensions or limits");
|
|
3506
|
+
}
|
|
3507
|
+
tick(n = 1) {
|
|
3508
|
+
this.work += n;
|
|
3509
|
+
if (this.work > this.maxWork)
|
|
3510
|
+
throw new GeographicSeamError("limit", "Exceeded maxWork");
|
|
3511
|
+
}
|
|
3512
|
+
canonicalLongitude(longitude) {
|
|
3513
|
+
while (this.longitudeAliases.has(longitude)) {
|
|
3514
|
+
this.tick();
|
|
3515
|
+
longitude = this.longitudeAliases.get(longitude);
|
|
3516
|
+
}
|
|
3517
|
+
return longitude;
|
|
3518
|
+
}
|
|
3519
|
+
aliasLongitude(from, to) {
|
|
3520
|
+
const a = this.canonicalLongitude(from), b = this.canonicalLongitude(to);
|
|
3521
|
+
if (a !== b)
|
|
3522
|
+
this.longitudeAliases.set(a, b);
|
|
3523
|
+
}
|
|
3524
|
+
projectLongitude(longitude, shift2) {
|
|
3525
|
+
const world = Math.round((longitude - this.right) / 360);
|
|
3526
|
+
const translated = longitude === this.right + 360 * world ? this.right + 360 * (world + shift2 / 360) : longitude + shift2;
|
|
3527
|
+
return this.canonicalLongitude(translated);
|
|
3528
|
+
}
|
|
3529
|
+
addVertices(n) {
|
|
3530
|
+
this.vertices += n;
|
|
3531
|
+
if (this.vertices > this.maxVertices)
|
|
3532
|
+
throw new GeographicSeamError("limit", "Exceeded maxVertices");
|
|
3533
|
+
}
|
|
3534
|
+
read(input) {
|
|
3535
|
+
if (!Number.isSafeInteger(input.length) || input.length < 0 || input.length % this.size)
|
|
3536
|
+
throw new GeographicSeamError("input", "Invalid packed geographic positions or vertex limit");
|
|
3537
|
+
this.addVertices(input.length / this.size);
|
|
3538
|
+
const result = [];
|
|
3539
|
+
for (let i = 0; i < input.length; i += this.size) {
|
|
3540
|
+
this.tick();
|
|
3541
|
+
const p = Array.from({ length: this.size }, (_, k) => input[i + k]);
|
|
3542
|
+
if (!p.every(Number.isFinite) || Math.abs(p[0]) > MAX_LONGITUDE || Math.abs(p[1]) > 90)
|
|
3543
|
+
throw new GeographicSeamError("input", "Expected finite positions, latitude in [-90,90], |longitude| <= 65536");
|
|
3544
|
+
result.push(p);
|
|
3545
|
+
}
|
|
3546
|
+
return result;
|
|
3547
|
+
}
|
|
3548
|
+
};
|
|
3549
|
+
function same(a, b) {
|
|
3550
|
+
return a.length === b.length && a.every((x, i) => x === b[i]);
|
|
3551
|
+
}
|
|
3552
|
+
function shortDifference(delta) {
|
|
3553
|
+
const value = delta % 360;
|
|
3554
|
+
return value > 180 ? value - 360 : value < -180 ? value + 360 : value;
|
|
3555
|
+
}
|
|
3556
|
+
function shortLongitudeTurns(a, b) {
|
|
3557
|
+
const delta = b - a, virtual = delta - b;
|
|
3558
|
+
const low = b - (delta - virtual) + (-a - virtual);
|
|
3559
|
+
const remainder = delta % 360;
|
|
3560
|
+
let turns = -Math.trunc(delta / 360);
|
|
3561
|
+
if (remainder > 180 || remainder === 180 && low > 0)
|
|
3562
|
+
turns--;
|
|
3563
|
+
if (remainder < -180 || remainder === -180 && low < 0)
|
|
3564
|
+
turns++;
|
|
3565
|
+
return turns;
|
|
3566
|
+
}
|
|
3567
|
+
function oppositeMeridians(a, b) {
|
|
3568
|
+
const x = shortDifference(b), y = -shortDifference(a), sum = x + y, virtual = sum - x;
|
|
3569
|
+
return Math.abs(sum) === 180 && x - (sum - virtual) + (y - virtual) === 0;
|
|
3570
|
+
}
|
|
3571
|
+
function worldAt(x, context) {
|
|
3572
|
+
let world = Math.floor((x - context.right) / 360) + 1;
|
|
3573
|
+
while (x < context.right + 360 * (world - 1))
|
|
3574
|
+
world--;
|
|
3575
|
+
while (x >= context.right + 360 * world)
|
|
3576
|
+
world++;
|
|
3577
|
+
return world;
|
|
3578
|
+
}
|
|
3579
|
+
function chartPoint(point, world, context) {
|
|
3580
|
+
const p = point.slice();
|
|
3581
|
+
p[0] -= 360 * world;
|
|
3582
|
+
const onLeft = point[0] === context.right + 360 * (world - 1);
|
|
3583
|
+
const onRight = point[0] === context.right + 360 * world;
|
|
3584
|
+
if (onLeft)
|
|
3585
|
+
p[0] = context.left;
|
|
3586
|
+
if (onRight)
|
|
3587
|
+
p[0] = context.right;
|
|
3588
|
+
if (!onLeft && p[0] === context.left || !onRight && p[0] === context.right)
|
|
3589
|
+
throw new GeographicSeamError("precision", "Longitude displacement cannot be represented in this chart");
|
|
3590
|
+
return p;
|
|
3591
|
+
}
|
|
3592
|
+
function straight(a, b) {
|
|
3593
|
+
return { a, b, source: null, sample: (t) => a.map((x, i) => x * (1 - t) + b[i] * t) };
|
|
3594
|
+
}
|
|
3595
|
+
function slice(edge, lo, hi) {
|
|
3596
|
+
const a = lo === 0 ? edge.a : lo === 1 ? edge.b : edge.sample(lo);
|
|
3597
|
+
const b = hi === 0 ? edge.a : hi === 1 ? edge.b : edge.sample(hi);
|
|
3598
|
+
const source = edge.source && {
|
|
3599
|
+
...edge.source,
|
|
3600
|
+
startFraction: edge.source.startFraction + (edge.source.endFraction - edge.source.startFraction) * lo,
|
|
3601
|
+
endFraction: edge.source.startFraction + (edge.source.endFraction - edge.source.startFraction) * hi
|
|
3602
|
+
};
|
|
3603
|
+
return {
|
|
3604
|
+
a,
|
|
3605
|
+
b,
|
|
3606
|
+
source,
|
|
3607
|
+
sample: (t) => t === 0 ? a.slice() : t === 1 ? b.slice() : edge.sample(lo + (hi - lo) * t)
|
|
3608
|
+
};
|
|
3609
|
+
}
|
|
3610
|
+
function shift(edge, delta) {
|
|
3611
|
+
const move = (p) => [p[0] + delta, ...p.slice(1)];
|
|
3612
|
+
return {
|
|
3613
|
+
a: move(edge.a),
|
|
3614
|
+
b: move(edge.b),
|
|
3615
|
+
source: edge.source && { ...edge.source, longitudeShift: edge.source.longitudeShift + delta },
|
|
3616
|
+
sample: (t) => move(edge.sample(t))
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
function createEdges(start, end, originalStart, edgeIndex, ringIndex, turns, context, splitLatitude = true) {
|
|
3620
|
+
context.tick();
|
|
3621
|
+
const { edgeModel, linearLongitude = "supplied" } = context.options;
|
|
3622
|
+
if (!Number.isSafeInteger(turns) || Math.abs(turns) > 128 || turns !== 0 && edgeModel !== "rhumb")
|
|
3623
|
+
throw new GeographicSeamError("input", "Turns require rhumb edges and |turns| <= 128");
|
|
3624
|
+
let offset2 = 360 * Math.round((start[0] - originalStart[0]) / 360);
|
|
3625
|
+
const source = {
|
|
3626
|
+
ringIndex,
|
|
3627
|
+
edgeIndex,
|
|
3628
|
+
startFraction: 0,
|
|
3629
|
+
endFraction: 1,
|
|
3630
|
+
longitudeShift: offset2
|
|
3631
|
+
};
|
|
3632
|
+
const first = start.slice(), last = end.slice();
|
|
3633
|
+
let horizontal;
|
|
3634
|
+
let critical;
|
|
3635
|
+
let pole;
|
|
3636
|
+
if (edgeModel === "linear") {
|
|
3637
|
+
last[0] = end[0] + (offset2 + (linearLongitude === "shortest" ? 360 * shortLongitudeTurns(originalStart[0], end[0]) : 0));
|
|
3638
|
+
horizontal = (t) => [first[0] * (1 - t) + last[0] * t, first[1] * (1 - t) + last[1] * t];
|
|
3639
|
+
} else if (edgeModel === "rhumb") {
|
|
3640
|
+
context.tick(2);
|
|
3641
|
+
const path = new RhumbPath(originalStart.slice(0, 2), last.slice(0, 2), {
|
|
3642
|
+
rhumb: context.options.rhumb,
|
|
3643
|
+
longitudeTurns: turns
|
|
3644
|
+
});
|
|
3645
|
+
last[0] = end[0] + (360 * Math.round((path.end[0] - end[0]) / 360) + offset2);
|
|
3646
|
+
horizontal = (t) => {
|
|
3647
|
+
const p = path.sample(t);
|
|
3648
|
+
p[0] += offset2;
|
|
3649
|
+
return p;
|
|
3650
|
+
};
|
|
3651
|
+
} else {
|
|
3652
|
+
context.tick(3);
|
|
3653
|
+
const solver = context.options.geodesic || getDefaultGeodesic2();
|
|
3654
|
+
const path = new GeodesicPath(originalStart.slice(0, 2), last.slice(0, 2), { geodesic: solver });
|
|
3655
|
+
if (Math.abs(first[1]) === 90) {
|
|
3656
|
+
context.tick(2);
|
|
3657
|
+
const incomingChart = new GeodesicPath(first.slice(0, 2), last.slice(0, 2), {
|
|
3658
|
+
geodesic: solver
|
|
3659
|
+
});
|
|
3660
|
+
offset2 = 360 * Math.round((incomingChart.end[0] - path.end[0]) / 360);
|
|
3661
|
+
source.longitudeShift = offset2;
|
|
3662
|
+
}
|
|
3663
|
+
last[0] = end[0] + (360 * Math.round((path.end[0] - end[0]) / 360) + offset2);
|
|
3664
|
+
horizontal = (t) => {
|
|
3665
|
+
const p = path.sample(t);
|
|
3666
|
+
p[0] += offset2;
|
|
3667
|
+
return p;
|
|
3668
|
+
};
|
|
3669
|
+
if (Math.abs(first[1]) === 90)
|
|
3670
|
+
first[0] = last[0];
|
|
3671
|
+
if (Math.abs(last[1]) === 90)
|
|
3672
|
+
last[0] = first[0];
|
|
3673
|
+
const inverse = solver.inverse(originalStart[1], originalStart[0], end[1], end[0]);
|
|
3674
|
+
const c1 = Math.cos(inverse.azi1 * Math.PI / 180), c2 = Math.cos(inverse.azi2 * Math.PI / 180);
|
|
3675
|
+
if (path.length > 0 && oppositeMeridians(originalStart[0], end[0]) && (inverse.azi1 === 0 || Math.abs(inverse.azi1) === 180) && Math.abs(first[1]) !== 90 && Math.abs(last[1]) !== 90) {
|
|
3676
|
+
const latitude = c1 > 0 ? 90 : -90;
|
|
3677
|
+
context.tick(2);
|
|
3678
|
+
const fraction = solver.inverse(start[1], start[0], latitude, start[0]).s12 / path.length;
|
|
3679
|
+
if (fraction > 0 && fraction < 1 && Math.abs(path.sample(fraction)[1] - latitude) < ANGULAR_TOLERANCE)
|
|
3680
|
+
pole = { fraction, latitude };
|
|
3681
|
+
} else if (splitLatitude && c1 * c2 < 0 && path.length > 0) {
|
|
3682
|
+
context.tick();
|
|
3683
|
+
const line = solver.line(originalStart[1], originalStart[0], inverse.azi1, {
|
|
3684
|
+
unrollLongitude: true
|
|
3685
|
+
});
|
|
3686
|
+
let lo = 0, hi = 1;
|
|
3687
|
+
for (let i = 0; i < 64; i++) {
|
|
3688
|
+
context.tick();
|
|
3689
|
+
const mid = (lo + hi) / 2;
|
|
3690
|
+
const c = Math.cos(line.position(path.length * mid).azi2 * Math.PI / 180);
|
|
3691
|
+
if (c > 0 === c1 > 0)
|
|
3692
|
+
lo = mid;
|
|
3693
|
+
else
|
|
3694
|
+
hi = mid;
|
|
3695
|
+
}
|
|
3696
|
+
critical = (lo + hi) / 2;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
if (Math.abs(last[0]) > MAX_LONGITUDE)
|
|
3700
|
+
throw new GeographicSeamError("input", "Unrolled longitude exceeds the declared seam profile");
|
|
3701
|
+
const sample = (t) => {
|
|
3702
|
+
context.tick();
|
|
3703
|
+
const p = t === 0 ? first.slice(0, 2) : t === 1 ? last.slice(0, 2) : horizontal(t);
|
|
3704
|
+
for (let i = 2; i < first.length; i++)
|
|
3705
|
+
p[i] = first[i] * (1 - t) + last[i] * t;
|
|
3706
|
+
if (!p.every(Number.isFinite))
|
|
3707
|
+
throw new GeographicSeamError("precision", "Nonfinite edge sample");
|
|
3708
|
+
return p;
|
|
3709
|
+
};
|
|
3710
|
+
const edge = { a: first, b: last, source, sample };
|
|
3711
|
+
if (pole) {
|
|
3712
|
+
const incoming = slice(edge, 0, pole.fraction), outgoing = slice(edge, pole.fraction, 1);
|
|
3713
|
+
incoming.b = [first[0], pole.latitude, ...sample(pole.fraction).slice(2)];
|
|
3714
|
+
outgoing.a = [last[0], pole.latitude, ...incoming.b.slice(2)];
|
|
3715
|
+
const incomingSample = incoming.sample, outgoingSample = outgoing.sample;
|
|
3716
|
+
incoming.sample = (t) => t === 1 ? incoming.b.slice() : incomingSample(t);
|
|
3717
|
+
outgoing.sample = (t) => t === 0 ? outgoing.a.slice() : outgoingSample(t);
|
|
3718
|
+
return [incoming, straight(incoming.b, outgoing.a), outgoing];
|
|
3719
|
+
}
|
|
3720
|
+
return critical !== void 0 && critical > 0 && critical < 1 ? [slice(edge, 0, critical), slice(edge, critical, 1)] : [edge];
|
|
3721
|
+
}
|
|
3722
|
+
function root(edge, axis, value, context) {
|
|
3723
|
+
if (edge.a[axis] === value)
|
|
3724
|
+
return 0;
|
|
3725
|
+
if (edge.b[axis] === value)
|
|
3726
|
+
return 1;
|
|
3727
|
+
if (!(value > Math.min(edge.a[axis], edge.b[axis]) && value < Math.max(edge.a[axis], edge.b[axis])))
|
|
3728
|
+
throw new GeographicSeamError("precision", "Unbracketed seam root");
|
|
3729
|
+
let lo = 0, hi = 1, a = edge.a, b = edge.b;
|
|
3730
|
+
for (let i = 0; i < context.iterations; i++) {
|
|
3731
|
+
context.tick();
|
|
3732
|
+
const t = (lo + hi) / 2, p = edge.sample(t);
|
|
3733
|
+
if (p[axis] === value)
|
|
3734
|
+
return t;
|
|
3735
|
+
if (hi - lo <= 4 * Number.EPSILON && Math.abs(a[0] - b[0]) * Math.max(Math.abs(Math.cos(a[1] * Math.PI / 180)), Math.abs(Math.cos(b[1] * Math.PI / 180))) <= ANGULAR_TOLERANCE && Math.abs(a[1] - b[1]) <= ANGULAR_TOLERANCE)
|
|
3736
|
+
return t;
|
|
3737
|
+
if (t === lo || t === hi)
|
|
3738
|
+
break;
|
|
3739
|
+
if (p[axis] < value === edge.a[axis] < edge.b[axis]) {
|
|
3740
|
+
lo = t;
|
|
3741
|
+
a = p;
|
|
3742
|
+
} else {
|
|
3743
|
+
hi = t;
|
|
3744
|
+
b = p;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
throw new GeographicSeamError("precision", "Seam root exhausted its precision/iteration budget");
|
|
3748
|
+
}
|
|
3749
|
+
function cut(edge, context) {
|
|
3750
|
+
const low = Math.min(edge.a[0], edge.b[0]), high = Math.max(edge.a[0], edge.b[0]);
|
|
3751
|
+
const fractions = [0, 1];
|
|
3752
|
+
for (let k = worldAt(low, context); context.right + 360 * k < high; k++) {
|
|
3753
|
+
context.tick();
|
|
3754
|
+
fractions.push(root(edge, 0, context.right + 360 * k, context));
|
|
3755
|
+
if (fractions.length > context.maxVertices)
|
|
3756
|
+
throw new GeographicSeamError("limit", "Too many seam crossings");
|
|
3757
|
+
}
|
|
3758
|
+
fractions.sort((a, b) => a - b);
|
|
3759
|
+
const result = [];
|
|
3760
|
+
for (let i = 1; i < fractions.length; i++) {
|
|
3761
|
+
context.tick();
|
|
3762
|
+
context.addVertices(2);
|
|
3763
|
+
const piece = slice(edge, fractions[i - 1], fractions[i]);
|
|
3764
|
+
for (const p of [piece.a, piece.b]) {
|
|
3765
|
+
const k = Math.round((p[0] - context.right) / 360), boundary = context.right + 360 * k;
|
|
3766
|
+
if (fractions[i - 1] !== 0 && p === piece.a || fractions[i] !== 1 && p === piece.b)
|
|
3767
|
+
p[0] = boundary;
|
|
3768
|
+
}
|
|
3769
|
+
const onBoundary = (x) => x === context.right + 360 * Math.round((x - context.right) / 360);
|
|
3770
|
+
const reference = !onBoundary(piece.a[0]) ? piece.a[0] : !onBoundary(piece.b[0]) ? piece.b[0] : (piece.a[0] + piece.b[0]) / 2;
|
|
3771
|
+
const world = worldAt(reference, context);
|
|
3772
|
+
const shifted = shift(piece, -360 * world);
|
|
3773
|
+
shifted.a = chartPoint(piece.a, world, context);
|
|
3774
|
+
shifted.b = chartPoint(piece.b, world, context);
|
|
3775
|
+
const previousSample = shifted.sample;
|
|
3776
|
+
shifted.sample = (t) => t === 0 ? shifted.a.slice() : t === 1 ? shifted.b.slice() : previousSample(t);
|
|
3777
|
+
result.push({ edge: shifted, world });
|
|
3778
|
+
}
|
|
3779
|
+
return result;
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3782
|
+
// dist/geographic-seams/polygon.js
|
|
3783
|
+
function winding(edges, point, context, side, generatedBoundary = true, longitudeShift = 0) {
|
|
3784
|
+
let value = 0, boundary = false;
|
|
3785
|
+
for (const edge of edges) {
|
|
3786
|
+
context.tick();
|
|
3787
|
+
const a = edge.a, b = edge.b;
|
|
3788
|
+
if (a[1] === b[1]) {
|
|
3789
|
+
if ((generatedBoundary || edge.source) && point[1] === a[1] && point[0] >= Math.min(context.projectLongitude(a[0], longitudeShift), context.projectLongitude(b[0], longitudeShift)) && point[0] <= Math.max(context.projectLongitude(a[0], longitudeShift), context.projectLongitude(b[0], longitudeShift)))
|
|
3790
|
+
boundary = true;
|
|
3791
|
+
continue;
|
|
3792
|
+
}
|
|
3793
|
+
if (point[1] >= Math.min(a[1], b[1]) && point[1] <= Math.max(a[1], b[1])) {
|
|
3794
|
+
const t = root(edge, 1, point[1], context), x = context.projectLongitude(edge.sample(t)[0], longitudeShift);
|
|
3795
|
+
if ((generatedBoundary || edge.source) && Math.abs(x - point[0]) <= ANGULAR_TOLERANCE)
|
|
3796
|
+
boundary = true;
|
|
3797
|
+
if (a[1] > point[1] !== b[1] > point[1] && (side === "left" ? x >= point[0] : x > point[0]))
|
|
3798
|
+
value += b[1] > a[1] ? 1 : -1;
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
return { value, boundary };
|
|
3802
|
+
}
|
|
3803
|
+
function contains(ring, p, context, side) {
|
|
3804
|
+
context.tick();
|
|
3805
|
+
for (let k = Math.ceil((ring.min - p[0]) / 360) - 1; k <= Math.floor((ring.max - p[0]) / 360) + 1; k++) {
|
|
3806
|
+
context.tick();
|
|
3807
|
+
if (winding(ring.membership, p, context, side, false, -360 * k).value !== 0)
|
|
3808
|
+
return true;
|
|
3809
|
+
}
|
|
3810
|
+
return false;
|
|
3811
|
+
}
|
|
3812
|
+
function filled(rings, p, context, side) {
|
|
3813
|
+
return contains(rings[0], p, context, side) && !rings.slice(1).some((r) => contains(r, p, context, side));
|
|
3814
|
+
}
|
|
3815
|
+
function prepare(input, index, context) {
|
|
3816
|
+
const positions = context.read(input.positions);
|
|
3817
|
+
if (positions.length > 1 && positions[0][0] === positions[positions.length - 1][0] && positions[0][1] === positions[positions.length - 1][1]) {
|
|
3818
|
+
if (!same(positions[0], positions[positions.length - 1]))
|
|
3819
|
+
throw new GeographicSeamError("input", "Closing polygon attributes must match");
|
|
3820
|
+
positions.pop();
|
|
3821
|
+
}
|
|
3822
|
+
if (new Set(positions.map((p) => `${p[0]},${p[1]}`)).size < 3)
|
|
3823
|
+
throw new GeographicSeamError("topology", "Polygon ring needs three distinct positions");
|
|
3824
|
+
const turns = input.longitudeTurns ? Array.from(input.longitudeTurns) : new Array(positions.length).fill(0);
|
|
3825
|
+
if (turns.length !== positions.length)
|
|
3826
|
+
throw new GeographicSeamError("input", "Expected a turn count per ring edge");
|
|
3827
|
+
const edges = [];
|
|
3828
|
+
let cursor = positions[0];
|
|
3829
|
+
for (let i = 0; i < positions.length; i++) {
|
|
3830
|
+
const end = positions[(i + 1) % positions.length];
|
|
3831
|
+
const pieces = createEdges(cursor, end, positions[i], i, index, turns[i], context);
|
|
3832
|
+
if (edges.length && !same(cursor, pieces[0].a)) {
|
|
3833
|
+
if (Math.abs(cursor[1]) !== 90 || cursor[1] !== pieces[0].a[1])
|
|
3834
|
+
throw new GeographicSeamError("precision", "Discontinuous ring edge");
|
|
3835
|
+
edges.push(straight(cursor, pieces[0].a));
|
|
3836
|
+
}
|
|
3837
|
+
for (const edge of pieces) {
|
|
3838
|
+
if (edge.a[0] === edge.b[0] && edge.a[1] === edge.b[1]) {
|
|
3839
|
+
if (!same(edge.a, edge.b))
|
|
3840
|
+
throw new GeographicSeamError("topology", "Zero-length polygon edge changes attributes");
|
|
3841
|
+
} else
|
|
3842
|
+
edges.push(edge);
|
|
3843
|
+
}
|
|
3844
|
+
cursor = pieces[pieces.length - 1].b;
|
|
3845
|
+
}
|
|
3846
|
+
if (!edges.length)
|
|
3847
|
+
throw new GeographicSeamError("topology", "Empty polygon boundary");
|
|
3848
|
+
const first = edges[0].a;
|
|
3849
|
+
if (Math.abs(first[1]) === 90) {
|
|
3850
|
+
const closing = first.slice();
|
|
3851
|
+
closing[0] += 360 * Math.round((cursor[0] - first[0]) / 360);
|
|
3852
|
+
if (!same(cursor, closing))
|
|
3853
|
+
edges.push(straight(cursor, closing));
|
|
3854
|
+
cursor = closing;
|
|
3855
|
+
}
|
|
3856
|
+
const turnsAround = Math.round((cursor[0] - first[0]) / 360);
|
|
3857
|
+
if (Math.abs(cursor[0] - first[0] - 360 * turnsAround) > ANGULAR_TOLERANCE || cursor[1] !== first[1] || Math.abs(turnsAround) > 1)
|
|
3858
|
+
throw new GeographicSeamError("topology", "Unsupported ring winding");
|
|
3859
|
+
let min = Infinity, max = -Infinity;
|
|
3860
|
+
for (const e of edges) {
|
|
3861
|
+
min = Math.min(min, e.a[0], e.b[0]);
|
|
3862
|
+
max = Math.max(max, e.a[0], e.b[0]);
|
|
3863
|
+
}
|
|
3864
|
+
if (max - min > 360 + ANGULAR_TOLERANCE)
|
|
3865
|
+
throw new GeographicSeamError("topology", "Ring exceeds a single longitude chart");
|
|
3866
|
+
const membership = edges.slice();
|
|
3867
|
+
const poleAttributes = input.poleAttributes ? Array.from(input.poleAttributes) : [];
|
|
3868
|
+
if (turnsAround !== 0) {
|
|
3869
|
+
if (!["north", "south"].includes(input.pole) || edges.some((e) => Math.abs(e.a[1]) === 90 || (e.b[0] - e.a[0]) * turnsAround < 0))
|
|
3870
|
+
throw new GeographicSeamError("topology", "Polar rings require an explicit pole and monotone longitude winding");
|
|
3871
|
+
if (poleAttributes.length !== context.size - 2 || !poleAttributes.every(Number.isFinite))
|
|
3872
|
+
throw new GeographicSeamError("input", "Explicit poleAttributes are required for polar attributes");
|
|
3873
|
+
const latitude = input.pole === "north" ? 90 : -90;
|
|
3874
|
+
const a = [cursor[0], latitude, ...poleAttributes], b = [first[0], latitude, ...poleAttributes];
|
|
3875
|
+
membership.push(straight(cursor, a), straight(a, b), straight(b, first));
|
|
3876
|
+
} else if (input.pole !== void 0 || poleAttributes.length) {
|
|
3877
|
+
throw new GeographicSeamError("input", "Pole selection applies only to once-winding polar rings");
|
|
3878
|
+
}
|
|
3879
|
+
return { edges, membership, min, max, pole: input.pole, poleAttributes };
|
|
3880
|
+
}
|
|
3881
|
+
function reverse(edge) {
|
|
3882
|
+
return {
|
|
3883
|
+
a: edge.b,
|
|
3884
|
+
b: edge.a,
|
|
3885
|
+
sample: (t) => edge.sample(1 - t),
|
|
3886
|
+
source: edge.source && {
|
|
3887
|
+
...edge.source,
|
|
3888
|
+
startFraction: edge.source.endFraction,
|
|
3889
|
+
endFraction: edge.source.startFraction
|
|
3890
|
+
}
|
|
3891
|
+
};
|
|
3892
|
+
}
|
|
3893
|
+
function canonicalAlias(edge, context) {
|
|
3894
|
+
const move = (p) => {
|
|
3895
|
+
const longitude = context.canonicalLongitude(p[0]);
|
|
3896
|
+
return longitude === p[0] ? p : [longitude, ...p.slice(1)];
|
|
3897
|
+
};
|
|
3898
|
+
return { ...edge, a: move(edge.a), b: move(edge.b), sample: (t) => move(edge.sample(t)) };
|
|
3899
|
+
}
|
|
3900
|
+
function interior(edges, context) {
|
|
3901
|
+
const ys = Array.from(new Set(edges.flatMap((e) => [e.a[1], e.b[1]]))).sort((a, b) => a - b);
|
|
3902
|
+
let index = 1;
|
|
3903
|
+
for (let i = 2; i < ys.length; i++)
|
|
3904
|
+
if (ys[i] - ys[i - 1] > ys[index] - ys[index - 1])
|
|
3905
|
+
index = i;
|
|
3906
|
+
if (ys.length < 2 || ys[index] - ys[index - 1] < 8 * ANGULAR_TOLERANCE)
|
|
3907
|
+
throw new GeographicSeamError("precision", "Polygon height below the topology budget");
|
|
3908
|
+
const y = (ys[index] + ys[index - 1]) / 2, xs = [];
|
|
3909
|
+
for (const edge of edges) {
|
|
3910
|
+
context.tick();
|
|
3911
|
+
if (edge.a[1] > y !== edge.b[1] > y)
|
|
3912
|
+
xs.push(edge.sample(root(edge, 1, y, context))[0]);
|
|
3913
|
+
}
|
|
3914
|
+
xs.sort((a, b) => a - b);
|
|
3915
|
+
for (let i = 1; i < xs.length; i++) {
|
|
3916
|
+
context.tick();
|
|
3917
|
+
if (xs[i] - xs[i - 1] < 8 * ANGULAR_TOLERANCE)
|
|
3918
|
+
continue;
|
|
3919
|
+
const point = [(xs[i] + xs[i - 1]) / 2, y], w = winding(edges, point, context);
|
|
3920
|
+
if (w.value && !w.boundary) {
|
|
3921
|
+
if (Math.abs(w.value) !== 1)
|
|
3922
|
+
throw new GeographicSeamError("topology", "Non-simple polygon winding");
|
|
3923
|
+
return { point, sign: Math.sign(w.value) };
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
throw new GeographicSeamError("topology", "No resolvable polygon interior");
|
|
3927
|
+
}
|
|
3928
|
+
function output(edges, sign, context) {
|
|
3929
|
+
if (interior(edges, context).sign !== sign)
|
|
3930
|
+
edges = edges.slice().reverse().map(reverse);
|
|
3931
|
+
context.addVertices(edges.length + 1);
|
|
3932
|
+
return {
|
|
3933
|
+
positions: new Float64Array([...edges.flatMap((e) => e.a), ...edges[0].a]),
|
|
3934
|
+
edges: edges.map((e) => e.source && { ...e.source })
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
function splitGeographicPolygon(inputs, options) {
|
|
3938
|
+
const context = new Context(options);
|
|
3939
|
+
if (!inputs.length)
|
|
3940
|
+
return [];
|
|
3941
|
+
context.tick(inputs.length);
|
|
3942
|
+
const rings = inputs.map((ring, i) => prepare(ring, i, context));
|
|
3943
|
+
const graph = [], nodes = /* @__PURE__ */ new Map();
|
|
3944
|
+
const key = (p) => `${p[0]},${p[1]}`;
|
|
3945
|
+
const add = (edge) => {
|
|
3946
|
+
context.tick();
|
|
3947
|
+
if (edge.a[0] === edge.b[0] && edge.a[1] === edge.b[1])
|
|
3948
|
+
return;
|
|
3949
|
+
const id = graph.length;
|
|
3950
|
+
graph.push(edge);
|
|
3951
|
+
for (const p of [edge.a, edge.b]) {
|
|
3952
|
+
const k = key(p), node = nodes.get(k);
|
|
3953
|
+
if (node) {
|
|
3954
|
+
if (!same(node.p, p))
|
|
3955
|
+
throw new GeographicSeamError("topology", "Touching boundaries have inconsistent attributes");
|
|
3956
|
+
node.edges.push(id);
|
|
3957
|
+
} else
|
|
3958
|
+
nodes.set(k, { p, edges: [id] });
|
|
3959
|
+
}
|
|
3960
|
+
};
|
|
3961
|
+
const pieces = [];
|
|
3962
|
+
const meridians = /* @__PURE__ */ new Map();
|
|
3963
|
+
for (const ring of rings) {
|
|
3964
|
+
if (ring.max - ring.min === 360) {
|
|
3965
|
+
const low = chartPoint([ring.min, 0], worldAt(ring.min, context), context)[0];
|
|
3966
|
+
const high = chartPoint([ring.max, 0], worldAt(ring.max, context), context)[0];
|
|
3967
|
+
const roundoff = 4 * Number.EPSILON * Math.max(360, Math.abs(ring.min), Math.abs(ring.max), Math.abs(context.left), Math.abs(context.right));
|
|
3968
|
+
if (Math.abs(high - low) > Math.min(roundoff, ANGULAR_TOLERANCE))
|
|
3969
|
+
throw new GeographicSeamError("precision", "Unresolvable full-width longitude alias");
|
|
3970
|
+
if (high === context.left)
|
|
3971
|
+
context.aliasLongitude(low, high);
|
|
3972
|
+
else
|
|
3973
|
+
context.aliasLongitude(high, low);
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
for (const ring of rings) {
|
|
3977
|
+
for (const original of ring.edges)
|
|
3978
|
+
for (const { edge: part } of cut(original, context)) {
|
|
3979
|
+
const edge = canonicalAlias(part, context);
|
|
3980
|
+
pieces.push(edge);
|
|
3981
|
+
if (edge.a[0] === edge.b[0]) {
|
|
3982
|
+
const events = meridians.get(edge.a[0]) || /* @__PURE__ */ new Set();
|
|
3983
|
+
events.add(edge.a[1]);
|
|
3984
|
+
events.add(edge.b[1]);
|
|
3985
|
+
meridians.set(edge.a[0], events);
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
}
|
|
3989
|
+
for (const edge of pieces) {
|
|
3990
|
+
if (edge.a[0] !== edge.b[0]) {
|
|
3991
|
+
add(edge);
|
|
3992
|
+
continue;
|
|
3993
|
+
}
|
|
3994
|
+
const fractions = [0, 1];
|
|
3995
|
+
const latitudes = /* @__PURE__ */ new Map();
|
|
3996
|
+
for (const y of meridians.get(edge.a[0])) {
|
|
3997
|
+
context.tick();
|
|
3998
|
+
if (y > Math.min(edge.a[1], edge.b[1]) && y < Math.max(edge.a[1], edge.b[1])) {
|
|
3999
|
+
const fraction = root(edge, 1, y, context);
|
|
4000
|
+
if (latitudes.has(fraction) && latitudes.get(fraction) !== y)
|
|
4001
|
+
throw new GeographicSeamError("precision", "Unresolvable meridian event separation");
|
|
4002
|
+
fractions.push(fraction);
|
|
4003
|
+
latitudes.set(fraction, y);
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
fractions.sort((a, b) => a - b);
|
|
4007
|
+
for (let i = 1; i < fractions.length; i++) {
|
|
4008
|
+
context.tick();
|
|
4009
|
+
const piece = slice(edge, fractions[i - 1], fractions[i]);
|
|
4010
|
+
if (latitudes.has(fractions[i - 1]))
|
|
4011
|
+
piece.a[1] = latitudes.get(fractions[i - 1]);
|
|
4012
|
+
if (latitudes.has(fractions[i]))
|
|
4013
|
+
piece.b[1] = latitudes.get(fractions[i]);
|
|
4014
|
+
if (fractions.length > 2)
|
|
4015
|
+
context.addVertices(2);
|
|
4016
|
+
const x = piece.a[0], latitude = (piece.a[1] + piece.b[1]) / 2;
|
|
4017
|
+
const seam = x === context.left;
|
|
4018
|
+
const ring = piece.source && rings[piece.source.ringIndex];
|
|
4019
|
+
if (ring && ring.max - ring.min >= 360 - ANGULAR_TOLERANCE && contains(ring, [x, latitude], context, seam ? "right" : "left") && contains(ring, [seam ? context.right : x, latitude], context, seam ? "left" : "right"))
|
|
4020
|
+
continue;
|
|
4021
|
+
const left = filled(rings, [x, latitude], context, seam ? "right" : "left");
|
|
4022
|
+
const right = filled(rings, [seam ? context.right : x, latitude], context, seam ? "left" : "right");
|
|
4023
|
+
if (left && right)
|
|
4024
|
+
continue;
|
|
4025
|
+
if (!left && !right)
|
|
4026
|
+
throw new GeographicSeamError("topology", "Unresolvable meridian-coincident boundary");
|
|
4027
|
+
if (seam && !left) {
|
|
4028
|
+
const assigned = shift(piece, 360), sample = assigned.sample;
|
|
4029
|
+
assigned.a[0] = assigned.b[0] = context.right;
|
|
4030
|
+
assigned.sample = (t) => {
|
|
4031
|
+
const p = sample(t);
|
|
4032
|
+
p[0] = context.right;
|
|
4033
|
+
return p;
|
|
4034
|
+
};
|
|
4035
|
+
add(assigned);
|
|
4036
|
+
} else
|
|
4037
|
+
add(piece);
|
|
4038
|
+
}
|
|
4039
|
+
}
|
|
4040
|
+
const pole = rings[0].pole;
|
|
4041
|
+
if (pole && !rings.slice(1).some((r) => r.pole === pole)) {
|
|
4042
|
+
const latitude = pole === "north" ? 90 : -90;
|
|
4043
|
+
add(straight([context.left, latitude, ...rings[0].poleAttributes], [context.right, latitude, ...rings[0].poleAttributes]));
|
|
4044
|
+
}
|
|
4045
|
+
for (const boundary of [context.left, context.right]) {
|
|
4046
|
+
const boundaryNodes = Array.from(nodes.values()).filter((n) => n.p[0] === boundary).sort((a, b) => a.p[1] - b.p[1]);
|
|
4047
|
+
const aligned = graph.filter((e) => e.a[0] === boundary && e.b[0] === boundary);
|
|
4048
|
+
for (let i = 1; i < boundaryNodes.length; i++) {
|
|
4049
|
+
context.tick();
|
|
4050
|
+
const a = boundaryNodes[i - 1].p, b = boundaryNodes[i].p, latitude = (a[1] + b[1]) / 2;
|
|
4051
|
+
if (latitude === a[1] || latitude === b[1])
|
|
4052
|
+
throw new GeographicSeamError("precision", "Unresolvable seam event separation");
|
|
4053
|
+
if (filled(rings, [boundary, latitude], context, boundary === context.left ? "right" : "left") && !aligned.some((e) => {
|
|
4054
|
+
context.tick();
|
|
4055
|
+
return latitude > Math.min(e.a[1], e.b[1]) && latitude < Math.max(e.a[1], e.b[1]);
|
|
4056
|
+
}))
|
|
4057
|
+
add(straight(a, b));
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
for (const node of nodes.values())
|
|
4061
|
+
if (node.edges.length !== 2)
|
|
4062
|
+
throw new GeographicSeamError("topology", "Touching, coincident or unresolved polygon boundaries");
|
|
4063
|
+
const used = /* @__PURE__ */ new Set(), cycles = [];
|
|
4064
|
+
for (let seed = 0; seed < graph.length; seed++) {
|
|
4065
|
+
if (used.has(seed))
|
|
4066
|
+
continue;
|
|
4067
|
+
const cycle = [], start = key(graph[seed].a);
|
|
4068
|
+
let id = seed, current = start;
|
|
4069
|
+
do {
|
|
4070
|
+
context.tick();
|
|
4071
|
+
if (used.has(id))
|
|
4072
|
+
throw new GeographicSeamError("topology", "Non-simple boundary graph");
|
|
4073
|
+
used.add(id);
|
|
4074
|
+
const edge = key(graph[id].a) === current ? graph[id] : reverse(graph[id]);
|
|
4075
|
+
cycle.push(edge);
|
|
4076
|
+
current = key(edge.b);
|
|
4077
|
+
const adjacent = nodes.get(current).edges;
|
|
4078
|
+
id = adjacent[0] === id ? adjacent[1] : adjacent[0];
|
|
4079
|
+
} while (current !== start);
|
|
4080
|
+
if (cycle.length < 3)
|
|
4081
|
+
throw new GeographicSeamError("topology", "Degenerate polygon component");
|
|
4082
|
+
cycles.push(cycle);
|
|
4083
|
+
}
|
|
4084
|
+
const parents = cycles.map((cycle, i) => {
|
|
4085
|
+
const containers = [];
|
|
4086
|
+
for (let j = 0; j < cycles.length; j++)
|
|
4087
|
+
if (j !== i) {
|
|
4088
|
+
const w = winding(cycles[j], cycle[0].a, context);
|
|
4089
|
+
if (w.boundary)
|
|
4090
|
+
throw new GeographicSeamError("topology", "Polygon components touch");
|
|
4091
|
+
if (w.value)
|
|
4092
|
+
containers.push(j);
|
|
4093
|
+
}
|
|
4094
|
+
if (containers.length > 1)
|
|
4095
|
+
throw new GeographicSeamError("topology", "Nested holes or overlapping polygon components");
|
|
4096
|
+
return containers[0];
|
|
4097
|
+
});
|
|
4098
|
+
const sign = interior(rings[0].membership, context).sign;
|
|
4099
|
+
const result = [], groups = /* @__PURE__ */ new Map();
|
|
4100
|
+
for (let i = 0; i < cycles.length; i++)
|
|
4101
|
+
if (parents[i] === void 0) {
|
|
4102
|
+
if (cycles[i].every((e) => e.source && e.source.ringIndex !== 0))
|
|
4103
|
+
throw new GeographicSeamError("topology", "Hole is outside the outer ring");
|
|
4104
|
+
const polygon = { rings: [output(cycles[i], sign, context)] };
|
|
4105
|
+
result.push(polygon);
|
|
4106
|
+
groups.set(i, polygon);
|
|
4107
|
+
}
|
|
4108
|
+
for (let i = 0; i < cycles.length; i++)
|
|
4109
|
+
if (parents[i] !== void 0) {
|
|
4110
|
+
const group = groups.get(parents[i]);
|
|
4111
|
+
if (!group)
|
|
4112
|
+
throw new GeographicSeamError("topology", "Nested polygon rings");
|
|
4113
|
+
group.rings.push(output(cycles[i], -sign, context));
|
|
4114
|
+
}
|
|
4115
|
+
return result;
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4118
|
+
// dist/geographic-seams.js
|
|
4119
|
+
function splitGeographicPolyline(input, options) {
|
|
4120
|
+
const context = new Context(options), points = context.read(input);
|
|
4121
|
+
const turns = options.longitudeTurns ? Array.from(options.longitudeTurns) : new Array(Math.max(0, points.length - 1)).fill(0);
|
|
4122
|
+
if (turns.length !== Math.max(0, points.length - 1))
|
|
4123
|
+
throw new GeographicSeamError("input", "Expected one turn count per line edge");
|
|
4124
|
+
if (!points.length)
|
|
4125
|
+
return [];
|
|
4126
|
+
if (points.length === 1) {
|
|
4127
|
+
context.addVertices(1);
|
|
4128
|
+
const world = worldAt(points[0][0], context), p = chartPoint(points[0], world, context);
|
|
4129
|
+
return [{ positions: new Float64Array(p), edges: [], world }];
|
|
4130
|
+
}
|
|
4131
|
+
const parts = [];
|
|
4132
|
+
let cursor = points[0];
|
|
4133
|
+
for (let i = 1; i < points.length; i++) {
|
|
4134
|
+
const edges = createEdges(cursor, points[i], points[i - 1], i - 1, 0, turns[i - 1], context, false);
|
|
4135
|
+
for (const original of edges) {
|
|
4136
|
+
if (!original.source)
|
|
4137
|
+
continue;
|
|
4138
|
+
for (const { edge, world } of cut(original, context)) {
|
|
4139
|
+
const previous = parts[parts.length - 1];
|
|
4140
|
+
if (previous && previous.world === world && same(previous.points[previous.points.length - 1], edge.a)) {
|
|
4141
|
+
previous.points.push(edge.b);
|
|
4142
|
+
previous.edges.push(edge.source);
|
|
4143
|
+
} else
|
|
4144
|
+
parts.push({ points: [edge.a, edge.b], edges: [edge.source], world });
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
cursor = edges[edges.length - 1].b;
|
|
4148
|
+
}
|
|
4149
|
+
return parts.map((part) => ({
|
|
4150
|
+
positions: new Float64Array(part.points.flat()),
|
|
4151
|
+
edges: part.edges,
|
|
4152
|
+
world: part.world
|
|
4153
|
+
}));
|
|
4154
|
+
}
|
|
1002
4155
|
//# sourceMappingURL=globe.cjs.map
|