@math.gl/geospatial 5.0.0-beta.5 → 5.0.0-beta.7
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/H3-LICENSE.TXT +201 -0
- package/H3-NOTICE.TXT +17 -0
- package/THIRD-PARTY-NOTICES.md +14 -9
- package/dist/elastic.cjs +3 -3
- package/dist/elastic.cjs.map +1 -1
- package/dist/elastic.d.ts +3 -3
- package/dist/elastic.d.ts.map +1 -1
- package/dist/elastic.js +3 -3
- package/dist/elastic.js.map +1 -1
- package/dist/index.cjs +1707 -192
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/maps/air-ocean-mesh.d.ts.map +1 -0
- package/dist/maps/air-ocean-mesh.js.map +1 -0
- package/dist/maps/albers-usa.d.ts.map +1 -0
- package/dist/maps/albers-usa.js.map +1 -0
- package/dist/maps/cap-map.d.ts.map +1 -0
- package/dist/maps/cap-map.js.map +1 -0
- package/dist/maps/elastic/data.d.ts.map +1 -0
- package/dist/maps/elastic/data.js.map +1 -0
- package/dist/maps/elastic/elasticI.d.ts.map +1 -0
- package/dist/maps/elastic/elasticI.js.map +1 -0
- package/dist/maps/elastic/elasticII.d.ts.map +1 -0
- package/dist/maps/elastic/elasticII.js.map +1 -0
- package/dist/maps/elastic/elasticIII.d.ts.map +1 -0
- package/dist/maps/elastic/elasticIII.js.map +1 -0
- package/dist/maps/elastic/geometry.d.ts.map +1 -0
- package/dist/maps/elastic/geometry.js.map +1 -0
- package/dist/maps/elastic/grid.d.ts.map +1 -0
- package/dist/maps/elastic/grid.js.map +1 -0
- package/dist/maps/elastic/map.d.ts.map +1 -0
- package/dist/maps/elastic/map.js +500 -0
- package/dist/maps/elastic/map.js.map +1 -0
- package/dist/maps/elastic/source-arc.d.ts.map +1 -0
- package/dist/maps/elastic/source-arc.js.map +1 -0
- package/dist/maps/geometry.cjs +1028 -0
- package/dist/maps/geometry.cjs.map +6 -0
- package/dist/maps/geometry.d.ts +12 -0
- package/dist/maps/geometry.d.ts.map +1 -0
- package/dist/maps/geometry.js +13 -0
- package/dist/maps/geometry.js.map +1 -0
- package/dist/maps/global-polygons.d.ts.map +1 -0
- package/dist/maps/global-polygons.js.map +1 -0
- package/dist/maps/gray-fuller.d.ts.map +1 -0
- package/dist/maps/gray-fuller.js.map +1 -0
- package/dist/maps/gringorten-kernel.d.ts.map +1 -0
- package/dist/maps/gringorten-kernel.js.map +1 -0
- package/dist/maps/h3-face-map.d.ts +7 -0
- package/dist/maps/h3-face-map.d.ts.map +1 -0
- package/dist/maps/h3-face-map.js +200 -0
- package/dist/maps/h3-face-map.js.map +1 -0
- package/dist/maps/healpix.d.ts.map +1 -0
- package/dist/maps/healpix.js.map +1 -0
- package/dist/maps/layout.d.ts.map +1 -0
- package/dist/maps/layout.js.map +1 -0
- package/dist/maps/map-engine.d.ts +239 -0
- package/dist/maps/map-engine.d.ts.map +1 -0
- package/dist/maps/map-engine.js +299 -0
- package/dist/maps/map-engine.js.map +1 -0
- package/dist/maps/map-layout.d.ts +119 -0
- package/dist/maps/map-layout.d.ts.map +1 -0
- package/dist/maps/map-layout.js +612 -0
- package/dist/maps/map-layout.js.map +1 -0
- package/dist/maps/map-surface-mesh.d.ts +44 -0
- package/dist/maps/map-surface-mesh.d.ts.map +1 -0
- package/dist/maps/map-surface-mesh.js +150 -0
- package/dist/maps/map-surface-mesh.js.map +1 -0
- package/dist/maps/map-transition-mesh.d.ts +51 -0
- package/dist/maps/map-transition-mesh.d.ts.map +1 -0
- package/dist/maps/map-transition-mesh.js +313 -0
- package/dist/maps/map-transition-mesh.js.map +1 -0
- package/dist/maps/map-transition.d.ts.map +1 -0
- package/dist/maps/map-transition.js.map +1 -0
- package/dist/maps/math.d.ts.map +1 -0
- package/dist/maps/math.js.map +1 -0
- package/dist/maps/mercator-map.d.ts.map +1 -0
- package/dist/maps/mercator-map.js +245 -0
- package/dist/maps/mercator-map.js.map +1 -0
- package/dist/maps/myriahedral/graticule.d.ts.map +1 -0
- package/dist/maps/myriahedral/graticule.js.map +1 -0
- package/dist/maps/myriahedral/mesh.d.ts.map +1 -0
- package/dist/maps/myriahedral/mesh.js.map +1 -0
- package/dist/maps/myriahedral/unfold.d.ts.map +1 -0
- package/dist/maps/myriahedral/unfold.js.map +1 -0
- package/dist/maps/myriahedral.d.ts.map +1 -0
- package/dist/maps/myriahedral.js.map +1 -0
- package/dist/maps/petroff.d.ts.map +1 -0
- package/dist/maps/petroff.js.map +1 -0
- package/dist/maps/polygon-constraints.d.ts.map +1 -0
- package/dist/maps/polygon-constraints.js.map +1 -0
- package/dist/maps/polyhedral.d.ts.map +1 -0
- package/dist/maps/polyhedral.js.map +1 -0
- package/dist/maps/prepare-features.d.ts.map +1 -0
- package/dist/maps/prepare-features.js.map +1 -0
- package/dist/maps/preset-kernels.d.ts +71 -0
- package/dist/maps/preset-kernels.d.ts.map +1 -0
- package/dist/maps/preset-kernels.js +372 -0
- package/dist/maps/preset-kernels.js.map +1 -0
- package/dist/maps/presets.cjs +7437 -0
- package/dist/maps/presets.cjs.map +6 -0
- package/dist/maps/presets.d.ts +37 -0
- package/dist/maps/presets.d.ts.map +1 -0
- package/dist/maps/presets.js +294 -0
- package/dist/maps/presets.js.map +1 -0
- package/dist/maps/projection-catalog.d.ts.map +1 -0
- package/dist/maps/projection-catalog.js +96 -0
- package/dist/maps/projection-catalog.js.map +1 -0
- package/dist/maps/projection-surface.d.ts +14 -0
- package/dist/maps/projection-surface.d.ts.map +1 -0
- package/dist/maps/projection-surface.js +50 -0
- package/dist/maps/projection-surface.js.map +1 -0
- package/dist/maps/quincuncial-kernel.d.ts.map +1 -0
- package/dist/maps/quincuncial-kernel.js.map +1 -0
- package/dist/maps/quincuncial-star.d.ts.map +1 -0
- package/dist/maps/quincuncial-star.js.map +1 -0
- package/dist/maps/regional-map.d.ts.map +1 -0
- package/dist/maps/regional-map.js.map +1 -0
- package/dist/maps/retroazimuthal-map.d.ts.map +1 -0
- package/dist/maps/retroazimuthal-map.js.map +1 -0
- package/dist/maps/rotated-map.d.ts +42 -0
- package/dist/maps/rotated-map.d.ts.map +1 -0
- package/dist/maps/rotated-map.js +72 -0
- package/dist/maps/rotated-map.js.map +1 -0
- package/dist/maps/snyder-mesh.d.ts.map +1 -0
- package/dist/maps/snyder-mesh.js.map +1 -0
- package/dist/maps/snyder.d.ts.map +1 -0
- package/dist/maps/snyder.js.map +1 -0
- package/dist/maps/source-arc.d.ts.map +1 -0
- package/dist/maps/source-arc.js.map +1 -0
- package/dist/maps/spherical-clip/cartesian.d.ts +8 -0
- package/dist/maps/spherical-clip/cartesian.d.ts.map +1 -0
- package/dist/maps/spherical-clip/cartesian.js.map +1 -0
- package/dist/maps/spherical-clip/circle.d.ts.map +1 -0
- package/dist/maps/spherical-clip/circle.js.map +1 -0
- package/dist/maps/spherical-clip/clip-buffer.d.ts.map +1 -0
- package/dist/maps/spherical-clip/clip-buffer.js.map +1 -0
- package/dist/maps/spherical-clip/clip-circle.d.ts.map +1 -0
- package/dist/maps/spherical-clip/clip-circle.js.map +1 -0
- package/dist/maps/spherical-clip/clip-index.d.ts.map +1 -0
- package/dist/maps/spherical-clip/clip-index.js.map +1 -0
- package/dist/maps/spherical-clip/clip-rejoin.d.ts.map +1 -0
- package/dist/maps/spherical-clip/clip-rejoin.js.map +1 -0
- package/dist/maps/spherical-clip/helpers.d.ts.map +1 -0
- package/dist/maps/spherical-clip/helpers.js.map +1 -0
- package/dist/maps/spherical-clip/math.d.ts +26 -0
- package/dist/maps/spherical-clip/math.d.ts.map +1 -0
- package/dist/maps/spherical-clip/math.js.map +1 -0
- package/dist/maps/spherical-clip/noop.d.ts.map +1 -0
- package/dist/maps/spherical-clip/noop.js.map +1 -0
- package/dist/maps/spherical-clip/pointEqual.d.ts +2 -0
- package/dist/maps/spherical-clip/pointEqual.d.ts.map +1 -0
- package/dist/maps/spherical-clip/pointEqual.js.map +1 -0
- package/dist/maps/spherical-clip/polygonContains.d.ts.map +1 -0
- package/dist/maps/spherical-clip/polygonContains.js.map +1 -0
- package/dist/maps/surfaces.cjs +183 -0
- package/dist/maps/surfaces.cjs.map +6 -0
- package/dist/maps/surfaces.d.ts +5 -0
- package/dist/maps/surfaces.d.ts.map +1 -0
- package/dist/maps/surfaces.js +6 -0
- package/dist/maps/surfaces.js.map +1 -0
- package/dist/maps/transitions.cjs +660 -0
- package/dist/maps/transitions.cjs.map +6 -0
- package/dist/maps/transitions.d.ts +8 -0
- package/dist/maps/transitions.d.ts.map +1 -0
- package/dist/maps/transitions.js +9 -0
- package/dist/maps/transitions.js.map +1 -0
- package/dist/maps/world-composite-kernels.d.ts.map +1 -0
- package/dist/maps/world-composite-kernels.js.map +1 -0
- package/dist/maps/world-kernels/airy.d.ts.map +1 -0
- package/dist/maps/world-kernels/airy.js.map +1 -0
- package/dist/maps/world-kernels/aitoff.d.ts.map +1 -0
- package/dist/maps/world-kernels/aitoff.js.map +1 -0
- package/dist/maps/world-kernels/armadillo.d.ts.map +1 -0
- package/dist/maps/world-kernels/armadillo.js.map +1 -0
- package/dist/maps/world-kernels/august.d.ts.map +1 -0
- package/dist/maps/world-kernels/august.js.map +1 -0
- package/dist/maps/world-kernels/baker.d.ts.map +1 -0
- package/dist/maps/world-kernels/baker.js.map +1 -0
- package/dist/maps/world-kernels/bertin.d.ts.map +1 -0
- package/dist/maps/world-kernels/bertin.js.map +1 -0
- package/dist/maps/world-kernels/boggs.d.ts.map +1 -0
- package/dist/maps/world-kernels/boggs.js.map +1 -0
- package/dist/maps/world-kernels/bonne.d.ts.map +1 -0
- package/dist/maps/world-kernels/bonne.js.map +1 -0
- package/dist/maps/world-kernels/bottomley.d.ts.map +1 -0
- package/dist/maps/world-kernels/bottomley.js.map +1 -0
- package/dist/maps/world-kernels/bromley.d.ts.map +1 -0
- package/dist/maps/world-kernels/bromley.js.map +1 -0
- package/dist/maps/world-kernels/chamberlin.d.ts.map +1 -0
- package/dist/maps/world-kernels/chamberlin.js.map +1 -0
- package/dist/maps/world-kernels/collignon.d.ts +5 -0
- package/dist/maps/world-kernels/collignon.d.ts.map +1 -0
- package/dist/maps/world-kernels/collignon.js.map +1 -0
- package/dist/maps/world-kernels/craig.d.ts.map +1 -0
- package/dist/maps/world-kernels/craig.js.map +1 -0
- package/dist/maps/world-kernels/craster.d.ts +5 -0
- package/dist/maps/world-kernels/craster.d.ts.map +1 -0
- package/dist/maps/world-kernels/craster.js.map +1 -0
- package/dist/maps/world-kernels/cylindricalEqualArea.d.ts.map +1 -0
- package/dist/maps/world-kernels/cylindricalEqualArea.js.map +1 -0
- package/dist/maps/world-kernels/cylindricalStereographic.d.ts.map +1 -0
- package/dist/maps/world-kernels/cylindricalStereographic.js.map +1 -0
- package/dist/maps/world-kernels/d3-geo-raw.d.ts.map +1 -0
- package/dist/maps/world-kernels/d3-geo-raw.js.map +1 -0
- package/dist/maps/world-kernels/eckert1.d.ts +5 -0
- package/dist/maps/world-kernels/eckert1.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert1.js.map +1 -0
- package/dist/maps/world-kernels/eckert2.d.ts +5 -0
- package/dist/maps/world-kernels/eckert2.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert2.js.map +1 -0
- package/dist/maps/world-kernels/eckert3.d.ts +5 -0
- package/dist/maps/world-kernels/eckert3.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert3.js.map +1 -0
- package/dist/maps/world-kernels/eckert4.d.ts +5 -0
- package/dist/maps/world-kernels/eckert4.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert4.js.map +1 -0
- package/dist/maps/world-kernels/eckert5.d.ts +5 -0
- package/dist/maps/world-kernels/eckert5.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert5.js.map +1 -0
- package/dist/maps/world-kernels/eckert6.d.ts +5 -0
- package/dist/maps/world-kernels/eckert6.d.ts.map +1 -0
- package/dist/maps/world-kernels/eckert6.js.map +1 -0
- package/dist/maps/world-kernels/eisenlohr.d.ts.map +1 -0
- package/dist/maps/world-kernels/eisenlohr.js.map +1 -0
- package/dist/maps/world-kernels/fahey.d.ts +5 -0
- package/dist/maps/world-kernels/fahey.d.ts.map +1 -0
- package/dist/maps/world-kernels/fahey.js.map +1 -0
- package/dist/maps/world-kernels/foucaut.d.ts +5 -0
- package/dist/maps/world-kernels/foucaut.d.ts.map +1 -0
- package/dist/maps/world-kernels/foucaut.js.map +1 -0
- package/dist/maps/world-kernels/foucautSinusoidal.d.ts.map +1 -0
- package/dist/maps/world-kernels/foucautSinusoidal.js.map +1 -0
- package/dist/maps/world-kernels/ginzburg4.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburg4.js.map +1 -0
- package/dist/maps/world-kernels/ginzburg5.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburg5.js.map +1 -0
- package/dist/maps/world-kernels/ginzburg6.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburg6.js.map +1 -0
- package/dist/maps/world-kernels/ginzburg8.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburg8.js.map +1 -0
- package/dist/maps/world-kernels/ginzburg9.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburg9.js.map +1 -0
- package/dist/maps/world-kernels/ginzburgPolyconic.d.ts.map +1 -0
- package/dist/maps/world-kernels/ginzburgPolyconic.js.map +1 -0
- package/dist/maps/world-kernels/hammer.d.ts.map +1 -0
- package/dist/maps/world-kernels/hammer.js.map +1 -0
- package/dist/maps/world-kernels/hammerRetroazimuthal.d.ts.map +1 -0
- package/dist/maps/world-kernels/hammerRetroazimuthal.js.map +1 -0
- package/dist/maps/world-kernels/hill.d.ts.map +1 -0
- package/dist/maps/world-kernels/hill.js.map +1 -0
- package/dist/maps/world-kernels/homolosine.d.ts +5 -0
- package/dist/maps/world-kernels/homolosine.d.ts.map +1 -0
- package/dist/maps/world-kernels/homolosine.js.map +1 -0
- package/dist/maps/world-kernels/hufnagel.d.ts.map +1 -0
- package/dist/maps/world-kernels/hufnagel.js.map +1 -0
- package/dist/maps/world-kernels/hyperelliptical.d.ts.map +1 -0
- package/dist/maps/world-kernels/hyperelliptical.js.map +1 -0
- package/dist/maps/world-kernels/integrate.d.ts.map +1 -0
- package/dist/maps/world-kernels/integrate.js.map +1 -0
- package/dist/maps/world-kernels/kavrayskiy7.d.ts +5 -0
- package/dist/maps/world-kernels/kavrayskiy7.d.ts.map +1 -0
- package/dist/maps/world-kernels/kavrayskiy7.js.map +1 -0
- package/dist/maps/world-kernels/lagrange.d.ts.map +1 -0
- package/dist/maps/world-kernels/lagrange.js.map +1 -0
- package/dist/maps/world-kernels/larrivee.d.ts.map +1 -0
- package/dist/maps/world-kernels/larrivee.js.map +1 -0
- package/dist/maps/world-kernels/laskowski.d.ts.map +1 -0
- package/dist/maps/world-kernels/laskowski.js.map +1 -0
- package/dist/maps/world-kernels/littrow.d.ts.map +1 -0
- package/dist/maps/world-kernels/littrow.js.map +1 -0
- package/dist/maps/world-kernels/loximuthal.d.ts.map +1 -0
- package/dist/maps/world-kernels/loximuthal.js.map +1 -0
- package/dist/maps/world-kernels/math.d.ts +36 -0
- package/dist/maps/world-kernels/math.d.ts.map +1 -0
- package/dist/maps/world-kernels/math.js.map +1 -0
- package/dist/maps/world-kernels/miller.d.ts +5 -0
- package/dist/maps/world-kernels/miller.d.ts.map +1 -0
- package/dist/maps/world-kernels/miller.js.map +1 -0
- package/dist/maps/world-kernels/modifiedStereographic.d.ts.map +1 -0
- package/dist/maps/world-kernels/modifiedStereographic.js.map +1 -0
- package/dist/maps/world-kernels/mollweide.d.ts.map +1 -0
- package/dist/maps/world-kernels/mollweide.js.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarParabolic.d.ts.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarParabolic.js.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarQuartic.d.ts.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarQuartic.js.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarSinusoidal.d.ts.map +1 -0
- package/dist/maps/world-kernels/mtFlatPolarSinusoidal.js.map +1 -0
- package/dist/maps/world-kernels/naturalEarth2.d.ts.map +1 -0
- package/dist/maps/world-kernels/naturalEarth2.js.map +1 -0
- package/dist/maps/world-kernels/nellHammer.d.ts.map +1 -0
- package/dist/maps/world-kernels/nellHammer.js.map +1 -0
- package/dist/maps/world-kernels/newton.d.ts.map +1 -0
- package/dist/maps/world-kernels/newton.js.map +1 -0
- package/dist/maps/world-kernels/nicolosi.d.ts.map +1 -0
- package/dist/maps/world-kernels/nicolosi.js.map +1 -0
- package/dist/maps/world-kernels/patterson.d.ts.map +1 -0
- package/dist/maps/world-kernels/patterson.js.map +1 -0
- package/dist/maps/world-kernels/polyconic.d.ts.map +1 -0
- package/dist/maps/world-kernels/polyconic.js.map +1 -0
- package/dist/maps/world-kernels/rectangularPolyconic.d.ts.map +1 -0
- package/dist/maps/world-kernels/rectangularPolyconic.js.map +1 -0
- package/dist/maps/world-kernels/robinson.d.ts.map +1 -0
- package/dist/maps/world-kernels/robinson.js.map +1 -0
- package/dist/maps/world-kernels/satellite.d.ts.map +1 -0
- package/dist/maps/world-kernels/satellite.js.map +1 -0
- package/dist/maps/world-kernels/sinuMollweide.d.ts +7 -0
- package/dist/maps/world-kernels/sinuMollweide.d.ts.map +1 -0
- package/dist/maps/world-kernels/sinuMollweide.js.map +1 -0
- package/dist/maps/world-kernels/sinusoidal.d.ts +5 -0
- package/dist/maps/world-kernels/sinusoidal.d.ts.map +1 -0
- package/dist/maps/world-kernels/sinusoidal.js.map +1 -0
- package/dist/maps/world-kernels/times.d.ts.map +1 -0
- package/dist/maps/world-kernels/times.js.map +1 -0
- package/dist/maps/world-kernels/twoPointEquidistant.d.ts.map +1 -0
- package/dist/maps/world-kernels/twoPointEquidistant.js.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten.d.ts.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten.js.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten2.d.ts.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten2.js.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten3.d.ts.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten3.js.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten4.d.ts.map +1 -0
- package/dist/maps/world-kernels/vanDerGrinten4.js.map +1 -0
- package/dist/maps/world-kernels/wagner.d.ts.map +1 -0
- package/dist/maps/world-kernels/wagner.js.map +1 -0
- package/dist/maps/world-kernels/wagner4.d.ts.map +1 -0
- package/dist/maps/world-kernels/wagner4.js.map +1 -0
- package/dist/maps/world-kernels/wagner6.d.ts +5 -0
- package/dist/maps/world-kernels/wagner6.d.ts.map +1 -0
- package/dist/maps/world-kernels/wagner6.js.map +1 -0
- package/dist/maps/world-kernels/wiechel.d.ts.map +1 -0
- package/dist/maps/world-kernels/wiechel.js.map +1 -0
- package/dist/maps/world-kernels/winkel3.d.ts.map +1 -0
- package/dist/maps/world-kernels/winkel3.js.map +1 -0
- package/dist/maps/world-kernels.d.ts.map +1 -0
- package/dist/maps/world-kernels.js.map +1 -0
- package/dist/maps/world-map.d.ts.map +1 -0
- package/dist/maps/world-map.js.map +1 -0
- package/dist/maps.cjs +9153 -0
- package/dist/maps.cjs.map +6 -0
- package/dist/maps.d.ts +63 -0
- package/dist/maps.d.ts.map +1 -0
- package/dist/maps.js +43 -0
- package/dist/maps.js.map +1 -0
- package/dist/tasks/definitions.d.ts +1 -1
- package/dist/tasks/definitions.d.ts.map +1 -1
- package/dist/tasks/index.cjs +3707 -3294
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/tasks/operations.d.ts +2 -2
- package/dist/tasks/operations.d.ts.map +1 -1
- package/dist/tasks/operations.js +10 -2
- package/dist/tasks/operations.js.map +1 -1
- package/dist/terrain/bounds-regions.d.ts +15 -0
- package/dist/terrain/bounds-regions.d.ts.map +1 -0
- package/dist/terrain/bounds-regions.js +84 -0
- package/dist/terrain/bounds-regions.js.map +1 -0
- package/dist/terrain/bounds-update.d.ts +11 -0
- package/dist/terrain/bounds-update.d.ts.map +1 -0
- package/dist/terrain/bounds-update.js +10 -0
- package/dist/terrain/bounds-update.js.map +1 -0
- package/dist/terrain/box-index.d.ts +9 -0
- package/dist/terrain/box-index.d.ts.map +1 -0
- package/dist/terrain/box-index.js +43 -0
- package/dist/terrain/box-index.js.map +1 -0
- package/dist/terrain/contour-simplify.d.ts +1 -0
- package/dist/terrain/contour-simplify.d.ts.map +1 -1
- package/dist/terrain/contour-simplify.js +5 -1
- package/dist/terrain/contour-simplify.js.map +1 -1
- package/dist/terrain/contour-topology.d.ts +30 -0
- package/dist/terrain/contour-topology.d.ts.map +1 -0
- package/dist/terrain/contour-topology.js +236 -0
- package/dist/terrain/contour-topology.js.map +1 -0
- package/dist/terrain/delatin-regions.d.ts +14 -0
- package/dist/terrain/delatin-regions.d.ts.map +1 -0
- package/dist/terrain/delatin-regions.js +15 -0
- package/dist/terrain/delatin-regions.js.map +1 -0
- package/dist/terrain/dirty-regions.d.ts +11 -0
- package/dist/terrain/dirty-regions.d.ts.map +1 -0
- package/dist/terrain/dirty-regions.js +34 -0
- package/dist/terrain/dirty-regions.js.map +1 -0
- package/dist/terrain/gradient-pyramid-regions.d.ts +15 -0
- package/dist/terrain/gradient-pyramid-regions.d.ts.map +1 -0
- package/dist/terrain/gradient-pyramid-regions.js +112 -0
- package/dist/terrain/gradient-pyramid-regions.js.map +1 -0
- package/dist/terrain/gradient-pyramid-update.d.ts +11 -0
- package/dist/terrain/gradient-pyramid-update.d.ts.map +1 -0
- package/dist/terrain/gradient-pyramid-update.js +17 -0
- package/dist/terrain/gradient-pyramid-update.js.map +1 -0
- package/dist/terrain/index.cjs +1603 -88
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +42 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +21 -0
- package/dist/terrain/index.js.map +1 -1
- package/dist/terrain/isobands-mixed.d.ts +18 -0
- package/dist/terrain/isobands-mixed.d.ts.map +1 -0
- package/dist/terrain/isobands-mixed.js +34 -0
- package/dist/terrain/isobands-mixed.js.map +1 -0
- package/dist/terrain/isobands.d.ts +24 -0
- package/dist/terrain/isobands.d.ts.map +1 -0
- package/dist/terrain/isobands.js +281 -0
- package/dist/terrain/isobands.js.map +1 -0
- package/dist/terrain/lod-coordinate.d.ts +15 -0
- package/dist/terrain/lod-coordinate.d.ts.map +1 -0
- package/dist/terrain/lod-coordinate.js +40 -0
- package/dist/terrain/lod-coordinate.js.map +1 -0
- package/dist/terrain/lod-morph-evaluate.d.ts +8 -0
- package/dist/terrain/lod-morph-evaluate.d.ts.map +1 -0
- package/dist/terrain/lod-morph-evaluate.js +30 -0
- package/dist/terrain/lod-morph-evaluate.js.map +1 -0
- package/dist/terrain/lod-morph.d.ts +35 -0
- package/dist/terrain/lod-morph.d.ts.map +1 -0
- package/dist/terrain/lod-morph.js +87 -0
- package/dist/terrain/lod-morph.js.map +1 -0
- package/dist/terrain/martini-regions.d.ts +14 -0
- package/dist/terrain/martini-regions.d.ts.map +1 -0
- package/dist/terrain/martini-regions.js +26 -0
- package/dist/terrain/martini-regions.js.map +1 -0
- package/dist/terrain/mesh-error.d.ts.map +1 -1
- package/dist/terrain/mesh-error.js +9 -1
- package/dist/terrain/mesh-error.js.map +1 -1
- package/dist/terrain/mesh-regions-data.d.ts +24 -0
- package/dist/terrain/mesh-regions-data.d.ts.map +1 -0
- package/dist/terrain/mesh-regions-data.js +80 -0
- package/dist/terrain/mesh-regions-data.js.map +1 -0
- package/dist/terrain/mesh-regions.d.ts +12 -0
- package/dist/terrain/mesh-regions.d.ts.map +1 -0
- package/dist/terrain/mesh-regions.js +10 -0
- package/dist/terrain/mesh-regions.js.map +1 -0
- package/dist/terrain/mesh-update.d.ts +11 -0
- package/dist/terrain/mesh-update.d.ts.map +1 -0
- package/dist/terrain/mesh-update.js +10 -0
- package/dist/terrain/mesh-update.js.map +1 -0
- package/dist/terrain/mixed-gradient-update.d.ts +15 -0
- package/dist/terrain/mixed-gradient-update.d.ts.map +1 -0
- package/dist/terrain/mixed-gradient-update.js +24 -0
- package/dist/terrain/mixed-gradient-update.js.map +1 -0
- package/dist/terrain/mixed-halo-update.d.ts +16 -0
- package/dist/terrain/mixed-halo-update.d.ts.map +1 -0
- package/dist/terrain/mixed-halo-update.js +46 -0
- package/dist/terrain/mixed-halo-update.js.map +1 -0
- package/dist/terrain/mixed-surface.d.ts +27 -0
- package/dist/terrain/mixed-surface.d.ts.map +1 -0
- package/dist/terrain/mixed-surface.js +160 -0
- package/dist/terrain/mixed-surface.js.map +1 -0
- package/dist/terrain/mixed-vertex-halos.d.ts +32 -0
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -0
- package/dist/terrain/mixed-vertex-halos.js +125 -0
- package/dist/terrain/mixed-vertex-halos.js.map +1 -0
- package/dist/terrain/persistent-bounds.d.ts +16 -0
- package/dist/terrain/persistent-bounds.d.ts.map +1 -0
- package/dist/terrain/persistent-bounds.js +51 -0
- package/dist/terrain/persistent-bounds.js.map +1 -0
- package/dist/terrain/persistent-gradients.d.ts +16 -0
- package/dist/terrain/persistent-gradients.d.ts.map +1 -0
- package/dist/terrain/persistent-gradients.js +69 -0
- package/dist/terrain/persistent-gradients.js.map +1 -0
- package/dist/terrain/persistent-hierarchy-data.d.ts +41 -0
- package/dist/terrain/persistent-hierarchy-data.d.ts.map +1 -0
- package/dist/terrain/persistent-hierarchy-data.js +130 -0
- package/dist/terrain/persistent-hierarchy-data.js.map +1 -0
- package/dist/terrain/sample-triangle-height.d.ts +4 -0
- package/dist/terrain/sample-triangle-height.d.ts.map +1 -0
- package/dist/terrain/sample-triangle-height.js +46 -0
- package/dist/terrain/sample-triangle-height.js.map +1 -0
- package/dist/terrain/tile-update-data.d.ts +14 -0
- package/dist/terrain/tile-update-data.d.ts.map +1 -0
- package/dist/terrain/tile-update-data.js +23 -0
- package/dist/terrain/tile-update-data.js.map +1 -0
- package/dist/turf/expressions.cjs +87 -0
- package/dist/turf/expressions.cjs.map +6 -0
- package/dist/turf/expressions.d.ts +24 -0
- package/dist/turf/expressions.d.ts.map +1 -0
- package/dist/turf/expressions.js +76 -0
- package/dist/turf/expressions.js.map +1 -0
- package/package.json +39 -12
- package/src/elastic.ts +3 -3
- package/src/index.ts +65 -0
- package/src/maps/elastic/map.ts +621 -0
- package/src/maps/geometry.ts +12 -0
- package/src/maps/h3-face-map.ts +251 -0
- package/src/maps/map-engine.ts +484 -0
- package/src/maps/map-layout.ts +777 -0
- package/src/maps/map-surface-mesh.ts +229 -0
- package/src/maps/map-transition-mesh.ts +421 -0
- package/src/maps/mercator-map.ts +298 -0
- package/src/maps/presets.ts +355 -0
- package/src/maps/projection-catalog.ts +132 -0
- package/src/maps/projection-surface.ts +70 -0
- package/src/maps/rotated-map.ts +92 -0
- package/src/maps/spherical-clip/cartesian.ts +43 -0
- package/src/maps/spherical-clip/math.ts +45 -0
- package/src/maps/spherical-clip/pointEqual.ts +10 -0
- package/src/maps/surfaces.ts +7 -0
- package/src/maps/transitions.ts +8 -0
- package/src/maps/world-kernels/collignon.ts +17 -0
- package/src/maps/world-kernels/craster.ts +18 -0
- package/src/maps/world-kernels/eckert1.ts +18 -0
- package/src/maps/world-kernels/eckert2.ts +17 -0
- package/src/maps/world-kernels/eckert3.ts +17 -0
- package/src/maps/world-kernels/eckert4.ts +24 -0
- package/src/maps/world-kernels/eckert5.ts +17 -0
- package/src/maps/world-kernels/eckert6.ts +22 -0
- package/src/maps/world-kernels/fahey.ts +19 -0
- package/src/maps/world-kernels/foucaut.ts +20 -0
- package/src/maps/world-kernels/kavrayskiy7.ts +15 -0
- package/src/maps/world-kernels/math.ts +98 -0
- package/src/maps/world-kernels/miller.ts +15 -0
- package/src/maps/world-kernels/sinusoidal.ts +15 -0
- package/src/maps/world-kernels/wagner6.ts +15 -0
- package/src/maps.ts +168 -0
- package/src/tasks/definitions.ts +1 -1
- package/src/tasks/operations.ts +11 -3
- package/src/terrain/bounds-regions.ts +106 -0
- package/src/terrain/bounds-update.ts +19 -0
- package/src/terrain/box-index.ts +47 -0
- package/src/terrain/contour-simplify.ts +10 -2
- package/src/terrain/contour-topology.ts +263 -0
- package/src/terrain/delatin-regions.ts +25 -0
- package/src/terrain/dirty-regions.ts +61 -0
- package/src/terrain/gradient-pyramid-regions.ts +140 -0
- package/src/terrain/gradient-pyramid-update.ts +25 -0
- package/src/terrain/index.ts +62 -0
- package/src/terrain/isobands-mixed.ts +49 -0
- package/src/terrain/isobands.ts +348 -0
- package/src/terrain/lod-coordinate.ts +57 -0
- package/src/terrain/lod-morph-evaluate.ts +36 -0
- package/src/terrain/lod-morph.ts +138 -0
- package/src/terrain/martini-regions.ts +38 -0
- package/src/terrain/mesh-error.ts +14 -1
- package/src/terrain/mesh-regions-data.ts +113 -0
- package/src/terrain/mesh-regions.ts +18 -0
- package/src/terrain/mesh-update.ts +15 -0
- package/src/terrain/mixed-gradient-update.ts +40 -0
- package/src/terrain/mixed-halo-update.ts +56 -0
- package/src/terrain/mixed-surface.ts +232 -0
- package/src/terrain/mixed-vertex-halos.ts +170 -0
- package/src/terrain/persistent-bounds.ts +95 -0
- package/src/terrain/persistent-gradients.ts +117 -0
- package/src/terrain/persistent-hierarchy-data.ts +196 -0
- package/src/terrain/sample-triangle-height.ts +50 -0
- package/src/terrain/tile-update-data.ts +32 -0
- package/src/turf/expressions.ts +97 -0
- package/dist/discontinuous/air-ocean-mesh.d.ts.map +0 -1
- package/dist/discontinuous/air-ocean-mesh.js.map +0 -1
- package/dist/discontinuous/albers-usa.d.ts.map +0 -1
- package/dist/discontinuous/albers-usa.js.map +0 -1
- package/dist/discontinuous/cap-map.d.ts.map +0 -1
- package/dist/discontinuous/cap-map.js.map +0 -1
- package/dist/discontinuous/elastic/data.d.ts.map +0 -1
- package/dist/discontinuous/elastic/data.js.map +0 -1
- package/dist/discontinuous/elastic/elasticI.d.ts.map +0 -1
- package/dist/discontinuous/elastic/elasticI.js.map +0 -1
- package/dist/discontinuous/elastic/elasticII.d.ts.map +0 -1
- package/dist/discontinuous/elastic/elasticII.js.map +0 -1
- package/dist/discontinuous/elastic/elasticIII.d.ts.map +0 -1
- package/dist/discontinuous/elastic/elasticIII.js.map +0 -1
- package/dist/discontinuous/elastic/geometry.d.ts.map +0 -1
- package/dist/discontinuous/elastic/geometry.js.map +0 -1
- package/dist/discontinuous/elastic/grid.d.ts.map +0 -1
- package/dist/discontinuous/elastic/grid.js.map +0 -1
- package/dist/discontinuous/elastic/map.d.ts.map +0 -1
- package/dist/discontinuous/elastic/map.js +0 -500
- package/dist/discontinuous/elastic/map.js.map +0 -1
- package/dist/discontinuous/elastic/source-arc.d.ts.map +0 -1
- package/dist/discontinuous/elastic/source-arc.js.map +0 -1
- package/dist/discontinuous/global-polygons.d.ts.map +0 -1
- package/dist/discontinuous/global-polygons.js.map +0 -1
- package/dist/discontinuous/gray-fuller.d.ts.map +0 -1
- package/dist/discontinuous/gray-fuller.js.map +0 -1
- package/dist/discontinuous/gringorten-kernel.d.ts.map +0 -1
- package/dist/discontinuous/gringorten-kernel.js.map +0 -1
- package/dist/discontinuous/healpix.d.ts.map +0 -1
- package/dist/discontinuous/healpix.js.map +0 -1
- package/dist/discontinuous/layout.d.ts.map +0 -1
- package/dist/discontinuous/layout.js.map +0 -1
- package/dist/discontinuous/map-engine.d.ts +0 -223
- package/dist/discontinuous/map-engine.d.ts.map +0 -1
- package/dist/discontinuous/map-engine.js +0 -408
- package/dist/discontinuous/map-engine.js.map +0 -1
- package/dist/discontinuous/map-layout.d.ts +0 -114
- package/dist/discontinuous/map-layout.d.ts.map +0 -1
- package/dist/discontinuous/map-layout.js +0 -605
- package/dist/discontinuous/map-layout.js.map +0 -1
- package/dist/discontinuous/map-transition.d.ts.map +0 -1
- package/dist/discontinuous/map-transition.js.map +0 -1
- package/dist/discontinuous/math.d.ts.map +0 -1
- package/dist/discontinuous/math.js.map +0 -1
- package/dist/discontinuous/mercator-map.d.ts.map +0 -1
- package/dist/discontinuous/mercator-map.js +0 -246
- package/dist/discontinuous/mercator-map.js.map +0 -1
- package/dist/discontinuous/myriahedral/graticule.d.ts.map +0 -1
- package/dist/discontinuous/myriahedral/graticule.js.map +0 -1
- package/dist/discontinuous/myriahedral/mesh.d.ts.map +0 -1
- package/dist/discontinuous/myriahedral/mesh.js.map +0 -1
- package/dist/discontinuous/myriahedral/unfold.d.ts.map +0 -1
- package/dist/discontinuous/myriahedral/unfold.js.map +0 -1
- package/dist/discontinuous/myriahedral.d.ts.map +0 -1
- package/dist/discontinuous/myriahedral.js.map +0 -1
- package/dist/discontinuous/petroff.d.ts.map +0 -1
- package/dist/discontinuous/petroff.js.map +0 -1
- package/dist/discontinuous/polygon-constraints.d.ts.map +0 -1
- package/dist/discontinuous/polygon-constraints.js.map +0 -1
- package/dist/discontinuous/polyhedral.d.ts.map +0 -1
- package/dist/discontinuous/polyhedral.js.map +0 -1
- package/dist/discontinuous/prepare-features.d.ts.map +0 -1
- package/dist/discontinuous/prepare-features.js.map +0 -1
- package/dist/discontinuous/presets.d.ts +0 -71
- package/dist/discontinuous/presets.d.ts.map +0 -1
- package/dist/discontinuous/presets.js +0 -372
- package/dist/discontinuous/presets.js.map +0 -1
- package/dist/discontinuous/projection-catalog.d.ts.map +0 -1
- package/dist/discontinuous/projection-catalog.js +0 -96
- package/dist/discontinuous/projection-catalog.js.map +0 -1
- package/dist/discontinuous/quincuncial-kernel.d.ts.map +0 -1
- package/dist/discontinuous/quincuncial-kernel.js.map +0 -1
- package/dist/discontinuous/quincuncial-star.d.ts.map +0 -1
- package/dist/discontinuous/quincuncial-star.js.map +0 -1
- package/dist/discontinuous/regional-map.d.ts.map +0 -1
- package/dist/discontinuous/regional-map.js.map +0 -1
- package/dist/discontinuous/retroazimuthal-map.d.ts.map +0 -1
- package/dist/discontinuous/retroazimuthal-map.js.map +0 -1
- package/dist/discontinuous/rotated-map.d.ts +0 -40
- package/dist/discontinuous/rotated-map.d.ts.map +0 -1
- package/dist/discontinuous/rotated-map.js +0 -66
- package/dist/discontinuous/rotated-map.js.map +0 -1
- package/dist/discontinuous/snyder-mesh.d.ts.map +0 -1
- package/dist/discontinuous/snyder-mesh.js.map +0 -1
- package/dist/discontinuous/snyder.d.ts.map +0 -1
- package/dist/discontinuous/snyder.js.map +0 -1
- package/dist/discontinuous/source-arc.d.ts.map +0 -1
- package/dist/discontinuous/source-arc.js.map +0 -1
- package/dist/discontinuous/spherical-clip/cartesian.d.ts +0 -8
- package/dist/discontinuous/spherical-clip/cartesian.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/cartesian.js.map +0 -1
- package/dist/discontinuous/spherical-clip/circle.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/circle.js.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-buffer.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-buffer.js.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-circle.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-circle.js.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-index.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-index.js.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-rejoin.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/clip-rejoin.js.map +0 -1
- package/dist/discontinuous/spherical-clip/helpers.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/helpers.js.map +0 -1
- package/dist/discontinuous/spherical-clip/math.d.ts +0 -26
- package/dist/discontinuous/spherical-clip/math.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/math.js.map +0 -1
- package/dist/discontinuous/spherical-clip/noop.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/noop.js.map +0 -1
- package/dist/discontinuous/spherical-clip/pointEqual.d.ts +0 -2
- package/dist/discontinuous/spherical-clip/pointEqual.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/pointEqual.js.map +0 -1
- package/dist/discontinuous/spherical-clip/polygonContains.d.ts.map +0 -1
- package/dist/discontinuous/spherical-clip/polygonContains.js.map +0 -1
- package/dist/discontinuous/world-composite-kernels.d.ts.map +0 -1
- package/dist/discontinuous/world-composite-kernels.js.map +0 -1
- package/dist/discontinuous/world-kernels/airy.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/airy.js.map +0 -1
- package/dist/discontinuous/world-kernels/aitoff.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/aitoff.js.map +0 -1
- package/dist/discontinuous/world-kernels/armadillo.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/armadillo.js.map +0 -1
- package/dist/discontinuous/world-kernels/august.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/august.js.map +0 -1
- package/dist/discontinuous/world-kernels/baker.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/baker.js.map +0 -1
- package/dist/discontinuous/world-kernels/bertin.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/bertin.js.map +0 -1
- package/dist/discontinuous/world-kernels/boggs.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/boggs.js.map +0 -1
- package/dist/discontinuous/world-kernels/bonne.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/bonne.js.map +0 -1
- package/dist/discontinuous/world-kernels/bottomley.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/bottomley.js.map +0 -1
- package/dist/discontinuous/world-kernels/bromley.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/bromley.js.map +0 -1
- package/dist/discontinuous/world-kernels/chamberlin.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/chamberlin.js.map +0 -1
- package/dist/discontinuous/world-kernels/collignon.d.ts +0 -5
- package/dist/discontinuous/world-kernels/collignon.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/collignon.js.map +0 -1
- package/dist/discontinuous/world-kernels/craig.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/craig.js.map +0 -1
- package/dist/discontinuous/world-kernels/craster.d.ts +0 -5
- package/dist/discontinuous/world-kernels/craster.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/craster.js.map +0 -1
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/cylindricalEqualArea.js.map +0 -1
- package/dist/discontinuous/world-kernels/cylindricalStereographic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/cylindricalStereographic.js.map +0 -1
- package/dist/discontinuous/world-kernels/d3-geo-raw.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/d3-geo-raw.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert1.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert1.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert1.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert2.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert2.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert2.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert3.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert3.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert3.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert4.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert4.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert4.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert5.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert5.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert5.js.map +0 -1
- package/dist/discontinuous/world-kernels/eckert6.d.ts +0 -5
- package/dist/discontinuous/world-kernels/eckert6.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eckert6.js.map +0 -1
- package/dist/discontinuous/world-kernels/eisenlohr.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/eisenlohr.js.map +0 -1
- package/dist/discontinuous/world-kernels/fahey.d.ts +0 -5
- package/dist/discontinuous/world-kernels/fahey.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/fahey.js.map +0 -1
- package/dist/discontinuous/world-kernels/foucaut.d.ts +0 -5
- package/dist/discontinuous/world-kernels/foucaut.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/foucaut.js.map +0 -1
- package/dist/discontinuous/world-kernels/foucautSinusoidal.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/foucautSinusoidal.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg4.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg4.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg5.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg5.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg6.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg6.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg8.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg8.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg9.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburg9.js.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/ginzburgPolyconic.js.map +0 -1
- package/dist/discontinuous/world-kernels/hammer.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/hammer.js.map +0 -1
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/hammerRetroazimuthal.js.map +0 -1
- package/dist/discontinuous/world-kernels/hill.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/hill.js.map +0 -1
- package/dist/discontinuous/world-kernels/homolosine.d.ts +0 -5
- package/dist/discontinuous/world-kernels/homolosine.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/homolosine.js.map +0 -1
- package/dist/discontinuous/world-kernels/hufnagel.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/hufnagel.js.map +0 -1
- package/dist/discontinuous/world-kernels/hyperelliptical.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/hyperelliptical.js.map +0 -1
- package/dist/discontinuous/world-kernels/integrate.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/integrate.js.map +0 -1
- package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts +0 -5
- package/dist/discontinuous/world-kernels/kavrayskiy7.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/kavrayskiy7.js.map +0 -1
- package/dist/discontinuous/world-kernels/lagrange.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/lagrange.js.map +0 -1
- package/dist/discontinuous/world-kernels/larrivee.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/larrivee.js.map +0 -1
- package/dist/discontinuous/world-kernels/laskowski.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/laskowski.js.map +0 -1
- package/dist/discontinuous/world-kernels/littrow.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/littrow.js.map +0 -1
- package/dist/discontinuous/world-kernels/loximuthal.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/loximuthal.js.map +0 -1
- package/dist/discontinuous/world-kernels/math.d.ts +0 -36
- package/dist/discontinuous/world-kernels/math.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/math.js.map +0 -1
- package/dist/discontinuous/world-kernels/miller.d.ts +0 -5
- package/dist/discontinuous/world-kernels/miller.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/miller.js.map +0 -1
- package/dist/discontinuous/world-kernels/modifiedStereographic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/modifiedStereographic.js.map +0 -1
- package/dist/discontinuous/world-kernels/mollweide.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/mollweide.js.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarParabolic.js.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarQuartic.js.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/mtFlatPolarSinusoidal.js.map +0 -1
- package/dist/discontinuous/world-kernels/naturalEarth2.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/naturalEarth2.js.map +0 -1
- package/dist/discontinuous/world-kernels/nellHammer.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/nellHammer.js.map +0 -1
- package/dist/discontinuous/world-kernels/newton.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/newton.js.map +0 -1
- package/dist/discontinuous/world-kernels/nicolosi.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/nicolosi.js.map +0 -1
- package/dist/discontinuous/world-kernels/patterson.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/patterson.js.map +0 -1
- package/dist/discontinuous/world-kernels/polyconic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/polyconic.js.map +0 -1
- package/dist/discontinuous/world-kernels/rectangularPolyconic.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/rectangularPolyconic.js.map +0 -1
- package/dist/discontinuous/world-kernels/robinson.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/robinson.js.map +0 -1
- package/dist/discontinuous/world-kernels/satellite.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/satellite.js.map +0 -1
- package/dist/discontinuous/world-kernels/sinuMollweide.d.ts +0 -7
- package/dist/discontinuous/world-kernels/sinuMollweide.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/sinuMollweide.js.map +0 -1
- package/dist/discontinuous/world-kernels/sinusoidal.d.ts +0 -5
- package/dist/discontinuous/world-kernels/sinusoidal.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/sinusoidal.js.map +0 -1
- package/dist/discontinuous/world-kernels/times.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/times.js.map +0 -1
- package/dist/discontinuous/world-kernels/twoPointEquidistant.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/twoPointEquidistant.js.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten.js.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten2.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten2.js.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten3.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten3.js.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten4.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/vanDerGrinten4.js.map +0 -1
- package/dist/discontinuous/world-kernels/wagner.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/wagner.js.map +0 -1
- package/dist/discontinuous/world-kernels/wagner4.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/wagner4.js.map +0 -1
- package/dist/discontinuous/world-kernels/wagner6.d.ts +0 -5
- package/dist/discontinuous/world-kernels/wagner6.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/wagner6.js.map +0 -1
- package/dist/discontinuous/world-kernels/wiechel.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/wiechel.js.map +0 -1
- package/dist/discontinuous/world-kernels/winkel3.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels/winkel3.js.map +0 -1
- package/dist/discontinuous/world-kernels.d.ts.map +0 -1
- package/dist/discontinuous/world-kernels.js.map +0 -1
- package/dist/discontinuous/world-map.d.ts.map +0 -1
- package/dist/discontinuous/world-map.js.map +0 -1
- package/dist/discontinuous.cjs +0 -8282
- package/dist/discontinuous.cjs.map +0 -6
- package/dist/discontinuous.d.ts +0 -52
- package/dist/discontinuous.d.ts.map +0 -1
- package/dist/discontinuous.js +0 -36
- package/dist/discontinuous.js.map +0 -1
- package/src/discontinuous/elastic/map.ts +0 -621
- package/src/discontinuous/map-engine.ts +0 -602
- package/src/discontinuous/map-layout.ts +0 -768
- package/src/discontinuous/mercator-map.ts +0 -299
- package/src/discontinuous/projection-catalog.ts +0 -132
- package/src/discontinuous/rotated-map.ts +0 -86
- package/src/discontinuous/spherical-clip/cartesian.js +0 -43
- package/src/discontinuous/spherical-clip/math.js +0 -45
- package/src/discontinuous/spherical-clip/pointEqual.js +0 -10
- package/src/discontinuous/world-kernels/collignon.js +0 -17
- package/src/discontinuous/world-kernels/craster.js +0 -18
- package/src/discontinuous/world-kernels/eckert1.js +0 -18
- package/src/discontinuous/world-kernels/eckert2.js +0 -17
- package/src/discontinuous/world-kernels/eckert3.js +0 -17
- package/src/discontinuous/world-kernels/eckert4.js +0 -24
- package/src/discontinuous/world-kernels/eckert5.js +0 -17
- package/src/discontinuous/world-kernels/eckert6.js +0 -22
- package/src/discontinuous/world-kernels/fahey.js +0 -19
- package/src/discontinuous/world-kernels/foucaut.js +0 -20
- package/src/discontinuous/world-kernels/kavrayskiy7.js +0 -15
- package/src/discontinuous/world-kernels/math.js +0 -98
- package/src/discontinuous/world-kernels/miller.js +0 -15
- package/src/discontinuous/world-kernels/sinusoidal.js +0 -15
- package/src/discontinuous/world-kernels/wagner6.js +0 -15
- package/src/discontinuous.ts +0 -142
- /package/dist/{discontinuous → maps}/air-ocean-mesh.d.ts +0 -0
- /package/dist/{discontinuous → maps}/air-ocean-mesh.js +0 -0
- /package/dist/{discontinuous → maps}/albers-usa.d.ts +0 -0
- /package/dist/{discontinuous → maps}/albers-usa.js +0 -0
- /package/dist/{discontinuous → maps}/cap-map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/cap-map.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/data.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/data.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticI.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticI.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticII.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticII.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticIII.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/elasticIII.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/geometry.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/geometry.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/grid.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/grid.js +0 -0
- /package/dist/{discontinuous → maps}/elastic/map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/source-arc.d.ts +0 -0
- /package/dist/{discontinuous → maps}/elastic/source-arc.js +0 -0
- /package/dist/{discontinuous → maps}/global-polygons.d.ts +0 -0
- /package/dist/{discontinuous → maps}/global-polygons.js +0 -0
- /package/dist/{discontinuous → maps}/gray-fuller.d.ts +0 -0
- /package/dist/{discontinuous → maps}/gray-fuller.js +0 -0
- /package/dist/{discontinuous → maps}/gringorten-kernel.d.ts +0 -0
- /package/dist/{discontinuous → maps}/gringorten-kernel.js +0 -0
- /package/dist/{discontinuous → maps}/healpix.d.ts +0 -0
- /package/dist/{discontinuous → maps}/healpix.js +0 -0
- /package/dist/{discontinuous → maps}/layout.d.ts +0 -0
- /package/dist/{discontinuous → maps}/layout.js +0 -0
- /package/dist/{discontinuous → maps}/map-transition.d.ts +0 -0
- /package/dist/{discontinuous → maps}/map-transition.js +0 -0
- /package/dist/{discontinuous → maps}/math.d.ts +0 -0
- /package/dist/{discontinuous → maps}/math.js +0 -0
- /package/dist/{discontinuous → maps}/mercator-map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/graticule.d.ts +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/graticule.js +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/mesh.d.ts +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/mesh.js +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/unfold.d.ts +0 -0
- /package/dist/{discontinuous → maps}/myriahedral/unfold.js +0 -0
- /package/dist/{discontinuous → maps}/myriahedral.d.ts +0 -0
- /package/dist/{discontinuous → maps}/myriahedral.js +0 -0
- /package/dist/{discontinuous → maps}/petroff.d.ts +0 -0
- /package/dist/{discontinuous → maps}/petroff.js +0 -0
- /package/dist/{discontinuous → maps}/polygon-constraints.d.ts +0 -0
- /package/dist/{discontinuous → maps}/polygon-constraints.js +0 -0
- /package/dist/{discontinuous → maps}/polyhedral.d.ts +0 -0
- /package/dist/{discontinuous → maps}/polyhedral.js +0 -0
- /package/dist/{discontinuous → maps}/prepare-features.d.ts +0 -0
- /package/dist/{discontinuous → maps}/prepare-features.js +0 -0
- /package/dist/{discontinuous → maps}/projection-catalog.d.ts +0 -0
- /package/dist/{discontinuous → maps}/quincuncial-kernel.d.ts +0 -0
- /package/dist/{discontinuous → maps}/quincuncial-kernel.js +0 -0
- /package/dist/{discontinuous → maps}/quincuncial-star.d.ts +0 -0
- /package/dist/{discontinuous → maps}/quincuncial-star.js +0 -0
- /package/dist/{discontinuous → maps}/regional-map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/regional-map.js +0 -0
- /package/dist/{discontinuous → maps}/retroazimuthal-map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/retroazimuthal-map.js +0 -0
- /package/dist/{discontinuous → maps}/snyder-mesh.d.ts +0 -0
- /package/dist/{discontinuous → maps}/snyder-mesh.js +0 -0
- /package/dist/{discontinuous → maps}/snyder.d.ts +0 -0
- /package/dist/{discontinuous → maps}/snyder.js +0 -0
- /package/dist/{discontinuous → maps}/source-arc.d.ts +0 -0
- /package/dist/{discontinuous → maps}/source-arc.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/cartesian.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/circle.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/circle.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-buffer.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-buffer.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-circle.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-circle.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-index.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-index.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-rejoin.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/clip-rejoin.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/helpers.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/helpers.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/math.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/noop.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/noop.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/pointEqual.js +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/polygonContains.d.ts +0 -0
- /package/dist/{discontinuous → maps}/spherical-clip/polygonContains.js +0 -0
- /package/dist/{discontinuous → maps}/world-composite-kernels.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-composite-kernels.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/airy.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/airy.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/aitoff.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/aitoff.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/armadillo.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/armadillo.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/august.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/august.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/baker.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/baker.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bertin.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bertin.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/boggs.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/boggs.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bonne.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bonne.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bottomley.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bottomley.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bromley.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/bromley.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/chamberlin.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/chamberlin.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/collignon.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/craig.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/craig.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/craster.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/cylindricalEqualArea.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/cylindricalEqualArea.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/cylindricalStereographic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/cylindricalStereographic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/d3-geo-raw.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/d3-geo-raw.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert1.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert2.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert3.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert4.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert5.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eckert6.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eisenlohr.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/eisenlohr.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/fahey.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/foucaut.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/foucautSinusoidal.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/foucautSinusoidal.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg4.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg4.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg5.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg5.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg6.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg6.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg8.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg8.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg9.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburg9.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburgPolyconic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/ginzburgPolyconic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hammer.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hammer.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hammerRetroazimuthal.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hammerRetroazimuthal.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hill.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hill.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/homolosine.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hufnagel.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hufnagel.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hyperelliptical.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/hyperelliptical.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/integrate.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/integrate.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/kavrayskiy7.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/lagrange.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/lagrange.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/larrivee.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/larrivee.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/laskowski.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/laskowski.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/littrow.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/littrow.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/loximuthal.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/loximuthal.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/math.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/miller.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/modifiedStereographic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/modifiedStereographic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mollweide.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mollweide.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarParabolic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarParabolic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarQuartic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarQuartic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarSinusoidal.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/mtFlatPolarSinusoidal.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/naturalEarth2.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/naturalEarth2.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/nellHammer.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/nellHammer.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/newton.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/newton.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/nicolosi.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/nicolosi.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/patterson.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/patterson.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/polyconic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/polyconic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/rectangularPolyconic.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/rectangularPolyconic.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/robinson.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/robinson.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/satellite.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/satellite.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/sinuMollweide.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/sinusoidal.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/times.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/times.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/twoPointEquidistant.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/twoPointEquidistant.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten2.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten2.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten3.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten3.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten4.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/vanDerGrinten4.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wagner.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wagner.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wagner4.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wagner4.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wagner6.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wiechel.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/wiechel.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/winkel3.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels/winkel3.js +0 -0
- /package/dist/{discontinuous → maps}/world-kernels.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-kernels.js +0 -0
- /package/dist/{discontinuous → maps}/world-map.d.ts +0 -0
- /package/dist/{discontinuous → maps}/world-map.js +0 -0
- /package/src/{discontinuous → maps}/AIR-OCEAN-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/D3-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/PETROFF-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/PROJ-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/air-ocean-mesh.ts +0 -0
- /package/src/{discontinuous → maps}/albers-usa.ts +0 -0
- /package/src/{discontinuous → maps}/cap-map.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/UNLICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/elastic/data.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/elasticI.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/elasticII.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/elasticIII.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/geometry.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/grid.ts +0 -0
- /package/src/{discontinuous → maps}/elastic/source-arc.ts +0 -0
- /package/src/{discontinuous → maps}/global-polygons.ts +0 -0
- /package/src/{discontinuous → maps}/gray-fuller.ts +0 -0
- /package/src/{discontinuous → maps}/gringorten-kernel.ts +0 -0
- /package/src/{discontinuous → maps}/healpix.ts +0 -0
- /package/src/{discontinuous → maps}/layout.ts +0 -0
- /package/src/{discontinuous → maps}/map-transition.ts +0 -0
- /package/src/{discontinuous → maps}/math.ts +0 -0
- /package/src/{discontinuous → maps}/myriahedral/graticule.ts +0 -0
- /package/src/{discontinuous → maps}/myriahedral/mesh.ts +0 -0
- /package/src/{discontinuous → maps}/myriahedral/unfold.ts +0 -0
- /package/src/{discontinuous → maps}/myriahedral.ts +0 -0
- /package/src/{discontinuous → maps}/petroff.ts +0 -0
- /package/src/{discontinuous → maps}/polygon-constraints.ts +0 -0
- /package/src/{discontinuous → maps}/polyhedral.ts +0 -0
- /package/src/{discontinuous → maps}/prepare-features.ts +0 -0
- /package/src/{discontinuous/presets.ts → maps/preset-kernels.ts} +0 -0
- /package/src/{discontinuous → maps}/quincuncial-kernel.ts +0 -0
- /package/src/{discontinuous → maps}/quincuncial-star.ts +0 -0
- /package/src/{discontinuous → maps}/regional-map.ts +0 -0
- /package/src/{discontinuous → maps}/retroazimuthal-map.ts +0 -0
- /package/src/{discontinuous → maps}/snyder-mesh.ts +0 -0
- /package/src/{discontinuous → maps}/snyder.ts +0 -0
- /package/src/{discontinuous → maps}/source-arc.ts +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/D3-GEO-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/circle.js +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/clip-buffer.js +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/clip-circle.js +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/clip-index.js +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/clip-rejoin.js +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/helpers.js +0 -0
- /package/src/{discontinuous/spherical-clip/noop.js → maps/spherical-clip/noop.ts} +0 -0
- /package/src/{discontinuous → maps}/spherical-clip/polygonContains.js +0 -0
- /package/src/{discontinuous → maps}/world-composite-kernels.ts +0 -0
- /package/src/{discontinuous → maps}/world-kernels/INTEGRATE-LICENSE.txt +0 -0
- /package/src/{discontinuous → maps}/world-kernels/airy.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/aitoff.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/armadillo.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/august.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/baker.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/bertin.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/boggs.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/bonne.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/bottomley.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/bromley.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/chamberlin.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/craig.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/cylindricalEqualArea.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/cylindricalStereographic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/d3-geo-raw.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/eisenlohr.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/foucautSinusoidal.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburg4.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburg5.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburg6.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburg8.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburg9.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/ginzburgPolyconic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/hammer.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/hammerRetroazimuthal.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/hill.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/homolosine.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/hufnagel.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/hyperelliptical.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/integrate.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/lagrange.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/larrivee.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/laskowski.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/littrow.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/loximuthal.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/modifiedStereographic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/mollweide.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/mtFlatPolarParabolic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/mtFlatPolarQuartic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/mtFlatPolarSinusoidal.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/naturalEarth2.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/nellHammer.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/newton.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/nicolosi.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/patterson.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/polyconic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/rectangularPolyconic.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/robinson.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/satellite.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/sinuMollweide.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/times.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/twoPointEquidistant.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/vanDerGrinten.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/vanDerGrinten2.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/vanDerGrinten3.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/vanDerGrinten4.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/wagner.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/wagner4.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/wiechel.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels/winkel3.js +0 -0
- /package/src/{discontinuous → maps}/world-kernels.ts +0 -0
- /package/src/{discontinuous → maps}/world-map.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -10,9 +10,9 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
var __copyProps = (to, from, except, desc) => {
|
|
12
12
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let
|
|
14
|
-
if (!__hasOwnProp.call(to,
|
|
15
|
-
__defProp(to,
|
|
13
|
+
for (let key3 of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key3) && key3 !== except)
|
|
15
|
+
__defProp(to, key3, { get: () => from[key3], enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable });
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
@@ -71,6 +71,7 @@ __export(index_exports, {
|
|
|
71
71
|
RhumbPolygon: () => RhumbPolygon,
|
|
72
72
|
TERRAIN_BUFFER_VERSION: () => TERRAIN_BUFFER_VERSION,
|
|
73
73
|
TerrainContourBoundaryAxis: () => TerrainContourBoundaryAxis,
|
|
74
|
+
TerrainMorphStatus: () => TerrainMorphStatus,
|
|
74
75
|
TerrainProfileViewStatus: () => TerrainProfileViewStatus,
|
|
75
76
|
TerrainSampleStatus: () => TerrainSampleStatus,
|
|
76
77
|
TerrainSurface: () => TerrainSurface,
|
|
@@ -84,6 +85,7 @@ __export(index_exports, {
|
|
|
84
85
|
altitudeToFovy: () => web_mercator_exports.altitudeToFovy,
|
|
85
86
|
clipGeographicPolygon: () => clipGeographicPolygon,
|
|
86
87
|
clipGeographicPolyline: () => clipGeographicPolyline,
|
|
88
|
+
coordinateTerrainLodMorphs: () => coordinateTerrainLodMorphs,
|
|
87
89
|
createCRSDescriptor: () => createCRSDescriptor,
|
|
88
90
|
createCRSDictionaryProvider: () => createCRSDictionaryProvider,
|
|
89
91
|
createCRSExecutionIdentity: () => createCRSExecutionIdentity,
|
|
@@ -99,7 +101,11 @@ __export(index_exports, {
|
|
|
99
101
|
createTerrainFilteredPyramid: () => createTerrainFilteredPyramid,
|
|
100
102
|
createTerrainGradientGrid: () => createTerrainGradientGrid,
|
|
101
103
|
createTerrainGradientPyramid: () => createTerrainGradientPyramid,
|
|
104
|
+
createTerrainIsobands: () => createTerrainIsobands,
|
|
105
|
+
createTerrainLodMorph: () => createTerrainLodMorph,
|
|
102
106
|
createTerrainMesh: () => createTerrainMesh,
|
|
107
|
+
createTerrainMixedIsobands: () => createTerrainMixedIsobands,
|
|
108
|
+
createTerrainMixedVertexTileHalos: () => createTerrainMixedVertexTileHalos,
|
|
103
109
|
createTerrainSkirt: () => createTerrainSkirt,
|
|
104
110
|
createTerrainSlopeAspectGrid: () => createTerrainSlopeAspectGrid,
|
|
105
111
|
createTerrainSurface: () => createTerrainSurface,
|
|
@@ -108,6 +114,7 @@ __export(index_exports, {
|
|
|
108
114
|
eastNorthUpToFixedFrame: () => eastNorthUpToFixedFrame,
|
|
109
115
|
encodePROJString: () => encodePROJString,
|
|
110
116
|
encodeWKTCRS: () => encodeWKTCRS,
|
|
117
|
+
evaluateTerrainLodMorph: () => evaluateTerrainLodMorph,
|
|
111
118
|
fitBounds: () => web_mercator_exports.fitBounds,
|
|
112
119
|
flyToViewport: () => web_mercator_exports.flyToViewport,
|
|
113
120
|
formatAngle: () => formatAngle,
|
|
@@ -127,6 +134,7 @@ __export(index_exports, {
|
|
|
127
134
|
getMeterZoom: () => web_mercator_exports.getMeterZoom,
|
|
128
135
|
getProjectionMatrix: () => web_mercator_exports.getProjectionMatrix,
|
|
129
136
|
getProjectionParameters: () => web_mercator_exports.getProjectionParameters,
|
|
137
|
+
getTerrainHierarchyNode: () => getTerrainHierarchyNode,
|
|
130
138
|
getTerrainMeshEdge: () => getTerrainMeshEdge,
|
|
131
139
|
getTerrainProfileHorizon: () => getTerrainProfileHorizon,
|
|
132
140
|
getTerrainProfileViewshed: () => getTerrainProfileViewshed,
|
|
@@ -165,6 +173,7 @@ __export(index_exports, {
|
|
|
165
173
|
scaleToZoom: () => web_mercator_exports.scaleToZoom,
|
|
166
174
|
selectTileMatrix: () => selectTileMatrix,
|
|
167
175
|
simplifyTerrainContourPaths: () => simplifyTerrainContourPaths,
|
|
176
|
+
simplifyTerrainContourPathsTopology: () => simplifyTerrainContourPathsTopology,
|
|
168
177
|
splitGeographicPolygon: () => splitGeographicPolygon,
|
|
169
178
|
splitGeographicPolyline: () => splitGeographicPolyline,
|
|
170
179
|
splitGlobeBounds: () => splitGlobeBounds,
|
|
@@ -180,6 +189,18 @@ __export(index_exports, {
|
|
|
180
189
|
unitsPerMeter: () => web_mercator_exports.unitsPerMeter,
|
|
181
190
|
unpackTerrainHeightField: () => unpackTerrainHeightField,
|
|
182
191
|
unprojectGrid: () => unprojectGrid,
|
|
192
|
+
updateTerrainBounds: () => updateTerrainBounds,
|
|
193
|
+
updateTerrainBoundsRegions: () => updateTerrainBoundsRegions,
|
|
194
|
+
updateTerrainDelatinMeshRegions: () => updateTerrainDelatinMeshRegions,
|
|
195
|
+
updateTerrainGradientPyramidRegions: () => updateTerrainGradientPyramidRegions,
|
|
196
|
+
updateTerrainGradientPyramids: () => updateTerrainGradientPyramids,
|
|
197
|
+
updateTerrainMartiniMeshRegions: () => updateTerrainMartiniMeshRegions,
|
|
198
|
+
updateTerrainMeshRegions: () => updateTerrainMeshRegions,
|
|
199
|
+
updateTerrainMeshes: () => updateTerrainMeshes,
|
|
200
|
+
updateTerrainMixedGradientGrids: () => updateTerrainMixedGradientGrids,
|
|
201
|
+
updateTerrainMixedVertexTileHalos: () => updateTerrainMixedVertexTileHalos,
|
|
202
|
+
updateTerrainPersistentBounds: () => updateTerrainPersistentBounds,
|
|
203
|
+
updateTerrainPersistentGradients: () => updateTerrainPersistentGradients,
|
|
183
204
|
updateTerrainVertexTileHalos: () => updateTerrainVertexTileHalos,
|
|
184
205
|
validateTileMatrix: () => validateTileMatrix,
|
|
185
206
|
validateTileMatrixLimits: () => validateTileMatrixLimits,
|
|
@@ -281,11 +302,11 @@ var import_core2 = require("@math.gl/core");
|
|
|
281
302
|
function exactNearestSurface(x, y, z, a, b, c, result) {
|
|
282
303
|
const values = [a, b, c, Math.abs(x), Math.abs(y), Math.abs(z)];
|
|
283
304
|
const parts = values.map((value3) => {
|
|
284
|
-
const
|
|
285
|
-
const dot4 =
|
|
305
|
+
const bits2 = value3.toString(2);
|
|
306
|
+
const dot4 = bits2.indexOf(".");
|
|
286
307
|
return {
|
|
287
|
-
integer: BigInt("0b" +
|
|
288
|
-
exponent: dot4 < 0 ? 0 : dot4 + 1 -
|
|
308
|
+
integer: BigInt("0b" + bits2.replace(".", "")),
|
|
309
|
+
exponent: dot4 < 0 ? 0 : dot4 + 1 - bits2.length
|
|
289
310
|
};
|
|
290
311
|
});
|
|
291
312
|
const exponent = Math.min(...parts.filter((p) => p.integer !== 0n).map((p) => p.exponent));
|
|
@@ -326,10 +347,10 @@ function exactNearestSurface(x, y, z, a, b, c, result) {
|
|
|
326
347
|
return false;
|
|
327
348
|
const dx = d[0] + t, dy = d[1] + t, dz = d[2] + t;
|
|
328
349
|
const xx = dx * dx, yy = dy * dy, zz = dz * dz;
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
350
|
+
const sign2 = u2[0] * yy * zz + u2[1] * xx * zz + u2[2] * xx * yy - xx * yy * zz;
|
|
351
|
+
if (sign2 === 0n)
|
|
331
352
|
return commit(t, unit3);
|
|
332
|
-
if (
|
|
353
|
+
if (sign2 > 0n)
|
|
333
354
|
lower = t;
|
|
334
355
|
else
|
|
335
356
|
upper = t;
|
|
@@ -2701,31 +2722,31 @@ var EllipsoidMetrics = class {
|
|
|
2701
2722
|
return kind === "isometric" ? Math.sign(latitude) * Infinity : latitude;
|
|
2702
2723
|
if (this.ratio === 1 && kind !== "isometric")
|
|
2703
2724
|
return latitude;
|
|
2704
|
-
const
|
|
2725
|
+
const sign2 = Math.sign(latitude);
|
|
2705
2726
|
const phi = Math.abs(latitude);
|
|
2706
2727
|
const [s, c] = sincos(phi);
|
|
2707
2728
|
switch (kind) {
|
|
2708
2729
|
case "geocentric":
|
|
2709
|
-
return
|
|
2730
|
+
return sign2 * angle(this.ratio * this.ratio * s, c);
|
|
2710
2731
|
case "parametric":
|
|
2711
|
-
return
|
|
2732
|
+
return sign2 * angle(this.ratio * s, c);
|
|
2712
2733
|
case "rectifying":
|
|
2713
|
-
return
|
|
2734
|
+
return sign2 * (phi <= 45 ? this.meridian(phi) / this.quarter * 90 : 90 - integrate((t) => this.meridianIntegrand(Math.PI / 2 - t), 0, (90 - phi) * DEG) / this.quarter * 90);
|
|
2714
2735
|
case "authalic": {
|
|
2715
2736
|
if (phi <= 45) {
|
|
2716
2737
|
const q = this.ratio ** 2 * (s / (c * c + (this.ratio * s) ** 2) + this.eccentricIntegral(s));
|
|
2717
|
-
return
|
|
2738
|
+
return sign2 * Math.asin(q / this.qPole) / DEG;
|
|
2718
2739
|
}
|
|
2719
2740
|
const cap = integrate((t) => {
|
|
2720
2741
|
const st = Math.sin(t), ct = Math.cos(t);
|
|
2721
2742
|
const d = st * st + (this.ratio * ct) ** 2;
|
|
2722
2743
|
return 2 * this.ratio ** 2 * st / (d * d);
|
|
2723
2744
|
}, 0, (90 - phi) * DEG);
|
|
2724
|
-
return
|
|
2745
|
+
return sign2 * (90 - 2 * Math.asin(Math.sqrt(cap / (2 * this.qPole))) / DEG);
|
|
2725
2746
|
}
|
|
2726
2747
|
default: {
|
|
2727
2748
|
const psi = Math.asinh(s / c) - this.e2 * this.eccentricIntegral(s);
|
|
2728
|
-
return
|
|
2749
|
+
return sign2 * (kind === "isometric" ? psi / DEG : psi < 1 ? Math.atan(Math.sinh(psi)) / DEG : 90 - 2 * Math.atan(Math.exp(-psi)) / DEG);
|
|
2729
2750
|
}
|
|
2730
2751
|
}
|
|
2731
2752
|
}
|
|
@@ -2743,10 +2764,10 @@ var EllipsoidMetrics = class {
|
|
|
2743
2764
|
return latitude;
|
|
2744
2765
|
if (this.ratio === 1 && kind !== "isometric")
|
|
2745
2766
|
return latitude;
|
|
2746
|
-
const
|
|
2767
|
+
const sign2 = Math.sign(latitude), target = Math.abs(latitude);
|
|
2747
2768
|
if (kind === "geocentric" || kind === "parametric") {
|
|
2748
2769
|
const [s, c] = sincos(target);
|
|
2749
|
-
return
|
|
2770
|
+
return sign2 * angle(s, c * (kind === "geocentric" ? this.ratio ** 2 : this.ratio));
|
|
2750
2771
|
}
|
|
2751
2772
|
let lo = 0, hi = 90;
|
|
2752
2773
|
for (let i = 0; i < 64; ++i) {
|
|
@@ -2758,7 +2779,7 @@ var EllipsoidMetrics = class {
|
|
|
2758
2779
|
else
|
|
2759
2780
|
hi = mid;
|
|
2760
2781
|
}
|
|
2761
|
-
return
|
|
2782
|
+
return sign2 * ((lo + hi) / 2);
|
|
2762
2783
|
}
|
|
2763
2784
|
eccentricIntegral(s) {
|
|
2764
2785
|
const e = Math.sqrt(Math.abs(this.e2));
|
|
@@ -2954,11 +2975,11 @@ var div = (x, y) => x * Q / y;
|
|
|
2954
2975
|
function exact(x) {
|
|
2955
2976
|
const bytes = new DataView(new ArrayBuffer(8));
|
|
2956
2977
|
bytes.setFloat64(0, x);
|
|
2957
|
-
const
|
|
2958
|
-
const mantissa =
|
|
2978
|
+
const bits2 = bytes.getBigUint64(0), exponent = Number(bits2 >> 52n & 2047n);
|
|
2979
|
+
const mantissa = bits2 & (1n << 52n) - 1n | (exponent ? 1n << 52n : 0n);
|
|
2959
2980
|
const shift2 = exponent ? exponent - 1075 : -1074;
|
|
2960
2981
|
const value3 = shift2 >= 0 ? mantissa * Q << BigInt(shift2) : mantissa * Q >> BigInt(-shift2);
|
|
2961
|
-
return
|
|
2982
|
+
return bits2 >> 63n ? -value3 : value3;
|
|
2962
2983
|
}
|
|
2963
2984
|
function sc(x) {
|
|
2964
2985
|
let s = x, c = Q, ts = x, tc = Q;
|
|
@@ -2973,13 +2994,13 @@ function sc(x) {
|
|
|
2973
2994
|
}
|
|
2974
2995
|
return [s, c];
|
|
2975
2996
|
}
|
|
2976
|
-
function remainingPoleDistance(a, b, latitude, azimuth, distance,
|
|
2997
|
+
function remainingPoleDistance(a, b, latitude, azimuth, distance, sign2) {
|
|
2977
2998
|
const unit3 = 2 ** Math.floor(Math.log2(a));
|
|
2978
2999
|
a /= unit3;
|
|
2979
3000
|
b /= unit3;
|
|
2980
3001
|
distance /= unit3;
|
|
2981
3002
|
const ratio2 = div(exact(b), exact(a));
|
|
2982
|
-
const theta = mul(90n * Q - BigInt(
|
|
3003
|
+
const theta = mul(90n * Q - BigInt(sign2) * exact(latitude), PI) / 180n;
|
|
2983
3004
|
const [s, c] = sc(theta), prolate = ratio2 > Q;
|
|
2984
3005
|
const square = mul(ratio2, ratio2);
|
|
2985
3006
|
const k = prolate ? Q - div(Q, square) : Q - square;
|
|
@@ -2998,7 +3019,7 @@ function remainingPoleDistance(a, b, latitude, azimuth, distance, sign) {
|
|
|
2998
3019
|
const gap = prolate ? div(total, ratio2) : mul(total, square);
|
|
2999
3020
|
const angle3 = mul(exact(azimuth % 360), PI) / 180n;
|
|
3000
3021
|
const north = mul(div(exact(distance), exact(a)), sc(angle3)[1]);
|
|
3001
|
-
return Number(gap - BigInt(
|
|
3022
|
+
return Number(gap - BigInt(sign2) * north) / Number(Q);
|
|
3002
3023
|
}
|
|
3003
3024
|
|
|
3004
3025
|
// dist/ellipsoid-rhumb.js
|
|
@@ -3118,10 +3139,10 @@ var EllipsoidRhumb = class {
|
|
|
3118
3139
|
return this.metrics.latitudeToAuxiliary(latitude, "isometric") * DEG2;
|
|
3119
3140
|
}
|
|
3120
3141
|
polarEndpoint(latitude, north, poleDistance) {
|
|
3121
|
-
const
|
|
3142
|
+
const sign2 = Math.abs(latitude) > 80 && Math.abs(north) < Math.abs(this.meridianDelta(0, latitude)) ? Math.sign(latitude) : Math.sign(north), theta1 = (90 - sign2 * latitude) * DEG2, limit = 10 * DEG2;
|
|
3122
3143
|
const density = (theta2) => this.r ** 2 / Math.hypot(Math.sin(theta2), this.r * Math.cos(theta2)) ** 3;
|
|
3123
3144
|
const gap = (theta2) => integrate(density, 0, theta2);
|
|
3124
|
-
const target =
|
|
3145
|
+
const target = sign2 === Math.sign(north) ? poleDistance : this.meridianDelta(sign2 > 0 ? latitude : -90, sign2 > 0 ? 90 : latitude) - sign2 * north;
|
|
3125
3146
|
if (!(target > 0 && target < gap(limit)))
|
|
3126
3147
|
return void 0;
|
|
3127
3148
|
let lo = 0, hi = limit, theta = target * this.r;
|
|
@@ -3151,9 +3172,9 @@ var EllipsoidRhumb = class {
|
|
|
3151
3172
|
return this.r ** 2 / (c * (c * c + (this.r * s) ** 2));
|
|
3152
3173
|
}, -1, 1) / 2 : -(this.polarPsi(theta) - this.polarPsi(theta1)) / span;
|
|
3153
3174
|
return {
|
|
3154
|
-
latitude:
|
|
3175
|
+
latitude: sign2 * (90 - theta / DEG2),
|
|
3155
3176
|
means: [meanM, meanP],
|
|
3156
|
-
psi:
|
|
3177
|
+
psi: sign2 * this.polarPsi(theta)
|
|
3157
3178
|
};
|
|
3158
3179
|
}
|
|
3159
3180
|
polarPsi(theta) {
|
|
@@ -3508,9 +3529,9 @@ var GeodesicIntersections = class {
|
|
|
3508
3529
|
++search.failedSeeds;
|
|
3509
3530
|
}
|
|
3510
3531
|
} else {
|
|
3511
|
-
for (const
|
|
3532
|
+
for (const sign2 of [-1, 1]) {
|
|
3512
3533
|
try {
|
|
3513
|
-
const s = this.bounds.conjugate(A3,
|
|
3534
|
+
const s = this.bounds.conjugate(A3, sign2 * this.bounds.halfCircumference);
|
|
3514
3535
|
const point2 = this.coincidencePoint(a, b, {
|
|
3515
3536
|
s: s * this.a,
|
|
3516
3537
|
t: c.direction * s * this.a,
|
|
@@ -3605,8 +3626,8 @@ var GeodesicIntersections = class {
|
|
|
3605
3626
|
for (let i = 0; i < 100; i++) {
|
|
3606
3627
|
const a = A3.position(x), b = B2.position(y), v = this.solver.inverse(a.lat2, a.lon2, b.lat2, b.lon2);
|
|
3607
3628
|
const X = math2.AngDiff(a.azi2, v.azi1), Y = math2.AngDiff(b.azi2, v.azi2), XY = math2.AngDiff(X.d, Y.d);
|
|
3608
|
-
const
|
|
3609
|
-
const sx = math2.sincosde(
|
|
3629
|
+
const orientation3 = XY.d + (XY.e + Y.e - X.e) < 0 ? -1 : 1;
|
|
3630
|
+
const sx = math2.sincosde(orientation3 * X.d, orientation3 * X.e), sy = math2.sincosde(orientation3 * Y.d, orientation3 * Y.e);
|
|
3610
3631
|
let dx, dy, c = 0;
|
|
3611
3632
|
if (v.s12 <= EPS * this.radius) {
|
|
3612
3633
|
if (Math.abs(sx.s - sy.s) <= EPS && Math.abs(sx.c - sy.c) <= EPS)
|
|
@@ -3666,15 +3687,15 @@ var GeodesicIntersections = class {
|
|
|
3666
3687
|
if (length > 0 && length < Math.sqrt(Number.EPSILON))
|
|
3667
3688
|
return void 0;
|
|
3668
3689
|
if (length <= EPS) {
|
|
3669
|
-
const
|
|
3690
|
+
const sign2 = dot(na, nb) >= 0 ? 1 : -1;
|
|
3670
3691
|
const offset2 = Math.atan2(dot(pa, tb), dot(pa, pb));
|
|
3671
3692
|
const coincidences = [];
|
|
3672
|
-
for (let k = Math.ceil((y -
|
|
3693
|
+
for (let k = Math.ceil((y - sign2 * x - d - offset2) / (2 * Math.PI)); k <= Math.floor((y - sign2 * x + d - offset2) / (2 * Math.PI)); k++) {
|
|
3673
3694
|
const shift2 = offset2 + 2 * Math.PI * k;
|
|
3674
|
-
const sx = (x +
|
|
3675
|
-
const sy =
|
|
3695
|
+
const sx = (x + sign2 * (y - shift2)) / 2;
|
|
3696
|
+
const sy = sign2 * sx + shift2;
|
|
3676
3697
|
if (Math.abs(sx - x) + Math.abs(sy - y) <= d + this.tolerance)
|
|
3677
|
-
coincidences.push({ s: sx * this.a, t: sy * this.a, direction:
|
|
3698
|
+
coincidences.push({ s: sx * this.a, t: sy * this.a, direction: sign2 });
|
|
3678
3699
|
}
|
|
3679
3700
|
let failed2 = 0;
|
|
3680
3701
|
const checked = coincidences.filter((c) => {
|
|
@@ -3698,8 +3719,8 @@ var GeodesicIntersections = class {
|
|
|
3698
3719
|
}
|
|
3699
3720
|
const result = [];
|
|
3700
3721
|
let failed = 0;
|
|
3701
|
-
for (const
|
|
3702
|
-
const p = crossing.map((v) =>
|
|
3722
|
+
for (const sign2 of [-1, 1]) {
|
|
3723
|
+
const p = crossing.map((v) => sign2 * v / length);
|
|
3703
3724
|
const s = Math.atan2(dot(p, ta), dot(p, pa)), t = Math.atan2(dot(p, tb), dot(p, pb));
|
|
3704
3725
|
const k0 = Math.ceil((x - d - s) / (2 * Math.PI)), k1 = Math.floor((x + d - s) / (2 * Math.PI));
|
|
3705
3726
|
const l0 = Math.ceil((y - d - t) / (2 * Math.PI)), l1 = Math.floor((y + d - t) / (2 * Math.PI));
|
|
@@ -4007,18 +4028,18 @@ function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, car
|
|
|
4007
4028
|
return result;
|
|
4008
4029
|
}
|
|
4009
4030
|
if (atPole) {
|
|
4010
|
-
const
|
|
4031
|
+
const sign2 = Math.sign(origin.z);
|
|
4011
4032
|
firstAxisVector = scratchVector1.fromArray(degeneratePositionLocalFrame[firstAxis]);
|
|
4012
4033
|
if (firstAxis !== "east" && firstAxis !== "west") {
|
|
4013
|
-
firstAxisVector.scale(
|
|
4034
|
+
firstAxisVector.scale(sign2);
|
|
4014
4035
|
}
|
|
4015
4036
|
secondAxisVector = scratchVector22.fromArray(degeneratePositionLocalFrame[secondAxis]);
|
|
4016
4037
|
if (secondAxis !== "east" && secondAxis !== "west") {
|
|
4017
|
-
secondAxisVector.scale(
|
|
4038
|
+
secondAxisVector.scale(sign2);
|
|
4018
4039
|
}
|
|
4019
4040
|
thirdAxisVector = scratchVector3.fromArray(degeneratePositionLocalFrame[thirdAxis]);
|
|
4020
4041
|
if (thirdAxis !== "east" && thirdAxis !== "west") {
|
|
4021
|
-
thirdAxisVector.scale(
|
|
4042
|
+
thirdAxisVector.scale(sign2);
|
|
4022
4043
|
}
|
|
4023
4044
|
} else {
|
|
4024
4045
|
const { up, east, north } = scratchAxisVectors;
|
|
@@ -5091,8 +5112,8 @@ function interior(edges, context) {
|
|
|
5091
5112
|
}
|
|
5092
5113
|
throw new GeographicSeamError("topology", "No resolvable polygon interior");
|
|
5093
5114
|
}
|
|
5094
|
-
function output(edges,
|
|
5095
|
-
if (interior(edges, context).sign !==
|
|
5115
|
+
function output(edges, sign2, context) {
|
|
5116
|
+
if (interior(edges, context).sign !== sign2)
|
|
5096
5117
|
edges = edges.slice().reverse().map(reverse);
|
|
5097
5118
|
context.addVertices(edges.length + 1);
|
|
5098
5119
|
return {
|
|
@@ -5113,7 +5134,7 @@ function processPolygon(inputs, options, latitudeRange) {
|
|
|
5113
5134
|
context.tick(inputs.length);
|
|
5114
5135
|
const rings = inputs.map((ring, i) => prepare(ring, i, context));
|
|
5115
5136
|
const graph = [], nodes = /* @__PURE__ */ new Map();
|
|
5116
|
-
const
|
|
5137
|
+
const key3 = (p) => `${p[0]},${p[1]}`;
|
|
5117
5138
|
const add3 = (edge) => {
|
|
5118
5139
|
context.tick();
|
|
5119
5140
|
if (edge.a[0] === edge.b[0] && edge.a[1] === edge.b[1])
|
|
@@ -5121,7 +5142,7 @@ function processPolygon(inputs, options, latitudeRange) {
|
|
|
5121
5142
|
const id = graph.length;
|
|
5122
5143
|
graph.push(edge);
|
|
5123
5144
|
for (const p of [edge.a, edge.b]) {
|
|
5124
|
-
const k =
|
|
5145
|
+
const k = key3(p), node = nodes.get(k);
|
|
5125
5146
|
if (node) {
|
|
5126
5147
|
if (!same(node.p, p))
|
|
5127
5148
|
throw new GeographicSeamError("topology", "Touching boundaries have inconsistent attributes");
|
|
@@ -5263,16 +5284,16 @@ function processPolygon(inputs, options, latitudeRange) {
|
|
|
5263
5284
|
for (let seed = 0; seed < graph.length; seed++) {
|
|
5264
5285
|
if (used.has(seed))
|
|
5265
5286
|
continue;
|
|
5266
|
-
const cycle = [], start =
|
|
5287
|
+
const cycle = [], start = key3(graph[seed].a);
|
|
5267
5288
|
let id = seed, current = start;
|
|
5268
5289
|
do {
|
|
5269
5290
|
context.tick();
|
|
5270
5291
|
if (used.has(id))
|
|
5271
5292
|
throw new GeographicSeamError("topology", "Non-simple boundary graph");
|
|
5272
5293
|
used.add(id);
|
|
5273
|
-
const edge =
|
|
5294
|
+
const edge = key3(graph[id].a) === current ? graph[id] : reverse(graph[id]);
|
|
5274
5295
|
cycle.push(edge);
|
|
5275
|
-
current =
|
|
5296
|
+
current = key3(edge.b);
|
|
5276
5297
|
const adjacent = nodes.get(current).edges;
|
|
5277
5298
|
id = adjacent[0] === id ? adjacent[1] : adjacent[0];
|
|
5278
5299
|
} while (current !== start);
|
|
@@ -5294,13 +5315,13 @@ function processPolygon(inputs, options, latitudeRange) {
|
|
|
5294
5315
|
throw new GeographicSeamError("topology", "Nested holes or overlapping polygon components");
|
|
5295
5316
|
return containers[0];
|
|
5296
5317
|
});
|
|
5297
|
-
const
|
|
5318
|
+
const sign2 = interior(rings[0].membership, context).sign;
|
|
5298
5319
|
const result = [], groups = /* @__PURE__ */ new Map();
|
|
5299
5320
|
for (let i = 0; i < cycles.length; i++)
|
|
5300
5321
|
if (parents[i] === void 0) {
|
|
5301
5322
|
if (cycles[i].every((e) => e.source && e.source.ringIndex !== 0))
|
|
5302
5323
|
throw new GeographicSeamError("topology", "Hole is outside the outer ring");
|
|
5303
|
-
const polygon = { rings: [output(cycles[i],
|
|
5324
|
+
const polygon = { rings: [output(cycles[i], sign2, context)] };
|
|
5304
5325
|
result.push(polygon);
|
|
5305
5326
|
groups.set(i, polygon);
|
|
5306
5327
|
}
|
|
@@ -5309,7 +5330,7 @@ function processPolygon(inputs, options, latitudeRange) {
|
|
|
5309
5330
|
const group = groups.get(parents[i]);
|
|
5310
5331
|
if (!group)
|
|
5311
5332
|
throw new GeographicSeamError("topology", "Nested polygon rings");
|
|
5312
|
-
group.rings.push(output(cycles[i], -
|
|
5333
|
+
group.rings.push(output(cycles[i], -sign2, context));
|
|
5313
5334
|
}
|
|
5314
5335
|
return result;
|
|
5315
5336
|
}
|
|
@@ -5713,7 +5734,7 @@ function cloneAndFreezeJsonValue(value3) {
|
|
|
5713
5734
|
return Object.freeze(value3.map((item) => cloneAndFreezeJsonValue(item)));
|
|
5714
5735
|
}
|
|
5715
5736
|
if (value3 && typeof value3 === "object") {
|
|
5716
|
-
return Object.freeze(Object.fromEntries(Object.entries(value3).map(([
|
|
5737
|
+
return Object.freeze(Object.fromEntries(Object.entries(value3).map(([key3, item]) => [key3, cloneAndFreezeJsonValue(item)])));
|
|
5717
5738
|
}
|
|
5718
5739
|
return value3;
|
|
5719
5740
|
}
|
|
@@ -6572,7 +6593,7 @@ function getCRSSignature(crs) {
|
|
|
6572
6593
|
return JSON.stringify([
|
|
6573
6594
|
crs.coordinateFrame,
|
|
6574
6595
|
crs.projection,
|
|
6575
|
-
Object.keys(crs.parameters).sort().map((
|
|
6596
|
+
Object.keys(crs.parameters).sort().map((key3) => [key3, crs.parameters[key3]]),
|
|
6576
6597
|
[crs.ellipsoid.semiMajorAxis, crs.ellipsoid.semiMinorAxis],
|
|
6577
6598
|
crs.axis,
|
|
6578
6599
|
[crs.xUnit.name, crs.xUnit.metersPerUnit, crs.xUnit.degreesPerUnit],
|
|
@@ -6593,7 +6614,7 @@ var CRSResolutionError = class extends Error {
|
|
|
6593
6614
|
}
|
|
6594
6615
|
};
|
|
6595
6616
|
function createCRSDictionaryProvider(definitions, options = {}) {
|
|
6596
|
-
const entries = new Map(Object.entries(definitions).map(([
|
|
6617
|
+
const entries = new Map(Object.entries(definitions).map(([key3, value3]) => [key3, snapshot(value3)]));
|
|
6597
6618
|
return Object.freeze({
|
|
6598
6619
|
id: options.id ?? "dictionary",
|
|
6599
6620
|
version: options.version,
|
|
@@ -6703,7 +6724,7 @@ function snapshot(value3) {
|
|
|
6703
6724
|
if (Array.isArray(value3))
|
|
6704
6725
|
return Object.freeze(value3.map((item) => snapshot(item)));
|
|
6705
6726
|
if (value3 && typeof value3 === "object") {
|
|
6706
|
-
return Object.freeze(Object.fromEntries(Object.entries(value3).map(([
|
|
6727
|
+
return Object.freeze(Object.fromEntries(Object.entries(value3).map(([key3, item]) => [key3, snapshot(item)])));
|
|
6707
6728
|
}
|
|
6708
6729
|
return value3;
|
|
6709
6730
|
}
|
|
@@ -6800,16 +6821,16 @@ function copyRecord(value3, stringsOnly) {
|
|
|
6800
6821
|
if (!value3 || typeof value3 !== "object" || Array.isArray(value3) || ![Object.prototype, null].includes(Object.getPrototypeOf(value3)))
|
|
6801
6822
|
throw new TypeError("Invalid execution identity record");
|
|
6802
6823
|
const result = /* @__PURE__ */ Object.create(null);
|
|
6803
|
-
for (const
|
|
6804
|
-
nonempty(
|
|
6805
|
-
const item = value3[
|
|
6824
|
+
for (const key3 of Object.keys(value3).sort()) {
|
|
6825
|
+
nonempty(key3);
|
|
6826
|
+
const item = value3[key3];
|
|
6806
6827
|
if (stringsOnly)
|
|
6807
6828
|
nonempty(item);
|
|
6808
6829
|
else if (!(item === null || typeof item === "string" || typeof item === "boolean" || typeof item === "number" && Number.isFinite(item)))
|
|
6809
6830
|
throw new TypeError("Invalid execution parameter");
|
|
6810
6831
|
if (Object.is(item, -0))
|
|
6811
6832
|
throw new TypeError("Execution parameters cannot contain negative zero");
|
|
6812
|
-
result[
|
|
6833
|
+
result[key3] = item;
|
|
6813
6834
|
}
|
|
6814
6835
|
return Object.freeze(result);
|
|
6815
6836
|
}
|
|
@@ -6858,10 +6879,10 @@ function createCRSDescriptor(options) {
|
|
|
6858
6879
|
} : copyScale(suppliedScale);
|
|
6859
6880
|
requireValue(Object.prototype.hasOwnProperty.call(options.converter, "WGS84"), "converter.WGS84");
|
|
6860
6881
|
const converter = /* @__PURE__ */ Object.create(null);
|
|
6861
|
-
for (const
|
|
6862
|
-
const operations = options.converter[
|
|
6863
|
-
requireValue(Boolean(
|
|
6864
|
-
converter[
|
|
6882
|
+
for (const key3 of Object.getOwnPropertyNames(options.converter)) {
|
|
6883
|
+
const operations = options.converter[key3];
|
|
6884
|
+
requireValue(Boolean(key3.trim()), "converter key");
|
|
6885
|
+
converter[key3] = Object.freeze({
|
|
6865
6886
|
from: bindConversion(operations, "from"),
|
|
6866
6887
|
to: bindConversion(operations, "to"),
|
|
6867
6888
|
normalize: bindConversion(operations, "normalize")
|
|
@@ -6878,9 +6899,9 @@ function createCRSDescriptor(options) {
|
|
|
6878
6899
|
converter: Object.freeze(converter)
|
|
6879
6900
|
});
|
|
6880
6901
|
}
|
|
6881
|
-
function bindConversion(owner,
|
|
6882
|
-
const operation = owner == null ? void 0 : owner[
|
|
6883
|
-
requireValue(typeof operation === "function", `converter.${
|
|
6902
|
+
function bindConversion(owner, key3) {
|
|
6903
|
+
const operation = owner == null ? void 0 : owner[key3];
|
|
6904
|
+
requireValue(typeof operation === "function", `converter.${key3}`);
|
|
6884
6905
|
function convert(coordinate, output2) {
|
|
6885
6906
|
const result = operation.call(owner, coordinate, output2);
|
|
6886
6907
|
requireSynchronous(result);
|
|
@@ -7025,8 +7046,8 @@ function value(c, n) {
|
|
|
7025
7046
|
}
|
|
7026
7047
|
function valueError(c, n) {
|
|
7027
7048
|
if (Math.abs(c.offset) > 0.5) {
|
|
7028
|
-
const
|
|
7029
|
-
return ROUND * (1 - Math.abs(c.offset) + Math.hypot(...n.map((x, i) => x -
|
|
7049
|
+
const sign2 = c.offset > 0 ? 1 : -1;
|
|
7050
|
+
return ROUND * (1 - Math.abs(c.offset) + Math.hypot(...n.map((x, i) => x - sign2 * c.normal[i])));
|
|
7030
7051
|
}
|
|
7031
7052
|
return ROUND * (Math.abs(c.offset) + n.reduce((sum, x, i) => sum + Math.abs(x * c.normal[i]), 0));
|
|
7032
7053
|
}
|
|
@@ -7368,7 +7389,7 @@ function orientation(edges, frame2, context) {
|
|
|
7368
7389
|
}
|
|
7369
7390
|
throw new GeographicSeamError("precision", "No resolvable chart-ring interior");
|
|
7370
7391
|
}
|
|
7371
|
-
function polygons(arcs, frame2, chart,
|
|
7392
|
+
function polygons(arcs, frame2, chart, sign2, context) {
|
|
7372
7393
|
const outgoing = /* @__PURE__ */ new Map(), incoming = /* @__PURE__ */ new Map();
|
|
7373
7394
|
for (let i = 0; i < arcs.length; i++) {
|
|
7374
7395
|
context.tick();
|
|
@@ -7380,8 +7401,8 @@ function polygons(arcs, frame2, chart, sign, context) {
|
|
|
7380
7401
|
outgoing.set(e.a.id, i);
|
|
7381
7402
|
incoming.set(e.b.id, i);
|
|
7382
7403
|
}
|
|
7383
|
-
for (const
|
|
7384
|
-
if (!incoming.has(
|
|
7404
|
+
for (const key3 of outgoing.keys())
|
|
7405
|
+
if (!incoming.has(key3))
|
|
7385
7406
|
throw new GeographicSeamError("topology", "Open atlas boundary");
|
|
7386
7407
|
const cycles = [], used = /* @__PURE__ */ new Set();
|
|
7387
7408
|
for (let i = 0; i < arcs.length; i++)
|
|
@@ -7425,7 +7446,7 @@ function polygons(arcs, frame2, chart, sign, context) {
|
|
|
7425
7446
|
if (orientation(cycles[i], frame2, context) !== expected)
|
|
7426
7447
|
throw new GeographicSeamError("topology", "Inconsistent nested atlas winding");
|
|
7427
7448
|
if (expected === 1) {
|
|
7428
|
-
const p = { chart, rings: [output2(cycles[i],
|
|
7449
|
+
const p = { chart, rings: [output2(cycles[i], sign2)] };
|
|
7429
7450
|
result.push(p);
|
|
7430
7451
|
groups.set(i, p);
|
|
7431
7452
|
}
|
|
@@ -7435,7 +7456,7 @@ function polygons(arcs, frame2, chart, sign, context) {
|
|
|
7435
7456
|
const immediate = parents[i].filter((j) => depths[j] === depths[i] - 1);
|
|
7436
7457
|
if (immediate.length !== 1 || !groups.has(immediate[0]))
|
|
7437
7458
|
throw new GeographicSeamError("topology", "Unresolved atlas ring hierarchy");
|
|
7438
|
-
groups.get(immediate[0]).rings.push(output2(cycles[i], -
|
|
7459
|
+
groups.get(immediate[0]).rings.push(output2(cycles[i], -sign2));
|
|
7439
7460
|
}
|
|
7440
7461
|
return result;
|
|
7441
7462
|
}
|
|
@@ -7650,9 +7671,9 @@ var GeographicCutAtlas = class {
|
|
|
7650
7671
|
const rings = snapshots.map((r, i) => prepare(r, i, context));
|
|
7651
7672
|
if (!rings.length)
|
|
7652
7673
|
return { sources: [], rings, sign: 1 };
|
|
7653
|
-
const
|
|
7674
|
+
const sign2 = interior(rings[0].membership, context).sign, sources = [];
|
|
7654
7675
|
for (let i = 0; i < rings.length; i++) {
|
|
7655
|
-
const
|
|
7676
|
+
const orientation3 = interior(rings[i].membership, context).sign, reversed = orientation3 !== (i ? -1 : 1), points = originals[i];
|
|
7656
7677
|
if (points.length > 1 && points[0][0] === points[points.length - 1][0] && points[0][1] === points[points.length - 1][1])
|
|
7657
7678
|
points.pop();
|
|
7658
7679
|
for (const edge of mergeEdges(rings[i].edges)) {
|
|
@@ -7664,14 +7685,14 @@ var GeographicCutAtlas = class {
|
|
|
7664
7685
|
});
|
|
7665
7686
|
}
|
|
7666
7687
|
}
|
|
7667
|
-
return { sources, rings, sign };
|
|
7688
|
+
return { sources, rings, sign: sign2 };
|
|
7668
7689
|
}
|
|
7669
7690
|
/** Clip simple original outer+hole rings to every chart. Shared events are computed once. */
|
|
7670
7691
|
clipPolygon(inputs) {
|
|
7671
|
-
const context = new Context(this.config.options), { sources, rings, sign } = this.sources(inputs, context);
|
|
7692
|
+
const context = new Context(this.config.options), { sources, rings, sign: sign2 } = this.sources(inputs, context);
|
|
7672
7693
|
if (!rings.length)
|
|
7673
7694
|
return [];
|
|
7674
|
-
return this.clip(sources, context, (n) => filled(rings, position(n), context),
|
|
7695
|
+
return this.clip(sources, context, (n) => filled(rings, position(n), context), sign2);
|
|
7675
7696
|
}
|
|
7676
7697
|
clipPolyline(input, options = {}) {
|
|
7677
7698
|
const context = new Context(this.config.options), points = context.read(input), turns = options.longitudeTurns ? Array.from(options.longitudeTurns) : new Array(Math.max(0, points.length - 1)).fill(0);
|
|
@@ -7705,7 +7726,7 @@ var GeographicCutAtlas = class {
|
|
|
7705
7726
|
}
|
|
7706
7727
|
return this.clip(sources, context);
|
|
7707
7728
|
}
|
|
7708
|
-
clip(sources, context, contains2,
|
|
7729
|
+
clip(sources, context, contains2, sign2 = 1) {
|
|
7709
7730
|
const registry = /* @__PURE__ */ new Map(), events = new Map(this.boundaries.map((c) => [c.id, /* @__PURE__ */ new Set()]));
|
|
7710
7731
|
let serial = 0;
|
|
7711
7732
|
const node = (n, attributes, source = false) => {
|
|
@@ -7730,7 +7751,7 @@ var GeographicCutAtlas = class {
|
|
|
7730
7751
|
registry.set(k, p);
|
|
7731
7752
|
return p;
|
|
7732
7753
|
};
|
|
7733
|
-
const
|
|
7754
|
+
const on2 = (n, b) => {
|
|
7734
7755
|
n.cuts.add(b.id);
|
|
7735
7756
|
events.get(b.id).add(n);
|
|
7736
7757
|
};
|
|
@@ -7750,8 +7771,8 @@ var GeographicCutAtlas = class {
|
|
|
7750
7771
|
if (!relevant([this.boundaries[i].id, this.boundaries[j].id], n))
|
|
7751
7772
|
continue;
|
|
7752
7773
|
const v = node(n, this.attributes);
|
|
7753
|
-
|
|
7754
|
-
|
|
7774
|
+
on2(v, this.boundaries[i]);
|
|
7775
|
+
on2(v, this.boundaries[j]);
|
|
7755
7776
|
}
|
|
7756
7777
|
}
|
|
7757
7778
|
const sourceArcs = [];
|
|
@@ -7767,8 +7788,8 @@ var GeographicCutAtlas = class {
|
|
|
7767
7788
|
const hit = roots(curve, b, context);
|
|
7768
7789
|
if (hit.coincident) {
|
|
7769
7790
|
coincident.add(b.id);
|
|
7770
|
-
|
|
7771
|
-
|
|
7791
|
+
on2(endpoints[0], b);
|
|
7792
|
+
on2(endpoints[1], b);
|
|
7772
7793
|
continue;
|
|
7773
7794
|
}
|
|
7774
7795
|
for (const t of hit.fractions) {
|
|
@@ -7780,11 +7801,11 @@ var GeographicCutAtlas = class {
|
|
|
7780
7801
|
v = node(n, p.slice(2), true);
|
|
7781
7802
|
at.set(t, v);
|
|
7782
7803
|
}
|
|
7783
|
-
|
|
7804
|
+
on2(v, b);
|
|
7784
7805
|
}
|
|
7785
7806
|
for (const v of endpoints)
|
|
7786
7807
|
if (value(b, v.n) === 0)
|
|
7787
|
-
|
|
7808
|
+
on2(v, b);
|
|
7788
7809
|
}
|
|
7789
7810
|
if (!contains2 && Math.hypot(...endpoints[0].n.map((x, i) => x - endpoints[1].n[i])) === 0 && curve.speed > ANGULAR) {
|
|
7790
7811
|
const steps = Math.max(4, Math.ceil(curve.speed / (Math.PI / 2)));
|
|
@@ -7830,7 +7851,7 @@ var GeographicCutAtlas = class {
|
|
|
7830
7851
|
if (Array.from(events.get(b.id)).some((v2) => Math.hypot(...v2.n.map((x, j) => x - n[j])) < ANGULAR))
|
|
7831
7852
|
continue;
|
|
7832
7853
|
const v = node(n, this.attributes);
|
|
7833
|
-
|
|
7854
|
+
on2(v, b);
|
|
7834
7855
|
}
|
|
7835
7856
|
const accepts = (cell, n, known) => {
|
|
7836
7857
|
const values = cell.cuts.filter((r) => !(known == null ? void 0 : known.has(r.circle.id))).map((r) => {
|
|
@@ -7926,7 +7947,7 @@ var GeographicCutAtlas = class {
|
|
|
7926
7947
|
arcs.push(arc);
|
|
7927
7948
|
}
|
|
7928
7949
|
}
|
|
7929
|
-
result.push(...polygons(arcs, cell, cell.id,
|
|
7950
|
+
result.push(...polygons(arcs, cell, cell.id, sign2, context));
|
|
7930
7951
|
}
|
|
7931
7952
|
return result;
|
|
7932
7953
|
}
|
|
@@ -8278,7 +8299,7 @@ var EllipsoidGeodesicExact = class {
|
|
|
8278
8299
|
c1 /= sigmaNorm;
|
|
8279
8300
|
const sig1 = Math.atan2(s1, c1);
|
|
8280
8301
|
const k2 = ca0 * ca0 * ep2, I = ellipticIntegrals(k2, ep2), dn1 = Math.sqrt(1 + k2 * s1 * s1);
|
|
8281
|
-
const
|
|
8302
|
+
const sign2 = sa0 < 0 || Object.is(sa0, -0) ? -1 : 1;
|
|
8282
8303
|
const includeArea = Boolean(options.area);
|
|
8283
8304
|
const unroll = Boolean(options.unrollLongitude), azi1 = angleMath.AngNormalize(azimuth);
|
|
8284
8305
|
const distanceLimit = b * I.E(sig1, 4 * Math.PI);
|
|
@@ -8286,13 +8307,13 @@ var EllipsoidGeodesicExact = class {
|
|
|
8286
8307
|
const phase = arcDegrees === void 0 ? { s: Math.sin(delta), c: Math.cos(delta) } : angleMath.sincosd(arcDegrees);
|
|
8287
8308
|
const s2 = s1 * phase.c + c1 * phase.s, c2 = c1 * phase.c - s1 * phase.s;
|
|
8288
8309
|
const dn2 = Math.sqrt(1 + k2 * s2 * s2), J = I.J(sig1, delta);
|
|
8289
|
-
const chi2 = Math.atan2(
|
|
8310
|
+
const chi2 = Math.atan2(sign2 * sa0 * s2, f1 * dn2 * c2), signedChi1 = Math.atan2(sign2 * sa0 * s1, f1 * dn1 * c1);
|
|
8290
8311
|
const t = k2 * (s2 - s1) * (s2 + s1) / (dn1 + dn2);
|
|
8291
8312
|
const turns = Math.trunc(arcDegrees === void 0 ? delta / Math.PI : arcDegrees / 180), remainder = arcDegrees === void 0 ? delta - turns * Math.PI : arcDegrees - turns * 180;
|
|
8292
8313
|
const parity = Math.abs(turns % 2) === 1 ? -1 : 1;
|
|
8293
8314
|
const sr = phase.s * parity;
|
|
8294
8315
|
const endS = s2 * parity, endC = c2 * parity;
|
|
8295
|
-
const chi = sa0 === 0 ? Math.round(
|
|
8316
|
+
const chi = sa0 === 0 ? Math.round(sign2 * (delta - (Math.atan2(s2, c2) - Math.atan2(s1, c1)) + (chi2 - signedChi1)) / Math.PI) * Math.PI : sign2 * (turns * Math.PI + (remainder === 0 ? 0 : Math.atan2(sign2 * sa0 * f1 * (dn1 * sr - t * s1 * endC), f1 * f1 * dn1 * dn2 * c1 * endC + sa0 * sa0 * s1 * endS)));
|
|
8296
8317
|
const longitude = (unroll ? lon : angleMath.AngNormalize(lon)) + (chi - e2 / f1 * sa0 * I.H(sig1, delta)) / DEG4;
|
|
8297
8318
|
const cosine = phase.c;
|
|
8298
8319
|
return {
|
|
@@ -8593,8 +8614,8 @@ function parseAngle(text, axis = "angle") {
|
|
|
8593
8614
|
const degrees2 = Number(parts[2]), minutes = Number(parts[3] ?? 0), seconds = Number(parts[4] ?? 0);
|
|
8594
8615
|
if (minutes >= 60 || seconds >= 60 || parts[3] !== void 0 && !Number.isInteger(degrees2) || parts[4] !== void 0 && !Number.isInteger(minutes))
|
|
8595
8616
|
throw new RangeError("Invalid DMS components");
|
|
8596
|
-
const
|
|
8597
|
-
const result =
|
|
8617
|
+
const sign2 = parts[1] === "-" || /[SW]/.test(hemisphere) ? -1 : 1;
|
|
8618
|
+
const result = sign2 * (degrees2 + minutes / 60 + seconds / 3600);
|
|
8598
8619
|
validate(result, axis);
|
|
8599
8620
|
return result;
|
|
8600
8621
|
}
|
|
@@ -9643,8 +9664,8 @@ function sphericalExtremum(vector2, parameters, domain, maximize = true) {
|
|
|
9643
9664
|
length = 1;
|
|
9644
9665
|
}
|
|
9645
9666
|
if (length > 1e-14) {
|
|
9646
|
-
for (const
|
|
9647
|
-
const position2 = axis.map((value3, index) => value3 * limit +
|
|
9667
|
+
for (const sign2 of [-1, 1]) {
|
|
9668
|
+
const position2 = axis.map((value3, index) => value3 * limit + sign2 * tangent[index] * Math.sin(domain.distance) / length);
|
|
9648
9669
|
consider(Math.atan2(position2[1], position2[0]), Math.atan2(position2[2], Math.hypot(position2[0], position2[1])));
|
|
9649
9670
|
}
|
|
9650
9671
|
}
|
|
@@ -9845,10 +9866,10 @@ function forward3(state, p) {
|
|
|
9845
9866
|
return p;
|
|
9846
9867
|
}
|
|
9847
9868
|
if (state.sphere && Math.abs(state.coslat0) <= EPSLN) {
|
|
9848
|
-
const
|
|
9849
|
-
const radius = 2 * state.a * state.k0 * Math.tan(Math.PI / 4 -
|
|
9869
|
+
const sign2 = state.lat0 > 0 ? 1 : -1;
|
|
9870
|
+
const radius = 2 * state.a * state.k0 * Math.tan(Math.PI / 4 - sign2 * lat / 2);
|
|
9850
9871
|
p.x = state.x0 + radius * Math.sin(dlon);
|
|
9851
|
-
p.y = state.y0 -
|
|
9872
|
+
p.y = state.y0 - sign2 * radius * Math.cos(dlon);
|
|
9852
9873
|
return p;
|
|
9853
9874
|
}
|
|
9854
9875
|
if (state.sphere) {
|
|
@@ -9989,7 +10010,7 @@ var prepared = /* @__PURE__ */ new Map();
|
|
|
9989
10010
|
function projection(zone, north) {
|
|
9990
10011
|
if (!Number.isInteger(zone) || zone < 0 || zone > 60 || typeof north !== "boolean")
|
|
9991
10012
|
throw new RangeError("Invalid UTM/UPS zone or hemisphere");
|
|
9992
|
-
const
|
|
10013
|
+
const key3 = 2 * zone + Number(north), cached = prepared.get(key3);
|
|
9993
10014
|
if (cached)
|
|
9994
10015
|
return cached;
|
|
9995
10016
|
const parameters = zone ? { zone: String(zone), ...north ? {} : { south: void 0 } } : {
|
|
@@ -10003,7 +10024,7 @@ function projection(zone, north) {
|
|
|
10003
10024
|
eccentricitySquared: F * (2 - F),
|
|
10004
10025
|
parameters
|
|
10005
10026
|
});
|
|
10006
|
-
prepared.set(
|
|
10027
|
+
prepared.set(key3, result);
|
|
10007
10028
|
return result;
|
|
10008
10029
|
}
|
|
10009
10030
|
function projectGrid(latitude, longitude, options = {}) {
|
|
@@ -10282,8 +10303,8 @@ function subdivideGeographicCutRing(inputs, ring, options) {
|
|
|
10282
10303
|
const s = descriptor.source, p = points[s.ringIndex];
|
|
10283
10304
|
if (!Number.isInteger(s.ringIndex) || !p || !Number.isInteger(s.edgeIndex) || s.edgeIndex < 0 || s.edgeIndex >= p.length || ![s.startFraction, s.endFraction, s.longitudeShift].every(Number.isFinite) || Math.min(s.startFraction, s.endFraction) < 0 || Math.max(s.startFraction, s.endFraction) > 1 || !Number.isSafeInteger(s.longitudeShift / 360))
|
|
10284
10305
|
throw new GeographicSeamError("input", "Invalid cut source interval");
|
|
10285
|
-
const
|
|
10286
|
-
let path = sources.get(
|
|
10306
|
+
const key3 = s.ringIndex + ":" + s.edgeIndex;
|
|
10307
|
+
let path = sources.get(key3);
|
|
10287
10308
|
if (!path) {
|
|
10288
10309
|
const first = p[s.edgeIndex], last = p[(s.edgeIndex + 1) % p.length], edgeTurns = ((_a = turns[s.ringIndex]) == null ? void 0 : _a[s.edgeIndex]) ?? 0;
|
|
10289
10310
|
if (settings.edgeModel === "geodesic")
|
|
@@ -10297,7 +10318,7 @@ function subdivideGeographicCutRing(inputs, ring, options) {
|
|
|
10297
10318
|
sample: edge.sample
|
|
10298
10319
|
};
|
|
10299
10320
|
}
|
|
10300
|
-
sources.set(
|
|
10321
|
+
sources.set(key3, path);
|
|
10301
10322
|
}
|
|
10302
10323
|
const curve = path;
|
|
10303
10324
|
return {
|
|
@@ -10704,19 +10725,19 @@ function validateBatch(positions, output2) {
|
|
|
10704
10725
|
}
|
|
10705
10726
|
const count = positions.length / 2;
|
|
10706
10727
|
const buffers = [positions];
|
|
10707
|
-
for (const [
|
|
10728
|
+
for (const [key3, size] of [
|
|
10708
10729
|
["heights", 1],
|
|
10709
10730
|
["statuses", 1],
|
|
10710
10731
|
["gradients", 2],
|
|
10711
10732
|
["normals", 3],
|
|
10712
10733
|
["gradientStatuses", 1]
|
|
10713
10734
|
]) {
|
|
10714
|
-
const buffer = output2[
|
|
10715
|
-
if (buffer === void 0 &&
|
|
10735
|
+
const buffer = output2[key3];
|
|
10736
|
+
if (buffer === void 0 && key3 !== "heights" && key3 !== "statuses")
|
|
10716
10737
|
continue;
|
|
10717
|
-
const byte =
|
|
10738
|
+
const byte = key3 === "statuses" || key3 === "gradientStatuses";
|
|
10718
10739
|
if ((byte ? !(buffer instanceof Uint8Array) : !isTerrainArray(buffer)) || buffer.length < count * size) {
|
|
10719
|
-
throw new Error(`Terrain batch ${
|
|
10740
|
+
throw new Error(`Terrain batch ${key3} has an invalid type or insufficient length`);
|
|
10720
10741
|
}
|
|
10721
10742
|
for (const other of buffers) {
|
|
10722
10743
|
if (buffer.buffer === other.buffer && buffer.byteOffset < other.byteOffset + other.byteLength && other.byteOffset < buffer.byteOffset + buffer.byteLength) {
|
|
@@ -10751,9 +10772,9 @@ function createTerrainSkirt(mesh, options) {
|
|
|
10751
10772
|
if (!Number.isFinite(area) || area <= 0)
|
|
10752
10773
|
throw new Error("Terrain skirt requires upward nondegenerate XY triangles");
|
|
10753
10774
|
for (let j = 0; j < 3; j++) {
|
|
10754
|
-
const u = ids[j], v = ids[(j + 1) % 3],
|
|
10775
|
+
const u = ids[j], v = ids[(j + 1) % 3], key3 = edgeKey(u, v), prior = boundary.get(key3);
|
|
10755
10776
|
if (!prior)
|
|
10756
|
-
boundary.set(
|
|
10777
|
+
boundary.set(key3, { a: u, b: v, count: 1 });
|
|
10757
10778
|
else {
|
|
10758
10779
|
if (prior.count !== 1 || prior.a !== v || prior.b !== u)
|
|
10759
10780
|
throw new Error("Terrain skirt mesh has nonmanifold or inconsistent edges");
|
|
@@ -10766,10 +10787,10 @@ function createTerrainSkirt(mesh, options) {
|
|
|
10766
10787
|
selected = [];
|
|
10767
10788
|
const used = /* @__PURE__ */ new Set();
|
|
10768
10789
|
for (let i = 0; i < edges.length; i += 2) {
|
|
10769
|
-
const
|
|
10770
|
-
if (!edge || edge.count !== 1 || used.has(
|
|
10790
|
+
const key3 = edgeKey(edges[i], edges[i + 1]), edge = boundary.get(key3);
|
|
10791
|
+
if (!edge || edge.count !== 1 || used.has(key3))
|
|
10771
10792
|
throw new Error("Terrain skirt selection must contain unique boundary edges");
|
|
10772
|
-
used.add(
|
|
10793
|
+
used.add(key3);
|
|
10773
10794
|
selected.push(edge);
|
|
10774
10795
|
}
|
|
10775
10796
|
} else
|
|
@@ -11023,10 +11044,10 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
11023
11044
|
throw new Error("Terrain requires unique matrix identifiers");
|
|
11024
11045
|
for (const tile of props.tiles) {
|
|
11025
11046
|
const matrix = this.validateTileId(tile);
|
|
11026
|
-
const
|
|
11027
|
-
if (this.tiles.has(
|
|
11047
|
+
const key3 = tileKey(tile.matrixId, tile.column, tile.row);
|
|
11048
|
+
if (this.tiles.has(key3))
|
|
11028
11049
|
throw new Error("Duplicate terrain tile");
|
|
11029
|
-
this.tiles.set(
|
|
11050
|
+
this.tiles.set(key3, copyTileData(tile, matrix));
|
|
11030
11051
|
}
|
|
11031
11052
|
for (const tile of props.tiles)
|
|
11032
11053
|
this.buildHalo(this.getMatrix(tile.matrixId), tile.column, tile.row, props.diagonal);
|
|
@@ -11055,10 +11076,10 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
11055
11076
|
const touched = /* @__PURE__ */ new Map();
|
|
11056
11077
|
for (const tile of [...update.tiles ?? [], ...update.remove ?? []]) {
|
|
11057
11078
|
this.validateTileId(tile);
|
|
11058
|
-
const
|
|
11059
|
-
if (touched.has(
|
|
11079
|
+
const key3 = tileKey(tile.matrixId, tile.column, tile.row);
|
|
11080
|
+
if (touched.has(key3))
|
|
11060
11081
|
throw new Error("Terrain update contains duplicate or conflicting tile identifiers");
|
|
11061
|
-
touched.set(
|
|
11082
|
+
touched.set(key3, tile);
|
|
11062
11083
|
}
|
|
11063
11084
|
for (const tile of update.tiles ?? [])
|
|
11064
11085
|
replacements.set(tileKey(tile.matrixId, tile.column, tile.row), copyTileData(tile, this.getMatrix(tile.matrixId)));
|
|
@@ -11069,18 +11090,18 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
11069
11090
|
diagonal: this.diagonal,
|
|
11070
11091
|
heightReference: this.heightReference
|
|
11071
11092
|
});
|
|
11072
|
-
for (const [
|
|
11073
|
-
next.tiles.set(
|
|
11074
|
-
for (const [
|
|
11075
|
-
next.halos.set(
|
|
11093
|
+
for (const [key3, tile] of this.tiles)
|
|
11094
|
+
next.tiles.set(key3, tile);
|
|
11095
|
+
for (const [key3, halo] of this.halos)
|
|
11096
|
+
next.halos.set(key3, halo);
|
|
11076
11097
|
const affected = /* @__PURE__ */ new Map();
|
|
11077
|
-
for (const [
|
|
11078
|
-
if (replacements.has(
|
|
11079
|
-
next.tiles.set(
|
|
11098
|
+
for (const [key3, tile] of touched) {
|
|
11099
|
+
if (replacements.has(key3))
|
|
11100
|
+
next.tiles.set(key3, replacements.get(key3));
|
|
11080
11101
|
else {
|
|
11081
|
-
if (!next.tiles.delete(
|
|
11102
|
+
if (!next.tiles.delete(key3))
|
|
11082
11103
|
continue;
|
|
11083
|
-
next.halos.delete(
|
|
11104
|
+
next.halos.delete(key3);
|
|
11084
11105
|
}
|
|
11085
11106
|
for (let row = tile.row - 1; row <= tile.row + 1; row++)
|
|
11086
11107
|
for (let column = tile.column - 1; column <= tile.column + 1; column++) {
|
|
@@ -11093,11 +11114,11 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
11093
11114
|
}
|
|
11094
11115
|
}
|
|
11095
11116
|
const changes = [];
|
|
11096
|
-
for (const [
|
|
11097
|
-
if (next.tiles.has(
|
|
11117
|
+
for (const [key3, tile] of affected) {
|
|
11118
|
+
if (next.tiles.has(key3)) {
|
|
11098
11119
|
next.buildHalo(next.getMatrix(tile.matrixId), tile.column, tile.row, this.diagonal);
|
|
11099
11120
|
changes.push({ ...tile, resident: true });
|
|
11100
|
-
} else if (this.tiles.has(
|
|
11121
|
+
} else if (this.tiles.has(key3))
|
|
11101
11122
|
changes.push(tile);
|
|
11102
11123
|
}
|
|
11103
11124
|
next.changes = freezeChanges(changes);
|
|
@@ -11820,10 +11841,10 @@ function buildTopology(indices, validity) {
|
|
|
11820
11841
|
if (!validity[triangle])
|
|
11821
11842
|
continue;
|
|
11822
11843
|
const a = indices[i], b = indices[triangle * 3 + (i % 3 + 1) % 3];
|
|
11823
|
-
const
|
|
11824
|
-
const opposite = edges.get(
|
|
11844
|
+
const key3 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
11845
|
+
const opposite = edges.get(key3);
|
|
11825
11846
|
if (opposite === void 0)
|
|
11826
|
-
edges.set(
|
|
11847
|
+
edges.set(key3, i);
|
|
11827
11848
|
else {
|
|
11828
11849
|
if (halfedges[opposite] !== -1)
|
|
11829
11850
|
throw new Error("Nonmanifold terrain edge");
|
|
@@ -11993,7 +12014,8 @@ function measureTerrainMeshError(field, mesh, options = {}) {
|
|
|
11993
12014
|
const x = mesh.gridCoordinates[i * 2] + shift2, y = mesh.gridCoordinates[i * 2 + 1] + shift2;
|
|
11994
12015
|
for (let axis = 0; axis < 2; axis++) {
|
|
11995
12016
|
const expected = field.origin[axis] - mesh.origin[axis] + x * field.columnStep[axis] + y * field.rowStep[axis];
|
|
11996
|
-
|
|
12017
|
+
const tolerance = Math.min(16 * Number.EPSILON * (Math.abs(field.origin[axis] - mesh.origin[axis]) + Math.abs(x * field.columnStep[axis]) + Math.abs(y * field.rowStep[axis])), 1e-9 * Math.max(Math.abs(field.columnStep[axis]), Math.abs(field.rowStep[axis])));
|
|
12018
|
+
if (!Number.isFinite(expected) || Math.abs(mesh.positions[i * 3 + axis] - expected) > tolerance)
|
|
11997
12019
|
throw new Error("Terrain mesh XY does not match the source grid frame");
|
|
11998
12020
|
}
|
|
11999
12021
|
}
|
|
@@ -12028,9 +12050,9 @@ function measureTerrainMeshError(field, mesh, options = {}) {
|
|
|
12028
12050
|
throw new Error("Terrain mesh sample-test budget exceeded");
|
|
12029
12051
|
const dx = baseX + (column + shift2) * columnX + (row + shift2) * rowX - px;
|
|
12030
12052
|
const dy = baseY + (column + shift2) * columnY + (row + shift2) * rowY - py;
|
|
12031
|
-
const
|
|
12032
|
-
const nu = (dx * vy - dy * vx) *
|
|
12033
|
-
const nv = (ux * dy - uy * dx) *
|
|
12053
|
+
const sign2 = Math.sign(xyArea), area = Math.abs(xyArea);
|
|
12054
|
+
const nu = (dx * vy - dy * vx) * sign2;
|
|
12055
|
+
const nv = (ux * dy - uy * dx) * sign2;
|
|
12034
12056
|
const tolerance = 16 * Number.EPSILON * (Math.abs(dx * vy) + Math.abs(dy * vx) + Math.abs(ux * dy) + Math.abs(uy * dx) + area);
|
|
12035
12057
|
if (nu < -tolerance || nv < -tolerance || nu + nv > area + tolerance)
|
|
12036
12058
|
continue;
|
|
@@ -12739,8 +12761,8 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
12739
12761
|
const exact2 = height(a) === level ? a : height(b) === level ? b : void 0;
|
|
12740
12762
|
return exact2 === void 0 ? { a, b, key: `e${a}/${b}` } : { a: exact2, b: exact2, key: `v${exact2}` };
|
|
12741
12763
|
};
|
|
12742
|
-
const vertex = ({ a, b, key:
|
|
12743
|
-
const existing = vertices.get(
|
|
12764
|
+
const vertex = ({ a, b, key: key3 }) => {
|
|
12765
|
+
const existing = vertices.get(key3);
|
|
12744
12766
|
if (existing !== void 0)
|
|
12745
12767
|
return existing;
|
|
12746
12768
|
if (positions.length / 3 >= maxVertices)
|
|
@@ -12767,7 +12789,7 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
12767
12789
|
const index = positions.length / 3;
|
|
12768
12790
|
positions.push(px, py, pz);
|
|
12769
12791
|
coordinates.push(x, y);
|
|
12770
|
-
vertices.set(
|
|
12792
|
+
vertices.set(key3, index);
|
|
12771
12793
|
return index;
|
|
12772
12794
|
};
|
|
12773
12795
|
const triangle = (a, b, c) => {
|
|
@@ -12784,14 +12806,14 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
12784
12806
|
if (hits.length !== 2 || hits[0].key === hits[1].key)
|
|
12785
12807
|
return;
|
|
12786
12808
|
const va = vertex(hits[0]), vb = vertex(hits[1]);
|
|
12787
|
-
const
|
|
12788
|
-
if (edges.has(
|
|
12809
|
+
const key3 = va < vb ? `${va}/${vb}` : `${vb}/${va}`;
|
|
12810
|
+
if (edges.has(key3))
|
|
12789
12811
|
return;
|
|
12790
12812
|
if (segments.length / 2 >= maxSegments)
|
|
12791
12813
|
throw new Error("Terrain contour segment capacity exceeded");
|
|
12792
12814
|
if (positions[3 * va] === positions[3 * vb] && positions[3 * va + 1] === positions[3 * vb + 1])
|
|
12793
12815
|
throw new Error("Terrain contour segment collapses; use a local origin");
|
|
12794
|
-
edges.add(
|
|
12816
|
+
edges.add(key3);
|
|
12795
12817
|
segments.push(va, vb);
|
|
12796
12818
|
levelIndices.push(levelIndex);
|
|
12797
12819
|
};
|
|
@@ -12878,10 +12900,10 @@ function stitchTerrainContours(contours, options = {}) {
|
|
|
12878
12900
|
validateContourVertex(contours, b, level, assignments);
|
|
12879
12901
|
if (a === b || contours.positions[3 * a] === contours.positions[3 * b] && contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
|
|
12880
12902
|
throw new Error("Degenerate terrain contour segment");
|
|
12881
|
-
const
|
|
12882
|
-
if (unique.has(
|
|
12903
|
+
const key3 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
12904
|
+
if (unique.has(key3))
|
|
12883
12905
|
throw new Error("Duplicate terrain contour segment");
|
|
12884
|
-
unique.add(
|
|
12906
|
+
unique.add(key3);
|
|
12885
12907
|
degrees2[a]++;
|
|
12886
12908
|
degrees2[b]++;
|
|
12887
12909
|
}
|
|
@@ -13069,10 +13091,10 @@ function diagnoseTerrainContourBoundaries(contours, options) {
|
|
|
13069
13091
|
validateContourVertex(contours, b, level, assignments);
|
|
13070
13092
|
if (a === b || contours.positions[3 * a] === contours.positions[3 * b] && contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
|
|
13071
13093
|
throw new Error("Degenerate terrain contour segment");
|
|
13072
|
-
const
|
|
13073
|
-
if (seen.has(
|
|
13094
|
+
const key3 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
13095
|
+
if (seen.has(key3))
|
|
13074
13096
|
throw new Error("Duplicate terrain contour segment");
|
|
13075
|
-
seen.add(
|
|
13097
|
+
seen.add(key3);
|
|
13076
13098
|
degrees2[a]++;
|
|
13077
13099
|
degrees2[b]++;
|
|
13078
13100
|
}
|
|
@@ -13208,6 +13230,10 @@ function simplifyTerrainContourPaths(paths, options) {
|
|
|
13208
13230
|
uses[vertex]++;
|
|
13209
13231
|
}
|
|
13210
13232
|
}
|
|
13233
|
+
const protectedIds = new Set(options.protectedVertexIndices);
|
|
13234
|
+
for (const id of protectedIds)
|
|
13235
|
+
if (id >= count)
|
|
13236
|
+
throw new Error("Invalid protected contour vertex");
|
|
13211
13237
|
const keep = new Uint8Array(paths.indices.length);
|
|
13212
13238
|
let distanceTests = 0, maxDeviation = 0;
|
|
13213
13239
|
for (let p = 0; p < pathCount; p++) {
|
|
@@ -13218,7 +13244,7 @@ function simplifyTerrainContourPaths(paths, options) {
|
|
|
13218
13244
|
keep[start + Math.floor(2 * (end - start) / 3)] = 1;
|
|
13219
13245
|
}
|
|
13220
13246
|
for (let i = start; i <= end; i++)
|
|
13221
|
-
if (uses[paths.indices[i]] > 1)
|
|
13247
|
+
if (uses[paths.indices[i]] > 1 || protectedIds.has(paths.indices[i]))
|
|
13222
13248
|
keep[i] = 1;
|
|
13223
13249
|
const stack = [];
|
|
13224
13250
|
let previous = start;
|
|
@@ -13439,9 +13465,9 @@ function compareTerrainSlopes(a, ad, b, bd) {
|
|
|
13439
13465
|
const bytes = new DataView(new ArrayBuffer(8));
|
|
13440
13466
|
const parts = (value3) => {
|
|
13441
13467
|
bytes.setFloat64(0, Math.abs(value3));
|
|
13442
|
-
const
|
|
13443
|
-
const exponent = Number(
|
|
13444
|
-
const fraction =
|
|
13468
|
+
const bits2 = bytes.getBigUint64(0);
|
|
13469
|
+
const exponent = Number(bits2 >> 52n & 0x7ffn);
|
|
13470
|
+
const fraction = bits2 & 0xfffffffffffffn;
|
|
13445
13471
|
return exponent ? [fraction | 0x10000000000000n, exponent - 1075] : [fraction, -1074];
|
|
13446
13472
|
};
|
|
13447
13473
|
const [am, ae] = parts(a), [bdm, bde] = parts(bd);
|
|
@@ -13558,10 +13584,10 @@ function reconcileTerrainVertexTiles(tiles, options) {
|
|
|
13558
13584
|
const shared2 = /* @__PURE__ */ new Map();
|
|
13559
13585
|
const result = [];
|
|
13560
13586
|
for (const tile of sorted) {
|
|
13561
|
-
const
|
|
13562
|
-
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row) || seen.has(
|
|
13587
|
+
const key3 = `${tile.column},${tile.row}`;
|
|
13588
|
+
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row) || seen.has(key3))
|
|
13563
13589
|
throw new Error("Invalid or duplicate vertex tile address");
|
|
13564
|
-
seen.add(
|
|
13590
|
+
seen.add(key3);
|
|
13565
13591
|
const x = tile.column * (width - 1), y = tile.row * (height - 1);
|
|
13566
13592
|
if (![x, y, x + width - 1, y + height - 1].every(Number.isSafeInteger))
|
|
13567
13593
|
throw new Error("Vertex tile lattice overflow");
|
|
@@ -13712,20 +13738,20 @@ function getTerrainVertexHaloAffectedTiles(resident, changed, options) {
|
|
|
13712
13738
|
if (!Number.isSafeInteger(limit) || limit < 0 || resident.length > limit || changed.length > limit || !Number.isSafeInteger(options.width) || options.width < 2 || !Number.isSafeInteger(options.height) || options.height < 2)
|
|
13713
13739
|
throw new Error("Invalid vertex halo tile capacity");
|
|
13714
13740
|
const addresses = /* @__PURE__ */ new Map();
|
|
13715
|
-
const
|
|
13741
|
+
const key3 = (tile) => {
|
|
13716
13742
|
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row))
|
|
13717
13743
|
throw new Error("Invalid vertex tile address");
|
|
13718
13744
|
return `${tile.column},${tile.row}`;
|
|
13719
13745
|
};
|
|
13720
13746
|
for (const tile of resident) {
|
|
13721
|
-
const id =
|
|
13747
|
+
const id = key3(tile);
|
|
13722
13748
|
if (addresses.has(id))
|
|
13723
13749
|
throw new Error("Duplicate resident vertex tile address");
|
|
13724
13750
|
addresses.set(id, { column: tile.column, row: tile.row });
|
|
13725
13751
|
}
|
|
13726
13752
|
const affected = /* @__PURE__ */ new Map();
|
|
13727
13753
|
for (const tile of changed) {
|
|
13728
|
-
|
|
13754
|
+
key3(tile);
|
|
13729
13755
|
const rx = options.width === 2 ? 2 : 1, ry = options.height === 2 ? 2 : 1;
|
|
13730
13756
|
for (let x = -rx; x <= rx; x++)
|
|
13731
13757
|
for (let y = -ry; y <= ry; y++) {
|
|
@@ -13752,26 +13778,26 @@ function updateTerrainVertexTileHalos(previous, resident, changed, options) {
|
|
|
13752
13778
|
const equalPair = (a, b) => a[0] === b[0] && a[1] === b[1];
|
|
13753
13779
|
if (prior.width !== options.width || prior.height !== options.height || !equalPair(prior.origin ?? [0, 0], options.origin ?? [0, 0]) || !equalPair(prior.columnStep ?? [1, 0], options.columnStep ?? [1, 0]) || !equalPair(prior.rowStep ?? [0, 1], options.rowStep ?? [0, 1]) || (prior.heightReference ?? "unknown") !== (options.heightReference ?? "unknown") || (prior.maxHeightDifference ?? 0) !== (options.maxHeightDifference ?? 0))
|
|
13754
13780
|
throw new Error("Vertex tile options changed; rebuild the full snapshot");
|
|
13755
|
-
const
|
|
13781
|
+
const key3 = (t) => `${t.column},${t.row}`;
|
|
13756
13782
|
const affected = getTerrainVertexHaloAffectedTiles(resident, changed, options);
|
|
13757
13783
|
getTerrainVertexHaloAffectedTiles(previous, [], options);
|
|
13758
|
-
const previousMap = new Map(previous.map((tile) => [
|
|
13759
|
-
const currentKeys = new Set(resident.map(
|
|
13760
|
-
const changedKeys = new Set(changed.map(
|
|
13784
|
+
const previousMap = new Map(previous.map((tile) => [key3(tile), tile]));
|
|
13785
|
+
const currentKeys = new Set(resident.map(key3));
|
|
13786
|
+
const changedKeys = new Set(changed.map(key3));
|
|
13761
13787
|
for (const tile of resident) {
|
|
13762
|
-
if (!previousMap.has(
|
|
13788
|
+
if (!previousMap.has(key3(tile)) && !changedKeys.has(key3(tile)))
|
|
13763
13789
|
throw new Error("Unreported vertex tile arrival");
|
|
13764
13790
|
}
|
|
13765
13791
|
const removed = [];
|
|
13766
13792
|
for (const tile of previous) {
|
|
13767
|
-
if (!currentKeys.has(
|
|
13768
|
-
if (!changedKeys.has(
|
|
13793
|
+
if (!currentKeys.has(key3(tile))) {
|
|
13794
|
+
if (!changedKeys.has(key3(tile)))
|
|
13769
13795
|
throw new Error("Unreported vertex tile eviction");
|
|
13770
13796
|
removed.push({ column: tile.column, row: tile.row });
|
|
13771
13797
|
}
|
|
13772
13798
|
}
|
|
13773
13799
|
removed.sort((a, b) => a.column - b.column || a.row - b.row);
|
|
13774
|
-
const affectedKeys = new Set(affected.map(
|
|
13800
|
+
const affectedKeys = new Set(affected.map(key3));
|
|
13775
13801
|
const rx = options.width === 2 ? 2 : 1;
|
|
13776
13802
|
const ry = options.height === 2 ? 2 : 1;
|
|
13777
13803
|
const needed = /* @__PURE__ */ new Set();
|
|
@@ -13782,12 +13808,12 @@ function updateTerrainVertexTileHalos(previous, resident, changed, options) {
|
|
|
13782
13808
|
if (Number.isSafeInteger(column) && Number.isSafeInteger(row))
|
|
13783
13809
|
needed.add(`${column},${row}`);
|
|
13784
13810
|
}
|
|
13785
|
-
const source = resident.filter((tile) => needed.has(
|
|
13811
|
+
const source = resident.filter((tile) => needed.has(key3(tile)));
|
|
13786
13812
|
const rebuilt = createTerrainVertexTileHalos(source, options).tiles;
|
|
13787
|
-
const results = new Map(previous.filter((tile) => currentKeys.has(
|
|
13813
|
+
const results = new Map(previous.filter((tile) => currentKeys.has(key3(tile)) && !affectedKeys.has(key3(tile))).map((tile) => [key3(tile), tile]));
|
|
13788
13814
|
for (const tile of rebuilt)
|
|
13789
|
-
if (affectedKeys.has(
|
|
13790
|
-
results.set(
|
|
13815
|
+
if (affectedKeys.has(key3(tile)))
|
|
13816
|
+
results.set(key3(tile), tile);
|
|
13791
13817
|
if (results.size !== resident.length)
|
|
13792
13818
|
throw new Error("Incomplete vertex halo update");
|
|
13793
13819
|
return {
|
|
@@ -13898,9 +13924,9 @@ function stitchTerrainMeshEdges(a, edgeA, b, edgeB, options = {}) {
|
|
|
13898
13924
|
let direction = 0;
|
|
13899
13925
|
for (let i = 0; i < mesh.indices.length; i += 3)
|
|
13900
13926
|
for (let j = 0; j < 3; j++) {
|
|
13901
|
-
const u = mesh.indices[i + j], v = mesh.indices[i + (j + 1) % 3],
|
|
13902
|
-
if (pairs.has(
|
|
13903
|
-
pairs.set(
|
|
13927
|
+
const u = mesh.indices[i + j], v = mesh.indices[i + (j + 1) % 3], key3 = pair(u, v);
|
|
13928
|
+
if (pairs.has(key3)) {
|
|
13929
|
+
pairs.set(key3, pairs.get(key3) + 1);
|
|
13904
13930
|
const nextDirection = Math.sign(mesh.gridCoordinates[2 * v + 1 - axis] - mesh.gridCoordinates[2 * u + 1 - axis]);
|
|
13905
13931
|
if (direction && direction !== nextDirection)
|
|
13906
13932
|
throw new Error("Inconsistent stitching boundary orientation");
|
|
@@ -14139,19 +14165,19 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14139
14165
|
throw new Error("Mixed contour frame overflow");
|
|
14140
14166
|
const onEdge = x === 0 || y === 0 || x === tile.width - 1 || y === tile.height - 1;
|
|
14141
14167
|
const xi = Math.floor(sx), yi = Math.floor(sy);
|
|
14142
|
-
const
|
|
14168
|
+
const key3 = `${level}/${tile.column + xi}/${sx - xi}/${tile.row + yi}/${sy - yi}`;
|
|
14143
14169
|
if (onEdge) {
|
|
14144
14170
|
const rounded = `${level}/${gx}/${gy}`;
|
|
14145
14171
|
const identity2 = roundedBoundary.get(rounded);
|
|
14146
|
-
if (identity2 !== void 0 && identity2 !==
|
|
14172
|
+
if (identity2 !== void 0 && identity2 !== key3)
|
|
14147
14173
|
throw new Error("Mixed contour lattice loses precision");
|
|
14148
|
-
roundedBoundary.set(rounded,
|
|
14174
|
+
roundedBoundary.set(rounded, key3);
|
|
14149
14175
|
}
|
|
14150
|
-
if (onEdge && local.has(
|
|
14176
|
+
if (onEdge && local.has(key3))
|
|
14151
14177
|
throw new Error("Duplicate mixed contour boundary vertex");
|
|
14152
14178
|
if (onEdge)
|
|
14153
|
-
local.add(
|
|
14154
|
-
let id = onEdge ? shared2.get(
|
|
14179
|
+
local.add(key3);
|
|
14180
|
+
let id = onEdge ? shared2.get(key3) : void 0;
|
|
14155
14181
|
if (id !== void 0) {
|
|
14156
14182
|
if (Math.hypot(px - positions[3 * id], py - positions[3 * id + 1]) > tolerance)
|
|
14157
14183
|
throw new Error("Mixed contour boundary positions disagree");
|
|
@@ -14163,7 +14189,7 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14163
14189
|
grid.push(gx, gy);
|
|
14164
14190
|
vertexLevels.push(level);
|
|
14165
14191
|
if (onEdge) {
|
|
14166
|
-
shared2.set(
|
|
14192
|
+
shared2.set(key3, id);
|
|
14167
14193
|
boundary.add(id);
|
|
14168
14194
|
}
|
|
14169
14195
|
}
|
|
@@ -14175,10 +14201,10 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14175
14201
|
const level = data.levelIndices[i], a = vertex(data.segments[2 * i], level), b = vertex(data.segments[2 * i + 1], level);
|
|
14176
14202
|
if (a === b || positions[3 * a] === positions[3 * b] && positions[3 * a + 1] === positions[3 * b + 1])
|
|
14177
14203
|
throw new Error("Degenerate mixed contour segment");
|
|
14178
|
-
const
|
|
14179
|
-
if (localEdges.has(
|
|
14204
|
+
const key3 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
14205
|
+
if (localEdges.has(key3))
|
|
14180
14206
|
throw new Error("Duplicate mixed contour segment");
|
|
14181
|
-
localEdges.add(
|
|
14207
|
+
localEdges.add(key3);
|
|
14182
14208
|
const box = bounds[ti];
|
|
14183
14209
|
const seam = grid[2 * a] === grid[2 * b] && (grid[2 * a] === box[0] || grid[2 * a] === box[2]) || grid[2 * a + 1] === grid[2 * b + 1] && (grid[2 * a + 1] === box[1] || grid[2 * a + 1] === box[3]);
|
|
14184
14210
|
edges.push({ a, b, level, tile: ti, seam });
|
|
@@ -14205,8 +14231,8 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14205
14231
|
}
|
|
14206
14232
|
cuts.sort((u, v) => grid[2 * u + axis] - grid[2 * v + axis]);
|
|
14207
14233
|
for (let i = 1; i < cuts.length; i++) {
|
|
14208
|
-
const u = cuts[i - 1], v = cuts[i],
|
|
14209
|
-
const prior = emitted.get(
|
|
14234
|
+
const u = cuts[i - 1], v = cuts[i], key3 = u < v ? `${u}/${v}` : `${v}/${u}`;
|
|
14235
|
+
const prior = emitted.get(key3);
|
|
14210
14236
|
if (prior !== void 0) {
|
|
14211
14237
|
if (prior === edge.tile)
|
|
14212
14238
|
throw new Error("Overlapping mixed contour segments within tile");
|
|
@@ -14214,7 +14240,7 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14214
14240
|
}
|
|
14215
14241
|
if (levels.length >= limits.maxSegments)
|
|
14216
14242
|
throw new Error("Mixed contour output segment capacity exceeded");
|
|
14217
|
-
emitted.set(
|
|
14243
|
+
emitted.set(key3, edge.tile);
|
|
14218
14244
|
segments.push(u, v);
|
|
14219
14245
|
levels.push(level);
|
|
14220
14246
|
}
|
|
@@ -14229,4 +14255,1493 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
14229
14255
|
heightReference: first.heightReference
|
|
14230
14256
|
};
|
|
14231
14257
|
}
|
|
14258
|
+
|
|
14259
|
+
// dist/terrain/sample-triangle-height.js
|
|
14260
|
+
function sampleTerrainTriangleHeight(field, x, y) {
|
|
14261
|
+
if (Number.isInteger(x) && Number.isInteger(y))
|
|
14262
|
+
return field.getHeight(x, y);
|
|
14263
|
+
const column = Math.min(Math.floor(x), field.width - 2);
|
|
14264
|
+
const row = Math.min(Math.floor(y), field.height - 2);
|
|
14265
|
+
const u = x - column, v = y - row;
|
|
14266
|
+
let a, b, c, d;
|
|
14267
|
+
if (field.diagonal === "00-11") {
|
|
14268
|
+
if (v <= u) {
|
|
14269
|
+
a = 1 - u;
|
|
14270
|
+
b = u - v;
|
|
14271
|
+
c = 0;
|
|
14272
|
+
d = v;
|
|
14273
|
+
} else {
|
|
14274
|
+
a = 1 - v;
|
|
14275
|
+
b = 0;
|
|
14276
|
+
c = v - u;
|
|
14277
|
+
d = u;
|
|
14278
|
+
}
|
|
14279
|
+
} else if (u + v <= 1) {
|
|
14280
|
+
a = 1 - u - v;
|
|
14281
|
+
b = u;
|
|
14282
|
+
c = v;
|
|
14283
|
+
d = 0;
|
|
14284
|
+
} else {
|
|
14285
|
+
a = 0;
|
|
14286
|
+
b = 1 - v;
|
|
14287
|
+
c = 1 - u;
|
|
14288
|
+
d = u + v - 1;
|
|
14289
|
+
}
|
|
14290
|
+
const za = a ? field.getHeight(column, row) : 0;
|
|
14291
|
+
const zb = b ? field.getHeight(column + 1, row) : 0;
|
|
14292
|
+
const zc = c ? field.getHeight(column, row + 1) : 0;
|
|
14293
|
+
const zd = d ? field.getHeight(column + 1, row + 1) : 0;
|
|
14294
|
+
if (za === void 0 || zb === void 0 || zc === void 0 || zd === void 0)
|
|
14295
|
+
return void 0;
|
|
14296
|
+
const height = a * za + b * zb + c * zc + d * zd;
|
|
14297
|
+
if (!Number.isFinite(height))
|
|
14298
|
+
throw new Error("Terrain triangle numeric sampling failure");
|
|
14299
|
+
return height;
|
|
14300
|
+
}
|
|
14301
|
+
|
|
14302
|
+
// dist/terrain/mixed-vertex-halos.js
|
|
14303
|
+
function createTerrainMixedVertexTileHalos(tiles, options = {}) {
|
|
14304
|
+
return buildMixedVertexTileHalos(tiles, options);
|
|
14305
|
+
}
|
|
14306
|
+
function buildMixedVertexTileHalos(tiles, options = {}, targets) {
|
|
14307
|
+
const maxSamples = options.maxSamples ?? 4e6, maxTests = options.maxTileTests ?? 1e7;
|
|
14308
|
+
if (![maxSamples, maxTests].every((v) => Number.isSafeInteger(v) && v >= 0))
|
|
14309
|
+
throw new Error("Invalid mixed halo capacity");
|
|
14310
|
+
let count = 0;
|
|
14311
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
14312
|
+
let frame2;
|
|
14313
|
+
const sources = [...tiles].sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row).map((tile) => {
|
|
14314
|
+
if (![tile.column, tile.row, tile.spacing].every(Number.isSafeInteger) || tile.spacing < 1 || 2 ** Math.round(Math.log2(tile.spacing)) !== tile.spacing)
|
|
14315
|
+
throw new Error("Invalid mixed halo lattice");
|
|
14316
|
+
const key3 = `${tile.spacing}/${tile.column}/${tile.row}`;
|
|
14317
|
+
if (addresses.has(key3))
|
|
14318
|
+
throw new Error("Duplicate mixed halo tile");
|
|
14319
|
+
addresses.add(key3);
|
|
14320
|
+
count += (tile.field.width + 2) * (tile.field.height + 2);
|
|
14321
|
+
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
14322
|
+
throw new Error("Mixed halo sample capacity exceeded");
|
|
14323
|
+
const field = new HeightField(tile.field);
|
|
14324
|
+
if (field.registration !== "vertex")
|
|
14325
|
+
throw new Error("Mixed halos require vertex registration");
|
|
14326
|
+
const column = field.columnStep.map((v) => v / tile.spacing);
|
|
14327
|
+
const row = field.rowStep.map((v) => v / tile.spacing);
|
|
14328
|
+
const origin = field.origin.map((v, axis) => v - tile.column * column[axis] - tile.row * row[axis]);
|
|
14329
|
+
const scale3 = field.origin.map((v, i) => Math.max(1, Math.abs(v), Math.abs(tile.column * column[i]), Math.abs(tile.row * row[i])));
|
|
14330
|
+
if (!origin.every(Number.isFinite))
|
|
14331
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
14332
|
+
if (frame2 && (frame2.reference !== field.heightReference || column.some((v, i) => v !== frame2.column[i]) || row.some((v, i) => v !== frame2.row[i]) || origin.some((v, i) => Math.abs(v - frame2.origin[i]) > Math.min(16 * Number.EPSILON * Math.max(scale3[i], frame2.scale[i]), 1e-9 * Math.max(Math.abs(column[i]), Math.abs(row[i]))))))
|
|
14333
|
+
throw new Error("Mixed halo frames or height references differ");
|
|
14334
|
+
frame2 ?? (frame2 = { origin, column, row, reference: field.heightReference, scale: scale3 });
|
|
14335
|
+
return { ...tile, source: field };
|
|
14336
|
+
});
|
|
14337
|
+
for (const axis of ["column", "row"]) {
|
|
14338
|
+
let min = Infinity, max = -Infinity;
|
|
14339
|
+
for (const tile of sources) {
|
|
14340
|
+
const size = axis === "column" ? tile.source.width : tile.source.height;
|
|
14341
|
+
const low = tile[axis] - tile.spacing, high = tile[axis] + size * tile.spacing;
|
|
14342
|
+
if (![low, high].every(Number.isSafeInteger))
|
|
14343
|
+
throw new Error("Mixed halo lattice overflow");
|
|
14344
|
+
min = Math.min(min, low);
|
|
14345
|
+
max = Math.max(max, high);
|
|
14346
|
+
}
|
|
14347
|
+
if (sources.length && !Number.isSafeInteger(max - min))
|
|
14348
|
+
throw new Error("Mixed halo lattice span overflow");
|
|
14349
|
+
}
|
|
14350
|
+
let tests = 0;
|
|
14351
|
+
return {
|
|
14352
|
+
tiles: sources.filter((tile) => !targets || targets.has(`${tile.spacing}/${tile.column}/${tile.row}`)).map((tile) => {
|
|
14353
|
+
const source = tile.source, width = source.width + 2, height = source.height + 2;
|
|
14354
|
+
const heights = new Float64Array(width * height), validity = new Uint8Array(heights.length), statuses = new Uint8Array(heights.length);
|
|
14355
|
+
for (let y = 0; y < height; y++)
|
|
14356
|
+
for (let x = 0; x < width; x++) {
|
|
14357
|
+
const gx = tile.column + (x - 1) * tile.spacing, gy = tile.row + (y - 1) * tile.spacing;
|
|
14358
|
+
if (![gx, gy].every(Number.isSafeInteger))
|
|
14359
|
+
throw new Error("Mixed halo lattice overflow");
|
|
14360
|
+
for (const candidate of sources) {
|
|
14361
|
+
if (++tests > maxTests)
|
|
14362
|
+
throw new Error("Mixed halo tile-test budget exceeded");
|
|
14363
|
+
const cx = (gx - candidate.column) / candidate.spacing, cy = (gy - candidate.row) / candidate.spacing;
|
|
14364
|
+
const f = candidate.source;
|
|
14365
|
+
if (cx < 0 || cy < 0 || cx > f.width - 1 || cy > f.height - 1)
|
|
14366
|
+
continue;
|
|
14367
|
+
const value3 = sampleTerrainTriangleHeight(f, cx, cy);
|
|
14368
|
+
const i = y * width + x;
|
|
14369
|
+
statuses[i] = value3 === void 0 ? 1 : 2;
|
|
14370
|
+
if (value3 !== void 0) {
|
|
14371
|
+
heights[i] = value3;
|
|
14372
|
+
validity[i] = 1;
|
|
14373
|
+
}
|
|
14374
|
+
break;
|
|
14375
|
+
}
|
|
14376
|
+
}
|
|
14377
|
+
const origin = [
|
|
14378
|
+
source.origin[0] - source.columnStep[0] - source.rowStep[0],
|
|
14379
|
+
source.origin[1] - source.columnStep[1] - source.rowStep[1]
|
|
14380
|
+
];
|
|
14381
|
+
if (!origin.every(Number.isFinite))
|
|
14382
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
14383
|
+
return {
|
|
14384
|
+
column: tile.column,
|
|
14385
|
+
row: tile.row,
|
|
14386
|
+
spacing: tile.spacing,
|
|
14387
|
+
statuses,
|
|
14388
|
+
field: {
|
|
14389
|
+
...tile.field,
|
|
14390
|
+
width,
|
|
14391
|
+
height,
|
|
14392
|
+
heights,
|
|
14393
|
+
validity,
|
|
14394
|
+
offset: 0,
|
|
14395
|
+
stride: width,
|
|
14396
|
+
origin,
|
|
14397
|
+
columnStep: [...source.columnStep],
|
|
14398
|
+
rowStep: [...source.rowStep]
|
|
14399
|
+
}
|
|
14400
|
+
};
|
|
14401
|
+
})
|
|
14402
|
+
};
|
|
14403
|
+
}
|
|
14404
|
+
|
|
14405
|
+
// dist/terrain/mixed-halo-update.js
|
|
14406
|
+
var key2 = (t) => `${t.spacing}/${t.column}/${t.row}`;
|
|
14407
|
+
function updateTerrainMixedVertexTileHalos(previous, resident, options = {}) {
|
|
14408
|
+
const budget = options.maxDependencyTests ?? 1e7;
|
|
14409
|
+
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
14410
|
+
throw new Error("Invalid mixed halo dependency budget");
|
|
14411
|
+
const old = new Map(previous == null ? void 0 : previous.sources.map((t) => [key2(t), t]));
|
|
14412
|
+
const current = new Map(resident.map((t) => [key2(t), t]));
|
|
14413
|
+
const changed = [...old.values()].filter((t) => current.get(key2(t)) !== t).concat(resident.filter((t) => old.get(key2(t)) !== t));
|
|
14414
|
+
const cached = new Map(previous == null ? void 0 : previous.tiles.map((t) => [key2(t), t]));
|
|
14415
|
+
const targets = /* @__PURE__ */ new Set();
|
|
14416
|
+
let tests = 0;
|
|
14417
|
+
for (const tile of resident) {
|
|
14418
|
+
if (!cached.has(key2(tile)))
|
|
14419
|
+
targets.add(key2(tile));
|
|
14420
|
+
for (const source of changed) {
|
|
14421
|
+
if (++tests > budget)
|
|
14422
|
+
throw new Error("Mixed halo dependency budget exceeded");
|
|
14423
|
+
if (tile.column - tile.spacing <= source.column + (source.field.width - 1) * source.spacing && tile.column + tile.field.width * tile.spacing >= source.column && tile.row - tile.spacing <= source.row + (source.field.height - 1) * source.spacing && tile.row + tile.field.height * tile.spacing >= source.row)
|
|
14424
|
+
targets.add(key2(tile));
|
|
14425
|
+
}
|
|
14426
|
+
}
|
|
14427
|
+
const built = buildMixedVertexTileHalos(resident, options, targets).tiles;
|
|
14428
|
+
for (const tile of built)
|
|
14429
|
+
cached.set(key2(tile), tile);
|
|
14430
|
+
const tiles = resident.map((t) => cached.get(key2(t))).sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row);
|
|
14431
|
+
return {
|
|
14432
|
+
sources: resident.slice(),
|
|
14433
|
+
tiles,
|
|
14434
|
+
rebuilt: built.map(key2),
|
|
14435
|
+
removed: [...old.keys()].filter((k) => !current.has(k)).sort()
|
|
14436
|
+
};
|
|
14437
|
+
}
|
|
14438
|
+
|
|
14439
|
+
// dist/terrain/mixed-gradient-update.js
|
|
14440
|
+
function updateTerrainMixedGradientGrids(previous, halos, options = {}) {
|
|
14441
|
+
const method = options.method ?? "horn";
|
|
14442
|
+
if (method !== "horn" && method !== "zevenbergen-thorne")
|
|
14443
|
+
throw new Error("Unknown terrain gradient method");
|
|
14444
|
+
const limit = options.maxSamples ?? 4e6;
|
|
14445
|
+
const count = halos.tiles.reduce((n, t) => n + t.field.width * t.field.height, 0);
|
|
14446
|
+
if (!Number.isSafeInteger(limit) || limit < 0 || !Number.isSafeInteger(count) || count > limit)
|
|
14447
|
+
throw new Error("Mixed gradient sample capacity exceeded");
|
|
14448
|
+
const cache = new Map((previous == null ? void 0 : previous.method) === method ? previous.tiles.map((t) => [t.halo, t]) : []);
|
|
14449
|
+
return {
|
|
14450
|
+
method,
|
|
14451
|
+
tiles: halos.tiles.map((halo) => cache.get(halo) ?? {
|
|
14452
|
+
halo,
|
|
14453
|
+
grid: createTerrainGradientGrid(new HeightField(halo.field), { method, maxSamples: limit })
|
|
14454
|
+
})
|
|
14455
|
+
};
|
|
14456
|
+
}
|
|
14457
|
+
|
|
14458
|
+
// dist/terrain/box-index.js
|
|
14459
|
+
var overlaps = (a, b) => a.minX <= b.maxX && b.minX <= a.maxX && a.minY <= b.maxY && b.minY <= a.maxY;
|
|
14460
|
+
function createTerrainBoxIndex(boxes) {
|
|
14461
|
+
const build = (ids) => {
|
|
14462
|
+
const box = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
|
|
14463
|
+
for (const id of ids) {
|
|
14464
|
+
const b = boxes[id];
|
|
14465
|
+
box.minX = Math.min(box.minX, b.minX);
|
|
14466
|
+
box.minY = Math.min(box.minY, b.minY);
|
|
14467
|
+
box.maxX = Math.max(box.maxX, b.maxX);
|
|
14468
|
+
box.maxY = Math.max(box.maxY, b.maxY);
|
|
14469
|
+
}
|
|
14470
|
+
if (ids.length <= 8)
|
|
14471
|
+
return { ...box, ids };
|
|
14472
|
+
const axis = box.maxX - box.minX >= box.maxY - box.minY ? "X" : "Y";
|
|
14473
|
+
ids.sort((a, b) => boxes[a][`min${axis}`] / 2 + boxes[a][`max${axis}`] / 2 - (boxes[b][`min${axis}`] / 2 + boxes[b][`max${axis}`] / 2) || a - b);
|
|
14474
|
+
const mid = ids.length >>> 1;
|
|
14475
|
+
return { ...box, left: build(ids.slice(0, mid)), right: build(ids.slice(mid)) };
|
|
14476
|
+
};
|
|
14477
|
+
const root2 = build(boxes.map((_, i) => i));
|
|
14478
|
+
return (query, charge) => {
|
|
14479
|
+
const found = [], stack = [root2];
|
|
14480
|
+
while (stack.length) {
|
|
14481
|
+
charge();
|
|
14482
|
+
const node = stack.pop();
|
|
14483
|
+
if (!overlaps(node, query))
|
|
14484
|
+
continue;
|
|
14485
|
+
if (node.ids) {
|
|
14486
|
+
for (const id of node.ids) {
|
|
14487
|
+
charge();
|
|
14488
|
+
if (overlaps(boxes[id], query))
|
|
14489
|
+
found.push(id);
|
|
14490
|
+
}
|
|
14491
|
+
} else
|
|
14492
|
+
stack.push(node.right, node.left);
|
|
14493
|
+
}
|
|
14494
|
+
return found.sort((a, b) => a - b);
|
|
14495
|
+
};
|
|
14496
|
+
}
|
|
14497
|
+
|
|
14498
|
+
// dist/terrain/contour-topology.js
|
|
14499
|
+
var bits = new DataView(new ArrayBuffer(8));
|
|
14500
|
+
function integer(x) {
|
|
14501
|
+
bits.setFloat64(0, x);
|
|
14502
|
+
const high = bits.getUint32(0), low = bits.getUint32(4);
|
|
14503
|
+
const exponent = high >>> 20 & 2047;
|
|
14504
|
+
const mantissa = BigInt(high & 1048575) << 32n | BigInt(low);
|
|
14505
|
+
const value3 = exponent ? (1n << 52n | mantissa) << BigInt(exponent - 1) : mantissa;
|
|
14506
|
+
return high >>> 31 ? -value3 : value3;
|
|
14507
|
+
}
|
|
14508
|
+
var orientation2 = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
|
14509
|
+
var sign = (v) => v < 0n ? -1 : v > 0n ? 1 : 0;
|
|
14510
|
+
var between = (a, b, p) => p >= (a < b ? a : b) && p <= (a > b ? a : b);
|
|
14511
|
+
var on = (a, b, p) => orientation2(a, b, p) === 0n && between(a.x, b.x, p.x) && between(a.y, b.y, p.y);
|
|
14512
|
+
function intersects(a, b, c, d) {
|
|
14513
|
+
return on(a, b, c) || on(a, b, d) || on(c, d, a) || on(c, d, b) || sign(orientation2(a, b, c)) * sign(orientation2(a, b, d)) < 0 && sign(orientation2(c, d, a)) * sign(orientation2(c, d, b)) < 0;
|
|
14514
|
+
}
|
|
14515
|
+
function simplifyTerrainContourPathsTopology(paths, options) {
|
|
14516
|
+
if (options.rejection !== void 0 && options.rejection !== "batch" && options.rejection !== "path")
|
|
14517
|
+
throw new Error("Invalid contour rejection policy");
|
|
14518
|
+
const candidate = simplifyTerrainContourPaths(paths, options);
|
|
14519
|
+
const budget = options.maxTopologyTests ?? 1e6;
|
|
14520
|
+
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
14521
|
+
throw new Error("Invalid contour topology budget");
|
|
14522
|
+
let topologyTests = 0;
|
|
14523
|
+
const charge = () => {
|
|
14524
|
+
if (++topologyTests > budget)
|
|
14525
|
+
throw new Error("Contour topology work budget exceeded");
|
|
14526
|
+
};
|
|
14527
|
+
const points = new Array(paths.positions.length / 3);
|
|
14528
|
+
for (const i of new Set(paths.indices))
|
|
14529
|
+
points[i] = { x: integer(paths.positions[3 * i]), y: integer(paths.positions[3 * i + 1]) };
|
|
14530
|
+
const edges = [];
|
|
14531
|
+
for (let p = 0; p < paths.closed.length; p++)
|
|
14532
|
+
for (let i = paths.offsets[p]; i + 1 < paths.offsets[p + 1]; i++)
|
|
14533
|
+
edges.push({ a: paths.indices[i], b: paths.indices[i + 1], p, i });
|
|
14534
|
+
const box = (a, b) => ({
|
|
14535
|
+
minX: Math.min(paths.positions[3 * a], paths.positions[3 * b]),
|
|
14536
|
+
maxX: Math.max(paths.positions[3 * a], paths.positions[3 * b]),
|
|
14537
|
+
minY: Math.min(paths.positions[3 * a + 1], paths.positions[3 * b + 1]),
|
|
14538
|
+
maxY: Math.max(paths.positions[3 * a + 1], paths.positions[3 * b + 1])
|
|
14539
|
+
});
|
|
14540
|
+
const edgeBoxes = edges.map((e) => box(e.a, e.b)), edgeIndex = createTerrainBoxIndex(edgeBoxes);
|
|
14541
|
+
const vertexIds = [...new Set(paths.indices)], vertexIndex = createTerrainBoxIndex(vertexIds.map((v) => box(v, v)));
|
|
14542
|
+
for (let i = 0; i < edges.length; i++)
|
|
14543
|
+
for (const j of edgeIndex(edgeBoxes[i], charge)) {
|
|
14544
|
+
if (j <= i)
|
|
14545
|
+
continue;
|
|
14546
|
+
charge();
|
|
14547
|
+
const a = edges[i], b = edges[j];
|
|
14548
|
+
const common = [a.a, a.b].filter((v) => v === b.a || v === b.b);
|
|
14549
|
+
if (common.length === 1) {
|
|
14550
|
+
const v = common[0], x = a.a === v ? a.b : a.a, y = b.a === v ? b.b : b.a;
|
|
14551
|
+
if (on(points[v], points[x], points[y]) || on(points[v], points[y], points[x]))
|
|
14552
|
+
throw new Error("Overlapping contour edges");
|
|
14553
|
+
} else if (intersects(points[a.a], points[a.b], points[b.a], points[b.b]))
|
|
14554
|
+
throw new Error("Contour input has crossings or unshared touches");
|
|
14555
|
+
}
|
|
14556
|
+
let rejected = false;
|
|
14557
|
+
const rejectedPaths = /* @__PURE__ */ new Set();
|
|
14558
|
+
for (let p = 0; p < paths.closed.length; p++) {
|
|
14559
|
+
let start = paths.offsets[p];
|
|
14560
|
+
for (let k = candidate.offsets[p] + 1; k < candidate.offsets[p + 1]; k++) {
|
|
14561
|
+
const endId = candidate.sourceVertexIndices[candidate.indices[k]];
|
|
14562
|
+
let end = start + 1;
|
|
14563
|
+
while (paths.indices[end] !== endId)
|
|
14564
|
+
end++;
|
|
14565
|
+
if (end > start + 1) {
|
|
14566
|
+
const a = paths.indices[start], b = paths.indices[end];
|
|
14567
|
+
const pa = points[a], pb = points[b];
|
|
14568
|
+
const axis = pa.x !== pb.x ? "x" : "y";
|
|
14569
|
+
const direction = sign(pb[axis] - pa[axis]);
|
|
14570
|
+
let straight2 = true;
|
|
14571
|
+
for (let i = start + 1; i <= end; i++) {
|
|
14572
|
+
charge();
|
|
14573
|
+
const q = points[paths.indices[i]], prior = points[paths.indices[i - 1]];
|
|
14574
|
+
if (!on(pa, pb, q) || sign(q[axis] - prior[axis]) !== direction)
|
|
14575
|
+
straight2 = false;
|
|
14576
|
+
}
|
|
14577
|
+
const interior2 = new Set(Array.from(paths.indices.subarray(start + 1, end)));
|
|
14578
|
+
let unsafe = false;
|
|
14579
|
+
for (const edgeId of edgeIndex(box(a, b), charge)) {
|
|
14580
|
+
const edge = edges[edgeId];
|
|
14581
|
+
if (edge.p === p && edge.i >= start && edge.i < end) {
|
|
14582
|
+
if (straight2)
|
|
14583
|
+
continue;
|
|
14584
|
+
charge();
|
|
14585
|
+
const others2 = [edge.a, edge.b].filter((v) => v !== a && v !== b);
|
|
14586
|
+
if (others2.some((v) => on(points[a], points[b], points[v])) || others2.length === 2 && intersects(points[a], points[b], points[edge.a], points[edge.b]))
|
|
14587
|
+
unsafe = true;
|
|
14588
|
+
continue;
|
|
14589
|
+
}
|
|
14590
|
+
charge();
|
|
14591
|
+
const others = [edge.a, edge.b].filter((v) => v !== a && v !== b);
|
|
14592
|
+
if (others.some((v) => on(points[a], points[b], points[v])) || others.length === 2 && intersects(points[a], points[b], points[edge.a], points[edge.b]))
|
|
14593
|
+
unsafe = true;
|
|
14594
|
+
}
|
|
14595
|
+
const swept = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
|
|
14596
|
+
for (let i = start; i <= end; i++) {
|
|
14597
|
+
const v = paths.indices[i];
|
|
14598
|
+
swept.minX = Math.min(swept.minX, paths.positions[3 * v]);
|
|
14599
|
+
swept.maxX = Math.max(swept.maxX, paths.positions[3 * v]);
|
|
14600
|
+
swept.minY = Math.min(swept.minY, paths.positions[3 * v + 1]);
|
|
14601
|
+
swept.maxY = Math.max(swept.maxY, paths.positions[3 * v + 1]);
|
|
14602
|
+
}
|
|
14603
|
+
for (const vertexId of vertexIndex(swept, charge)) {
|
|
14604
|
+
const vertex = vertexIds[vertexId];
|
|
14605
|
+
if (vertex === a || vertex === b || interior2.has(vertex))
|
|
14606
|
+
continue;
|
|
14607
|
+
let inside = false;
|
|
14608
|
+
for (let i = start, j = end; i <= end; j = i++) {
|
|
14609
|
+
charge();
|
|
14610
|
+
const u = points[paths.indices[i]], v = points[paths.indices[j]], q = points[vertex];
|
|
14611
|
+
if (on(u, v, q)) {
|
|
14612
|
+
unsafe = true;
|
|
14613
|
+
break;
|
|
14614
|
+
}
|
|
14615
|
+
if (u.y > q.y !== v.y > q.y && orientation2(u, v, q) > 0n === v.y > u.y)
|
|
14616
|
+
inside = !inside;
|
|
14617
|
+
}
|
|
14618
|
+
if (inside)
|
|
14619
|
+
unsafe = true;
|
|
14620
|
+
}
|
|
14621
|
+
if (unsafe) {
|
|
14622
|
+
rejected = true;
|
|
14623
|
+
rejectedPaths.add(p);
|
|
14624
|
+
}
|
|
14625
|
+
}
|
|
14626
|
+
start = end;
|
|
14627
|
+
}
|
|
14628
|
+
}
|
|
14629
|
+
const outputEdges = [];
|
|
14630
|
+
for (let p = 0; p < candidate.closed.length; p++)
|
|
14631
|
+
for (let i = candidate.offsets[p]; i + 1 < candidate.offsets[p + 1]; i++)
|
|
14632
|
+
outputEdges.push({
|
|
14633
|
+
p,
|
|
14634
|
+
a: candidate.sourceVertexIndices[candidate.indices[i]],
|
|
14635
|
+
b: candidate.sourceVertexIndices[candidate.indices[i + 1]]
|
|
14636
|
+
});
|
|
14637
|
+
const outputBoxes = outputEdges.map((e) => box(e.a, e.b)), outputIndex = createTerrainBoxIndex(outputBoxes);
|
|
14638
|
+
for (let i = 0; i < outputEdges.length; i++)
|
|
14639
|
+
for (const j of outputIndex(outputBoxes[i], charge)) {
|
|
14640
|
+
if (j <= i)
|
|
14641
|
+
continue;
|
|
14642
|
+
charge();
|
|
14643
|
+
const a = outputEdges[i], b = outputEdges[j];
|
|
14644
|
+
const common = [a.a, a.b].filter((v) => v === b.a || v === b.b);
|
|
14645
|
+
if (common.length === 1) {
|
|
14646
|
+
const v = common[0], x = a.a === v ? a.b : a.a, y = b.a === v ? b.b : b.a;
|
|
14647
|
+
if (on(points[v], points[x], points[y]) || on(points[v], points[y], points[x])) {
|
|
14648
|
+
rejected = true;
|
|
14649
|
+
rejectedPaths.add(a.p);
|
|
14650
|
+
rejectedPaths.add(b.p);
|
|
14651
|
+
}
|
|
14652
|
+
} else if (intersects(points[a.a], points[a.b], points[b.a], points[b.b])) {
|
|
14653
|
+
rejected = true;
|
|
14654
|
+
rejectedPaths.add(a.p);
|
|
14655
|
+
rejectedPaths.add(b.p);
|
|
14656
|
+
}
|
|
14657
|
+
}
|
|
14658
|
+
if (rejected && options.rejection === "path") {
|
|
14659
|
+
const indices = [], offsets = [0];
|
|
14660
|
+
for (let p = 0; p < paths.closed.length; p++) {
|
|
14661
|
+
if (rejectedPaths.has(p))
|
|
14662
|
+
for (let i = paths.offsets[p]; i < paths.offsets[p + 1]; i++)
|
|
14663
|
+
indices.push(paths.indices[i]);
|
|
14664
|
+
else
|
|
14665
|
+
for (let i = candidate.offsets[p]; i < candidate.offsets[p + 1]; i++)
|
|
14666
|
+
indices.push(candidate.sourceVertexIndices[candidate.indices[i]]);
|
|
14667
|
+
offsets.push(indices.length);
|
|
14668
|
+
}
|
|
14669
|
+
return {
|
|
14670
|
+
...paths,
|
|
14671
|
+
positions: paths.positions.slice(),
|
|
14672
|
+
gridCoordinates: paths.gridCoordinates.slice(),
|
|
14673
|
+
indices: Uint32Array.from(indices),
|
|
14674
|
+
offsets: Uint32Array.from(offsets),
|
|
14675
|
+
closed: paths.closed.slice(),
|
|
14676
|
+
levelIndices: paths.levelIndices.slice(),
|
|
14677
|
+
levels: paths.levels.slice(),
|
|
14678
|
+
origin: Object.freeze([...paths.origin]),
|
|
14679
|
+
sourceVertexIndices: Uint32Array.from({ length: points.length }, (_, i) => i),
|
|
14680
|
+
maxDeviation: candidate.maxDeviation,
|
|
14681
|
+
requestedMaxError: options.maxError,
|
|
14682
|
+
distanceTests: candidate.distanceTests,
|
|
14683
|
+
topologyTests,
|
|
14684
|
+
rejected: true
|
|
14685
|
+
};
|
|
14686
|
+
}
|
|
14687
|
+
if (!rejected)
|
|
14688
|
+
return { ...candidate, topologyTests, rejected: false };
|
|
14689
|
+
return {
|
|
14690
|
+
...paths,
|
|
14691
|
+
positions: paths.positions.slice(),
|
|
14692
|
+
gridCoordinates: paths.gridCoordinates.slice(),
|
|
14693
|
+
indices: paths.indices.slice(),
|
|
14694
|
+
offsets: paths.offsets.slice(),
|
|
14695
|
+
levelIndices: paths.levelIndices.slice(),
|
|
14696
|
+
closed: paths.closed.slice(),
|
|
14697
|
+
levels: paths.levels.slice(),
|
|
14698
|
+
origin: Object.freeze([...paths.origin]),
|
|
14699
|
+
sourceVertexIndices: Uint32Array.from({ length: points.length }, (_, i) => i),
|
|
14700
|
+
maxDeviation: 0,
|
|
14701
|
+
requestedMaxError: options.maxError,
|
|
14702
|
+
distanceTests: candidate.distanceTests,
|
|
14703
|
+
topologyTests,
|
|
14704
|
+
rejected: true
|
|
14705
|
+
};
|
|
14706
|
+
}
|
|
14707
|
+
|
|
14708
|
+
// dist/terrain/isobands.js
|
|
14709
|
+
function createTerrainIsobands(fields, levels, options = {}) {
|
|
14710
|
+
const maxLevels = options.maxLevels ?? 256;
|
|
14711
|
+
if (!Number.isSafeInteger(maxLevels) || maxLevels < 2 || levels.length > maxLevels)
|
|
14712
|
+
throw new Error("Isoband level capacity exceeded");
|
|
14713
|
+
if (levels.length < 2 || levels.some((v, i) => !Number.isFinite(v) || i > 0 && v <= levels[i - 1]))
|
|
14714
|
+
throw new Error("Invalid isoband levels");
|
|
14715
|
+
const maxTriangles = options.maxTriangles ?? 2e6, maxVertices = options.maxVertices ?? 2e6, maxEdges = options.maxEdges ?? 6 * maxTriangles, maxTests = options.maxTests ?? 32 * maxTriangles;
|
|
14716
|
+
if (![maxTriangles, maxVertices, maxEdges, maxTests].every((n) => Number.isSafeInteger(n) && n >= 0))
|
|
14717
|
+
throw new Error("Invalid isoband capacity");
|
|
14718
|
+
const count = fields.reduce((n, f) => n + 2 * (f.width - 1) * (f.height - 1), 0);
|
|
14719
|
+
if (!Number.isSafeInteger(count) || count > maxTriangles)
|
|
14720
|
+
throw new Error("Isoband triangle capacity exceeded");
|
|
14721
|
+
const originals = /* @__PURE__ */ new Map(), vertices = /* @__PURE__ */ new Map();
|
|
14722
|
+
const frame2 = fields[0];
|
|
14723
|
+
for (const f of fields)
|
|
14724
|
+
if (f.heightReference !== frame2.heightReference)
|
|
14725
|
+
throw new Error("Isoband height references differ");
|
|
14726
|
+
let tests = 0, edgeCount = 0;
|
|
14727
|
+
const charge = () => {
|
|
14728
|
+
if (++tests > maxTests)
|
|
14729
|
+
throw new Error("Isoband work budget exceeded");
|
|
14730
|
+
};
|
|
14731
|
+
const rectangles = fields.map((f) => {
|
|
14732
|
+
if (f.registration !== frame2.registration || f.columnStep.some((v, i) => v !== frame2.columnStep[i]) || f.rowStep.some((v, i) => v !== frame2.rowStep[i]))
|
|
14733
|
+
throw new Error("Isoband tiles require a conforming common frame");
|
|
14734
|
+
const dx = f.origin[0] - frame2.origin[0], dy = f.origin[1] - frame2.origin[1];
|
|
14735
|
+
const determinant = frame2.columnStep[0] * frame2.rowStep[1] - frame2.columnStep[1] * frame2.rowStep[0];
|
|
14736
|
+
const x = Math.round((dx * frame2.rowStep[1] - dy * frame2.rowStep[0]) / determinant), y = Math.round((dy * frame2.columnStep[0] - dx * frame2.columnStep[1]) / determinant);
|
|
14737
|
+
if (!Number.isSafeInteger(x) || !Number.isSafeInteger(y))
|
|
14738
|
+
throw new Error("Isoband tiles require integral lattice origins");
|
|
14739
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
14740
|
+
const a = x * frame2.columnStep[axis], b = y * frame2.rowStep[axis];
|
|
14741
|
+
const expected = frame2.origin[axis] + a + b;
|
|
14742
|
+
const tolerance = Math.min(16 * Number.EPSILON * Math.max(1, Math.abs(f.origin[axis]), Math.abs(frame2.origin[axis]), Math.abs(a), Math.abs(b)), 1e-9 * Math.max(Math.abs(frame2.columnStep[axis]), Math.abs(frame2.rowStep[axis])));
|
|
14743
|
+
if (!Number.isFinite(expected) || Math.abs(f.origin[axis] - expected) > tolerance)
|
|
14744
|
+
throw new Error("Isoband tiles require integral lattice origins");
|
|
14745
|
+
}
|
|
14746
|
+
return { x, y, right: x + f.width - 1, top: y + f.height - 1 };
|
|
14747
|
+
});
|
|
14748
|
+
const rectangleBoxes = rectangles.map((r) => ({ minX: r.x, minY: r.y, maxX: r.right, maxY: r.top })), rectangleIndex = createTerrainBoxIndex(rectangleBoxes);
|
|
14749
|
+
const rangeIndex = createTerrainBoxIndex(fields.map((f) => {
|
|
14750
|
+
var _a, _b;
|
|
14751
|
+
return {
|
|
14752
|
+
minX: ((_a = f.heightRange) == null ? void 0 : _a[0]) ?? Infinity,
|
|
14753
|
+
maxX: ((_b = f.heightRange) == null ? void 0 : _b[1]) ?? -Infinity,
|
|
14754
|
+
minY: 0,
|
|
14755
|
+
maxY: 0
|
|
14756
|
+
};
|
|
14757
|
+
}));
|
|
14758
|
+
for (let i = 0; i < rectangles.length; i++)
|
|
14759
|
+
for (const j of rectangleIndex(rectangleBoxes[i], charge)) {
|
|
14760
|
+
if (j <= i)
|
|
14761
|
+
continue;
|
|
14762
|
+
charge();
|
|
14763
|
+
const a = rectangles[i], b = rectangles[j];
|
|
14764
|
+
if (a.x < b.right && b.x < a.right && a.y < b.top && b.y < a.top)
|
|
14765
|
+
throw new Error("Overlapping isoband tiles");
|
|
14766
|
+
for (let y = Math.max(a.y, b.y); y <= Math.min(a.top, b.top); y++)
|
|
14767
|
+
for (let x = Math.max(a.x, b.x); x <= Math.min(a.right, b.right); x++) {
|
|
14768
|
+
charge();
|
|
14769
|
+
const u = fields[i].getHeight(x - a.x, y - a.y), v = fields[j].getHeight(x - b.x, y - b.y);
|
|
14770
|
+
if (u !== void 0 && v !== void 0 && u !== v)
|
|
14771
|
+
throw new Error("Isoband shared heights differ");
|
|
14772
|
+
}
|
|
14773
|
+
}
|
|
14774
|
+
const rings = [], bands = [];
|
|
14775
|
+
const register = (v) => {
|
|
14776
|
+
if (!vertices.has(v.key)) {
|
|
14777
|
+
if (vertices.size >= maxVertices)
|
|
14778
|
+
throw new Error("Isoband vertex capacity exceeded");
|
|
14779
|
+
vertices.set(v.key, v);
|
|
14780
|
+
}
|
|
14781
|
+
return vertices.get(v.key);
|
|
14782
|
+
};
|
|
14783
|
+
const clip = (poly, level, above) => {
|
|
14784
|
+
const out = [];
|
|
14785
|
+
for (let i = 0; i < poly.length; i++) {
|
|
14786
|
+
charge();
|
|
14787
|
+
const a = poly[i], b = poly[(i + 1) % poly.length], ia = above ? a.z >= level : a.z <= level, ib = above ? b.z >= level : b.z <= level;
|
|
14788
|
+
if (ia)
|
|
14789
|
+
out.push(a);
|
|
14790
|
+
if (ia !== ib) {
|
|
14791
|
+
if (a.z === level) {
|
|
14792
|
+
out.push(a);
|
|
14793
|
+
continue;
|
|
14794
|
+
}
|
|
14795
|
+
if (b.z === level) {
|
|
14796
|
+
out.push(b);
|
|
14797
|
+
continue;
|
|
14798
|
+
}
|
|
14799
|
+
const support = [.../* @__PURE__ */ new Set([...a.support, ...b.support])].sort();
|
|
14800
|
+
if (support.length !== 2)
|
|
14801
|
+
throw new Error("Invalid isoband intersection support");
|
|
14802
|
+
const u = originals.get(support[0]), v = originals.get(support[1]);
|
|
14803
|
+
const scale3 = Math.max(Math.abs(u.z), Math.abs(v.z), Math.abs(level), 1);
|
|
14804
|
+
const t = (level / scale3 - u.z / scale3) / (v.z / scale3 - u.z / scale3);
|
|
14805
|
+
const point2 = {
|
|
14806
|
+
x: u.x * (1 - t) + v.x * t,
|
|
14807
|
+
y: u.y * (1 - t) + v.y * t,
|
|
14808
|
+
z: level,
|
|
14809
|
+
key: `e:${support.join("|")}:${level}`,
|
|
14810
|
+
support
|
|
14811
|
+
};
|
|
14812
|
+
if (![point2.x, point2.y, t].every(Number.isFinite))
|
|
14813
|
+
throw new Error("Isoband arithmetic overflow");
|
|
14814
|
+
out.push(register(point2));
|
|
14815
|
+
}
|
|
14816
|
+
}
|
|
14817
|
+
return out.filter((v, i) => v.key !== out[(i + 1) % out.length].key);
|
|
14818
|
+
};
|
|
14819
|
+
for (let band = 0; band + 1 < levels.length; band++) {
|
|
14820
|
+
const edges = /* @__PURE__ */ new Map();
|
|
14821
|
+
for (const fieldId of rangeIndex({ minX: levels[band], maxX: levels[band + 1], minY: 0, maxY: 0 }, charge))
|
|
14822
|
+
for (let y = 0; y < fields[fieldId].height - 1; y++)
|
|
14823
|
+
for (let x = 0; x < fields[fieldId].width - 1; x++) {
|
|
14824
|
+
const f = fields[fieldId];
|
|
14825
|
+
const nodes = [
|
|
14826
|
+
[x, y],
|
|
14827
|
+
[x + 1, y],
|
|
14828
|
+
[x, y + 1],
|
|
14829
|
+
[x + 1, y + 1]
|
|
14830
|
+
].map(([c, r]) => {
|
|
14831
|
+
const z = f.getHeight(c, r);
|
|
14832
|
+
if (z === void 0)
|
|
14833
|
+
return void 0;
|
|
14834
|
+
const shift2 = f.registration === "cell" ? 0.5 : 0;
|
|
14835
|
+
const px = frame2.origin[0] + (rectangles[fieldId].x + c + shift2) * frame2.columnStep[0] + (rectangles[fieldId].y + r + shift2) * frame2.rowStep[0], py = frame2.origin[1] + (rectangles[fieldId].x + c + shift2) * frame2.columnStep[1] + (rectangles[fieldId].y + r + shift2) * frame2.rowStep[1];
|
|
14836
|
+
if (![px, py].every(Number.isFinite))
|
|
14837
|
+
throw new Error("Isoband coordinate overflow");
|
|
14838
|
+
const key3 = `v:${px},${py}`, v = { x: px, y: py, z, key: key3, support: [key3] };
|
|
14839
|
+
const old = originals.get(key3);
|
|
14840
|
+
if (old && old.z !== z)
|
|
14841
|
+
throw new Error("Isoband shared heights differ");
|
|
14842
|
+
originals.set(key3, v);
|
|
14843
|
+
return v;
|
|
14844
|
+
});
|
|
14845
|
+
for (const ids of f.diagonal === "00-11" ? [
|
|
14846
|
+
[0, 1, 3],
|
|
14847
|
+
[0, 3, 2]
|
|
14848
|
+
] : [
|
|
14849
|
+
[0, 1, 2],
|
|
14850
|
+
[1, 3, 2]
|
|
14851
|
+
]) {
|
|
14852
|
+
charge();
|
|
14853
|
+
if (ids.some((i) => !nodes[i]))
|
|
14854
|
+
continue;
|
|
14855
|
+
let poly = ids.map((i) => nodes[i]);
|
|
14856
|
+
if (poly.every((v) => v.z === levels[band + 1]) && band + 2 < levels.length)
|
|
14857
|
+
continue;
|
|
14858
|
+
if ((poly[1].x - poly[0].x) * (poly[2].y - poly[0].y) - (poly[1].y - poly[0].y) * (poly[2].x - poly[0].x) < 0)
|
|
14859
|
+
poly.reverse();
|
|
14860
|
+
poly = clip(clip(poly, levels[band], true), levels[band + 1], false);
|
|
14861
|
+
if (poly.length < 3)
|
|
14862
|
+
continue;
|
|
14863
|
+
const area2 = poly.reduce((n, a, i) => {
|
|
14864
|
+
const b = poly[(i + 1) % poly.length], o = poly[0];
|
|
14865
|
+
return n + (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);
|
|
14866
|
+
}, 0);
|
|
14867
|
+
if (!Number.isFinite(area2))
|
|
14868
|
+
throw new Error("Isoband area arithmetic overflow");
|
|
14869
|
+
if (area2 === 0)
|
|
14870
|
+
continue;
|
|
14871
|
+
for (let i = 0; i < poly.length; i++) {
|
|
14872
|
+
const a = register(poly[i]), b = register(poly[(i + 1) % poly.length]);
|
|
14873
|
+
if (++edgeCount > maxEdges)
|
|
14874
|
+
throw new Error("Isoband edge capacity exceeded");
|
|
14875
|
+
const key3 = `${a.key}>${b.key}`, reverse2 = `${b.key}>${a.key}`;
|
|
14876
|
+
if (edges.has(reverse2))
|
|
14877
|
+
edges.delete(reverse2);
|
|
14878
|
+
else {
|
|
14879
|
+
if (edges.has(key3))
|
|
14880
|
+
throw new Error("Overlapping isoband tiles");
|
|
14881
|
+
edges.set(key3, { a, b });
|
|
14882
|
+
}
|
|
14883
|
+
}
|
|
14884
|
+
}
|
|
14885
|
+
}
|
|
14886
|
+
const outgoing = /* @__PURE__ */ new Map();
|
|
14887
|
+
for (const [key3, e] of edges) {
|
|
14888
|
+
if (!outgoing.has(e.a.key))
|
|
14889
|
+
outgoing.set(e.a.key, /* @__PURE__ */ new Set());
|
|
14890
|
+
outgoing.get(e.a.key).add(key3);
|
|
14891
|
+
}
|
|
14892
|
+
while (edges.size) {
|
|
14893
|
+
const first = edges.values().next().value, ring = [];
|
|
14894
|
+
let edge = first;
|
|
14895
|
+
for (; ; ) {
|
|
14896
|
+
charge();
|
|
14897
|
+
ring.push(edge.a);
|
|
14898
|
+
edges.delete(`${edge.a.key}>${edge.b.key}`);
|
|
14899
|
+
outgoing.get(edge.a.key).delete(`${edge.a.key}>${edge.b.key}`);
|
|
14900
|
+
if (edge.b.key === first.a.key)
|
|
14901
|
+
break;
|
|
14902
|
+
const choices = [...outgoing.get(edge.b.key) ?? []].map((k) => edges.get(k));
|
|
14903
|
+
if (!choices.length)
|
|
14904
|
+
throw new Error("Open isoband boundary");
|
|
14905
|
+
const angle3 = (e) => Math.atan2((edge.b.x - edge.a.x) * (e.b.y - e.a.y) - (edge.b.y - edge.a.y) * (e.b.x - e.a.x), (edge.b.x - edge.a.x) * (e.b.x - e.a.x) + (edge.b.y - edge.a.y) * (e.b.y - e.a.y));
|
|
14906
|
+
choices.sort((a, b) => angle3(b) - angle3(a) || a.b.key.localeCompare(b.b.key));
|
|
14907
|
+
edge = choices[0];
|
|
14908
|
+
}
|
|
14909
|
+
rings.push(ring);
|
|
14910
|
+
bands.push(band);
|
|
14911
|
+
}
|
|
14912
|
+
}
|
|
14913
|
+
const area = (ring) => ring.reduce((n, a, i) => {
|
|
14914
|
+
const b = ring[(i + 1) % ring.length], o = ring[0];
|
|
14915
|
+
return n + (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);
|
|
14916
|
+
}, 0);
|
|
14917
|
+
const areas = rings.map(area), parents = new Int32Array(rings.length).fill(-1);
|
|
14918
|
+
const ringBoxes = rings.map((r) => r.reduce((b, v) => ({
|
|
14919
|
+
minX: Math.min(b.minX, v.x),
|
|
14920
|
+
minY: Math.min(b.minY, v.y),
|
|
14921
|
+
maxX: Math.max(b.maxX, v.x),
|
|
14922
|
+
maxY: Math.max(b.maxY, v.y)
|
|
14923
|
+
}), { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity }));
|
|
14924
|
+
const ringIndex = createTerrainBoxIndex(ringBoxes);
|
|
14925
|
+
for (let i = 0; i < rings.length; i++)
|
|
14926
|
+
if (areas[i] < 0) {
|
|
14927
|
+
let best = Infinity;
|
|
14928
|
+
const q = rings[i][0];
|
|
14929
|
+
for (const j of ringIndex({ minX: q.x, maxX: q.x, minY: q.y, maxY: q.y }, charge))
|
|
14930
|
+
if (bands[j] === bands[i] && areas[j] > 0) {
|
|
14931
|
+
let inside = false;
|
|
14932
|
+
const ring = rings[j];
|
|
14933
|
+
for (let k = 0, l = ring.length - 1; k < ring.length; l = k++) {
|
|
14934
|
+
charge();
|
|
14935
|
+
const a = ring[k], b = ring[l];
|
|
14936
|
+
if (a.y > q.y !== b.y > q.y && q.x < (b.x - a.x) * (q.y - a.y) / (b.y - a.y) + a.x)
|
|
14937
|
+
inside = !inside;
|
|
14938
|
+
}
|
|
14939
|
+
if (inside && areas[j] < best) {
|
|
14940
|
+
parents[i] = j;
|
|
14941
|
+
best = areas[j];
|
|
14942
|
+
}
|
|
14943
|
+
}
|
|
14944
|
+
if (parents[i] < 0)
|
|
14945
|
+
throw new Error("Uncontained isoband hole");
|
|
14946
|
+
}
|
|
14947
|
+
const used = /* @__PURE__ */ new Map(), positions = [], indices = [], offsets = [0];
|
|
14948
|
+
for (const ring of rings) {
|
|
14949
|
+
for (const v of [...ring, ring[0]]) {
|
|
14950
|
+
if (!used.has(v.key)) {
|
|
14951
|
+
used.set(v.key, used.size);
|
|
14952
|
+
positions.push(v.x, v.y);
|
|
14953
|
+
}
|
|
14954
|
+
indices.push(used.get(v.key));
|
|
14955
|
+
}
|
|
14956
|
+
offsets.push(indices.length);
|
|
14957
|
+
}
|
|
14958
|
+
return {
|
|
14959
|
+
positions: Float64Array.from(positions),
|
|
14960
|
+
indices: Uint32Array.from(indices),
|
|
14961
|
+
offsets: Uint32Array.from(offsets),
|
|
14962
|
+
bandIndices: Uint32Array.from(bands),
|
|
14963
|
+
parents,
|
|
14964
|
+
levels: Float64Array.from(levels),
|
|
14965
|
+
heightReference: (frame2 == null ? void 0 : frame2.heightReference) ?? "unknown"
|
|
14966
|
+
};
|
|
14967
|
+
}
|
|
14968
|
+
|
|
14969
|
+
// dist/terrain/tile-update-data.js
|
|
14970
|
+
function updateTerrainTileData(previous, resident, create, maxSamples = 4e6) {
|
|
14971
|
+
if (!Number.isSafeInteger(maxSamples) || maxSamples < 0)
|
|
14972
|
+
throw new Error("Invalid terrain update sample capacity");
|
|
14973
|
+
let count = 0;
|
|
14974
|
+
const ids = /* @__PURE__ */ new Set();
|
|
14975
|
+
for (const tile of resident) {
|
|
14976
|
+
if (typeof tile.id !== "string" || ids.has(tile.id))
|
|
14977
|
+
throw new Error("Invalid or duplicate terrain update tile");
|
|
14978
|
+
ids.add(tile.id);
|
|
14979
|
+
count += tile.field.width * tile.field.height;
|
|
14980
|
+
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
14981
|
+
throw new Error("Terrain update sample capacity exceeded");
|
|
14982
|
+
}
|
|
14983
|
+
const cached = new Map(previous == null ? void 0 : previous.map((t) => [t.source.id, t]));
|
|
14984
|
+
return resident.map((source) => {
|
|
14985
|
+
const old = cached.get(source.id);
|
|
14986
|
+
return (old == null ? void 0 : old.source.field) === source.field ? { source, data: old.data } : { source, data: create(source.field) };
|
|
14987
|
+
});
|
|
14988
|
+
}
|
|
14989
|
+
|
|
14990
|
+
// dist/terrain/mesh-update.js
|
|
14991
|
+
function updateTerrainMeshes(previous, resident, options = {}) {
|
|
14992
|
+
return updateTerrainTileData(previous, resident, createTerrainMesh, options.maxSamples);
|
|
14993
|
+
}
|
|
14994
|
+
|
|
14995
|
+
// dist/terrain/bounds-update.js
|
|
14996
|
+
function updateTerrainBounds(previous, resident, options = {}) {
|
|
14997
|
+
return updateTerrainTileData(previous, resident, (f) => new HeightFieldMinMax(f), options.maxSamples);
|
|
14998
|
+
}
|
|
14999
|
+
|
|
15000
|
+
// dist/terrain/gradient-pyramid-update.js
|
|
15001
|
+
function updateTerrainGradientPyramids(previous, gradients, options = {}) {
|
|
15002
|
+
const limit = options.maxSamples ?? 4e6;
|
|
15003
|
+
const count = gradients.tiles.reduce((n, t) => n + t.grid.width * t.grid.height, 0);
|
|
15004
|
+
if (!Number.isSafeInteger(limit) || limit < 0 || !Number.isSafeInteger(count) || count > limit)
|
|
15005
|
+
throw new Error("Gradient pyramid update sample capacity exceeded");
|
|
15006
|
+
const cached = new Map(previous == null ? void 0 : previous.map((t) => [t.source.grid, t.data]));
|
|
15007
|
+
return gradients.tiles.map((source) => ({
|
|
15008
|
+
source,
|
|
15009
|
+
data: cached.get(source.grid) ?? createTerrainGradientPyramid(source.grid, { maxSamples: limit })
|
|
15010
|
+
}));
|
|
15011
|
+
}
|
|
15012
|
+
|
|
15013
|
+
// dist/terrain/dirty-regions.js
|
|
15014
|
+
function validateTerrainDirtyWindows(windows, width, height, maxWindows = 1e5) {
|
|
15015
|
+
if (windows.length > maxWindows)
|
|
15016
|
+
throw new Error("Terrain dirty window capacity exceeded");
|
|
15017
|
+
for (const w of windows)
|
|
15018
|
+
if (![w.minColumn, w.minRow, w.maxColumn, w.maxRow].every(Number.isSafeInteger) || w.minColumn < 0 || w.minRow < 0 || w.maxColumn >= width || w.maxRow >= height || w.minColumn > w.maxColumn || w.minRow > w.maxRow)
|
|
15019
|
+
throw new Error("Invalid terrain dirty sample window");
|
|
15020
|
+
}
|
|
15021
|
+
function sameTerrainFrame(a, b) {
|
|
15022
|
+
return a.width === b.width && a.height === b.height && a.registration === b.registration && a.diagonal === b.diagonal && a.heightReference === b.heightReference && a.origin.every((v, i) => v === b.origin[i]) && a.columnStep.every((v, i) => v === b.columnStep[i]) && a.rowStep.every((v, i) => v === b.rowStep[i]);
|
|
15023
|
+
}
|
|
15024
|
+
function terrainDirtyIndices(windows, width, height, expand, charge) {
|
|
15025
|
+
const ids = /* @__PURE__ */ new Set();
|
|
15026
|
+
for (const w of windows)
|
|
15027
|
+
for (let y = Math.max(0, w.minRow - expand); y <= Math.min(height - 1, w.maxRow + expand); y++)
|
|
15028
|
+
for (let x = Math.max(0, w.minColumn - expand); x <= Math.min(width - 1, w.maxColumn + expand); x++) {
|
|
15029
|
+
charge();
|
|
15030
|
+
ids.add(y * width + x);
|
|
15031
|
+
}
|
|
15032
|
+
return ids;
|
|
15033
|
+
}
|
|
15034
|
+
|
|
15035
|
+
// dist/terrain/mesh-regions-data.js
|
|
15036
|
+
function updateMeshRegions(previous, field, dirty, options, configuration, create) {
|
|
15037
|
+
const cells = options.cellsPerRegion ?? 32, limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
15038
|
+
if (![cells, limit, budget].every(Number.isSafeInteger) || cells < 1 || limit < 0 || budget < 0)
|
|
15039
|
+
throw new Error("Invalid terrain mesh region capacity");
|
|
15040
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
15041
|
+
let count = 0, tests = 0;
|
|
15042
|
+
const regions = [], rebuilt = [];
|
|
15043
|
+
const reusable = previous && sameTerrainFrame(previous.field, field) && previous.cellsPerRegion === cells && previous.configuration === configuration;
|
|
15044
|
+
const cache = new Map(previous == null ? void 0 : previous.regions.map((r) => [`${r.column},${r.row}`, r]));
|
|
15045
|
+
for (let row = 0; row < field.height - 1; row += cells)
|
|
15046
|
+
for (let column = 0; column < field.width - 1; column += cells) {
|
|
15047
|
+
const width = Math.min(cells, field.width - 1 - column) + 1, height = Math.min(cells, field.height - 1 - row) + 1;
|
|
15048
|
+
count += width * height;
|
|
15049
|
+
if (!Number.isSafeInteger(count) || count > limit)
|
|
15050
|
+
throw new Error("Terrain mesh region sample capacity exceeded");
|
|
15051
|
+
let affected = !reusable;
|
|
15052
|
+
for (const w of reusable ? dirty : []) {
|
|
15053
|
+
if (++tests > budget)
|
|
15054
|
+
throw new Error("Terrain mesh region work budget exceeded");
|
|
15055
|
+
if (w.minColumn <= column + width - 1 && w.maxColumn >= column && w.minRow <= row + height - 1 && w.maxRow >= row)
|
|
15056
|
+
affected = true;
|
|
15057
|
+
}
|
|
15058
|
+
const old = cache.get(`${column},${row}`);
|
|
15059
|
+
if (!affected && old) {
|
|
15060
|
+
regions.push(old);
|
|
15061
|
+
continue;
|
|
15062
|
+
}
|
|
15063
|
+
const heights = Float64Array.from({ length: width * height }, (_, i) => field.getHeight(column + i % width, row + Math.floor(i / width)) ?? NaN);
|
|
15064
|
+
const source = new HeightField({
|
|
15065
|
+
width,
|
|
15066
|
+
height,
|
|
15067
|
+
heights,
|
|
15068
|
+
origin: [
|
|
15069
|
+
column * field.columnStep[0] + row * field.rowStep[0],
|
|
15070
|
+
column * field.columnStep[1] + row * field.rowStep[1]
|
|
15071
|
+
],
|
|
15072
|
+
columnStep: field.columnStep,
|
|
15073
|
+
rowStep: field.rowStep,
|
|
15074
|
+
registration: field.registration,
|
|
15075
|
+
diagonal: field.diagonal,
|
|
15076
|
+
heightReference: field.heightReference
|
|
15077
|
+
});
|
|
15078
|
+
rebuilt.push(regions.length);
|
|
15079
|
+
let data = create(source);
|
|
15080
|
+
if (data) {
|
|
15081
|
+
const mesh = data;
|
|
15082
|
+
const positions = mesh.positions.map((value3, i) => {
|
|
15083
|
+
const axis = i % 3;
|
|
15084
|
+
if (axis === 2)
|
|
15085
|
+
return value3;
|
|
15086
|
+
const vertex = Math.floor(i / 3), shift2 = field.registration === "cell" ? 0.5 : 0;
|
|
15087
|
+
const c = column + mesh.gridCoordinates[2 * vertex] + shift2, r = row + mesh.gridCoordinates[2 * vertex + 1] + shift2;
|
|
15088
|
+
const coordinate = c * field.columnStep[axis] + r * field.rowStep[axis];
|
|
15089
|
+
if (!Number.isFinite(coordinate))
|
|
15090
|
+
throw new Error("Terrain region coordinate overflow");
|
|
15091
|
+
return coordinate;
|
|
15092
|
+
});
|
|
15093
|
+
data = { ...mesh, origin: [0, 0, 0], positions };
|
|
15094
|
+
}
|
|
15095
|
+
regions.push({ column, row, field: source, data });
|
|
15096
|
+
}
|
|
15097
|
+
return {
|
|
15098
|
+
field,
|
|
15099
|
+
origin: [field.origin[0], field.origin[1], 0],
|
|
15100
|
+
cellsPerRegion: cells,
|
|
15101
|
+
configuration,
|
|
15102
|
+
regions,
|
|
15103
|
+
rebuilt: Uint32Array.from(rebuilt)
|
|
15104
|
+
};
|
|
15105
|
+
}
|
|
15106
|
+
|
|
15107
|
+
// dist/terrain/mesh-regions.js
|
|
15108
|
+
function updateTerrainMeshRegions(previous, field, dirty, options = {}) {
|
|
15109
|
+
return updateMeshRegions(previous, field, dirty, options, "regular", createTerrainMesh);
|
|
15110
|
+
}
|
|
15111
|
+
|
|
15112
|
+
// dist/terrain/martini-regions.js
|
|
15113
|
+
function updateTerrainMartiniMeshRegions(previous, field, dirty, options) {
|
|
15114
|
+
const cells = options.cellsPerRegion ?? 32;
|
|
15115
|
+
if (!Number.isSafeInteger(cells) || cells < 1 || cells > 32768 || (cells & cells - 1) !== 0 || (field.width - 1) % cells || (field.height - 1) % cells || !Number.isFinite(options.maxError) || options.maxError < 0)
|
|
15116
|
+
throw new Error("Invalid MARTINI region dimensions or error");
|
|
15117
|
+
return updateMeshRegions(previous, field, dirty, options, `martini:${options.maxError}`, (f) => f.validCount !== f.width * f.height ? null : createMartiniTerrainMesh(f, {
|
|
15118
|
+
maxError: options.maxError,
|
|
15119
|
+
fullEdges: ["minColumn", "maxColumn", "minRow", "maxRow"]
|
|
15120
|
+
}));
|
|
15121
|
+
}
|
|
15122
|
+
|
|
15123
|
+
// dist/terrain/delatin-regions.js
|
|
15124
|
+
function updateTerrainDelatinMeshRegions(previous, field, dirty, options) {
|
|
15125
|
+
if (!Number.isFinite(options.maxError) || options.maxError < 0)
|
|
15126
|
+
throw new Error("Invalid Delatin region error");
|
|
15127
|
+
return updateMeshRegions(previous, field, dirty, options, `delatin:${options.maxError}`, (f) => f.validCount !== f.width * f.height ? null : createDelatinTerrainMesh(f, { maxError: options.maxError }));
|
|
15128
|
+
}
|
|
15129
|
+
|
|
15130
|
+
// dist/terrain/bounds-regions.js
|
|
15131
|
+
function updateTerrainBoundsRegions(previous, field, dirty, options = {}) {
|
|
15132
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
15133
|
+
if (![limit, budget].every(Number.isSafeInteger) || limit < 0 || budget < 0 || field.width * field.height > limit)
|
|
15134
|
+
throw new Error("Invalid bounds region capacity");
|
|
15135
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
15136
|
+
if (!previous || !sameTerrainFrame(previous.field, field)) {
|
|
15137
|
+
const bounds = new HeightFieldMinMax(field), levels2 = Array.from({ length: bounds.levelCount }, (_, i) => bounds.copyLevel(i));
|
|
15138
|
+
return { field, levels: levels2, updatedCounts: Uint32Array.from(levels2, (l) => l.width * l.height) };
|
|
15139
|
+
}
|
|
15140
|
+
let tests = 0;
|
|
15141
|
+
const charge = () => {
|
|
15142
|
+
if (++tests > budget)
|
|
15143
|
+
throw new Error("Bounds region work budget exceeded");
|
|
15144
|
+
};
|
|
15145
|
+
let ids = terrainDirtyIndices(dirty, field.width - 1, field.height - 1, 1, charge);
|
|
15146
|
+
const counts = [], levels = previous.levels.slice();
|
|
15147
|
+
for (let l = 0; l < levels.length; l++) {
|
|
15148
|
+
counts.push(ids.size);
|
|
15149
|
+
if (!ids.size)
|
|
15150
|
+
continue;
|
|
15151
|
+
const old = levels[l], next = {
|
|
15152
|
+
...old,
|
|
15153
|
+
minimums: old.minimums.slice(),
|
|
15154
|
+
maximums: old.maximums.slice(),
|
|
15155
|
+
populatedCellCounts: old.populatedCellCounts.slice(),
|
|
15156
|
+
completeCellCounts: old.completeCellCounts.slice()
|
|
15157
|
+
};
|
|
15158
|
+
const parents = /* @__PURE__ */ new Set();
|
|
15159
|
+
for (const id of ids) {
|
|
15160
|
+
charge();
|
|
15161
|
+
const x = id % next.width, y = Math.floor(id / next.width);
|
|
15162
|
+
let min = Infinity, max = -Infinity, populated = 0, complete = 0;
|
|
15163
|
+
if (l === 0) {
|
|
15164
|
+
let valid = 0;
|
|
15165
|
+
for (let dy = 0; dy < 2; dy++)
|
|
15166
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
15167
|
+
const h = field.getHeight(x + dx, y + dy);
|
|
15168
|
+
if (h !== void 0) {
|
|
15169
|
+
valid++;
|
|
15170
|
+
min = Math.min(min, h);
|
|
15171
|
+
max = Math.max(max, h);
|
|
15172
|
+
}
|
|
15173
|
+
}
|
|
15174
|
+
populated = valid ? 1 : 0;
|
|
15175
|
+
complete = valid === 4 ? 1 : 0;
|
|
15176
|
+
} else {
|
|
15177
|
+
const child = levels[l - 1];
|
|
15178
|
+
for (let dy = 0; dy < 2; dy++)
|
|
15179
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
15180
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
15181
|
+
if (cx >= child.width || cy >= child.height)
|
|
15182
|
+
continue;
|
|
15183
|
+
const i = cy * child.width + cx;
|
|
15184
|
+
if (child.populatedCellCounts[i]) {
|
|
15185
|
+
min = Math.min(min, child.minimums[i]);
|
|
15186
|
+
max = Math.max(max, child.maximums[i]);
|
|
15187
|
+
}
|
|
15188
|
+
populated += child.populatedCellCounts[i];
|
|
15189
|
+
complete += child.completeCellCounts[i];
|
|
15190
|
+
}
|
|
15191
|
+
}
|
|
15192
|
+
next.minimums[id] = populated ? min : 0;
|
|
15193
|
+
next.maximums[id] = populated ? max : 0;
|
|
15194
|
+
next.populatedCellCounts[id] = populated;
|
|
15195
|
+
next.completeCellCounts[id] = complete;
|
|
15196
|
+
parents.add(Math.floor(y / 2) * Math.ceil(next.width / 2) + Math.floor(x / 2));
|
|
15197
|
+
}
|
|
15198
|
+
levels[l] = next;
|
|
15199
|
+
ids = parents;
|
|
15200
|
+
}
|
|
15201
|
+
return { field, levels, updatedCounts: Uint32Array.from(counts) };
|
|
15202
|
+
}
|
|
15203
|
+
|
|
15204
|
+
// dist/terrain/gradient-pyramid-regions.js
|
|
15205
|
+
function updateTerrainGradientPyramidRegions(previous, grid, dirty, options = {}) {
|
|
15206
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
15207
|
+
if (![limit, budget].every(Number.isSafeInteger) || limit < 0 || budget < 0 || !Number.isSafeInteger(grid.width) || grid.width < 1 || !Number.isSafeInteger(grid.height) || grid.height < 1 || grid.width * grid.height > limit)
|
|
15208
|
+
throw new Error("Invalid gradient region capacity");
|
|
15209
|
+
if (grid.method !== "horn" && grid.method !== "zevenbergen-thorne" || grid.registration !== "vertex" && grid.registration !== "cell" || typeof grid.heightReference !== "string" || ![grid.origin, grid.columnStep, grid.rowStep].every((v) => v.length === 2 && v.every(Number.isFinite)))
|
|
15210
|
+
throw new Error("Invalid gradient region metadata");
|
|
15211
|
+
validateTerrainDirtyWindows(dirty, grid.width, grid.height);
|
|
15212
|
+
const old = previous == null ? void 0 : previous.source;
|
|
15213
|
+
if (!old || old.width !== grid.width || old.height !== grid.height || old.method !== grid.method || old.registration !== grid.registration || old.heightReference !== grid.heightReference || !old.origin.every((v, i) => v === grid.origin[i]) || !old.columnStep.every((v, i) => v === grid.columnStep[i]) || !old.rowStep.every((v, i) => v === grid.rowStep[i])) {
|
|
15214
|
+
const pyramid = createTerrainGradientPyramid(grid, { maxSamples: limit });
|
|
15215
|
+
return {
|
|
15216
|
+
source: grid,
|
|
15217
|
+
pyramid,
|
|
15218
|
+
updatedCounts: Uint32Array.from(pyramid.levels, (l) => l.width * l.height)
|
|
15219
|
+
};
|
|
15220
|
+
}
|
|
15221
|
+
if (!(grid.gradients instanceof Float64Array) || grid.gradients.length !== 2 * grid.width * grid.height || !(grid.statuses instanceof Uint8Array) || grid.statuses.length !== grid.width * grid.height)
|
|
15222
|
+
throw new Error("Invalid gradient region buffers");
|
|
15223
|
+
const levels = previous.pyramid.levels.slice();
|
|
15224
|
+
let tests = 0;
|
|
15225
|
+
const charge = () => {
|
|
15226
|
+
if (++tests > budget)
|
|
15227
|
+
throw new Error("Gradient region work budget exceeded");
|
|
15228
|
+
};
|
|
15229
|
+
let ids = terrainDirtyIndices(dirty, grid.width, grid.height, 0, charge);
|
|
15230
|
+
const counts = [];
|
|
15231
|
+
for (let l = 0; l < levels.length; l++) {
|
|
15232
|
+
counts.push(ids.size);
|
|
15233
|
+
if (!ids.size)
|
|
15234
|
+
continue;
|
|
15235
|
+
const oldLevel = levels[l], next = {
|
|
15236
|
+
...oldLevel,
|
|
15237
|
+
gradients: oldLevel.gradients.slice(),
|
|
15238
|
+
validCounts: oldLevel.validCounts.slice(),
|
|
15239
|
+
sampleCounts: oldLevel.sampleCounts
|
|
15240
|
+
};
|
|
15241
|
+
const parents = /* @__PURE__ */ new Set();
|
|
15242
|
+
for (const id of ids) {
|
|
15243
|
+
charge();
|
|
15244
|
+
const x = id % next.width, y = Math.floor(id / next.width);
|
|
15245
|
+
next.validCounts[id] = 0;
|
|
15246
|
+
next.gradients[2 * id] = next.gradients[2 * id + 1] = 0;
|
|
15247
|
+
if (l === 0) {
|
|
15248
|
+
if (grid.statuses[id] > 6)
|
|
15249
|
+
throw new Error("Invalid terrain gradient status");
|
|
15250
|
+
if (grid.statuses[id] === 0) {
|
|
15251
|
+
if (!Number.isFinite(grid.gradients[2 * id]) || !Number.isFinite(grid.gradients[2 * id + 1]))
|
|
15252
|
+
throw new Error("Invalid terrain gradient value");
|
|
15253
|
+
next.validCounts[id] = 1;
|
|
15254
|
+
next.gradients[2 * id] = grid.gradients[2 * id];
|
|
15255
|
+
next.gradients[2 * id + 1] = grid.gradients[2 * id + 1];
|
|
15256
|
+
}
|
|
15257
|
+
} else {
|
|
15258
|
+
const child = levels[l - 1];
|
|
15259
|
+
for (let dy = 0; dy < 2; dy++)
|
|
15260
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
15261
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
15262
|
+
if (cx >= child.width || cy >= child.height)
|
|
15263
|
+
continue;
|
|
15264
|
+
const i = cy * child.width + cx, n = child.validCounts[i], count = next.validCounts[id];
|
|
15265
|
+
if (n) {
|
|
15266
|
+
const total = count + n;
|
|
15267
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
15268
|
+
const a = next.gradients[2 * id + axis], b = child.gradients[2 * i + axis];
|
|
15269
|
+
next.gradients[2 * id + axis] = count ? a * (count / total) + b * (n / total) : b;
|
|
15270
|
+
}
|
|
15271
|
+
next.validCounts[id] = total;
|
|
15272
|
+
}
|
|
15273
|
+
}
|
|
15274
|
+
}
|
|
15275
|
+
parents.add(Math.floor(y / 2) * Math.ceil(next.width / 2) + Math.floor(x / 2));
|
|
15276
|
+
}
|
|
15277
|
+
levels[l] = next;
|
|
15278
|
+
ids = parents;
|
|
15279
|
+
}
|
|
15280
|
+
return {
|
|
15281
|
+
source: grid,
|
|
15282
|
+
pyramid: { ...previous.pyramid, levels },
|
|
15283
|
+
updatedCounts: Uint32Array.from(counts)
|
|
15284
|
+
};
|
|
15285
|
+
}
|
|
15286
|
+
|
|
15287
|
+
// dist/terrain/persistent-hierarchy-data.js
|
|
15288
|
+
function getTerrainHierarchyNode(level, column, row) {
|
|
15289
|
+
if (!Number.isSafeInteger(level.width) || level.width < 1 || !Number.isSafeInteger(level.height) || level.height < 1 || !Number.isSafeInteger(level.nodesPerBlock) || level.nodesPerBlock < 1 || !Array.isArray(level.blocks))
|
|
15290
|
+
throw new Error("Invalid persistent hierarchy level");
|
|
15291
|
+
if (!Number.isSafeInteger(column) || !Number.isSafeInteger(row) || column < 0 || row < 0 || column >= level.width || row >= level.height)
|
|
15292
|
+
throw new Error("Invalid persistent hierarchy node");
|
|
15293
|
+
const id = row * level.width + column, block = level.blocks[Math.floor(id / level.nodesPerBlock)], i = block ? 2 * (id - block.offset) : -1;
|
|
15294
|
+
const expectedOffset = Math.floor(id / level.nodesPerBlock) * level.nodesPerBlock;
|
|
15295
|
+
if (!block || block.offset !== expectedOffset || block.count !== Math.min(level.nodesPerBlock, level.width * level.height - expectedOffset) || !(block.values instanceof Float64Array) || !(block.counts instanceof Uint32Array) || block.values.length !== 2 * block.count || block.counts.length !== 2 * block.count)
|
|
15296
|
+
throw new Error("Invalid persistent hierarchy block");
|
|
15297
|
+
return {
|
|
15298
|
+
values: [block.values[i], block.values[i + 1]],
|
|
15299
|
+
counts: [block.counts[i], block.counts[i + 1]]
|
|
15300
|
+
};
|
|
15301
|
+
}
|
|
15302
|
+
function packTerrainHierarchyLevel(width, height, blockSize, values, counts, nodesPerBlock) {
|
|
15303
|
+
if (values.length !== 2 * width * height || counts.length !== values.length || !values.every(Number.isFinite))
|
|
15304
|
+
throw new Error("Invalid persistent hierarchy buffers");
|
|
15305
|
+
const blocks = [];
|
|
15306
|
+
for (let offset2 = 0; offset2 < width * height; offset2 += nodesPerBlock) {
|
|
15307
|
+
const count = Math.min(nodesPerBlock, width * height - offset2);
|
|
15308
|
+
blocks.push({
|
|
15309
|
+
offset: offset2,
|
|
15310
|
+
count,
|
|
15311
|
+
values: values.slice(2 * offset2, 2 * (offset2 + count)),
|
|
15312
|
+
counts: counts.slice(2 * offset2, 2 * (offset2 + count))
|
|
15313
|
+
});
|
|
15314
|
+
}
|
|
15315
|
+
return { width, height, blockSize, nodesPerBlock, blocks };
|
|
15316
|
+
}
|
|
15317
|
+
function persistentHierarchyOptions(options, count) {
|
|
15318
|
+
const nodesPerBlock = options.nodesPerBlock ?? 256, maxSamples = options.maxSamples ?? 4e6, maxTests = options.maxTests ?? 1e7;
|
|
15319
|
+
if (![nodesPerBlock, maxSamples, maxTests, count].every(Number.isSafeInteger) || nodesPerBlock < 1 || maxSamples < 0 || maxTests < 0 || count < 1 || count > maxSamples)
|
|
15320
|
+
throw new Error("Invalid persistent terrain hierarchy capacity");
|
|
15321
|
+
let tests = 0;
|
|
15322
|
+
return {
|
|
15323
|
+
nodesPerBlock,
|
|
15324
|
+
maxSamples,
|
|
15325
|
+
charge: () => {
|
|
15326
|
+
if (++tests > maxTests)
|
|
15327
|
+
throw new Error("Persistent hierarchy work budget exceeded");
|
|
15328
|
+
}
|
|
15329
|
+
};
|
|
15330
|
+
}
|
|
15331
|
+
function updatePersistentHierarchy(previous, ids, mode, base, charge) {
|
|
15332
|
+
const levels = previous.slice(), updatedNodes = [];
|
|
15333
|
+
let copiedBlocks = 0, copiedBytes = 0;
|
|
15334
|
+
for (let l = 0; l < levels.length; l++) {
|
|
15335
|
+
updatedNodes.push(ids.size);
|
|
15336
|
+
if (!ids.size)
|
|
15337
|
+
continue;
|
|
15338
|
+
const old = levels[l], blocks = old.blocks.slice(), cloned = /* @__PURE__ */ new Set(), parents = /* @__PURE__ */ new Set();
|
|
15339
|
+
const node = (level, x, y) => getTerrainHierarchyNode(level, x, y);
|
|
15340
|
+
for (const id of ids) {
|
|
15341
|
+
charge();
|
|
15342
|
+
const x = id % old.width, y = Math.floor(id / old.width);
|
|
15343
|
+
let value3;
|
|
15344
|
+
if (l === 0)
|
|
15345
|
+
value3 = base(x, y);
|
|
15346
|
+
else {
|
|
15347
|
+
const child = levels[l - 1];
|
|
15348
|
+
let a = mode === "bounds" ? Infinity : 0, b = mode === "bounds" ? -Infinity : 0, c = 0, d = 0;
|
|
15349
|
+
for (let dy = 0; dy < 2; dy++)
|
|
15350
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
15351
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
15352
|
+
if (cx >= child.width || cy >= child.height)
|
|
15353
|
+
continue;
|
|
15354
|
+
const v = node(child, cx, cy), n = v.counts[0];
|
|
15355
|
+
d += v.counts[1];
|
|
15356
|
+
if (n) {
|
|
15357
|
+
if (mode === "bounds") {
|
|
15358
|
+
a = Math.min(a, v.values[0]);
|
|
15359
|
+
b = Math.max(b, v.values[1]);
|
|
15360
|
+
} else {
|
|
15361
|
+
const total = c + n;
|
|
15362
|
+
a = c ? a * (c / total) + v.values[0] * (n / total) : v.values[0];
|
|
15363
|
+
b = c ? b * (c / total) + v.values[1] * (n / total) : v.values[1];
|
|
15364
|
+
}
|
|
15365
|
+
c += n;
|
|
15366
|
+
}
|
|
15367
|
+
}
|
|
15368
|
+
if (c && (!Number.isFinite(a) || !Number.isFinite(b)))
|
|
15369
|
+
throw new Error("Persistent hierarchy arithmetic overflow");
|
|
15370
|
+
value3 = { values: c ? [a, b] : [0, 0], counts: [c, d] };
|
|
15371
|
+
}
|
|
15372
|
+
const blockId = Math.floor(id / old.nodesPerBlock);
|
|
15373
|
+
if (!cloned.has(blockId)) {
|
|
15374
|
+
const source = blocks[blockId];
|
|
15375
|
+
blocks[blockId] = { ...source, values: source.values.slice(), counts: source.counts.slice() };
|
|
15376
|
+
cloned.add(blockId);
|
|
15377
|
+
copiedBlocks++;
|
|
15378
|
+
copiedBytes += blocks[blockId].values.byteLength + blocks[blockId].counts.byteLength;
|
|
15379
|
+
}
|
|
15380
|
+
const block = blocks[blockId], i = 2 * (id - block.offset);
|
|
15381
|
+
block.values[i] = value3.values[0];
|
|
15382
|
+
block.values[i + 1] = value3.values[1];
|
|
15383
|
+
block.counts[i] = value3.counts[0];
|
|
15384
|
+
block.counts[i + 1] = value3.counts[1];
|
|
15385
|
+
parents.add(Math.floor(y / 2) * Math.ceil(old.width / 2) + Math.floor(x / 2));
|
|
15386
|
+
}
|
|
15387
|
+
levels[l] = { ...old, blocks };
|
|
15388
|
+
ids = parents;
|
|
15389
|
+
}
|
|
15390
|
+
return { levels, stats: { copiedBlocks, copiedBytes, updatedNodes: Uint32Array.from(updatedNodes) } };
|
|
15391
|
+
}
|
|
15392
|
+
|
|
15393
|
+
// dist/terrain/persistent-bounds.js
|
|
15394
|
+
function updateTerrainPersistentBounds(previous, field, dirty, options = {}) {
|
|
15395
|
+
const { nodesPerBlock, charge } = persistentHierarchyOptions(options, field.width * field.height);
|
|
15396
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
15397
|
+
if (!previous || !sameTerrainFrame(previous.field, field) || previous.levels[0].nodesPerBlock !== nodesPerBlock) {
|
|
15398
|
+
const bounds = new HeightFieldMinMax(field), levels = Array.from({ length: bounds.levelCount }, (_, i) => {
|
|
15399
|
+
const l = bounds.copyLevel(i), values = new Float64Array(2 * l.width * l.height), counts = new Uint32Array(values.length);
|
|
15400
|
+
for (let j = 0; j < l.width * l.height; j++) {
|
|
15401
|
+
values[2 * j] = l.minimums[j];
|
|
15402
|
+
values[2 * j + 1] = l.maximums[j];
|
|
15403
|
+
counts[2 * j] = l.populatedCellCounts[j];
|
|
15404
|
+
counts[2 * j + 1] = l.completeCellCounts[j];
|
|
15405
|
+
}
|
|
15406
|
+
return packTerrainHierarchyLevel(l.width, l.height, l.blockSize, values, counts, nodesPerBlock);
|
|
15407
|
+
});
|
|
15408
|
+
return {
|
|
15409
|
+
field,
|
|
15410
|
+
levels,
|
|
15411
|
+
stats: {
|
|
15412
|
+
copiedBlocks: levels.reduce((n, l) => n + l.blocks.length, 0),
|
|
15413
|
+
copiedBytes: levels.reduce((n, l) => n + l.blocks.reduce((s, b) => s + b.values.byteLength + b.counts.byteLength, 0), 0),
|
|
15414
|
+
updatedNodes: Uint32Array.from(levels, (l) => l.width * l.height)
|
|
15415
|
+
}
|
|
15416
|
+
};
|
|
15417
|
+
}
|
|
15418
|
+
const ids = terrainDirtyIndices(dirty, field.width - 1, field.height - 1, 1, charge);
|
|
15419
|
+
const result = updatePersistentHierarchy(previous.levels, ids, "bounds", (x, y) => {
|
|
15420
|
+
let min = Infinity, max = -Infinity, n = 0;
|
|
15421
|
+
for (let dy = 0; dy < 2; dy++)
|
|
15422
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
15423
|
+
const z = field.getHeight(x + dx, y + dy);
|
|
15424
|
+
if (z !== void 0) {
|
|
15425
|
+
min = Math.min(min, z);
|
|
15426
|
+
max = Math.max(max, z);
|
|
15427
|
+
n++;
|
|
15428
|
+
}
|
|
15429
|
+
}
|
|
15430
|
+
return { values: n ? [min, max] : [0, 0], counts: [n ? 1 : 0, n === 4 ? 1 : 0] };
|
|
15431
|
+
}, charge);
|
|
15432
|
+
return { field, ...result };
|
|
15433
|
+
}
|
|
15434
|
+
|
|
15435
|
+
// dist/terrain/persistent-gradients.js
|
|
15436
|
+
function updateTerrainPersistentGradients(previous, grid, dirty, options = {}) {
|
|
15437
|
+
const { nodesPerBlock, maxSamples, charge } = persistentHierarchyOptions(options, grid.width * grid.height);
|
|
15438
|
+
if (!Number.isSafeInteger(grid.width) || grid.width < 1 || !Number.isSafeInteger(grid.height) || grid.height < 1 || !(grid.gradients instanceof Float64Array) || grid.gradients.length !== 2 * grid.width * grid.height || !(grid.statuses instanceof Uint8Array) || grid.statuses.length !== grid.width * grid.height || grid.method !== "horn" && grid.method !== "zevenbergen-thorne" || grid.registration !== "vertex" && grid.registration !== "cell" || typeof grid.heightReference !== "string" || ![grid.origin, grid.columnStep, grid.rowStep].every((v) => v.length === 2 && v.every(Number.isFinite)))
|
|
15439
|
+
throw new Error("Invalid persistent gradient grid");
|
|
15440
|
+
validateTerrainDirtyWindows(dirty, grid.width, grid.height);
|
|
15441
|
+
const old = previous == null ? void 0 : previous.source;
|
|
15442
|
+
if (!old || old.width !== grid.width || old.height !== grid.height || old.method !== grid.method || old.registration !== grid.registration || old.heightReference !== grid.heightReference || !old.origin.every((v, i) => v === grid.origin[i]) || !old.columnStep.every((v, i) => v === grid.columnStep[i]) || !old.rowStep.every((v, i) => v === grid.rowStep[i]) || previous.levels[0].nodesPerBlock !== nodesPerBlock) {
|
|
15443
|
+
const pyramid = createTerrainGradientPyramid(grid, { maxSamples }), levels = pyramid.levels.map((l) => {
|
|
15444
|
+
const counts = new Uint32Array(2 * l.width * l.height);
|
|
15445
|
+
for (let i = 0; i < l.width * l.height; i++) {
|
|
15446
|
+
counts[2 * i] = l.validCounts[i];
|
|
15447
|
+
counts[2 * i + 1] = l.sampleCounts[i];
|
|
15448
|
+
}
|
|
15449
|
+
return packTerrainHierarchyLevel(l.width, l.height, l.blockSize, l.gradients, counts, nodesPerBlock);
|
|
15450
|
+
});
|
|
15451
|
+
return {
|
|
15452
|
+
source: grid,
|
|
15453
|
+
levels,
|
|
15454
|
+
stats: {
|
|
15455
|
+
copiedBlocks: levels.reduce((n, l) => n + l.blocks.length, 0),
|
|
15456
|
+
copiedBytes: levels.reduce((n, l) => n + l.blocks.reduce((s, b) => s + b.values.byteLength + b.counts.byteLength, 0), 0),
|
|
15457
|
+
updatedNodes: Uint32Array.from(levels, (l) => l.width * l.height)
|
|
15458
|
+
}
|
|
15459
|
+
};
|
|
15460
|
+
}
|
|
15461
|
+
const ids = terrainDirtyIndices(dirty, grid.width, grid.height, 0, charge);
|
|
15462
|
+
const result = updatePersistentHierarchy(previous.levels, ids, "gradient", (x, y) => {
|
|
15463
|
+
const i = y * grid.width + x, s = grid.statuses[i];
|
|
15464
|
+
if (s > 6)
|
|
15465
|
+
throw new Error("Invalid terrain gradient status");
|
|
15466
|
+
if (s === 0 && (!Number.isFinite(grid.gradients[2 * i]) || !Number.isFinite(grid.gradients[2 * i + 1])))
|
|
15467
|
+
throw new Error("Invalid terrain gradient value");
|
|
15468
|
+
return {
|
|
15469
|
+
values: s === 0 ? [grid.gradients[2 * i], grid.gradients[2 * i + 1]] : [0, 0],
|
|
15470
|
+
counts: [s === 0 ? 1 : 0, 1]
|
|
15471
|
+
};
|
|
15472
|
+
}, charge);
|
|
15473
|
+
return { source: grid, ...result };
|
|
15474
|
+
}
|
|
15475
|
+
|
|
15476
|
+
// dist/terrain/lod-morph.js
|
|
15477
|
+
var TerrainMorphStatus = {
|
|
15478
|
+
VALID: 0,
|
|
15479
|
+
FINE_NO_DATA: 1,
|
|
15480
|
+
COARSE_NO_DATA: 2,
|
|
15481
|
+
OUTSIDE_COARSE: 3
|
|
15482
|
+
};
|
|
15483
|
+
function createTerrainLodMorph(fine, coarse, options) {
|
|
15484
|
+
const { ratio: ratio2 } = options, offset2 = options.coarseOrigin ?? [0, 0], limit = options.maxSamples ?? 4e6, count = fine.width * fine.height;
|
|
15485
|
+
if (!Number.isSafeInteger(ratio2) || ratio2 < 2 || 2 ** Math.round(Math.log2(ratio2)) !== ratio2 || offset2.length !== 2 || !offset2.every(Number.isSafeInteger) || !Number.isSafeInteger(limit) || limit < 0 || count > limit)
|
|
15486
|
+
throw new Error("Invalid terrain LOD ratio, origin or sample capacity");
|
|
15487
|
+
if (fine.registration !== "vertex" || coarse.registration !== "vertex" || fine.diagonal !== coarse.diagonal || fine.heightReference !== coarse.heightReference)
|
|
15488
|
+
throw new Error("Incompatible terrain LOD registration, diagonal or height reference");
|
|
15489
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
15490
|
+
if (fine.columnStep[axis] * ratio2 !== coarse.columnStep[axis] || fine.rowStep[axis] * ratio2 !== coarse.rowStep[axis])
|
|
15491
|
+
throw new Error("Terrain LOD steps differ");
|
|
15492
|
+
const a = offset2[0] * fine.columnStep[axis], b = offset2[1] * fine.rowStep[axis], expected = fine.origin[axis] + a + b;
|
|
15493
|
+
const tolerance = Math.min(16 * Number.EPSILON * Math.max(1, Math.abs(fine.origin[axis]), Math.abs(coarse.origin[axis]), Math.abs(a), Math.abs(b)), 1e-9 * Math.max(Math.abs(fine.columnStep[axis]), Math.abs(fine.rowStep[axis])));
|
|
15494
|
+
if (!Number.isFinite(expected) || Math.abs(coarse.origin[axis] - expected) > tolerance)
|
|
15495
|
+
throw new Error("Terrain LOD origins differ");
|
|
15496
|
+
}
|
|
15497
|
+
const fineHeights = new Float64Array(count), coarseHeights = new Float64Array(count), deltas = new Float64Array(count), statuses = new Uint8Array(count), coarseCoordinates = new Float64Array(2 * count);
|
|
15498
|
+
let maxNodalDisplacement = 0;
|
|
15499
|
+
for (let y = 0; y < fine.height; y++)
|
|
15500
|
+
for (let x = 0; x < fine.width; x++) {
|
|
15501
|
+
const i = y * fine.width + x, u = (x - offset2[0]) / ratio2, v = (y - offset2[1]) / ratio2;
|
|
15502
|
+
if (!Number.isSafeInteger(x - offset2[0]) || !Number.isSafeInteger(y - offset2[1]))
|
|
15503
|
+
throw new Error("Terrain LOD lattice overflow");
|
|
15504
|
+
coarseCoordinates[2 * i] = u;
|
|
15505
|
+
coarseCoordinates[2 * i + 1] = v;
|
|
15506
|
+
const source = fine.getHeight(x, y);
|
|
15507
|
+
if (source === void 0) {
|
|
15508
|
+
statuses[i] = TerrainMorphStatus.FINE_NO_DATA;
|
|
15509
|
+
continue;
|
|
15510
|
+
}
|
|
15511
|
+
fineHeights[i] = source;
|
|
15512
|
+
if (u < 0 || v < 0 || u > coarse.width - 1 || v > coarse.height - 1) {
|
|
15513
|
+
statuses[i] = TerrainMorphStatus.OUTSIDE_COARSE;
|
|
15514
|
+
continue;
|
|
15515
|
+
}
|
|
15516
|
+
const target = sampleTerrainTriangleHeight(coarse, u, v);
|
|
15517
|
+
if (target === void 0) {
|
|
15518
|
+
statuses[i] = TerrainMorphStatus.COARSE_NO_DATA;
|
|
15519
|
+
continue;
|
|
15520
|
+
}
|
|
15521
|
+
const delta = target - source;
|
|
15522
|
+
if (!Number.isFinite(delta))
|
|
15523
|
+
throw new Error("Terrain LOD displacement overflow");
|
|
15524
|
+
coarseHeights[i] = target;
|
|
15525
|
+
deltas[i] = delta;
|
|
15526
|
+
maxNodalDisplacement = Math.max(maxNodalDisplacement, Math.abs(delta));
|
|
15527
|
+
}
|
|
15528
|
+
return {
|
|
15529
|
+
width: fine.width,
|
|
15530
|
+
height: fine.height,
|
|
15531
|
+
origin: [...fine.origin],
|
|
15532
|
+
columnStep: [...fine.columnStep],
|
|
15533
|
+
rowStep: [...fine.rowStep],
|
|
15534
|
+
heightReference: fine.heightReference,
|
|
15535
|
+
fineHeights,
|
|
15536
|
+
coarseHeights,
|
|
15537
|
+
deltas,
|
|
15538
|
+
statuses,
|
|
15539
|
+
coarseCoordinates,
|
|
15540
|
+
maxNodalDisplacement,
|
|
15541
|
+
ratio: ratio2,
|
|
15542
|
+
coarseOrigin: [...offset2],
|
|
15543
|
+
diagonal: fine.diagonal
|
|
15544
|
+
};
|
|
15545
|
+
}
|
|
15546
|
+
|
|
15547
|
+
// dist/terrain/lod-morph-evaluate.js
|
|
15548
|
+
function evaluateTerrainLodMorph(morph, factor) {
|
|
15549
|
+
const count = morph.width * morph.height;
|
|
15550
|
+
if (!Number.isFinite(factor) || factor < 0 || factor > 1 || !Number.isSafeInteger(count) || count < 1 || morph.fineHeights.length !== count || morph.coarseHeights.length !== count || morph.statuses.length !== count)
|
|
15551
|
+
throw new Error("Invalid terrain morph evaluation");
|
|
15552
|
+
const heights = new Float64Array(count), validity = new Uint8Array(count);
|
|
15553
|
+
for (let i = 0; i < count; i++) {
|
|
15554
|
+
if (morph.statuses[i] > 3)
|
|
15555
|
+
throw new Error("Invalid terrain morph status");
|
|
15556
|
+
if (morph.statuses[i] !== 0)
|
|
15557
|
+
continue;
|
|
15558
|
+
const a = morph.fineHeights[i], b = morph.coarseHeights[i];
|
|
15559
|
+
if (!Number.isFinite(a) || !Number.isFinite(b))
|
|
15560
|
+
throw new Error("Invalid terrain morph height");
|
|
15561
|
+
heights[i] = factor === 0 ? a : factor === 1 ? b : a * (1 - factor) + b * factor;
|
|
15562
|
+
if (!Number.isFinite(heights[i]))
|
|
15563
|
+
throw new Error("Terrain morph arithmetic overflow");
|
|
15564
|
+
validity[i] = 1;
|
|
15565
|
+
}
|
|
15566
|
+
return { heights, validity };
|
|
15567
|
+
}
|
|
15568
|
+
|
|
15569
|
+
// dist/terrain/mixed-surface.js
|
|
15570
|
+
function reconcileMixedSurface(tiles, options = {}) {
|
|
15571
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 2e7, adjustment = options.maxHeightAdjustment ?? 0;
|
|
15572
|
+
if (![limit, budget].every(Number.isSafeInteger) || limit < 0 || budget < 0 || Number.isNaN(adjustment) || adjustment < 0)
|
|
15573
|
+
throw new Error("Invalid mixed surface capacity or adjustment");
|
|
15574
|
+
let count = 0, tests = 0, maxHeightAdjustment = 0, sharedSamples = 0;
|
|
15575
|
+
const charge = () => {
|
|
15576
|
+
if (++tests > budget)
|
|
15577
|
+
throw new Error("Mixed surface work budget exceeded");
|
|
15578
|
+
};
|
|
15579
|
+
const seen = /* @__PURE__ */ new Set();
|
|
15580
|
+
const sorted = [...tiles].sort((a, b) => b.spacing - a.spacing || a.column - b.column || a.row - b.row);
|
|
15581
|
+
const sources = sorted.map((t) => {
|
|
15582
|
+
if (![t.column, t.row, t.spacing].every(Number.isSafeInteger) || t.spacing < 1 || 2 ** Math.round(Math.log2(t.spacing)) !== t.spacing)
|
|
15583
|
+
throw new Error("Invalid mixed surface lattice");
|
|
15584
|
+
const key3 = `${t.spacing}/${t.column}/${t.row}`;
|
|
15585
|
+
if (seen.has(key3))
|
|
15586
|
+
throw new Error("Duplicate mixed surface tile");
|
|
15587
|
+
seen.add(key3);
|
|
15588
|
+
const width = (t.field.width - 1) * t.spacing + 1, height = (t.field.height - 1) * t.spacing + 1;
|
|
15589
|
+
count += width * height;
|
|
15590
|
+
if (![width, height, count, t.column + width - 1, t.row + height - 1].every(Number.isSafeInteger) || width < 2 || height < 2 || count > limit)
|
|
15591
|
+
throw new Error("Mixed surface sample capacity or lattice overflow");
|
|
15592
|
+
const field = new HeightField(t.field);
|
|
15593
|
+
if (field.registration !== "vertex")
|
|
15594
|
+
throw new Error("Mixed surfaces require vertex registration");
|
|
15595
|
+
return { ...t, field, width, height };
|
|
15596
|
+
});
|
|
15597
|
+
const first = sources[0];
|
|
15598
|
+
const columnStep = (first == null ? void 0 : first.field.columnStep.map((v) => v / first.spacing)) ?? [1, 0], rowStep = (first == null ? void 0 : first.field.rowStep.map((v) => v / first.spacing)) ?? [0, 1];
|
|
15599
|
+
const origin = (first == null ? void 0 : first.field.origin.map((v, i) => v - first.column * columnStep[i] - first.row * rowStep[i])) ?? [0, 0];
|
|
15600
|
+
if (!origin.every(Number.isFinite))
|
|
15601
|
+
throw new Error("Mixed surface frame overflow");
|
|
15602
|
+
for (const t of sources)
|
|
15603
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
15604
|
+
const expected = origin[axis] + t.column * columnStep[axis] + t.row * rowStep[axis];
|
|
15605
|
+
const tolerance = Math.min(32 * Number.EPSILON * Math.max(1, Math.abs(t.field.origin[axis]), Math.abs(origin[axis]), Math.abs(t.column * columnStep[axis]), Math.abs(t.row * rowStep[axis])), 1e-9 * Math.max(Math.abs(columnStep[axis]), Math.abs(rowStep[axis])));
|
|
15606
|
+
if (t.field.diagonal !== first.field.diagonal || t.field.heightReference !== first.field.heightReference || t.field.columnStep[axis] / t.spacing !== columnStep[axis] || t.field.rowStep[axis] / t.spacing !== rowStep[axis] || !Number.isFinite(expected) || Math.abs(t.field.origin[axis] - expected) > tolerance)
|
|
15607
|
+
throw new Error("Mixed surface frames, diagonals or height references differ");
|
|
15608
|
+
}
|
|
15609
|
+
for (const axis of ["column", "row"]) {
|
|
15610
|
+
let min = Infinity, max = -Infinity;
|
|
15611
|
+
for (const t of sources) {
|
|
15612
|
+
min = Math.min(min, t[axis]);
|
|
15613
|
+
max = Math.max(max, t[axis] + (axis === "column" ? t.width : t.height) - 1);
|
|
15614
|
+
}
|
|
15615
|
+
if (sources.length && !Number.isSafeInteger(max - min))
|
|
15616
|
+
throw new Error("Mixed surface lattice span overflow");
|
|
15617
|
+
}
|
|
15618
|
+
const boxes = sources.map((t) => ({
|
|
15619
|
+
minX: t.column,
|
|
15620
|
+
minY: t.row,
|
|
15621
|
+
maxX: t.column + t.width - 1,
|
|
15622
|
+
maxY: t.row + t.height - 1
|
|
15623
|
+
})), index = createTerrainBoxIndex(boxes);
|
|
15624
|
+
const neighbors = boxes.map((box, i) => index(box, charge).filter((j) => {
|
|
15625
|
+
if (i !== j && box.minX < boxes[j].maxX && boxes[j].minX < box.maxX && box.minY < boxes[j].maxY && boxes[j].minY < box.maxY)
|
|
15626
|
+
throw new Error("Overlapping mixed surface interiors");
|
|
15627
|
+
return j !== i;
|
|
15628
|
+
}));
|
|
15629
|
+
const fields = sources.map((t, i) => {
|
|
15630
|
+
const heights = new Float64Array(t.width * t.height), validity = new Uint8Array(heights.length);
|
|
15631
|
+
for (let y = 0; y < t.height; y++)
|
|
15632
|
+
for (let x = 0; x < t.width; x++) {
|
|
15633
|
+
charge();
|
|
15634
|
+
const gx = t.column + x, gy = t.row + y, local = sampleTerrainTriangleHeight(t.field, x / t.spacing, y / t.spacing);
|
|
15635
|
+
let owner = i, shared2 = false, missing = local === void 0;
|
|
15636
|
+
if (x === 0 || y === 0 || x === t.width - 1 || y === t.height - 1)
|
|
15637
|
+
for (const j of neighbors[i]) {
|
|
15638
|
+
charge();
|
|
15639
|
+
const b = boxes[j];
|
|
15640
|
+
if (gx >= b.minX && gx <= b.maxX && gy >= b.minY && gy <= b.maxY) {
|
|
15641
|
+
shared2 = true;
|
|
15642
|
+
const neighbor = sources[j];
|
|
15643
|
+
if (sampleTerrainTriangleHeight(neighbor.field, (gx - neighbor.column) / neighbor.spacing, (gy - neighbor.row) / neighbor.spacing) === void 0)
|
|
15644
|
+
missing = true;
|
|
15645
|
+
owner = Math.min(owner, j);
|
|
15646
|
+
}
|
|
15647
|
+
}
|
|
15648
|
+
const source = sources[owner], value3 = missing ? void 0 : owner === i ? local : sampleTerrainTriangleHeight(source.field, (gx - source.column) / source.spacing, (gy - source.row) / source.spacing);
|
|
15649
|
+
if (shared2)
|
|
15650
|
+
sharedSamples++;
|
|
15651
|
+
if (local !== void 0 && value3 !== void 0) {
|
|
15652
|
+
const delta = Math.abs(value3 - local);
|
|
15653
|
+
if (!Number.isFinite(delta) || delta > adjustment)
|
|
15654
|
+
throw new Error("Mixed surface height adjustment exceeded");
|
|
15655
|
+
maxHeightAdjustment = Math.max(maxHeightAdjustment, delta);
|
|
15656
|
+
}
|
|
15657
|
+
if (value3 !== void 0) {
|
|
15658
|
+
const id = y * t.width + x;
|
|
15659
|
+
heights[id] = value3;
|
|
15660
|
+
validity[id] = 1;
|
|
15661
|
+
}
|
|
15662
|
+
}
|
|
15663
|
+
const props = {
|
|
15664
|
+
width: t.width,
|
|
15665
|
+
height: t.height,
|
|
15666
|
+
heights,
|
|
15667
|
+
validity,
|
|
15668
|
+
origin: [
|
|
15669
|
+
origin[0] + t.column * columnStep[0] + t.row * rowStep[0],
|
|
15670
|
+
origin[1] + t.column * columnStep[1] + t.row * rowStep[1]
|
|
15671
|
+
],
|
|
15672
|
+
columnStep: [...columnStep],
|
|
15673
|
+
rowStep: [...rowStep],
|
|
15674
|
+
registration: "vertex",
|
|
15675
|
+
diagonal: t.field.diagonal,
|
|
15676
|
+
heightReference: t.field.heightReference
|
|
15677
|
+
};
|
|
15678
|
+
return {
|
|
15679
|
+
column: t.column,
|
|
15680
|
+
row: t.row,
|
|
15681
|
+
spacing: 1,
|
|
15682
|
+
sourceSpacing: t.spacing,
|
|
15683
|
+
field: props
|
|
15684
|
+
};
|
|
15685
|
+
});
|
|
15686
|
+
return {
|
|
15687
|
+
origin,
|
|
15688
|
+
columnStep,
|
|
15689
|
+
rowStep,
|
|
15690
|
+
tiles: fields,
|
|
15691
|
+
maxHeightAdjustment,
|
|
15692
|
+
sharedSamples,
|
|
15693
|
+
tests
|
|
15694
|
+
};
|
|
15695
|
+
}
|
|
15696
|
+
|
|
15697
|
+
// dist/terrain/lod-coordinate.js
|
|
15698
|
+
function coordinateTerrainLodMorphs(tiles, options = {}) {
|
|
15699
|
+
const limit = options.maxSamples ?? 4e6;
|
|
15700
|
+
if (!Number.isSafeInteger(limit) || limit < 0)
|
|
15701
|
+
throw new Error("Invalid coordinated morph sample capacity");
|
|
15702
|
+
let count = 0;
|
|
15703
|
+
for (const t of tiles) {
|
|
15704
|
+
count += t.morph.width * t.morph.height;
|
|
15705
|
+
if (!Number.isSafeInteger(count) || count > limit)
|
|
15706
|
+
throw new Error("Coordinated morph sample capacity exceeded");
|
|
15707
|
+
}
|
|
15708
|
+
return reconcileMixedSurface(tiles.map((t) => {
|
|
15709
|
+
const evaluated = evaluateTerrainLodMorph(t.morph, t.factor);
|
|
15710
|
+
return {
|
|
15711
|
+
column: t.column,
|
|
15712
|
+
row: t.row,
|
|
15713
|
+
spacing: t.spacing,
|
|
15714
|
+
field: {
|
|
15715
|
+
...evaluated,
|
|
15716
|
+
width: t.morph.width,
|
|
15717
|
+
height: t.morph.height,
|
|
15718
|
+
origin: t.morph.origin,
|
|
15719
|
+
columnStep: t.morph.columnStep,
|
|
15720
|
+
rowStep: t.morph.rowStep,
|
|
15721
|
+
registration: "vertex",
|
|
15722
|
+
diagonal: t.morph.diagonal,
|
|
15723
|
+
heightReference: t.morph.heightReference
|
|
15724
|
+
}
|
|
15725
|
+
};
|
|
15726
|
+
}), { ...options, maxHeightAdjustment: options.maxHeightAdjustment ?? Infinity });
|
|
15727
|
+
}
|
|
15728
|
+
|
|
15729
|
+
// dist/terrain/isobands-mixed.js
|
|
15730
|
+
function createTerrainMixedIsobands(tiles, levels, options = {}) {
|
|
15731
|
+
const maxLevels = options.maxLevels ?? 256;
|
|
15732
|
+
if (!Number.isSafeInteger(maxLevels) || maxLevels < 2 || levels.length < 2 || levels.length > maxLevels || levels.some((v, i) => !Number.isFinite(v) || i > 0 && v <= levels[i - 1]))
|
|
15733
|
+
throw new Error("Invalid mixed isoband levels or capacity");
|
|
15734
|
+
const triangles = tiles.reduce((n, t) => n + 2 * (t.field.width - 1) * (t.field.height - 1) * t.spacing * t.spacing, 0);
|
|
15735
|
+
const maxTriangles = options.maxTriangles ?? 2e6;
|
|
15736
|
+
if (!Number.isSafeInteger(triangles) || !Number.isSafeInteger(maxTriangles) || maxTriangles < 0 || triangles > maxTriangles)
|
|
15737
|
+
throw new Error("Mixed isoband triangle capacity exceeded");
|
|
15738
|
+
const maxTests = options.maxTests ?? 2e7;
|
|
15739
|
+
const surface2 = reconcileMixedSurface(tiles, { ...options, maxTests });
|
|
15740
|
+
const bands = createTerrainIsobands(surface2.tiles.map((t) => new HeightField(t.field)), levels, { ...options, maxTests: maxTests - surface2.tests });
|
|
15741
|
+
return {
|
|
15742
|
+
...bands,
|
|
15743
|
+
maxHeightAdjustment: surface2.maxHeightAdjustment,
|
|
15744
|
+
sharedSamples: surface2.sharedSamples
|
|
15745
|
+
};
|
|
15746
|
+
}
|
|
14232
15747
|
//# sourceMappingURL=index.cjs.map
|