@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/terrain/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 key2 of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
15
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
@@ -35,23 +35,31 @@ __export(index_exports, {
|
|
|
35
35
|
HeightFieldMinMax: () => HeightFieldMinMax,
|
|
36
36
|
TERRAIN_BUFFER_VERSION: () => TERRAIN_BUFFER_VERSION,
|
|
37
37
|
TerrainContourBoundaryAxis: () => TerrainContourBoundaryAxis,
|
|
38
|
+
TerrainMorphStatus: () => TerrainMorphStatus,
|
|
38
39
|
TerrainProfileViewStatus: () => TerrainProfileViewStatus,
|
|
39
40
|
TerrainSampleStatus: () => TerrainSampleStatus,
|
|
40
41
|
TerrainSurface: () => TerrainSurface,
|
|
41
42
|
TerrainVertexHaloStatus: () => TerrainVertexHaloStatus,
|
|
42
43
|
TiledHeightField: () => TiledHeightField,
|
|
44
|
+
coordinateTerrainLodMorphs: () => coordinateTerrainLodMorphs,
|
|
43
45
|
createDelatinTerrainMesh: () => createDelatinTerrainMesh,
|
|
44
46
|
createMartiniTerrainMesh: () => createMartiniTerrainMesh,
|
|
45
47
|
createTerrainContours: () => createTerrainContours,
|
|
46
48
|
createTerrainFilteredPyramid: () => createTerrainFilteredPyramid,
|
|
47
49
|
createTerrainGradientGrid: () => createTerrainGradientGrid,
|
|
48
50
|
createTerrainGradientPyramid: () => createTerrainGradientPyramid,
|
|
51
|
+
createTerrainIsobands: () => createTerrainIsobands,
|
|
52
|
+
createTerrainLodMorph: () => createTerrainLodMorph,
|
|
49
53
|
createTerrainMesh: () => createTerrainMesh,
|
|
54
|
+
createTerrainMixedIsobands: () => createTerrainMixedIsobands,
|
|
55
|
+
createTerrainMixedVertexTileHalos: () => createTerrainMixedVertexTileHalos,
|
|
50
56
|
createTerrainSkirt: () => createTerrainSkirt,
|
|
51
57
|
createTerrainSlopeAspectGrid: () => createTerrainSlopeAspectGrid,
|
|
52
58
|
createTerrainSurface: () => createTerrainSurface,
|
|
53
59
|
createTerrainVertexTileHalos: () => createTerrainVertexTileHalos,
|
|
54
60
|
diagnoseTerrainContourBoundaries: () => diagnoseTerrainContourBoundaries,
|
|
61
|
+
evaluateTerrainLodMorph: () => evaluateTerrainLodMorph,
|
|
62
|
+
getTerrainHierarchyNode: () => getTerrainHierarchyNode,
|
|
55
63
|
getTerrainMeshEdge: () => getTerrainMeshEdge,
|
|
56
64
|
getTerrainProfileHorizon: () => getTerrainProfileHorizon,
|
|
57
65
|
getTerrainProfileViewshed: () => getTerrainProfileViewshed,
|
|
@@ -64,10 +72,23 @@ __export(index_exports, {
|
|
|
64
72
|
reconcileTerrainVertexTiles: () => reconcileTerrainVertexTiles,
|
|
65
73
|
sampleTerrainProfile: () => sampleTerrainProfile,
|
|
66
74
|
simplifyTerrainContourPaths: () => simplifyTerrainContourPaths,
|
|
75
|
+
simplifyTerrainContourPathsTopology: () => simplifyTerrainContourPathsTopology,
|
|
67
76
|
stitchTerrainContourTiles: () => stitchTerrainContourTiles,
|
|
68
77
|
stitchTerrainContours: () => stitchTerrainContours,
|
|
69
78
|
stitchTerrainMeshEdges: () => stitchTerrainMeshEdges,
|
|
70
79
|
unpackTerrainHeightField: () => unpackTerrainHeightField,
|
|
80
|
+
updateTerrainBounds: () => updateTerrainBounds,
|
|
81
|
+
updateTerrainBoundsRegions: () => updateTerrainBoundsRegions,
|
|
82
|
+
updateTerrainDelatinMeshRegions: () => updateTerrainDelatinMeshRegions,
|
|
83
|
+
updateTerrainGradientPyramidRegions: () => updateTerrainGradientPyramidRegions,
|
|
84
|
+
updateTerrainGradientPyramids: () => updateTerrainGradientPyramids,
|
|
85
|
+
updateTerrainMartiniMeshRegions: () => updateTerrainMartiniMeshRegions,
|
|
86
|
+
updateTerrainMeshRegions: () => updateTerrainMeshRegions,
|
|
87
|
+
updateTerrainMeshes: () => updateTerrainMeshes,
|
|
88
|
+
updateTerrainMixedGradientGrids: () => updateTerrainMixedGradientGrids,
|
|
89
|
+
updateTerrainMixedVertexTileHalos: () => updateTerrainMixedVertexTileHalos,
|
|
90
|
+
updateTerrainPersistentBounds: () => updateTerrainPersistentBounds,
|
|
91
|
+
updateTerrainPersistentGradients: () => updateTerrainPersistentGradients,
|
|
71
92
|
updateTerrainVertexTileHalos: () => updateTerrainVertexTileHalos,
|
|
72
93
|
weldTerrainContourTiles: () => weldTerrainContourTiles,
|
|
73
94
|
weldTerrainMixedContourTiles: () => weldTerrainMixedContourTiles
|
|
@@ -358,19 +379,19 @@ function validateBatch(positions, output) {
|
|
|
358
379
|
}
|
|
359
380
|
const count = positions.length / 2;
|
|
360
381
|
const buffers = [positions];
|
|
361
|
-
for (const [
|
|
382
|
+
for (const [key2, size] of [
|
|
362
383
|
["heights", 1],
|
|
363
384
|
["statuses", 1],
|
|
364
385
|
["gradients", 2],
|
|
365
386
|
["normals", 3],
|
|
366
387
|
["gradientStatuses", 1]
|
|
367
388
|
]) {
|
|
368
|
-
const buffer = output[
|
|
369
|
-
if (buffer === void 0 &&
|
|
389
|
+
const buffer = output[key2];
|
|
390
|
+
if (buffer === void 0 && key2 !== "heights" && key2 !== "statuses")
|
|
370
391
|
continue;
|
|
371
|
-
const byte =
|
|
392
|
+
const byte = key2 === "statuses" || key2 === "gradientStatuses";
|
|
372
393
|
if ((byte ? !(buffer instanceof Uint8Array) : !isTerrainArray(buffer)) || buffer.length < count * size) {
|
|
373
|
-
throw new Error(`Terrain batch ${
|
|
394
|
+
throw new Error(`Terrain batch ${key2} has an invalid type or insufficient length`);
|
|
374
395
|
}
|
|
375
396
|
for (const other of buffers) {
|
|
376
397
|
if (buffer.buffer === other.buffer && buffer.byteOffset < other.byteOffset + other.byteLength && other.byteOffset < buffer.byteOffset + buffer.byteLength) {
|
|
@@ -405,9 +426,9 @@ function createTerrainSkirt(mesh, options) {
|
|
|
405
426
|
if (!Number.isFinite(area) || area <= 0)
|
|
406
427
|
throw new Error("Terrain skirt requires upward nondegenerate XY triangles");
|
|
407
428
|
for (let j = 0; j < 3; j++) {
|
|
408
|
-
const u = ids[j], v = ids[(j + 1) % 3],
|
|
429
|
+
const u = ids[j], v = ids[(j + 1) % 3], key2 = edgeKey(u, v), prior = boundary.get(key2);
|
|
409
430
|
if (!prior)
|
|
410
|
-
boundary.set(
|
|
431
|
+
boundary.set(key2, { a: u, b: v, count: 1 });
|
|
411
432
|
else {
|
|
412
433
|
if (prior.count !== 1 || prior.a !== v || prior.b !== u)
|
|
413
434
|
throw new Error("Terrain skirt mesh has nonmanifold or inconsistent edges");
|
|
@@ -420,10 +441,10 @@ function createTerrainSkirt(mesh, options) {
|
|
|
420
441
|
selected = [];
|
|
421
442
|
const used = /* @__PURE__ */ new Set();
|
|
422
443
|
for (let i = 0; i < edges.length; i += 2) {
|
|
423
|
-
const
|
|
424
|
-
if (!edge || edge.count !== 1 || used.has(
|
|
444
|
+
const key2 = edgeKey(edges[i], edges[i + 1]), edge = boundary.get(key2);
|
|
445
|
+
if (!edge || edge.count !== 1 || used.has(key2))
|
|
425
446
|
throw new Error("Terrain skirt selection must contain unique boundary edges");
|
|
426
|
-
used.add(
|
|
447
|
+
used.add(key2);
|
|
427
448
|
selected.push(edge);
|
|
428
449
|
}
|
|
429
450
|
} else
|
|
@@ -708,10 +729,10 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
708
729
|
throw new Error("Terrain requires unique matrix identifiers");
|
|
709
730
|
for (const tile of props.tiles) {
|
|
710
731
|
const matrix = this.validateTileId(tile);
|
|
711
|
-
const
|
|
712
|
-
if (this.tiles.has(
|
|
732
|
+
const key2 = tileKey(tile.matrixId, tile.column, tile.row);
|
|
733
|
+
if (this.tiles.has(key2))
|
|
713
734
|
throw new Error("Duplicate terrain tile");
|
|
714
|
-
this.tiles.set(
|
|
735
|
+
this.tiles.set(key2, copyTileData(tile, matrix));
|
|
715
736
|
}
|
|
716
737
|
for (const tile of props.tiles)
|
|
717
738
|
this.buildHalo(this.getMatrix(tile.matrixId), tile.column, tile.row, props.diagonal);
|
|
@@ -740,10 +761,10 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
740
761
|
const touched = /* @__PURE__ */ new Map();
|
|
741
762
|
for (const tile of [...update.tiles ?? [], ...update.remove ?? []]) {
|
|
742
763
|
this.validateTileId(tile);
|
|
743
|
-
const
|
|
744
|
-
if (touched.has(
|
|
764
|
+
const key2 = tileKey(tile.matrixId, tile.column, tile.row);
|
|
765
|
+
if (touched.has(key2))
|
|
745
766
|
throw new Error("Terrain update contains duplicate or conflicting tile identifiers");
|
|
746
|
-
touched.set(
|
|
767
|
+
touched.set(key2, tile);
|
|
747
768
|
}
|
|
748
769
|
for (const tile of update.tiles ?? [])
|
|
749
770
|
replacements.set(tileKey(tile.matrixId, tile.column, tile.row), copyTileData(tile, this.getMatrix(tile.matrixId)));
|
|
@@ -754,18 +775,18 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
754
775
|
diagonal: this.diagonal,
|
|
755
776
|
heightReference: this.heightReference
|
|
756
777
|
});
|
|
757
|
-
for (const [
|
|
758
|
-
next.tiles.set(
|
|
759
|
-
for (const [
|
|
760
|
-
next.halos.set(
|
|
778
|
+
for (const [key2, tile] of this.tiles)
|
|
779
|
+
next.tiles.set(key2, tile);
|
|
780
|
+
for (const [key2, halo] of this.halos)
|
|
781
|
+
next.halos.set(key2, halo);
|
|
761
782
|
const affected = /* @__PURE__ */ new Map();
|
|
762
|
-
for (const [
|
|
763
|
-
if (replacements.has(
|
|
764
|
-
next.tiles.set(
|
|
783
|
+
for (const [key2, tile] of touched) {
|
|
784
|
+
if (replacements.has(key2))
|
|
785
|
+
next.tiles.set(key2, replacements.get(key2));
|
|
765
786
|
else {
|
|
766
|
-
if (!next.tiles.delete(
|
|
787
|
+
if (!next.tiles.delete(key2))
|
|
767
788
|
continue;
|
|
768
|
-
next.halos.delete(
|
|
789
|
+
next.halos.delete(key2);
|
|
769
790
|
}
|
|
770
791
|
for (let row = tile.row - 1; row <= tile.row + 1; row++)
|
|
771
792
|
for (let column = tile.column - 1; column <= tile.column + 1; column++) {
|
|
@@ -778,11 +799,11 @@ var TiledHeightField = class _TiledHeightField {
|
|
|
778
799
|
}
|
|
779
800
|
}
|
|
780
801
|
const changes = [];
|
|
781
|
-
for (const [
|
|
782
|
-
if (next.tiles.has(
|
|
802
|
+
for (const [key2, tile] of affected) {
|
|
803
|
+
if (next.tiles.has(key2)) {
|
|
783
804
|
next.buildHalo(next.getMatrix(tile.matrixId), tile.column, tile.row, this.diagonal);
|
|
784
805
|
changes.push({ ...tile, resident: true });
|
|
785
|
-
} else if (this.tiles.has(
|
|
806
|
+
} else if (this.tiles.has(key2))
|
|
786
807
|
changes.push(tile);
|
|
787
808
|
}
|
|
788
809
|
next.changes = freezeChanges(changes);
|
|
@@ -1505,10 +1526,10 @@ function buildTopology(indices, validity) {
|
|
|
1505
1526
|
if (!validity[triangle])
|
|
1506
1527
|
continue;
|
|
1507
1528
|
const a = indices[i], b = indices[triangle * 3 + (i % 3 + 1) % 3];
|
|
1508
|
-
const
|
|
1509
|
-
const opposite = edges.get(
|
|
1529
|
+
const key2 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
1530
|
+
const opposite = edges.get(key2);
|
|
1510
1531
|
if (opposite === void 0)
|
|
1511
|
-
edges.set(
|
|
1532
|
+
edges.set(key2, i);
|
|
1512
1533
|
else {
|
|
1513
1534
|
if (halfedges[opposite] !== -1)
|
|
1514
1535
|
throw new Error("Nonmanifold terrain edge");
|
|
@@ -1678,7 +1699,8 @@ function measureTerrainMeshError(field, mesh, options = {}) {
|
|
|
1678
1699
|
const x = mesh.gridCoordinates[i * 2] + shift, y = mesh.gridCoordinates[i * 2 + 1] + shift;
|
|
1679
1700
|
for (let axis = 0; axis < 2; axis++) {
|
|
1680
1701
|
const expected = field.origin[axis] - mesh.origin[axis] + x * field.columnStep[axis] + y * field.rowStep[axis];
|
|
1681
|
-
|
|
1702
|
+
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])));
|
|
1703
|
+
if (!Number.isFinite(expected) || Math.abs(mesh.positions[i * 3 + axis] - expected) > tolerance)
|
|
1682
1704
|
throw new Error("Terrain mesh XY does not match the source grid frame");
|
|
1683
1705
|
}
|
|
1684
1706
|
}
|
|
@@ -1713,9 +1735,9 @@ function measureTerrainMeshError(field, mesh, options = {}) {
|
|
|
1713
1735
|
throw new Error("Terrain mesh sample-test budget exceeded");
|
|
1714
1736
|
const dx = baseX + (column + shift) * columnX + (row + shift) * rowX - px;
|
|
1715
1737
|
const dy = baseY + (column + shift) * columnY + (row + shift) * rowY - py;
|
|
1716
|
-
const
|
|
1717
|
-
const nu = (dx * vy - dy * vx) *
|
|
1718
|
-
const nv = (ux * dy - uy * dx) *
|
|
1738
|
+
const sign2 = Math.sign(xyArea), area = Math.abs(xyArea);
|
|
1739
|
+
const nu = (dx * vy - dy * vx) * sign2;
|
|
1740
|
+
const nv = (ux * dy - uy * dx) * sign2;
|
|
1719
1741
|
const tolerance = 16 * Number.EPSILON * (Math.abs(dx * vy) + Math.abs(dy * vx) + Math.abs(ux * dy) + Math.abs(uy * dx) + area);
|
|
1720
1742
|
if (nu < -tolerance || nv < -tolerance || nu + nv > area + tolerance)
|
|
1721
1743
|
continue;
|
|
@@ -2424,8 +2446,8 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
2424
2446
|
const exact = height(a) === level ? a : height(b) === level ? b : void 0;
|
|
2425
2447
|
return exact === void 0 ? { a, b, key: `e${a}/${b}` } : { a: exact, b: exact, key: `v${exact}` };
|
|
2426
2448
|
};
|
|
2427
|
-
const vertex = ({ a, b, key }) => {
|
|
2428
|
-
const existing = vertices.get(
|
|
2449
|
+
const vertex = ({ a, b, key: key2 }) => {
|
|
2450
|
+
const existing = vertices.get(key2);
|
|
2429
2451
|
if (existing !== void 0)
|
|
2430
2452
|
return existing;
|
|
2431
2453
|
if (positions.length / 3 >= maxVertices)
|
|
@@ -2452,7 +2474,7 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
2452
2474
|
const index = positions.length / 3;
|
|
2453
2475
|
positions.push(px, py, pz);
|
|
2454
2476
|
coordinates.push(x, y);
|
|
2455
|
-
vertices.set(
|
|
2477
|
+
vertices.set(key2, index);
|
|
2456
2478
|
return index;
|
|
2457
2479
|
};
|
|
2458
2480
|
const triangle = (a, b, c) => {
|
|
@@ -2469,14 +2491,14 @@ function createTerrainContours(field, levels, options = {}) {
|
|
|
2469
2491
|
if (hits.length !== 2 || hits[0].key === hits[1].key)
|
|
2470
2492
|
return;
|
|
2471
2493
|
const va = vertex(hits[0]), vb = vertex(hits[1]);
|
|
2472
|
-
const
|
|
2473
|
-
if (edges.has(
|
|
2494
|
+
const key2 = va < vb ? `${va}/${vb}` : `${vb}/${va}`;
|
|
2495
|
+
if (edges.has(key2))
|
|
2474
2496
|
return;
|
|
2475
2497
|
if (segments.length / 2 >= maxSegments)
|
|
2476
2498
|
throw new Error("Terrain contour segment capacity exceeded");
|
|
2477
2499
|
if (positions[3 * va] === positions[3 * vb] && positions[3 * va + 1] === positions[3 * vb + 1])
|
|
2478
2500
|
throw new Error("Terrain contour segment collapses; use a local origin");
|
|
2479
|
-
edges.add(
|
|
2501
|
+
edges.add(key2);
|
|
2480
2502
|
segments.push(va, vb);
|
|
2481
2503
|
levelIndices.push(levelIndex);
|
|
2482
2504
|
};
|
|
@@ -2563,10 +2585,10 @@ function stitchTerrainContours(contours, options = {}) {
|
|
|
2563
2585
|
validateContourVertex(contours, b, level, assignments);
|
|
2564
2586
|
if (a === b || contours.positions[3 * a] === contours.positions[3 * b] && contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
|
|
2565
2587
|
throw new Error("Degenerate terrain contour segment");
|
|
2566
|
-
const
|
|
2567
|
-
if (unique.has(
|
|
2588
|
+
const key2 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
2589
|
+
if (unique.has(key2))
|
|
2568
2590
|
throw new Error("Duplicate terrain contour segment");
|
|
2569
|
-
unique.add(
|
|
2591
|
+
unique.add(key2);
|
|
2570
2592
|
degrees[a]++;
|
|
2571
2593
|
degrees[b]++;
|
|
2572
2594
|
}
|
|
@@ -2754,10 +2776,10 @@ function diagnoseTerrainContourBoundaries(contours, options) {
|
|
|
2754
2776
|
validateContourVertex(contours, b, level, assignments);
|
|
2755
2777
|
if (a === b || contours.positions[3 * a] === contours.positions[3 * b] && contours.positions[3 * a + 1] === contours.positions[3 * b + 1])
|
|
2756
2778
|
throw new Error("Degenerate terrain contour segment");
|
|
2757
|
-
const
|
|
2758
|
-
if (seen.has(
|
|
2779
|
+
const key2 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
2780
|
+
if (seen.has(key2))
|
|
2759
2781
|
throw new Error("Duplicate terrain contour segment");
|
|
2760
|
-
seen.add(
|
|
2782
|
+
seen.add(key2);
|
|
2761
2783
|
degrees[a]++;
|
|
2762
2784
|
degrees[b]++;
|
|
2763
2785
|
}
|
|
@@ -2893,6 +2915,10 @@ function simplifyTerrainContourPaths(paths, options) {
|
|
|
2893
2915
|
uses[vertex]++;
|
|
2894
2916
|
}
|
|
2895
2917
|
}
|
|
2918
|
+
const protectedIds = new Set(options.protectedVertexIndices);
|
|
2919
|
+
for (const id of protectedIds)
|
|
2920
|
+
if (id >= count)
|
|
2921
|
+
throw new Error("Invalid protected contour vertex");
|
|
2896
2922
|
const keep = new Uint8Array(paths.indices.length);
|
|
2897
2923
|
let distanceTests = 0, maxDeviation = 0;
|
|
2898
2924
|
for (let p = 0; p < pathCount; p++) {
|
|
@@ -2903,7 +2929,7 @@ function simplifyTerrainContourPaths(paths, options) {
|
|
|
2903
2929
|
keep[start + Math.floor(2 * (end - start) / 3)] = 1;
|
|
2904
2930
|
}
|
|
2905
2931
|
for (let i = start; i <= end; i++)
|
|
2906
|
-
if (uses[paths.indices[i]] > 1)
|
|
2932
|
+
if (uses[paths.indices[i]] > 1 || protectedIds.has(paths.indices[i]))
|
|
2907
2933
|
keep[i] = 1;
|
|
2908
2934
|
const stack = [];
|
|
2909
2935
|
let previous = start;
|
|
@@ -3124,9 +3150,9 @@ function compareTerrainSlopes(a, ad, b, bd) {
|
|
|
3124
3150
|
const bytes = new DataView(new ArrayBuffer(8));
|
|
3125
3151
|
const parts = (value) => {
|
|
3126
3152
|
bytes.setFloat64(0, Math.abs(value));
|
|
3127
|
-
const
|
|
3128
|
-
const exponent = Number(
|
|
3129
|
-
const fraction =
|
|
3153
|
+
const bits2 = bytes.getBigUint64(0);
|
|
3154
|
+
const exponent = Number(bits2 >> 52n & 0x7ffn);
|
|
3155
|
+
const fraction = bits2 & 0xfffffffffffffn;
|
|
3130
3156
|
return exponent ? [fraction | 0x10000000000000n, exponent - 1075] : [fraction, -1074];
|
|
3131
3157
|
};
|
|
3132
3158
|
const [am, ae] = parts(a), [bdm, bde] = parts(bd);
|
|
@@ -3243,10 +3269,10 @@ function reconcileTerrainVertexTiles(tiles, options) {
|
|
|
3243
3269
|
const shared = /* @__PURE__ */ new Map();
|
|
3244
3270
|
const result = [];
|
|
3245
3271
|
for (const tile of sorted) {
|
|
3246
|
-
const
|
|
3247
|
-
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row) || seen.has(
|
|
3272
|
+
const key2 = `${tile.column},${tile.row}`;
|
|
3273
|
+
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row) || seen.has(key2))
|
|
3248
3274
|
throw new Error("Invalid or duplicate vertex tile address");
|
|
3249
|
-
seen.add(
|
|
3275
|
+
seen.add(key2);
|
|
3250
3276
|
const x = tile.column * (width - 1), y = tile.row * (height - 1);
|
|
3251
3277
|
if (![x, y, x + width - 1, y + height - 1].every(Number.isSafeInteger))
|
|
3252
3278
|
throw new Error("Vertex tile lattice overflow");
|
|
@@ -3397,20 +3423,20 @@ function getTerrainVertexHaloAffectedTiles(resident, changed, options) {
|
|
|
3397
3423
|
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)
|
|
3398
3424
|
throw new Error("Invalid vertex halo tile capacity");
|
|
3399
3425
|
const addresses = /* @__PURE__ */ new Map();
|
|
3400
|
-
const
|
|
3426
|
+
const key2 = (tile) => {
|
|
3401
3427
|
if (!Number.isSafeInteger(tile.column) || !Number.isSafeInteger(tile.row))
|
|
3402
3428
|
throw new Error("Invalid vertex tile address");
|
|
3403
3429
|
return `${tile.column},${tile.row}`;
|
|
3404
3430
|
};
|
|
3405
3431
|
for (const tile of resident) {
|
|
3406
|
-
const id =
|
|
3432
|
+
const id = key2(tile);
|
|
3407
3433
|
if (addresses.has(id))
|
|
3408
3434
|
throw new Error("Duplicate resident vertex tile address");
|
|
3409
3435
|
addresses.set(id, { column: tile.column, row: tile.row });
|
|
3410
3436
|
}
|
|
3411
3437
|
const affected = /* @__PURE__ */ new Map();
|
|
3412
3438
|
for (const tile of changed) {
|
|
3413
|
-
|
|
3439
|
+
key2(tile);
|
|
3414
3440
|
const rx = options.width === 2 ? 2 : 1, ry = options.height === 2 ? 2 : 1;
|
|
3415
3441
|
for (let x = -rx; x <= rx; x++)
|
|
3416
3442
|
for (let y = -ry; y <= ry; y++) {
|
|
@@ -3437,26 +3463,26 @@ function updateTerrainVertexTileHalos(previous, resident, changed, options) {
|
|
|
3437
3463
|
const equalPair = (a, b) => a[0] === b[0] && a[1] === b[1];
|
|
3438
3464
|
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))
|
|
3439
3465
|
throw new Error("Vertex tile options changed; rebuild the full snapshot");
|
|
3440
|
-
const
|
|
3466
|
+
const key2 = (t) => `${t.column},${t.row}`;
|
|
3441
3467
|
const affected = getTerrainVertexHaloAffectedTiles(resident, changed, options);
|
|
3442
3468
|
getTerrainVertexHaloAffectedTiles(previous, [], options);
|
|
3443
|
-
const previousMap = new Map(previous.map((tile) => [
|
|
3444
|
-
const currentKeys = new Set(resident.map(
|
|
3445
|
-
const changedKeys = new Set(changed.map(
|
|
3469
|
+
const previousMap = new Map(previous.map((tile) => [key2(tile), tile]));
|
|
3470
|
+
const currentKeys = new Set(resident.map(key2));
|
|
3471
|
+
const changedKeys = new Set(changed.map(key2));
|
|
3446
3472
|
for (const tile of resident) {
|
|
3447
|
-
if (!previousMap.has(
|
|
3473
|
+
if (!previousMap.has(key2(tile)) && !changedKeys.has(key2(tile)))
|
|
3448
3474
|
throw new Error("Unreported vertex tile arrival");
|
|
3449
3475
|
}
|
|
3450
3476
|
const removed = [];
|
|
3451
3477
|
for (const tile of previous) {
|
|
3452
|
-
if (!currentKeys.has(
|
|
3453
|
-
if (!changedKeys.has(
|
|
3478
|
+
if (!currentKeys.has(key2(tile))) {
|
|
3479
|
+
if (!changedKeys.has(key2(tile)))
|
|
3454
3480
|
throw new Error("Unreported vertex tile eviction");
|
|
3455
3481
|
removed.push({ column: tile.column, row: tile.row });
|
|
3456
3482
|
}
|
|
3457
3483
|
}
|
|
3458
3484
|
removed.sort((a, b) => a.column - b.column || a.row - b.row);
|
|
3459
|
-
const affectedKeys = new Set(affected.map(
|
|
3485
|
+
const affectedKeys = new Set(affected.map(key2));
|
|
3460
3486
|
const rx = options.width === 2 ? 2 : 1;
|
|
3461
3487
|
const ry = options.height === 2 ? 2 : 1;
|
|
3462
3488
|
const needed = /* @__PURE__ */ new Set();
|
|
@@ -3467,12 +3493,12 @@ function updateTerrainVertexTileHalos(previous, resident, changed, options) {
|
|
|
3467
3493
|
if (Number.isSafeInteger(column) && Number.isSafeInteger(row))
|
|
3468
3494
|
needed.add(`${column},${row}`);
|
|
3469
3495
|
}
|
|
3470
|
-
const source = resident.filter((tile) => needed.has(
|
|
3496
|
+
const source = resident.filter((tile) => needed.has(key2(tile)));
|
|
3471
3497
|
const rebuilt = createTerrainVertexTileHalos(source, options).tiles;
|
|
3472
|
-
const results = new Map(previous.filter((tile) => currentKeys.has(
|
|
3498
|
+
const results = new Map(previous.filter((tile) => currentKeys.has(key2(tile)) && !affectedKeys.has(key2(tile))).map((tile) => [key2(tile), tile]));
|
|
3473
3499
|
for (const tile of rebuilt)
|
|
3474
|
-
if (affectedKeys.has(
|
|
3475
|
-
results.set(
|
|
3500
|
+
if (affectedKeys.has(key2(tile)))
|
|
3501
|
+
results.set(key2(tile), tile);
|
|
3476
3502
|
if (results.size !== resident.length)
|
|
3477
3503
|
throw new Error("Incomplete vertex halo update");
|
|
3478
3504
|
return {
|
|
@@ -3583,9 +3609,9 @@ function stitchTerrainMeshEdges(a, edgeA, b, edgeB, options = {}) {
|
|
|
3583
3609
|
let direction = 0;
|
|
3584
3610
|
for (let i = 0; i < mesh.indices.length; i += 3)
|
|
3585
3611
|
for (let j = 0; j < 3; j++) {
|
|
3586
|
-
const u = mesh.indices[i + j], v = mesh.indices[i + (j + 1) % 3],
|
|
3587
|
-
if (pairs.has(
|
|
3588
|
-
pairs.set(
|
|
3612
|
+
const u = mesh.indices[i + j], v = mesh.indices[i + (j + 1) % 3], key2 = pair(u, v);
|
|
3613
|
+
if (pairs.has(key2)) {
|
|
3614
|
+
pairs.set(key2, pairs.get(key2) + 1);
|
|
3589
3615
|
const nextDirection = Math.sign(mesh.gridCoordinates[2 * v + 1 - axis] - mesh.gridCoordinates[2 * u + 1 - axis]);
|
|
3590
3616
|
if (direction && direction !== nextDirection)
|
|
3591
3617
|
throw new Error("Inconsistent stitching boundary orientation");
|
|
@@ -3824,19 +3850,19 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3824
3850
|
throw new Error("Mixed contour frame overflow");
|
|
3825
3851
|
const onEdge = x === 0 || y === 0 || x === tile.width - 1 || y === tile.height - 1;
|
|
3826
3852
|
const xi = Math.floor(sx), yi = Math.floor(sy);
|
|
3827
|
-
const
|
|
3853
|
+
const key2 = `${level}/${tile.column + xi}/${sx - xi}/${tile.row + yi}/${sy - yi}`;
|
|
3828
3854
|
if (onEdge) {
|
|
3829
3855
|
const rounded = `${level}/${gx}/${gy}`;
|
|
3830
3856
|
const identity = roundedBoundary.get(rounded);
|
|
3831
|
-
if (identity !== void 0 && identity !==
|
|
3857
|
+
if (identity !== void 0 && identity !== key2)
|
|
3832
3858
|
throw new Error("Mixed contour lattice loses precision");
|
|
3833
|
-
roundedBoundary.set(rounded,
|
|
3859
|
+
roundedBoundary.set(rounded, key2);
|
|
3834
3860
|
}
|
|
3835
|
-
if (onEdge && local.has(
|
|
3861
|
+
if (onEdge && local.has(key2))
|
|
3836
3862
|
throw new Error("Duplicate mixed contour boundary vertex");
|
|
3837
3863
|
if (onEdge)
|
|
3838
|
-
local.add(
|
|
3839
|
-
let id = onEdge ? shared.get(
|
|
3864
|
+
local.add(key2);
|
|
3865
|
+
let id = onEdge ? shared.get(key2) : void 0;
|
|
3840
3866
|
if (id !== void 0) {
|
|
3841
3867
|
if (Math.hypot(px - positions[3 * id], py - positions[3 * id + 1]) > tolerance)
|
|
3842
3868
|
throw new Error("Mixed contour boundary positions disagree");
|
|
@@ -3848,7 +3874,7 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3848
3874
|
grid.push(gx, gy);
|
|
3849
3875
|
vertexLevels.push(level);
|
|
3850
3876
|
if (onEdge) {
|
|
3851
|
-
shared.set(
|
|
3877
|
+
shared.set(key2, id);
|
|
3852
3878
|
boundary.add(id);
|
|
3853
3879
|
}
|
|
3854
3880
|
}
|
|
@@ -3860,10 +3886,10 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3860
3886
|
const level = data.levelIndices[i], a = vertex(data.segments[2 * i], level), b = vertex(data.segments[2 * i + 1], level);
|
|
3861
3887
|
if (a === b || positions[3 * a] === positions[3 * b] && positions[3 * a + 1] === positions[3 * b + 1])
|
|
3862
3888
|
throw new Error("Degenerate mixed contour segment");
|
|
3863
|
-
const
|
|
3864
|
-
if (localEdges.has(
|
|
3889
|
+
const key2 = a < b ? `${a}/${b}` : `${b}/${a}`;
|
|
3890
|
+
if (localEdges.has(key2))
|
|
3865
3891
|
throw new Error("Duplicate mixed contour segment");
|
|
3866
|
-
localEdges.add(
|
|
3892
|
+
localEdges.add(key2);
|
|
3867
3893
|
const box = bounds[ti];
|
|
3868
3894
|
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]);
|
|
3869
3895
|
edges.push({ a, b, level, tile: ti, seam });
|
|
@@ -3890,8 +3916,8 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3890
3916
|
}
|
|
3891
3917
|
cuts.sort((u, v) => grid[2 * u + axis] - grid[2 * v + axis]);
|
|
3892
3918
|
for (let i = 1; i < cuts.length; i++) {
|
|
3893
|
-
const u = cuts[i - 1], v = cuts[i],
|
|
3894
|
-
const prior = emitted.get(
|
|
3919
|
+
const u = cuts[i - 1], v = cuts[i], key2 = u < v ? `${u}/${v}` : `${v}/${u}`;
|
|
3920
|
+
const prior = emitted.get(key2);
|
|
3895
3921
|
if (prior !== void 0) {
|
|
3896
3922
|
if (prior === edge.tile)
|
|
3897
3923
|
throw new Error("Overlapping mixed contour segments within tile");
|
|
@@ -3899,7 +3925,7 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3899
3925
|
}
|
|
3900
3926
|
if (levels.length >= limits.maxSegments)
|
|
3901
3927
|
throw new Error("Mixed contour output segment capacity exceeded");
|
|
3902
|
-
emitted.set(
|
|
3928
|
+
emitted.set(key2, edge.tile);
|
|
3903
3929
|
segments.push(u, v);
|
|
3904
3930
|
levels.push(level);
|
|
3905
3931
|
}
|
|
@@ -3914,4 +3940,1493 @@ function weldTerrainMixedContourTiles(tiles, options = {}) {
|
|
|
3914
3940
|
heightReference: first.heightReference
|
|
3915
3941
|
};
|
|
3916
3942
|
}
|
|
3943
|
+
|
|
3944
|
+
// dist/terrain/sample-triangle-height.js
|
|
3945
|
+
function sampleTerrainTriangleHeight(field, x, y) {
|
|
3946
|
+
if (Number.isInteger(x) && Number.isInteger(y))
|
|
3947
|
+
return field.getHeight(x, y);
|
|
3948
|
+
const column = Math.min(Math.floor(x), field.width - 2);
|
|
3949
|
+
const row = Math.min(Math.floor(y), field.height - 2);
|
|
3950
|
+
const u = x - column, v = y - row;
|
|
3951
|
+
let a, b, c, d;
|
|
3952
|
+
if (field.diagonal === "00-11") {
|
|
3953
|
+
if (v <= u) {
|
|
3954
|
+
a = 1 - u;
|
|
3955
|
+
b = u - v;
|
|
3956
|
+
c = 0;
|
|
3957
|
+
d = v;
|
|
3958
|
+
} else {
|
|
3959
|
+
a = 1 - v;
|
|
3960
|
+
b = 0;
|
|
3961
|
+
c = v - u;
|
|
3962
|
+
d = u;
|
|
3963
|
+
}
|
|
3964
|
+
} else if (u + v <= 1) {
|
|
3965
|
+
a = 1 - u - v;
|
|
3966
|
+
b = u;
|
|
3967
|
+
c = v;
|
|
3968
|
+
d = 0;
|
|
3969
|
+
} else {
|
|
3970
|
+
a = 0;
|
|
3971
|
+
b = 1 - v;
|
|
3972
|
+
c = 1 - u;
|
|
3973
|
+
d = u + v - 1;
|
|
3974
|
+
}
|
|
3975
|
+
const za = a ? field.getHeight(column, row) : 0;
|
|
3976
|
+
const zb = b ? field.getHeight(column + 1, row) : 0;
|
|
3977
|
+
const zc = c ? field.getHeight(column, row + 1) : 0;
|
|
3978
|
+
const zd = d ? field.getHeight(column + 1, row + 1) : 0;
|
|
3979
|
+
if (za === void 0 || zb === void 0 || zc === void 0 || zd === void 0)
|
|
3980
|
+
return void 0;
|
|
3981
|
+
const height = a * za + b * zb + c * zc + d * zd;
|
|
3982
|
+
if (!Number.isFinite(height))
|
|
3983
|
+
throw new Error("Terrain triangle numeric sampling failure");
|
|
3984
|
+
return height;
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3987
|
+
// dist/terrain/mixed-vertex-halos.js
|
|
3988
|
+
function createTerrainMixedVertexTileHalos(tiles, options = {}) {
|
|
3989
|
+
return buildMixedVertexTileHalos(tiles, options);
|
|
3990
|
+
}
|
|
3991
|
+
function buildMixedVertexTileHalos(tiles, options = {}, targets) {
|
|
3992
|
+
const maxSamples = options.maxSamples ?? 4e6, maxTests = options.maxTileTests ?? 1e7;
|
|
3993
|
+
if (![maxSamples, maxTests].every((v) => Number.isSafeInteger(v) && v >= 0))
|
|
3994
|
+
throw new Error("Invalid mixed halo capacity");
|
|
3995
|
+
let count = 0;
|
|
3996
|
+
const addresses = /* @__PURE__ */ new Set();
|
|
3997
|
+
let frame;
|
|
3998
|
+
const sources = [...tiles].sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row).map((tile) => {
|
|
3999
|
+
if (![tile.column, tile.row, tile.spacing].every(Number.isSafeInteger) || tile.spacing < 1 || 2 ** Math.round(Math.log2(tile.spacing)) !== tile.spacing)
|
|
4000
|
+
throw new Error("Invalid mixed halo lattice");
|
|
4001
|
+
const key2 = `${tile.spacing}/${tile.column}/${tile.row}`;
|
|
4002
|
+
if (addresses.has(key2))
|
|
4003
|
+
throw new Error("Duplicate mixed halo tile");
|
|
4004
|
+
addresses.add(key2);
|
|
4005
|
+
count += (tile.field.width + 2) * (tile.field.height + 2);
|
|
4006
|
+
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
4007
|
+
throw new Error("Mixed halo sample capacity exceeded");
|
|
4008
|
+
const field = new HeightField(tile.field);
|
|
4009
|
+
if (field.registration !== "vertex")
|
|
4010
|
+
throw new Error("Mixed halos require vertex registration");
|
|
4011
|
+
const column = field.columnStep.map((v) => v / tile.spacing);
|
|
4012
|
+
const row = field.rowStep.map((v) => v / tile.spacing);
|
|
4013
|
+
const origin = field.origin.map((v, axis) => v - tile.column * column[axis] - tile.row * row[axis]);
|
|
4014
|
+
const scale = field.origin.map((v, i) => Math.max(1, Math.abs(v), Math.abs(tile.column * column[i]), Math.abs(tile.row * row[i])));
|
|
4015
|
+
if (!origin.every(Number.isFinite))
|
|
4016
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
4017
|
+
if (frame && (frame.reference !== field.heightReference || column.some((v, i) => v !== frame.column[i]) || row.some((v, i) => v !== frame.row[i]) || origin.some((v, i) => Math.abs(v - frame.origin[i]) > Math.min(16 * Number.EPSILON * Math.max(scale[i], frame.scale[i]), 1e-9 * Math.max(Math.abs(column[i]), Math.abs(row[i]))))))
|
|
4018
|
+
throw new Error("Mixed halo frames or height references differ");
|
|
4019
|
+
frame ?? (frame = { origin, column, row, reference: field.heightReference, scale });
|
|
4020
|
+
return { ...tile, source: field };
|
|
4021
|
+
});
|
|
4022
|
+
for (const axis of ["column", "row"]) {
|
|
4023
|
+
let min = Infinity, max = -Infinity;
|
|
4024
|
+
for (const tile of sources) {
|
|
4025
|
+
const size = axis === "column" ? tile.source.width : tile.source.height;
|
|
4026
|
+
const low = tile[axis] - tile.spacing, high = tile[axis] + size * tile.spacing;
|
|
4027
|
+
if (![low, high].every(Number.isSafeInteger))
|
|
4028
|
+
throw new Error("Mixed halo lattice overflow");
|
|
4029
|
+
min = Math.min(min, low);
|
|
4030
|
+
max = Math.max(max, high);
|
|
4031
|
+
}
|
|
4032
|
+
if (sources.length && !Number.isSafeInteger(max - min))
|
|
4033
|
+
throw new Error("Mixed halo lattice span overflow");
|
|
4034
|
+
}
|
|
4035
|
+
let tests = 0;
|
|
4036
|
+
return {
|
|
4037
|
+
tiles: sources.filter((tile) => !targets || targets.has(`${tile.spacing}/${tile.column}/${tile.row}`)).map((tile) => {
|
|
4038
|
+
const source = tile.source, width = source.width + 2, height = source.height + 2;
|
|
4039
|
+
const heights = new Float64Array(width * height), validity = new Uint8Array(heights.length), statuses = new Uint8Array(heights.length);
|
|
4040
|
+
for (let y = 0; y < height; y++)
|
|
4041
|
+
for (let x = 0; x < width; x++) {
|
|
4042
|
+
const gx = tile.column + (x - 1) * tile.spacing, gy = tile.row + (y - 1) * tile.spacing;
|
|
4043
|
+
if (![gx, gy].every(Number.isSafeInteger))
|
|
4044
|
+
throw new Error("Mixed halo lattice overflow");
|
|
4045
|
+
for (const candidate of sources) {
|
|
4046
|
+
if (++tests > maxTests)
|
|
4047
|
+
throw new Error("Mixed halo tile-test budget exceeded");
|
|
4048
|
+
const cx = (gx - candidate.column) / candidate.spacing, cy = (gy - candidate.row) / candidate.spacing;
|
|
4049
|
+
const f = candidate.source;
|
|
4050
|
+
if (cx < 0 || cy < 0 || cx > f.width - 1 || cy > f.height - 1)
|
|
4051
|
+
continue;
|
|
4052
|
+
const value = sampleTerrainTriangleHeight(f, cx, cy);
|
|
4053
|
+
const i = y * width + x;
|
|
4054
|
+
statuses[i] = value === void 0 ? 1 : 2;
|
|
4055
|
+
if (value !== void 0) {
|
|
4056
|
+
heights[i] = value;
|
|
4057
|
+
validity[i] = 1;
|
|
4058
|
+
}
|
|
4059
|
+
break;
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
const origin = [
|
|
4063
|
+
source.origin[0] - source.columnStep[0] - source.rowStep[0],
|
|
4064
|
+
source.origin[1] - source.columnStep[1] - source.rowStep[1]
|
|
4065
|
+
];
|
|
4066
|
+
if (!origin.every(Number.isFinite))
|
|
4067
|
+
throw new Error("Mixed halo coordinate overflow");
|
|
4068
|
+
return {
|
|
4069
|
+
column: tile.column,
|
|
4070
|
+
row: tile.row,
|
|
4071
|
+
spacing: tile.spacing,
|
|
4072
|
+
statuses,
|
|
4073
|
+
field: {
|
|
4074
|
+
...tile.field,
|
|
4075
|
+
width,
|
|
4076
|
+
height,
|
|
4077
|
+
heights,
|
|
4078
|
+
validity,
|
|
4079
|
+
offset: 0,
|
|
4080
|
+
stride: width,
|
|
4081
|
+
origin,
|
|
4082
|
+
columnStep: [...source.columnStep],
|
|
4083
|
+
rowStep: [...source.rowStep]
|
|
4084
|
+
}
|
|
4085
|
+
};
|
|
4086
|
+
})
|
|
4087
|
+
};
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
// dist/terrain/mixed-halo-update.js
|
|
4091
|
+
var key = (t) => `${t.spacing}/${t.column}/${t.row}`;
|
|
4092
|
+
function updateTerrainMixedVertexTileHalos(previous, resident, options = {}) {
|
|
4093
|
+
const budget = options.maxDependencyTests ?? 1e7;
|
|
4094
|
+
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
4095
|
+
throw new Error("Invalid mixed halo dependency budget");
|
|
4096
|
+
const old = new Map(previous == null ? void 0 : previous.sources.map((t) => [key(t), t]));
|
|
4097
|
+
const current = new Map(resident.map((t) => [key(t), t]));
|
|
4098
|
+
const changed = [...old.values()].filter((t) => current.get(key(t)) !== t).concat(resident.filter((t) => old.get(key(t)) !== t));
|
|
4099
|
+
const cached = new Map(previous == null ? void 0 : previous.tiles.map((t) => [key(t), t]));
|
|
4100
|
+
const targets = /* @__PURE__ */ new Set();
|
|
4101
|
+
let tests = 0;
|
|
4102
|
+
for (const tile of resident) {
|
|
4103
|
+
if (!cached.has(key(tile)))
|
|
4104
|
+
targets.add(key(tile));
|
|
4105
|
+
for (const source of changed) {
|
|
4106
|
+
if (++tests > budget)
|
|
4107
|
+
throw new Error("Mixed halo dependency budget exceeded");
|
|
4108
|
+
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)
|
|
4109
|
+
targets.add(key(tile));
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
const built = buildMixedVertexTileHalos(resident, options, targets).tiles;
|
|
4113
|
+
for (const tile of built)
|
|
4114
|
+
cached.set(key(tile), tile);
|
|
4115
|
+
const tiles = resident.map((t) => cached.get(key(t))).sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row);
|
|
4116
|
+
return {
|
|
4117
|
+
sources: resident.slice(),
|
|
4118
|
+
tiles,
|
|
4119
|
+
rebuilt: built.map(key),
|
|
4120
|
+
removed: [...old.keys()].filter((k) => !current.has(k)).sort()
|
|
4121
|
+
};
|
|
4122
|
+
}
|
|
4123
|
+
|
|
4124
|
+
// dist/terrain/mixed-gradient-update.js
|
|
4125
|
+
function updateTerrainMixedGradientGrids(previous, halos, options = {}) {
|
|
4126
|
+
const method = options.method ?? "horn";
|
|
4127
|
+
if (method !== "horn" && method !== "zevenbergen-thorne")
|
|
4128
|
+
throw new Error("Unknown terrain gradient method");
|
|
4129
|
+
const limit = options.maxSamples ?? 4e6;
|
|
4130
|
+
const count = halos.tiles.reduce((n, t) => n + t.field.width * t.field.height, 0);
|
|
4131
|
+
if (!Number.isSafeInteger(limit) || limit < 0 || !Number.isSafeInteger(count) || count > limit)
|
|
4132
|
+
throw new Error("Mixed gradient sample capacity exceeded");
|
|
4133
|
+
const cache = new Map((previous == null ? void 0 : previous.method) === method ? previous.tiles.map((t) => [t.halo, t]) : []);
|
|
4134
|
+
return {
|
|
4135
|
+
method,
|
|
4136
|
+
tiles: halos.tiles.map((halo) => cache.get(halo) ?? {
|
|
4137
|
+
halo,
|
|
4138
|
+
grid: createTerrainGradientGrid(new HeightField(halo.field), { method, maxSamples: limit })
|
|
4139
|
+
})
|
|
4140
|
+
};
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
// dist/terrain/box-index.js
|
|
4144
|
+
var overlaps = (a, b) => a.minX <= b.maxX && b.minX <= a.maxX && a.minY <= b.maxY && b.minY <= a.maxY;
|
|
4145
|
+
function createTerrainBoxIndex(boxes) {
|
|
4146
|
+
const build = (ids) => {
|
|
4147
|
+
const box = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
|
|
4148
|
+
for (const id of ids) {
|
|
4149
|
+
const b = boxes[id];
|
|
4150
|
+
box.minX = Math.min(box.minX, b.minX);
|
|
4151
|
+
box.minY = Math.min(box.minY, b.minY);
|
|
4152
|
+
box.maxX = Math.max(box.maxX, b.maxX);
|
|
4153
|
+
box.maxY = Math.max(box.maxY, b.maxY);
|
|
4154
|
+
}
|
|
4155
|
+
if (ids.length <= 8)
|
|
4156
|
+
return { ...box, ids };
|
|
4157
|
+
const axis = box.maxX - box.minX >= box.maxY - box.minY ? "X" : "Y";
|
|
4158
|
+
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);
|
|
4159
|
+
const mid = ids.length >>> 1;
|
|
4160
|
+
return { ...box, left: build(ids.slice(0, mid)), right: build(ids.slice(mid)) };
|
|
4161
|
+
};
|
|
4162
|
+
const root = build(boxes.map((_, i) => i));
|
|
4163
|
+
return (query, charge) => {
|
|
4164
|
+
const found = [], stack = [root];
|
|
4165
|
+
while (stack.length) {
|
|
4166
|
+
charge();
|
|
4167
|
+
const node = stack.pop();
|
|
4168
|
+
if (!overlaps(node, query))
|
|
4169
|
+
continue;
|
|
4170
|
+
if (node.ids) {
|
|
4171
|
+
for (const id of node.ids) {
|
|
4172
|
+
charge();
|
|
4173
|
+
if (overlaps(boxes[id], query))
|
|
4174
|
+
found.push(id);
|
|
4175
|
+
}
|
|
4176
|
+
} else
|
|
4177
|
+
stack.push(node.right, node.left);
|
|
4178
|
+
}
|
|
4179
|
+
return found.sort((a, b) => a - b);
|
|
4180
|
+
};
|
|
4181
|
+
}
|
|
4182
|
+
|
|
4183
|
+
// dist/terrain/contour-topology.js
|
|
4184
|
+
var bits = new DataView(new ArrayBuffer(8));
|
|
4185
|
+
function integer(x) {
|
|
4186
|
+
bits.setFloat64(0, x);
|
|
4187
|
+
const high = bits.getUint32(0), low = bits.getUint32(4);
|
|
4188
|
+
const exponent = high >>> 20 & 2047;
|
|
4189
|
+
const mantissa = BigInt(high & 1048575) << 32n | BigInt(low);
|
|
4190
|
+
const value = exponent ? (1n << 52n | mantissa) << BigInt(exponent - 1) : mantissa;
|
|
4191
|
+
return high >>> 31 ? -value : value;
|
|
4192
|
+
}
|
|
4193
|
+
var orientation = (a, b, c) => (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
|
4194
|
+
var sign = (v) => v < 0n ? -1 : v > 0n ? 1 : 0;
|
|
4195
|
+
var between = (a, b, p) => p >= (a < b ? a : b) && p <= (a > b ? a : b);
|
|
4196
|
+
var on = (a, b, p) => orientation(a, b, p) === 0n && between(a.x, b.x, p.x) && between(a.y, b.y, p.y);
|
|
4197
|
+
function intersects(a, b, c, d) {
|
|
4198
|
+
return on(a, b, c) || on(a, b, d) || on(c, d, a) || on(c, d, b) || sign(orientation(a, b, c)) * sign(orientation(a, b, d)) < 0 && sign(orientation(c, d, a)) * sign(orientation(c, d, b)) < 0;
|
|
4199
|
+
}
|
|
4200
|
+
function simplifyTerrainContourPathsTopology(paths, options) {
|
|
4201
|
+
if (options.rejection !== void 0 && options.rejection !== "batch" && options.rejection !== "path")
|
|
4202
|
+
throw new Error("Invalid contour rejection policy");
|
|
4203
|
+
const candidate = simplifyTerrainContourPaths(paths, options);
|
|
4204
|
+
const budget = options.maxTopologyTests ?? 1e6;
|
|
4205
|
+
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
4206
|
+
throw new Error("Invalid contour topology budget");
|
|
4207
|
+
let topologyTests = 0;
|
|
4208
|
+
const charge = () => {
|
|
4209
|
+
if (++topologyTests > budget)
|
|
4210
|
+
throw new Error("Contour topology work budget exceeded");
|
|
4211
|
+
};
|
|
4212
|
+
const points = new Array(paths.positions.length / 3);
|
|
4213
|
+
for (const i of new Set(paths.indices))
|
|
4214
|
+
points[i] = { x: integer(paths.positions[3 * i]), y: integer(paths.positions[3 * i + 1]) };
|
|
4215
|
+
const edges = [];
|
|
4216
|
+
for (let p = 0; p < paths.closed.length; p++)
|
|
4217
|
+
for (let i = paths.offsets[p]; i + 1 < paths.offsets[p + 1]; i++)
|
|
4218
|
+
edges.push({ a: paths.indices[i], b: paths.indices[i + 1], p, i });
|
|
4219
|
+
const box = (a, b) => ({
|
|
4220
|
+
minX: Math.min(paths.positions[3 * a], paths.positions[3 * b]),
|
|
4221
|
+
maxX: Math.max(paths.positions[3 * a], paths.positions[3 * b]),
|
|
4222
|
+
minY: Math.min(paths.positions[3 * a + 1], paths.positions[3 * b + 1]),
|
|
4223
|
+
maxY: Math.max(paths.positions[3 * a + 1], paths.positions[3 * b + 1])
|
|
4224
|
+
});
|
|
4225
|
+
const edgeBoxes = edges.map((e) => box(e.a, e.b)), edgeIndex = createTerrainBoxIndex(edgeBoxes);
|
|
4226
|
+
const vertexIds = [...new Set(paths.indices)], vertexIndex = createTerrainBoxIndex(vertexIds.map((v) => box(v, v)));
|
|
4227
|
+
for (let i = 0; i < edges.length; i++)
|
|
4228
|
+
for (const j of edgeIndex(edgeBoxes[i], charge)) {
|
|
4229
|
+
if (j <= i)
|
|
4230
|
+
continue;
|
|
4231
|
+
charge();
|
|
4232
|
+
const a = edges[i], b = edges[j];
|
|
4233
|
+
const common = [a.a, a.b].filter((v) => v === b.a || v === b.b);
|
|
4234
|
+
if (common.length === 1) {
|
|
4235
|
+
const v = common[0], x = a.a === v ? a.b : a.a, y = b.a === v ? b.b : b.a;
|
|
4236
|
+
if (on(points[v], points[x], points[y]) || on(points[v], points[y], points[x]))
|
|
4237
|
+
throw new Error("Overlapping contour edges");
|
|
4238
|
+
} else if (intersects(points[a.a], points[a.b], points[b.a], points[b.b]))
|
|
4239
|
+
throw new Error("Contour input has crossings or unshared touches");
|
|
4240
|
+
}
|
|
4241
|
+
let rejected = false;
|
|
4242
|
+
const rejectedPaths = /* @__PURE__ */ new Set();
|
|
4243
|
+
for (let p = 0; p < paths.closed.length; p++) {
|
|
4244
|
+
let start = paths.offsets[p];
|
|
4245
|
+
for (let k = candidate.offsets[p] + 1; k < candidate.offsets[p + 1]; k++) {
|
|
4246
|
+
const endId = candidate.sourceVertexIndices[candidate.indices[k]];
|
|
4247
|
+
let end = start + 1;
|
|
4248
|
+
while (paths.indices[end] !== endId)
|
|
4249
|
+
end++;
|
|
4250
|
+
if (end > start + 1) {
|
|
4251
|
+
const a = paths.indices[start], b = paths.indices[end];
|
|
4252
|
+
const pa = points[a], pb = points[b];
|
|
4253
|
+
const axis = pa.x !== pb.x ? "x" : "y";
|
|
4254
|
+
const direction = sign(pb[axis] - pa[axis]);
|
|
4255
|
+
let straight = true;
|
|
4256
|
+
for (let i = start + 1; i <= end; i++) {
|
|
4257
|
+
charge();
|
|
4258
|
+
const q = points[paths.indices[i]], prior = points[paths.indices[i - 1]];
|
|
4259
|
+
if (!on(pa, pb, q) || sign(q[axis] - prior[axis]) !== direction)
|
|
4260
|
+
straight = false;
|
|
4261
|
+
}
|
|
4262
|
+
const interior = new Set(Array.from(paths.indices.subarray(start + 1, end)));
|
|
4263
|
+
let unsafe = false;
|
|
4264
|
+
for (const edgeId of edgeIndex(box(a, b), charge)) {
|
|
4265
|
+
const edge = edges[edgeId];
|
|
4266
|
+
if (edge.p === p && edge.i >= start && edge.i < end) {
|
|
4267
|
+
if (straight)
|
|
4268
|
+
continue;
|
|
4269
|
+
charge();
|
|
4270
|
+
const others2 = [edge.a, edge.b].filter((v) => v !== a && v !== b);
|
|
4271
|
+
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]))
|
|
4272
|
+
unsafe = true;
|
|
4273
|
+
continue;
|
|
4274
|
+
}
|
|
4275
|
+
charge();
|
|
4276
|
+
const others = [edge.a, edge.b].filter((v) => v !== a && v !== b);
|
|
4277
|
+
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]))
|
|
4278
|
+
unsafe = true;
|
|
4279
|
+
}
|
|
4280
|
+
const swept = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity };
|
|
4281
|
+
for (let i = start; i <= end; i++) {
|
|
4282
|
+
const v = paths.indices[i];
|
|
4283
|
+
swept.minX = Math.min(swept.minX, paths.positions[3 * v]);
|
|
4284
|
+
swept.maxX = Math.max(swept.maxX, paths.positions[3 * v]);
|
|
4285
|
+
swept.minY = Math.min(swept.minY, paths.positions[3 * v + 1]);
|
|
4286
|
+
swept.maxY = Math.max(swept.maxY, paths.positions[3 * v + 1]);
|
|
4287
|
+
}
|
|
4288
|
+
for (const vertexId of vertexIndex(swept, charge)) {
|
|
4289
|
+
const vertex = vertexIds[vertexId];
|
|
4290
|
+
if (vertex === a || vertex === b || interior.has(vertex))
|
|
4291
|
+
continue;
|
|
4292
|
+
let inside = false;
|
|
4293
|
+
for (let i = start, j = end; i <= end; j = i++) {
|
|
4294
|
+
charge();
|
|
4295
|
+
const u = points[paths.indices[i]], v = points[paths.indices[j]], q = points[vertex];
|
|
4296
|
+
if (on(u, v, q)) {
|
|
4297
|
+
unsafe = true;
|
|
4298
|
+
break;
|
|
4299
|
+
}
|
|
4300
|
+
if (u.y > q.y !== v.y > q.y && orientation(u, v, q) > 0n === v.y > u.y)
|
|
4301
|
+
inside = !inside;
|
|
4302
|
+
}
|
|
4303
|
+
if (inside)
|
|
4304
|
+
unsafe = true;
|
|
4305
|
+
}
|
|
4306
|
+
if (unsafe) {
|
|
4307
|
+
rejected = true;
|
|
4308
|
+
rejectedPaths.add(p);
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
start = end;
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
const outputEdges = [];
|
|
4315
|
+
for (let p = 0; p < candidate.closed.length; p++)
|
|
4316
|
+
for (let i = candidate.offsets[p]; i + 1 < candidate.offsets[p + 1]; i++)
|
|
4317
|
+
outputEdges.push({
|
|
4318
|
+
p,
|
|
4319
|
+
a: candidate.sourceVertexIndices[candidate.indices[i]],
|
|
4320
|
+
b: candidate.sourceVertexIndices[candidate.indices[i + 1]]
|
|
4321
|
+
});
|
|
4322
|
+
const outputBoxes = outputEdges.map((e) => box(e.a, e.b)), outputIndex = createTerrainBoxIndex(outputBoxes);
|
|
4323
|
+
for (let i = 0; i < outputEdges.length; i++)
|
|
4324
|
+
for (const j of outputIndex(outputBoxes[i], charge)) {
|
|
4325
|
+
if (j <= i)
|
|
4326
|
+
continue;
|
|
4327
|
+
charge();
|
|
4328
|
+
const a = outputEdges[i], b = outputEdges[j];
|
|
4329
|
+
const common = [a.a, a.b].filter((v) => v === b.a || v === b.b);
|
|
4330
|
+
if (common.length === 1) {
|
|
4331
|
+
const v = common[0], x = a.a === v ? a.b : a.a, y = b.a === v ? b.b : b.a;
|
|
4332
|
+
if (on(points[v], points[x], points[y]) || on(points[v], points[y], points[x])) {
|
|
4333
|
+
rejected = true;
|
|
4334
|
+
rejectedPaths.add(a.p);
|
|
4335
|
+
rejectedPaths.add(b.p);
|
|
4336
|
+
}
|
|
4337
|
+
} else if (intersects(points[a.a], points[a.b], points[b.a], points[b.b])) {
|
|
4338
|
+
rejected = true;
|
|
4339
|
+
rejectedPaths.add(a.p);
|
|
4340
|
+
rejectedPaths.add(b.p);
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
if (rejected && options.rejection === "path") {
|
|
4344
|
+
const indices = [], offsets = [0];
|
|
4345
|
+
for (let p = 0; p < paths.closed.length; p++) {
|
|
4346
|
+
if (rejectedPaths.has(p))
|
|
4347
|
+
for (let i = paths.offsets[p]; i < paths.offsets[p + 1]; i++)
|
|
4348
|
+
indices.push(paths.indices[i]);
|
|
4349
|
+
else
|
|
4350
|
+
for (let i = candidate.offsets[p]; i < candidate.offsets[p + 1]; i++)
|
|
4351
|
+
indices.push(candidate.sourceVertexIndices[candidate.indices[i]]);
|
|
4352
|
+
offsets.push(indices.length);
|
|
4353
|
+
}
|
|
4354
|
+
return {
|
|
4355
|
+
...paths,
|
|
4356
|
+
positions: paths.positions.slice(),
|
|
4357
|
+
gridCoordinates: paths.gridCoordinates.slice(),
|
|
4358
|
+
indices: Uint32Array.from(indices),
|
|
4359
|
+
offsets: Uint32Array.from(offsets),
|
|
4360
|
+
closed: paths.closed.slice(),
|
|
4361
|
+
levelIndices: paths.levelIndices.slice(),
|
|
4362
|
+
levels: paths.levels.slice(),
|
|
4363
|
+
origin: Object.freeze([...paths.origin]),
|
|
4364
|
+
sourceVertexIndices: Uint32Array.from({ length: points.length }, (_, i) => i),
|
|
4365
|
+
maxDeviation: candidate.maxDeviation,
|
|
4366
|
+
requestedMaxError: options.maxError,
|
|
4367
|
+
distanceTests: candidate.distanceTests,
|
|
4368
|
+
topologyTests,
|
|
4369
|
+
rejected: true
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4372
|
+
if (!rejected)
|
|
4373
|
+
return { ...candidate, topologyTests, rejected: false };
|
|
4374
|
+
return {
|
|
4375
|
+
...paths,
|
|
4376
|
+
positions: paths.positions.slice(),
|
|
4377
|
+
gridCoordinates: paths.gridCoordinates.slice(),
|
|
4378
|
+
indices: paths.indices.slice(),
|
|
4379
|
+
offsets: paths.offsets.slice(),
|
|
4380
|
+
levelIndices: paths.levelIndices.slice(),
|
|
4381
|
+
closed: paths.closed.slice(),
|
|
4382
|
+
levels: paths.levels.slice(),
|
|
4383
|
+
origin: Object.freeze([...paths.origin]),
|
|
4384
|
+
sourceVertexIndices: Uint32Array.from({ length: points.length }, (_, i) => i),
|
|
4385
|
+
maxDeviation: 0,
|
|
4386
|
+
requestedMaxError: options.maxError,
|
|
4387
|
+
distanceTests: candidate.distanceTests,
|
|
4388
|
+
topologyTests,
|
|
4389
|
+
rejected: true
|
|
4390
|
+
};
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4393
|
+
// dist/terrain/isobands.js
|
|
4394
|
+
function createTerrainIsobands(fields, levels, options = {}) {
|
|
4395
|
+
const maxLevels = options.maxLevels ?? 256;
|
|
4396
|
+
if (!Number.isSafeInteger(maxLevels) || maxLevels < 2 || levels.length > maxLevels)
|
|
4397
|
+
throw new Error("Isoband level capacity exceeded");
|
|
4398
|
+
if (levels.length < 2 || levels.some((v, i) => !Number.isFinite(v) || i > 0 && v <= levels[i - 1]))
|
|
4399
|
+
throw new Error("Invalid isoband levels");
|
|
4400
|
+
const maxTriangles = options.maxTriangles ?? 2e6, maxVertices = options.maxVertices ?? 2e6, maxEdges = options.maxEdges ?? 6 * maxTriangles, maxTests = options.maxTests ?? 32 * maxTriangles;
|
|
4401
|
+
if (![maxTriangles, maxVertices, maxEdges, maxTests].every((n) => Number.isSafeInteger(n) && n >= 0))
|
|
4402
|
+
throw new Error("Invalid isoband capacity");
|
|
4403
|
+
const count = fields.reduce((n, f) => n + 2 * (f.width - 1) * (f.height - 1), 0);
|
|
4404
|
+
if (!Number.isSafeInteger(count) || count > maxTriangles)
|
|
4405
|
+
throw new Error("Isoband triangle capacity exceeded");
|
|
4406
|
+
const originals = /* @__PURE__ */ new Map(), vertices = /* @__PURE__ */ new Map();
|
|
4407
|
+
const frame = fields[0];
|
|
4408
|
+
for (const f of fields)
|
|
4409
|
+
if (f.heightReference !== frame.heightReference)
|
|
4410
|
+
throw new Error("Isoband height references differ");
|
|
4411
|
+
let tests = 0, edgeCount = 0;
|
|
4412
|
+
const charge = () => {
|
|
4413
|
+
if (++tests > maxTests)
|
|
4414
|
+
throw new Error("Isoband work budget exceeded");
|
|
4415
|
+
};
|
|
4416
|
+
const rectangles = fields.map((f) => {
|
|
4417
|
+
if (f.registration !== frame.registration || f.columnStep.some((v, i) => v !== frame.columnStep[i]) || f.rowStep.some((v, i) => v !== frame.rowStep[i]))
|
|
4418
|
+
throw new Error("Isoband tiles require a conforming common frame");
|
|
4419
|
+
const dx = f.origin[0] - frame.origin[0], dy = f.origin[1] - frame.origin[1];
|
|
4420
|
+
const determinant = frame.columnStep[0] * frame.rowStep[1] - frame.columnStep[1] * frame.rowStep[0];
|
|
4421
|
+
const x = Math.round((dx * frame.rowStep[1] - dy * frame.rowStep[0]) / determinant), y = Math.round((dy * frame.columnStep[0] - dx * frame.columnStep[1]) / determinant);
|
|
4422
|
+
if (!Number.isSafeInteger(x) || !Number.isSafeInteger(y))
|
|
4423
|
+
throw new Error("Isoband tiles require integral lattice origins");
|
|
4424
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
4425
|
+
const a = x * frame.columnStep[axis], b = y * frame.rowStep[axis];
|
|
4426
|
+
const expected = frame.origin[axis] + a + b;
|
|
4427
|
+
const tolerance = Math.min(16 * Number.EPSILON * Math.max(1, Math.abs(f.origin[axis]), Math.abs(frame.origin[axis]), Math.abs(a), Math.abs(b)), 1e-9 * Math.max(Math.abs(frame.columnStep[axis]), Math.abs(frame.rowStep[axis])));
|
|
4428
|
+
if (!Number.isFinite(expected) || Math.abs(f.origin[axis] - expected) > tolerance)
|
|
4429
|
+
throw new Error("Isoband tiles require integral lattice origins");
|
|
4430
|
+
}
|
|
4431
|
+
return { x, y, right: x + f.width - 1, top: y + f.height - 1 };
|
|
4432
|
+
});
|
|
4433
|
+
const rectangleBoxes = rectangles.map((r) => ({ minX: r.x, minY: r.y, maxX: r.right, maxY: r.top })), rectangleIndex = createTerrainBoxIndex(rectangleBoxes);
|
|
4434
|
+
const rangeIndex = createTerrainBoxIndex(fields.map((f) => {
|
|
4435
|
+
var _a, _b;
|
|
4436
|
+
return {
|
|
4437
|
+
minX: ((_a = f.heightRange) == null ? void 0 : _a[0]) ?? Infinity,
|
|
4438
|
+
maxX: ((_b = f.heightRange) == null ? void 0 : _b[1]) ?? -Infinity,
|
|
4439
|
+
minY: 0,
|
|
4440
|
+
maxY: 0
|
|
4441
|
+
};
|
|
4442
|
+
}));
|
|
4443
|
+
for (let i = 0; i < rectangles.length; i++)
|
|
4444
|
+
for (const j of rectangleIndex(rectangleBoxes[i], charge)) {
|
|
4445
|
+
if (j <= i)
|
|
4446
|
+
continue;
|
|
4447
|
+
charge();
|
|
4448
|
+
const a = rectangles[i], b = rectangles[j];
|
|
4449
|
+
if (a.x < b.right && b.x < a.right && a.y < b.top && b.y < a.top)
|
|
4450
|
+
throw new Error("Overlapping isoband tiles");
|
|
4451
|
+
for (let y = Math.max(a.y, b.y); y <= Math.min(a.top, b.top); y++)
|
|
4452
|
+
for (let x = Math.max(a.x, b.x); x <= Math.min(a.right, b.right); x++) {
|
|
4453
|
+
charge();
|
|
4454
|
+
const u = fields[i].getHeight(x - a.x, y - a.y), v = fields[j].getHeight(x - b.x, y - b.y);
|
|
4455
|
+
if (u !== void 0 && v !== void 0 && u !== v)
|
|
4456
|
+
throw new Error("Isoband shared heights differ");
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
const rings = [], bands = [];
|
|
4460
|
+
const register = (v) => {
|
|
4461
|
+
if (!vertices.has(v.key)) {
|
|
4462
|
+
if (vertices.size >= maxVertices)
|
|
4463
|
+
throw new Error("Isoband vertex capacity exceeded");
|
|
4464
|
+
vertices.set(v.key, v);
|
|
4465
|
+
}
|
|
4466
|
+
return vertices.get(v.key);
|
|
4467
|
+
};
|
|
4468
|
+
const clip = (poly, level, above) => {
|
|
4469
|
+
const out = [];
|
|
4470
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4471
|
+
charge();
|
|
4472
|
+
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;
|
|
4473
|
+
if (ia)
|
|
4474
|
+
out.push(a);
|
|
4475
|
+
if (ia !== ib) {
|
|
4476
|
+
if (a.z === level) {
|
|
4477
|
+
out.push(a);
|
|
4478
|
+
continue;
|
|
4479
|
+
}
|
|
4480
|
+
if (b.z === level) {
|
|
4481
|
+
out.push(b);
|
|
4482
|
+
continue;
|
|
4483
|
+
}
|
|
4484
|
+
const support = [.../* @__PURE__ */ new Set([...a.support, ...b.support])].sort();
|
|
4485
|
+
if (support.length !== 2)
|
|
4486
|
+
throw new Error("Invalid isoband intersection support");
|
|
4487
|
+
const u = originals.get(support[0]), v = originals.get(support[1]);
|
|
4488
|
+
const scale = Math.max(Math.abs(u.z), Math.abs(v.z), Math.abs(level), 1);
|
|
4489
|
+
const t = (level / scale - u.z / scale) / (v.z / scale - u.z / scale);
|
|
4490
|
+
const point = {
|
|
4491
|
+
x: u.x * (1 - t) + v.x * t,
|
|
4492
|
+
y: u.y * (1 - t) + v.y * t,
|
|
4493
|
+
z: level,
|
|
4494
|
+
key: `e:${support.join("|")}:${level}`,
|
|
4495
|
+
support
|
|
4496
|
+
};
|
|
4497
|
+
if (![point.x, point.y, t].every(Number.isFinite))
|
|
4498
|
+
throw new Error("Isoband arithmetic overflow");
|
|
4499
|
+
out.push(register(point));
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
return out.filter((v, i) => v.key !== out[(i + 1) % out.length].key);
|
|
4503
|
+
};
|
|
4504
|
+
for (let band = 0; band + 1 < levels.length; band++) {
|
|
4505
|
+
const edges = /* @__PURE__ */ new Map();
|
|
4506
|
+
for (const fieldId of rangeIndex({ minX: levels[band], maxX: levels[band + 1], minY: 0, maxY: 0 }, charge))
|
|
4507
|
+
for (let y = 0; y < fields[fieldId].height - 1; y++)
|
|
4508
|
+
for (let x = 0; x < fields[fieldId].width - 1; x++) {
|
|
4509
|
+
const f = fields[fieldId];
|
|
4510
|
+
const nodes = [
|
|
4511
|
+
[x, y],
|
|
4512
|
+
[x + 1, y],
|
|
4513
|
+
[x, y + 1],
|
|
4514
|
+
[x + 1, y + 1]
|
|
4515
|
+
].map(([c, r]) => {
|
|
4516
|
+
const z = f.getHeight(c, r);
|
|
4517
|
+
if (z === void 0)
|
|
4518
|
+
return void 0;
|
|
4519
|
+
const shift = f.registration === "cell" ? 0.5 : 0;
|
|
4520
|
+
const px = frame.origin[0] + (rectangles[fieldId].x + c + shift) * frame.columnStep[0] + (rectangles[fieldId].y + r + shift) * frame.rowStep[0], py = frame.origin[1] + (rectangles[fieldId].x + c + shift) * frame.columnStep[1] + (rectangles[fieldId].y + r + shift) * frame.rowStep[1];
|
|
4521
|
+
if (![px, py].every(Number.isFinite))
|
|
4522
|
+
throw new Error("Isoband coordinate overflow");
|
|
4523
|
+
const key2 = `v:${px},${py}`, v = { x: px, y: py, z, key: key2, support: [key2] };
|
|
4524
|
+
const old = originals.get(key2);
|
|
4525
|
+
if (old && old.z !== z)
|
|
4526
|
+
throw new Error("Isoband shared heights differ");
|
|
4527
|
+
originals.set(key2, v);
|
|
4528
|
+
return v;
|
|
4529
|
+
});
|
|
4530
|
+
for (const ids of f.diagonal === "00-11" ? [
|
|
4531
|
+
[0, 1, 3],
|
|
4532
|
+
[0, 3, 2]
|
|
4533
|
+
] : [
|
|
4534
|
+
[0, 1, 2],
|
|
4535
|
+
[1, 3, 2]
|
|
4536
|
+
]) {
|
|
4537
|
+
charge();
|
|
4538
|
+
if (ids.some((i) => !nodes[i]))
|
|
4539
|
+
continue;
|
|
4540
|
+
let poly = ids.map((i) => nodes[i]);
|
|
4541
|
+
if (poly.every((v) => v.z === levels[band + 1]) && band + 2 < levels.length)
|
|
4542
|
+
continue;
|
|
4543
|
+
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)
|
|
4544
|
+
poly.reverse();
|
|
4545
|
+
poly = clip(clip(poly, levels[band], true), levels[band + 1], false);
|
|
4546
|
+
if (poly.length < 3)
|
|
4547
|
+
continue;
|
|
4548
|
+
const area2 = poly.reduce((n, a, i) => {
|
|
4549
|
+
const b = poly[(i + 1) % poly.length], o = poly[0];
|
|
4550
|
+
return n + (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);
|
|
4551
|
+
}, 0);
|
|
4552
|
+
if (!Number.isFinite(area2))
|
|
4553
|
+
throw new Error("Isoband area arithmetic overflow");
|
|
4554
|
+
if (area2 === 0)
|
|
4555
|
+
continue;
|
|
4556
|
+
for (let i = 0; i < poly.length; i++) {
|
|
4557
|
+
const a = register(poly[i]), b = register(poly[(i + 1) % poly.length]);
|
|
4558
|
+
if (++edgeCount > maxEdges)
|
|
4559
|
+
throw new Error("Isoband edge capacity exceeded");
|
|
4560
|
+
const key2 = `${a.key}>${b.key}`, reverse = `${b.key}>${a.key}`;
|
|
4561
|
+
if (edges.has(reverse))
|
|
4562
|
+
edges.delete(reverse);
|
|
4563
|
+
else {
|
|
4564
|
+
if (edges.has(key2))
|
|
4565
|
+
throw new Error("Overlapping isoband tiles");
|
|
4566
|
+
edges.set(key2, { a, b });
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
const outgoing = /* @__PURE__ */ new Map();
|
|
4572
|
+
for (const [key2, e] of edges) {
|
|
4573
|
+
if (!outgoing.has(e.a.key))
|
|
4574
|
+
outgoing.set(e.a.key, /* @__PURE__ */ new Set());
|
|
4575
|
+
outgoing.get(e.a.key).add(key2);
|
|
4576
|
+
}
|
|
4577
|
+
while (edges.size) {
|
|
4578
|
+
const first = edges.values().next().value, ring = [];
|
|
4579
|
+
let edge = first;
|
|
4580
|
+
for (; ; ) {
|
|
4581
|
+
charge();
|
|
4582
|
+
ring.push(edge.a);
|
|
4583
|
+
edges.delete(`${edge.a.key}>${edge.b.key}`);
|
|
4584
|
+
outgoing.get(edge.a.key).delete(`${edge.a.key}>${edge.b.key}`);
|
|
4585
|
+
if (edge.b.key === first.a.key)
|
|
4586
|
+
break;
|
|
4587
|
+
const choices = [...outgoing.get(edge.b.key) ?? []].map((k) => edges.get(k));
|
|
4588
|
+
if (!choices.length)
|
|
4589
|
+
throw new Error("Open isoband boundary");
|
|
4590
|
+
const angle = (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));
|
|
4591
|
+
choices.sort((a, b) => angle(b) - angle(a) || a.b.key.localeCompare(b.b.key));
|
|
4592
|
+
edge = choices[0];
|
|
4593
|
+
}
|
|
4594
|
+
rings.push(ring);
|
|
4595
|
+
bands.push(band);
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
const area = (ring) => ring.reduce((n, a, i) => {
|
|
4599
|
+
const b = ring[(i + 1) % ring.length], o = ring[0];
|
|
4600
|
+
return n + (a.x - o.x) * (b.y - o.y) - (b.x - o.x) * (a.y - o.y);
|
|
4601
|
+
}, 0);
|
|
4602
|
+
const areas = rings.map(area), parents = new Int32Array(rings.length).fill(-1);
|
|
4603
|
+
const ringBoxes = rings.map((r) => r.reduce((b, v) => ({
|
|
4604
|
+
minX: Math.min(b.minX, v.x),
|
|
4605
|
+
minY: Math.min(b.minY, v.y),
|
|
4606
|
+
maxX: Math.max(b.maxX, v.x),
|
|
4607
|
+
maxY: Math.max(b.maxY, v.y)
|
|
4608
|
+
}), { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity }));
|
|
4609
|
+
const ringIndex = createTerrainBoxIndex(ringBoxes);
|
|
4610
|
+
for (let i = 0; i < rings.length; i++)
|
|
4611
|
+
if (areas[i] < 0) {
|
|
4612
|
+
let best = Infinity;
|
|
4613
|
+
const q = rings[i][0];
|
|
4614
|
+
for (const j of ringIndex({ minX: q.x, maxX: q.x, minY: q.y, maxY: q.y }, charge))
|
|
4615
|
+
if (bands[j] === bands[i] && areas[j] > 0) {
|
|
4616
|
+
let inside = false;
|
|
4617
|
+
const ring = rings[j];
|
|
4618
|
+
for (let k = 0, l = ring.length - 1; k < ring.length; l = k++) {
|
|
4619
|
+
charge();
|
|
4620
|
+
const a = ring[k], b = ring[l];
|
|
4621
|
+
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)
|
|
4622
|
+
inside = !inside;
|
|
4623
|
+
}
|
|
4624
|
+
if (inside && areas[j] < best) {
|
|
4625
|
+
parents[i] = j;
|
|
4626
|
+
best = areas[j];
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
if (parents[i] < 0)
|
|
4630
|
+
throw new Error("Uncontained isoband hole");
|
|
4631
|
+
}
|
|
4632
|
+
const used = /* @__PURE__ */ new Map(), positions = [], indices = [], offsets = [0];
|
|
4633
|
+
for (const ring of rings) {
|
|
4634
|
+
for (const v of [...ring, ring[0]]) {
|
|
4635
|
+
if (!used.has(v.key)) {
|
|
4636
|
+
used.set(v.key, used.size);
|
|
4637
|
+
positions.push(v.x, v.y);
|
|
4638
|
+
}
|
|
4639
|
+
indices.push(used.get(v.key));
|
|
4640
|
+
}
|
|
4641
|
+
offsets.push(indices.length);
|
|
4642
|
+
}
|
|
4643
|
+
return {
|
|
4644
|
+
positions: Float64Array.from(positions),
|
|
4645
|
+
indices: Uint32Array.from(indices),
|
|
4646
|
+
offsets: Uint32Array.from(offsets),
|
|
4647
|
+
bandIndices: Uint32Array.from(bands),
|
|
4648
|
+
parents,
|
|
4649
|
+
levels: Float64Array.from(levels),
|
|
4650
|
+
heightReference: (frame == null ? void 0 : frame.heightReference) ?? "unknown"
|
|
4651
|
+
};
|
|
4652
|
+
}
|
|
4653
|
+
|
|
4654
|
+
// dist/terrain/tile-update-data.js
|
|
4655
|
+
function updateTerrainTileData(previous, resident, create, maxSamples = 4e6) {
|
|
4656
|
+
if (!Number.isSafeInteger(maxSamples) || maxSamples < 0)
|
|
4657
|
+
throw new Error("Invalid terrain update sample capacity");
|
|
4658
|
+
let count = 0;
|
|
4659
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4660
|
+
for (const tile of resident) {
|
|
4661
|
+
if (typeof tile.id !== "string" || ids.has(tile.id))
|
|
4662
|
+
throw new Error("Invalid or duplicate terrain update tile");
|
|
4663
|
+
ids.add(tile.id);
|
|
4664
|
+
count += tile.field.width * tile.field.height;
|
|
4665
|
+
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
4666
|
+
throw new Error("Terrain update sample capacity exceeded");
|
|
4667
|
+
}
|
|
4668
|
+
const cached = new Map(previous == null ? void 0 : previous.map((t) => [t.source.id, t]));
|
|
4669
|
+
return resident.map((source) => {
|
|
4670
|
+
const old = cached.get(source.id);
|
|
4671
|
+
return (old == null ? void 0 : old.source.field) === source.field ? { source, data: old.data } : { source, data: create(source.field) };
|
|
4672
|
+
});
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4675
|
+
// dist/terrain/mesh-update.js
|
|
4676
|
+
function updateTerrainMeshes(previous, resident, options = {}) {
|
|
4677
|
+
return updateTerrainTileData(previous, resident, createTerrainMesh, options.maxSamples);
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
// dist/terrain/bounds-update.js
|
|
4681
|
+
function updateTerrainBounds(previous, resident, options = {}) {
|
|
4682
|
+
return updateTerrainTileData(previous, resident, (f) => new HeightFieldMinMax(f), options.maxSamples);
|
|
4683
|
+
}
|
|
4684
|
+
|
|
4685
|
+
// dist/terrain/gradient-pyramid-update.js
|
|
4686
|
+
function updateTerrainGradientPyramids(previous, gradients, options = {}) {
|
|
4687
|
+
const limit = options.maxSamples ?? 4e6;
|
|
4688
|
+
const count = gradients.tiles.reduce((n, t) => n + t.grid.width * t.grid.height, 0);
|
|
4689
|
+
if (!Number.isSafeInteger(limit) || limit < 0 || !Number.isSafeInteger(count) || count > limit)
|
|
4690
|
+
throw new Error("Gradient pyramid update sample capacity exceeded");
|
|
4691
|
+
const cached = new Map(previous == null ? void 0 : previous.map((t) => [t.source.grid, t.data]));
|
|
4692
|
+
return gradients.tiles.map((source) => ({
|
|
4693
|
+
source,
|
|
4694
|
+
data: cached.get(source.grid) ?? createTerrainGradientPyramid(source.grid, { maxSamples: limit })
|
|
4695
|
+
}));
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
// dist/terrain/dirty-regions.js
|
|
4699
|
+
function validateTerrainDirtyWindows(windows, width, height, maxWindows = 1e5) {
|
|
4700
|
+
if (windows.length > maxWindows)
|
|
4701
|
+
throw new Error("Terrain dirty window capacity exceeded");
|
|
4702
|
+
for (const w of windows)
|
|
4703
|
+
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)
|
|
4704
|
+
throw new Error("Invalid terrain dirty sample window");
|
|
4705
|
+
}
|
|
4706
|
+
function sameTerrainFrame(a, b) {
|
|
4707
|
+
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]);
|
|
4708
|
+
}
|
|
4709
|
+
function terrainDirtyIndices(windows, width, height, expand, charge) {
|
|
4710
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4711
|
+
for (const w of windows)
|
|
4712
|
+
for (let y = Math.max(0, w.minRow - expand); y <= Math.min(height - 1, w.maxRow + expand); y++)
|
|
4713
|
+
for (let x = Math.max(0, w.minColumn - expand); x <= Math.min(width - 1, w.maxColumn + expand); x++) {
|
|
4714
|
+
charge();
|
|
4715
|
+
ids.add(y * width + x);
|
|
4716
|
+
}
|
|
4717
|
+
return ids;
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4720
|
+
// dist/terrain/mesh-regions-data.js
|
|
4721
|
+
function updateMeshRegions(previous, field, dirty, options, configuration, create) {
|
|
4722
|
+
const cells = options.cellsPerRegion ?? 32, limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
4723
|
+
if (![cells, limit, budget].every(Number.isSafeInteger) || cells < 1 || limit < 0 || budget < 0)
|
|
4724
|
+
throw new Error("Invalid terrain mesh region capacity");
|
|
4725
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
4726
|
+
let count = 0, tests = 0;
|
|
4727
|
+
const regions = [], rebuilt = [];
|
|
4728
|
+
const reusable = previous && sameTerrainFrame(previous.field, field) && previous.cellsPerRegion === cells && previous.configuration === configuration;
|
|
4729
|
+
const cache = new Map(previous == null ? void 0 : previous.regions.map((r) => [`${r.column},${r.row}`, r]));
|
|
4730
|
+
for (let row = 0; row < field.height - 1; row += cells)
|
|
4731
|
+
for (let column = 0; column < field.width - 1; column += cells) {
|
|
4732
|
+
const width = Math.min(cells, field.width - 1 - column) + 1, height = Math.min(cells, field.height - 1 - row) + 1;
|
|
4733
|
+
count += width * height;
|
|
4734
|
+
if (!Number.isSafeInteger(count) || count > limit)
|
|
4735
|
+
throw new Error("Terrain mesh region sample capacity exceeded");
|
|
4736
|
+
let affected = !reusable;
|
|
4737
|
+
for (const w of reusable ? dirty : []) {
|
|
4738
|
+
if (++tests > budget)
|
|
4739
|
+
throw new Error("Terrain mesh region work budget exceeded");
|
|
4740
|
+
if (w.minColumn <= column + width - 1 && w.maxColumn >= column && w.minRow <= row + height - 1 && w.maxRow >= row)
|
|
4741
|
+
affected = true;
|
|
4742
|
+
}
|
|
4743
|
+
const old = cache.get(`${column},${row}`);
|
|
4744
|
+
if (!affected && old) {
|
|
4745
|
+
regions.push(old);
|
|
4746
|
+
continue;
|
|
4747
|
+
}
|
|
4748
|
+
const heights = Float64Array.from({ length: width * height }, (_, i) => field.getHeight(column + i % width, row + Math.floor(i / width)) ?? NaN);
|
|
4749
|
+
const source = new HeightField({
|
|
4750
|
+
width,
|
|
4751
|
+
height,
|
|
4752
|
+
heights,
|
|
4753
|
+
origin: [
|
|
4754
|
+
column * field.columnStep[0] + row * field.rowStep[0],
|
|
4755
|
+
column * field.columnStep[1] + row * field.rowStep[1]
|
|
4756
|
+
],
|
|
4757
|
+
columnStep: field.columnStep,
|
|
4758
|
+
rowStep: field.rowStep,
|
|
4759
|
+
registration: field.registration,
|
|
4760
|
+
diagonal: field.diagonal,
|
|
4761
|
+
heightReference: field.heightReference
|
|
4762
|
+
});
|
|
4763
|
+
rebuilt.push(regions.length);
|
|
4764
|
+
let data = create(source);
|
|
4765
|
+
if (data) {
|
|
4766
|
+
const mesh = data;
|
|
4767
|
+
const positions = mesh.positions.map((value, i) => {
|
|
4768
|
+
const axis = i % 3;
|
|
4769
|
+
if (axis === 2)
|
|
4770
|
+
return value;
|
|
4771
|
+
const vertex = Math.floor(i / 3), shift = field.registration === "cell" ? 0.5 : 0;
|
|
4772
|
+
const c = column + mesh.gridCoordinates[2 * vertex] + shift, r = row + mesh.gridCoordinates[2 * vertex + 1] + shift;
|
|
4773
|
+
const coordinate = c * field.columnStep[axis] + r * field.rowStep[axis];
|
|
4774
|
+
if (!Number.isFinite(coordinate))
|
|
4775
|
+
throw new Error("Terrain region coordinate overflow");
|
|
4776
|
+
return coordinate;
|
|
4777
|
+
});
|
|
4778
|
+
data = { ...mesh, origin: [0, 0, 0], positions };
|
|
4779
|
+
}
|
|
4780
|
+
regions.push({ column, row, field: source, data });
|
|
4781
|
+
}
|
|
4782
|
+
return {
|
|
4783
|
+
field,
|
|
4784
|
+
origin: [field.origin[0], field.origin[1], 0],
|
|
4785
|
+
cellsPerRegion: cells,
|
|
4786
|
+
configuration,
|
|
4787
|
+
regions,
|
|
4788
|
+
rebuilt: Uint32Array.from(rebuilt)
|
|
4789
|
+
};
|
|
4790
|
+
}
|
|
4791
|
+
|
|
4792
|
+
// dist/terrain/mesh-regions.js
|
|
4793
|
+
function updateTerrainMeshRegions(previous, field, dirty, options = {}) {
|
|
4794
|
+
return updateMeshRegions(previous, field, dirty, options, "regular", createTerrainMesh);
|
|
4795
|
+
}
|
|
4796
|
+
|
|
4797
|
+
// dist/terrain/martini-regions.js
|
|
4798
|
+
function updateTerrainMartiniMeshRegions(previous, field, dirty, options) {
|
|
4799
|
+
const cells = options.cellsPerRegion ?? 32;
|
|
4800
|
+
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)
|
|
4801
|
+
throw new Error("Invalid MARTINI region dimensions or error");
|
|
4802
|
+
return updateMeshRegions(previous, field, dirty, options, `martini:${options.maxError}`, (f) => f.validCount !== f.width * f.height ? null : createMartiniTerrainMesh(f, {
|
|
4803
|
+
maxError: options.maxError,
|
|
4804
|
+
fullEdges: ["minColumn", "maxColumn", "minRow", "maxRow"]
|
|
4805
|
+
}));
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
// dist/terrain/delatin-regions.js
|
|
4809
|
+
function updateTerrainDelatinMeshRegions(previous, field, dirty, options) {
|
|
4810
|
+
if (!Number.isFinite(options.maxError) || options.maxError < 0)
|
|
4811
|
+
throw new Error("Invalid Delatin region error");
|
|
4812
|
+
return updateMeshRegions(previous, field, dirty, options, `delatin:${options.maxError}`, (f) => f.validCount !== f.width * f.height ? null : createDelatinTerrainMesh(f, { maxError: options.maxError }));
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4815
|
+
// dist/terrain/bounds-regions.js
|
|
4816
|
+
function updateTerrainBoundsRegions(previous, field, dirty, options = {}) {
|
|
4817
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
4818
|
+
if (![limit, budget].every(Number.isSafeInteger) || limit < 0 || budget < 0 || field.width * field.height > limit)
|
|
4819
|
+
throw new Error("Invalid bounds region capacity");
|
|
4820
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
4821
|
+
if (!previous || !sameTerrainFrame(previous.field, field)) {
|
|
4822
|
+
const bounds = new HeightFieldMinMax(field), levels2 = Array.from({ length: bounds.levelCount }, (_, i) => bounds.copyLevel(i));
|
|
4823
|
+
return { field, levels: levels2, updatedCounts: Uint32Array.from(levels2, (l) => l.width * l.height) };
|
|
4824
|
+
}
|
|
4825
|
+
let tests = 0;
|
|
4826
|
+
const charge = () => {
|
|
4827
|
+
if (++tests > budget)
|
|
4828
|
+
throw new Error("Bounds region work budget exceeded");
|
|
4829
|
+
};
|
|
4830
|
+
let ids = terrainDirtyIndices(dirty, field.width - 1, field.height - 1, 1, charge);
|
|
4831
|
+
const counts = [], levels = previous.levels.slice();
|
|
4832
|
+
for (let l = 0; l < levels.length; l++) {
|
|
4833
|
+
counts.push(ids.size);
|
|
4834
|
+
if (!ids.size)
|
|
4835
|
+
continue;
|
|
4836
|
+
const old = levels[l], next = {
|
|
4837
|
+
...old,
|
|
4838
|
+
minimums: old.minimums.slice(),
|
|
4839
|
+
maximums: old.maximums.slice(),
|
|
4840
|
+
populatedCellCounts: old.populatedCellCounts.slice(),
|
|
4841
|
+
completeCellCounts: old.completeCellCounts.slice()
|
|
4842
|
+
};
|
|
4843
|
+
const parents = /* @__PURE__ */ new Set();
|
|
4844
|
+
for (const id of ids) {
|
|
4845
|
+
charge();
|
|
4846
|
+
const x = id % next.width, y = Math.floor(id / next.width);
|
|
4847
|
+
let min = Infinity, max = -Infinity, populated = 0, complete = 0;
|
|
4848
|
+
if (l === 0) {
|
|
4849
|
+
let valid = 0;
|
|
4850
|
+
for (let dy = 0; dy < 2; dy++)
|
|
4851
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
4852
|
+
const h = field.getHeight(x + dx, y + dy);
|
|
4853
|
+
if (h !== void 0) {
|
|
4854
|
+
valid++;
|
|
4855
|
+
min = Math.min(min, h);
|
|
4856
|
+
max = Math.max(max, h);
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
populated = valid ? 1 : 0;
|
|
4860
|
+
complete = valid === 4 ? 1 : 0;
|
|
4861
|
+
} else {
|
|
4862
|
+
const child = levels[l - 1];
|
|
4863
|
+
for (let dy = 0; dy < 2; dy++)
|
|
4864
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
4865
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
4866
|
+
if (cx >= child.width || cy >= child.height)
|
|
4867
|
+
continue;
|
|
4868
|
+
const i = cy * child.width + cx;
|
|
4869
|
+
if (child.populatedCellCounts[i]) {
|
|
4870
|
+
min = Math.min(min, child.minimums[i]);
|
|
4871
|
+
max = Math.max(max, child.maximums[i]);
|
|
4872
|
+
}
|
|
4873
|
+
populated += child.populatedCellCounts[i];
|
|
4874
|
+
complete += child.completeCellCounts[i];
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
next.minimums[id] = populated ? min : 0;
|
|
4878
|
+
next.maximums[id] = populated ? max : 0;
|
|
4879
|
+
next.populatedCellCounts[id] = populated;
|
|
4880
|
+
next.completeCellCounts[id] = complete;
|
|
4881
|
+
parents.add(Math.floor(y / 2) * Math.ceil(next.width / 2) + Math.floor(x / 2));
|
|
4882
|
+
}
|
|
4883
|
+
levels[l] = next;
|
|
4884
|
+
ids = parents;
|
|
4885
|
+
}
|
|
4886
|
+
return { field, levels, updatedCounts: Uint32Array.from(counts) };
|
|
4887
|
+
}
|
|
4888
|
+
|
|
4889
|
+
// dist/terrain/gradient-pyramid-regions.js
|
|
4890
|
+
function updateTerrainGradientPyramidRegions(previous, grid, dirty, options = {}) {
|
|
4891
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 1e7;
|
|
4892
|
+
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)
|
|
4893
|
+
throw new Error("Invalid gradient region capacity");
|
|
4894
|
+
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)))
|
|
4895
|
+
throw new Error("Invalid gradient region metadata");
|
|
4896
|
+
validateTerrainDirtyWindows(dirty, grid.width, grid.height);
|
|
4897
|
+
const old = previous == null ? void 0 : previous.source;
|
|
4898
|
+
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])) {
|
|
4899
|
+
const pyramid = createTerrainGradientPyramid(grid, { maxSamples: limit });
|
|
4900
|
+
return {
|
|
4901
|
+
source: grid,
|
|
4902
|
+
pyramid,
|
|
4903
|
+
updatedCounts: Uint32Array.from(pyramid.levels, (l) => l.width * l.height)
|
|
4904
|
+
};
|
|
4905
|
+
}
|
|
4906
|
+
if (!(grid.gradients instanceof Float64Array) || grid.gradients.length !== 2 * grid.width * grid.height || !(grid.statuses instanceof Uint8Array) || grid.statuses.length !== grid.width * grid.height)
|
|
4907
|
+
throw new Error("Invalid gradient region buffers");
|
|
4908
|
+
const levels = previous.pyramid.levels.slice();
|
|
4909
|
+
let tests = 0;
|
|
4910
|
+
const charge = () => {
|
|
4911
|
+
if (++tests > budget)
|
|
4912
|
+
throw new Error("Gradient region work budget exceeded");
|
|
4913
|
+
};
|
|
4914
|
+
let ids = terrainDirtyIndices(dirty, grid.width, grid.height, 0, charge);
|
|
4915
|
+
const counts = [];
|
|
4916
|
+
for (let l = 0; l < levels.length; l++) {
|
|
4917
|
+
counts.push(ids.size);
|
|
4918
|
+
if (!ids.size)
|
|
4919
|
+
continue;
|
|
4920
|
+
const oldLevel = levels[l], next = {
|
|
4921
|
+
...oldLevel,
|
|
4922
|
+
gradients: oldLevel.gradients.slice(),
|
|
4923
|
+
validCounts: oldLevel.validCounts.slice(),
|
|
4924
|
+
sampleCounts: oldLevel.sampleCounts
|
|
4925
|
+
};
|
|
4926
|
+
const parents = /* @__PURE__ */ new Set();
|
|
4927
|
+
for (const id of ids) {
|
|
4928
|
+
charge();
|
|
4929
|
+
const x = id % next.width, y = Math.floor(id / next.width);
|
|
4930
|
+
next.validCounts[id] = 0;
|
|
4931
|
+
next.gradients[2 * id] = next.gradients[2 * id + 1] = 0;
|
|
4932
|
+
if (l === 0) {
|
|
4933
|
+
if (grid.statuses[id] > 6)
|
|
4934
|
+
throw new Error("Invalid terrain gradient status");
|
|
4935
|
+
if (grid.statuses[id] === 0) {
|
|
4936
|
+
if (!Number.isFinite(grid.gradients[2 * id]) || !Number.isFinite(grid.gradients[2 * id + 1]))
|
|
4937
|
+
throw new Error("Invalid terrain gradient value");
|
|
4938
|
+
next.validCounts[id] = 1;
|
|
4939
|
+
next.gradients[2 * id] = grid.gradients[2 * id];
|
|
4940
|
+
next.gradients[2 * id + 1] = grid.gradients[2 * id + 1];
|
|
4941
|
+
}
|
|
4942
|
+
} else {
|
|
4943
|
+
const child = levels[l - 1];
|
|
4944
|
+
for (let dy = 0; dy < 2; dy++)
|
|
4945
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
4946
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
4947
|
+
if (cx >= child.width || cy >= child.height)
|
|
4948
|
+
continue;
|
|
4949
|
+
const i = cy * child.width + cx, n = child.validCounts[i], count = next.validCounts[id];
|
|
4950
|
+
if (n) {
|
|
4951
|
+
const total = count + n;
|
|
4952
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
4953
|
+
const a = next.gradients[2 * id + axis], b = child.gradients[2 * i + axis];
|
|
4954
|
+
next.gradients[2 * id + axis] = count ? a * (count / total) + b * (n / total) : b;
|
|
4955
|
+
}
|
|
4956
|
+
next.validCounts[id] = total;
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
}
|
|
4960
|
+
parents.add(Math.floor(y / 2) * Math.ceil(next.width / 2) + Math.floor(x / 2));
|
|
4961
|
+
}
|
|
4962
|
+
levels[l] = next;
|
|
4963
|
+
ids = parents;
|
|
4964
|
+
}
|
|
4965
|
+
return {
|
|
4966
|
+
source: grid,
|
|
4967
|
+
pyramid: { ...previous.pyramid, levels },
|
|
4968
|
+
updatedCounts: Uint32Array.from(counts)
|
|
4969
|
+
};
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
// dist/terrain/persistent-hierarchy-data.js
|
|
4973
|
+
function getTerrainHierarchyNode(level, column, row) {
|
|
4974
|
+
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))
|
|
4975
|
+
throw new Error("Invalid persistent hierarchy level");
|
|
4976
|
+
if (!Number.isSafeInteger(column) || !Number.isSafeInteger(row) || column < 0 || row < 0 || column >= level.width || row >= level.height)
|
|
4977
|
+
throw new Error("Invalid persistent hierarchy node");
|
|
4978
|
+
const id = row * level.width + column, block = level.blocks[Math.floor(id / level.nodesPerBlock)], i = block ? 2 * (id - block.offset) : -1;
|
|
4979
|
+
const expectedOffset = Math.floor(id / level.nodesPerBlock) * level.nodesPerBlock;
|
|
4980
|
+
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)
|
|
4981
|
+
throw new Error("Invalid persistent hierarchy block");
|
|
4982
|
+
return {
|
|
4983
|
+
values: [block.values[i], block.values[i + 1]],
|
|
4984
|
+
counts: [block.counts[i], block.counts[i + 1]]
|
|
4985
|
+
};
|
|
4986
|
+
}
|
|
4987
|
+
function packTerrainHierarchyLevel(width, height, blockSize, values, counts, nodesPerBlock) {
|
|
4988
|
+
if (values.length !== 2 * width * height || counts.length !== values.length || !values.every(Number.isFinite))
|
|
4989
|
+
throw new Error("Invalid persistent hierarchy buffers");
|
|
4990
|
+
const blocks = [];
|
|
4991
|
+
for (let offset = 0; offset < width * height; offset += nodesPerBlock) {
|
|
4992
|
+
const count = Math.min(nodesPerBlock, width * height - offset);
|
|
4993
|
+
blocks.push({
|
|
4994
|
+
offset,
|
|
4995
|
+
count,
|
|
4996
|
+
values: values.slice(2 * offset, 2 * (offset + count)),
|
|
4997
|
+
counts: counts.slice(2 * offset, 2 * (offset + count))
|
|
4998
|
+
});
|
|
4999
|
+
}
|
|
5000
|
+
return { width, height, blockSize, nodesPerBlock, blocks };
|
|
5001
|
+
}
|
|
5002
|
+
function persistentHierarchyOptions(options, count) {
|
|
5003
|
+
const nodesPerBlock = options.nodesPerBlock ?? 256, maxSamples = options.maxSamples ?? 4e6, maxTests = options.maxTests ?? 1e7;
|
|
5004
|
+
if (![nodesPerBlock, maxSamples, maxTests, count].every(Number.isSafeInteger) || nodesPerBlock < 1 || maxSamples < 0 || maxTests < 0 || count < 1 || count > maxSamples)
|
|
5005
|
+
throw new Error("Invalid persistent terrain hierarchy capacity");
|
|
5006
|
+
let tests = 0;
|
|
5007
|
+
return {
|
|
5008
|
+
nodesPerBlock,
|
|
5009
|
+
maxSamples,
|
|
5010
|
+
charge: () => {
|
|
5011
|
+
if (++tests > maxTests)
|
|
5012
|
+
throw new Error("Persistent hierarchy work budget exceeded");
|
|
5013
|
+
}
|
|
5014
|
+
};
|
|
5015
|
+
}
|
|
5016
|
+
function updatePersistentHierarchy(previous, ids, mode, base, charge) {
|
|
5017
|
+
const levels = previous.slice(), updatedNodes = [];
|
|
5018
|
+
let copiedBlocks = 0, copiedBytes = 0;
|
|
5019
|
+
for (let l = 0; l < levels.length; l++) {
|
|
5020
|
+
updatedNodes.push(ids.size);
|
|
5021
|
+
if (!ids.size)
|
|
5022
|
+
continue;
|
|
5023
|
+
const old = levels[l], blocks = old.blocks.slice(), cloned = /* @__PURE__ */ new Set(), parents = /* @__PURE__ */ new Set();
|
|
5024
|
+
const node = (level, x, y) => getTerrainHierarchyNode(level, x, y);
|
|
5025
|
+
for (const id of ids) {
|
|
5026
|
+
charge();
|
|
5027
|
+
const x = id % old.width, y = Math.floor(id / old.width);
|
|
5028
|
+
let value;
|
|
5029
|
+
if (l === 0)
|
|
5030
|
+
value = base(x, y);
|
|
5031
|
+
else {
|
|
5032
|
+
const child = levels[l - 1];
|
|
5033
|
+
let a = mode === "bounds" ? Infinity : 0, b = mode === "bounds" ? -Infinity : 0, c = 0, d = 0;
|
|
5034
|
+
for (let dy = 0; dy < 2; dy++)
|
|
5035
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
5036
|
+
const cx = x * 2 + dx, cy = y * 2 + dy;
|
|
5037
|
+
if (cx >= child.width || cy >= child.height)
|
|
5038
|
+
continue;
|
|
5039
|
+
const v = node(child, cx, cy), n = v.counts[0];
|
|
5040
|
+
d += v.counts[1];
|
|
5041
|
+
if (n) {
|
|
5042
|
+
if (mode === "bounds") {
|
|
5043
|
+
a = Math.min(a, v.values[0]);
|
|
5044
|
+
b = Math.max(b, v.values[1]);
|
|
5045
|
+
} else {
|
|
5046
|
+
const total = c + n;
|
|
5047
|
+
a = c ? a * (c / total) + v.values[0] * (n / total) : v.values[0];
|
|
5048
|
+
b = c ? b * (c / total) + v.values[1] * (n / total) : v.values[1];
|
|
5049
|
+
}
|
|
5050
|
+
c += n;
|
|
5051
|
+
}
|
|
5052
|
+
}
|
|
5053
|
+
if (c && (!Number.isFinite(a) || !Number.isFinite(b)))
|
|
5054
|
+
throw new Error("Persistent hierarchy arithmetic overflow");
|
|
5055
|
+
value = { values: c ? [a, b] : [0, 0], counts: [c, d] };
|
|
5056
|
+
}
|
|
5057
|
+
const blockId = Math.floor(id / old.nodesPerBlock);
|
|
5058
|
+
if (!cloned.has(blockId)) {
|
|
5059
|
+
const source = blocks[blockId];
|
|
5060
|
+
blocks[blockId] = { ...source, values: source.values.slice(), counts: source.counts.slice() };
|
|
5061
|
+
cloned.add(blockId);
|
|
5062
|
+
copiedBlocks++;
|
|
5063
|
+
copiedBytes += blocks[blockId].values.byteLength + blocks[blockId].counts.byteLength;
|
|
5064
|
+
}
|
|
5065
|
+
const block = blocks[blockId], i = 2 * (id - block.offset);
|
|
5066
|
+
block.values[i] = value.values[0];
|
|
5067
|
+
block.values[i + 1] = value.values[1];
|
|
5068
|
+
block.counts[i] = value.counts[0];
|
|
5069
|
+
block.counts[i + 1] = value.counts[1];
|
|
5070
|
+
parents.add(Math.floor(y / 2) * Math.ceil(old.width / 2) + Math.floor(x / 2));
|
|
5071
|
+
}
|
|
5072
|
+
levels[l] = { ...old, blocks };
|
|
5073
|
+
ids = parents;
|
|
5074
|
+
}
|
|
5075
|
+
return { levels, stats: { copiedBlocks, copiedBytes, updatedNodes: Uint32Array.from(updatedNodes) } };
|
|
5076
|
+
}
|
|
5077
|
+
|
|
5078
|
+
// dist/terrain/persistent-bounds.js
|
|
5079
|
+
function updateTerrainPersistentBounds(previous, field, dirty, options = {}) {
|
|
5080
|
+
const { nodesPerBlock, charge } = persistentHierarchyOptions(options, field.width * field.height);
|
|
5081
|
+
validateTerrainDirtyWindows(dirty, field.width, field.height);
|
|
5082
|
+
if (!previous || !sameTerrainFrame(previous.field, field) || previous.levels[0].nodesPerBlock !== nodesPerBlock) {
|
|
5083
|
+
const bounds = new HeightFieldMinMax(field), levels = Array.from({ length: bounds.levelCount }, (_, i) => {
|
|
5084
|
+
const l = bounds.copyLevel(i), values = new Float64Array(2 * l.width * l.height), counts = new Uint32Array(values.length);
|
|
5085
|
+
for (let j = 0; j < l.width * l.height; j++) {
|
|
5086
|
+
values[2 * j] = l.minimums[j];
|
|
5087
|
+
values[2 * j + 1] = l.maximums[j];
|
|
5088
|
+
counts[2 * j] = l.populatedCellCounts[j];
|
|
5089
|
+
counts[2 * j + 1] = l.completeCellCounts[j];
|
|
5090
|
+
}
|
|
5091
|
+
return packTerrainHierarchyLevel(l.width, l.height, l.blockSize, values, counts, nodesPerBlock);
|
|
5092
|
+
});
|
|
5093
|
+
return {
|
|
5094
|
+
field,
|
|
5095
|
+
levels,
|
|
5096
|
+
stats: {
|
|
5097
|
+
copiedBlocks: levels.reduce((n, l) => n + l.blocks.length, 0),
|
|
5098
|
+
copiedBytes: levels.reduce((n, l) => n + l.blocks.reduce((s, b) => s + b.values.byteLength + b.counts.byteLength, 0), 0),
|
|
5099
|
+
updatedNodes: Uint32Array.from(levels, (l) => l.width * l.height)
|
|
5100
|
+
}
|
|
5101
|
+
};
|
|
5102
|
+
}
|
|
5103
|
+
const ids = terrainDirtyIndices(dirty, field.width - 1, field.height - 1, 1, charge);
|
|
5104
|
+
const result = updatePersistentHierarchy(previous.levels, ids, "bounds", (x, y) => {
|
|
5105
|
+
let min = Infinity, max = -Infinity, n = 0;
|
|
5106
|
+
for (let dy = 0; dy < 2; dy++)
|
|
5107
|
+
for (let dx = 0; dx < 2; dx++) {
|
|
5108
|
+
const z = field.getHeight(x + dx, y + dy);
|
|
5109
|
+
if (z !== void 0) {
|
|
5110
|
+
min = Math.min(min, z);
|
|
5111
|
+
max = Math.max(max, z);
|
|
5112
|
+
n++;
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
return { values: n ? [min, max] : [0, 0], counts: [n ? 1 : 0, n === 4 ? 1 : 0] };
|
|
5116
|
+
}, charge);
|
|
5117
|
+
return { field, ...result };
|
|
5118
|
+
}
|
|
5119
|
+
|
|
5120
|
+
// dist/terrain/persistent-gradients.js
|
|
5121
|
+
function updateTerrainPersistentGradients(previous, grid, dirty, options = {}) {
|
|
5122
|
+
const { nodesPerBlock, maxSamples, charge } = persistentHierarchyOptions(options, grid.width * grid.height);
|
|
5123
|
+
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)))
|
|
5124
|
+
throw new Error("Invalid persistent gradient grid");
|
|
5125
|
+
validateTerrainDirtyWindows(dirty, grid.width, grid.height);
|
|
5126
|
+
const old = previous == null ? void 0 : previous.source;
|
|
5127
|
+
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) {
|
|
5128
|
+
const pyramid = createTerrainGradientPyramid(grid, { maxSamples }), levels = pyramid.levels.map((l) => {
|
|
5129
|
+
const counts = new Uint32Array(2 * l.width * l.height);
|
|
5130
|
+
for (let i = 0; i < l.width * l.height; i++) {
|
|
5131
|
+
counts[2 * i] = l.validCounts[i];
|
|
5132
|
+
counts[2 * i + 1] = l.sampleCounts[i];
|
|
5133
|
+
}
|
|
5134
|
+
return packTerrainHierarchyLevel(l.width, l.height, l.blockSize, l.gradients, counts, nodesPerBlock);
|
|
5135
|
+
});
|
|
5136
|
+
return {
|
|
5137
|
+
source: grid,
|
|
5138
|
+
levels,
|
|
5139
|
+
stats: {
|
|
5140
|
+
copiedBlocks: levels.reduce((n, l) => n + l.blocks.length, 0),
|
|
5141
|
+
copiedBytes: levels.reduce((n, l) => n + l.blocks.reduce((s, b) => s + b.values.byteLength + b.counts.byteLength, 0), 0),
|
|
5142
|
+
updatedNodes: Uint32Array.from(levels, (l) => l.width * l.height)
|
|
5143
|
+
}
|
|
5144
|
+
};
|
|
5145
|
+
}
|
|
5146
|
+
const ids = terrainDirtyIndices(dirty, grid.width, grid.height, 0, charge);
|
|
5147
|
+
const result = updatePersistentHierarchy(previous.levels, ids, "gradient", (x, y) => {
|
|
5148
|
+
const i = y * grid.width + x, s = grid.statuses[i];
|
|
5149
|
+
if (s > 6)
|
|
5150
|
+
throw new Error("Invalid terrain gradient status");
|
|
5151
|
+
if (s === 0 && (!Number.isFinite(grid.gradients[2 * i]) || !Number.isFinite(grid.gradients[2 * i + 1])))
|
|
5152
|
+
throw new Error("Invalid terrain gradient value");
|
|
5153
|
+
return {
|
|
5154
|
+
values: s === 0 ? [grid.gradients[2 * i], grid.gradients[2 * i + 1]] : [0, 0],
|
|
5155
|
+
counts: [s === 0 ? 1 : 0, 1]
|
|
5156
|
+
};
|
|
5157
|
+
}, charge);
|
|
5158
|
+
return { source: grid, ...result };
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
// dist/terrain/lod-morph.js
|
|
5162
|
+
var TerrainMorphStatus = {
|
|
5163
|
+
VALID: 0,
|
|
5164
|
+
FINE_NO_DATA: 1,
|
|
5165
|
+
COARSE_NO_DATA: 2,
|
|
5166
|
+
OUTSIDE_COARSE: 3
|
|
5167
|
+
};
|
|
5168
|
+
function createTerrainLodMorph(fine, coarse, options) {
|
|
5169
|
+
const { ratio } = options, offset = options.coarseOrigin ?? [0, 0], limit = options.maxSamples ?? 4e6, count = fine.width * fine.height;
|
|
5170
|
+
if (!Number.isSafeInteger(ratio) || ratio < 2 || 2 ** Math.round(Math.log2(ratio)) !== ratio || offset.length !== 2 || !offset.every(Number.isSafeInteger) || !Number.isSafeInteger(limit) || limit < 0 || count > limit)
|
|
5171
|
+
throw new Error("Invalid terrain LOD ratio, origin or sample capacity");
|
|
5172
|
+
if (fine.registration !== "vertex" || coarse.registration !== "vertex" || fine.diagonal !== coarse.diagonal || fine.heightReference !== coarse.heightReference)
|
|
5173
|
+
throw new Error("Incompatible terrain LOD registration, diagonal or height reference");
|
|
5174
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
5175
|
+
if (fine.columnStep[axis] * ratio !== coarse.columnStep[axis] || fine.rowStep[axis] * ratio !== coarse.rowStep[axis])
|
|
5176
|
+
throw new Error("Terrain LOD steps differ");
|
|
5177
|
+
const a = offset[0] * fine.columnStep[axis], b = offset[1] * fine.rowStep[axis], expected = fine.origin[axis] + a + b;
|
|
5178
|
+
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])));
|
|
5179
|
+
if (!Number.isFinite(expected) || Math.abs(coarse.origin[axis] - expected) > tolerance)
|
|
5180
|
+
throw new Error("Terrain LOD origins differ");
|
|
5181
|
+
}
|
|
5182
|
+
const fineHeights = new Float64Array(count), coarseHeights = new Float64Array(count), deltas = new Float64Array(count), statuses = new Uint8Array(count), coarseCoordinates = new Float64Array(2 * count);
|
|
5183
|
+
let maxNodalDisplacement = 0;
|
|
5184
|
+
for (let y = 0; y < fine.height; y++)
|
|
5185
|
+
for (let x = 0; x < fine.width; x++) {
|
|
5186
|
+
const i = y * fine.width + x, u = (x - offset[0]) / ratio, v = (y - offset[1]) / ratio;
|
|
5187
|
+
if (!Number.isSafeInteger(x - offset[0]) || !Number.isSafeInteger(y - offset[1]))
|
|
5188
|
+
throw new Error("Terrain LOD lattice overflow");
|
|
5189
|
+
coarseCoordinates[2 * i] = u;
|
|
5190
|
+
coarseCoordinates[2 * i + 1] = v;
|
|
5191
|
+
const source = fine.getHeight(x, y);
|
|
5192
|
+
if (source === void 0) {
|
|
5193
|
+
statuses[i] = TerrainMorphStatus.FINE_NO_DATA;
|
|
5194
|
+
continue;
|
|
5195
|
+
}
|
|
5196
|
+
fineHeights[i] = source;
|
|
5197
|
+
if (u < 0 || v < 0 || u > coarse.width - 1 || v > coarse.height - 1) {
|
|
5198
|
+
statuses[i] = TerrainMorphStatus.OUTSIDE_COARSE;
|
|
5199
|
+
continue;
|
|
5200
|
+
}
|
|
5201
|
+
const target = sampleTerrainTriangleHeight(coarse, u, v);
|
|
5202
|
+
if (target === void 0) {
|
|
5203
|
+
statuses[i] = TerrainMorphStatus.COARSE_NO_DATA;
|
|
5204
|
+
continue;
|
|
5205
|
+
}
|
|
5206
|
+
const delta = target - source;
|
|
5207
|
+
if (!Number.isFinite(delta))
|
|
5208
|
+
throw new Error("Terrain LOD displacement overflow");
|
|
5209
|
+
coarseHeights[i] = target;
|
|
5210
|
+
deltas[i] = delta;
|
|
5211
|
+
maxNodalDisplacement = Math.max(maxNodalDisplacement, Math.abs(delta));
|
|
5212
|
+
}
|
|
5213
|
+
return {
|
|
5214
|
+
width: fine.width,
|
|
5215
|
+
height: fine.height,
|
|
5216
|
+
origin: [...fine.origin],
|
|
5217
|
+
columnStep: [...fine.columnStep],
|
|
5218
|
+
rowStep: [...fine.rowStep],
|
|
5219
|
+
heightReference: fine.heightReference,
|
|
5220
|
+
fineHeights,
|
|
5221
|
+
coarseHeights,
|
|
5222
|
+
deltas,
|
|
5223
|
+
statuses,
|
|
5224
|
+
coarseCoordinates,
|
|
5225
|
+
maxNodalDisplacement,
|
|
5226
|
+
ratio,
|
|
5227
|
+
coarseOrigin: [...offset],
|
|
5228
|
+
diagonal: fine.diagonal
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
// dist/terrain/lod-morph-evaluate.js
|
|
5233
|
+
function evaluateTerrainLodMorph(morph, factor) {
|
|
5234
|
+
const count = morph.width * morph.height;
|
|
5235
|
+
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)
|
|
5236
|
+
throw new Error("Invalid terrain morph evaluation");
|
|
5237
|
+
const heights = new Float64Array(count), validity = new Uint8Array(count);
|
|
5238
|
+
for (let i = 0; i < count; i++) {
|
|
5239
|
+
if (morph.statuses[i] > 3)
|
|
5240
|
+
throw new Error("Invalid terrain morph status");
|
|
5241
|
+
if (morph.statuses[i] !== 0)
|
|
5242
|
+
continue;
|
|
5243
|
+
const a = morph.fineHeights[i], b = morph.coarseHeights[i];
|
|
5244
|
+
if (!Number.isFinite(a) || !Number.isFinite(b))
|
|
5245
|
+
throw new Error("Invalid terrain morph height");
|
|
5246
|
+
heights[i] = factor === 0 ? a : factor === 1 ? b : a * (1 - factor) + b * factor;
|
|
5247
|
+
if (!Number.isFinite(heights[i]))
|
|
5248
|
+
throw new Error("Terrain morph arithmetic overflow");
|
|
5249
|
+
validity[i] = 1;
|
|
5250
|
+
}
|
|
5251
|
+
return { heights, validity };
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5254
|
+
// dist/terrain/mixed-surface.js
|
|
5255
|
+
function reconcileMixedSurface(tiles, options = {}) {
|
|
5256
|
+
const limit = options.maxSamples ?? 4e6, budget = options.maxTests ?? 2e7, adjustment = options.maxHeightAdjustment ?? 0;
|
|
5257
|
+
if (![limit, budget].every(Number.isSafeInteger) || limit < 0 || budget < 0 || Number.isNaN(adjustment) || adjustment < 0)
|
|
5258
|
+
throw new Error("Invalid mixed surface capacity or adjustment");
|
|
5259
|
+
let count = 0, tests = 0, maxHeightAdjustment = 0, sharedSamples = 0;
|
|
5260
|
+
const charge = () => {
|
|
5261
|
+
if (++tests > budget)
|
|
5262
|
+
throw new Error("Mixed surface work budget exceeded");
|
|
5263
|
+
};
|
|
5264
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5265
|
+
const sorted = [...tiles].sort((a, b) => b.spacing - a.spacing || a.column - b.column || a.row - b.row);
|
|
5266
|
+
const sources = sorted.map((t) => {
|
|
5267
|
+
if (![t.column, t.row, t.spacing].every(Number.isSafeInteger) || t.spacing < 1 || 2 ** Math.round(Math.log2(t.spacing)) !== t.spacing)
|
|
5268
|
+
throw new Error("Invalid mixed surface lattice");
|
|
5269
|
+
const key2 = `${t.spacing}/${t.column}/${t.row}`;
|
|
5270
|
+
if (seen.has(key2))
|
|
5271
|
+
throw new Error("Duplicate mixed surface tile");
|
|
5272
|
+
seen.add(key2);
|
|
5273
|
+
const width = (t.field.width - 1) * t.spacing + 1, height = (t.field.height - 1) * t.spacing + 1;
|
|
5274
|
+
count += width * height;
|
|
5275
|
+
if (![width, height, count, t.column + width - 1, t.row + height - 1].every(Number.isSafeInteger) || width < 2 || height < 2 || count > limit)
|
|
5276
|
+
throw new Error("Mixed surface sample capacity or lattice overflow");
|
|
5277
|
+
const field = new HeightField(t.field);
|
|
5278
|
+
if (field.registration !== "vertex")
|
|
5279
|
+
throw new Error("Mixed surfaces require vertex registration");
|
|
5280
|
+
return { ...t, field, width, height };
|
|
5281
|
+
});
|
|
5282
|
+
const first = sources[0];
|
|
5283
|
+
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];
|
|
5284
|
+
const origin = (first == null ? void 0 : first.field.origin.map((v, i) => v - first.column * columnStep[i] - first.row * rowStep[i])) ?? [0, 0];
|
|
5285
|
+
if (!origin.every(Number.isFinite))
|
|
5286
|
+
throw new Error("Mixed surface frame overflow");
|
|
5287
|
+
for (const t of sources)
|
|
5288
|
+
for (let axis = 0; axis < 2; axis++) {
|
|
5289
|
+
const expected = origin[axis] + t.column * columnStep[axis] + t.row * rowStep[axis];
|
|
5290
|
+
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])));
|
|
5291
|
+
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)
|
|
5292
|
+
throw new Error("Mixed surface frames, diagonals or height references differ");
|
|
5293
|
+
}
|
|
5294
|
+
for (const axis of ["column", "row"]) {
|
|
5295
|
+
let min = Infinity, max = -Infinity;
|
|
5296
|
+
for (const t of sources) {
|
|
5297
|
+
min = Math.min(min, t[axis]);
|
|
5298
|
+
max = Math.max(max, t[axis] + (axis === "column" ? t.width : t.height) - 1);
|
|
5299
|
+
}
|
|
5300
|
+
if (sources.length && !Number.isSafeInteger(max - min))
|
|
5301
|
+
throw new Error("Mixed surface lattice span overflow");
|
|
5302
|
+
}
|
|
5303
|
+
const boxes = sources.map((t) => ({
|
|
5304
|
+
minX: t.column,
|
|
5305
|
+
minY: t.row,
|
|
5306
|
+
maxX: t.column + t.width - 1,
|
|
5307
|
+
maxY: t.row + t.height - 1
|
|
5308
|
+
})), index = createTerrainBoxIndex(boxes);
|
|
5309
|
+
const neighbors = boxes.map((box, i) => index(box, charge).filter((j) => {
|
|
5310
|
+
if (i !== j && box.minX < boxes[j].maxX && boxes[j].minX < box.maxX && box.minY < boxes[j].maxY && boxes[j].minY < box.maxY)
|
|
5311
|
+
throw new Error("Overlapping mixed surface interiors");
|
|
5312
|
+
return j !== i;
|
|
5313
|
+
}));
|
|
5314
|
+
const fields = sources.map((t, i) => {
|
|
5315
|
+
const heights = new Float64Array(t.width * t.height), validity = new Uint8Array(heights.length);
|
|
5316
|
+
for (let y = 0; y < t.height; y++)
|
|
5317
|
+
for (let x = 0; x < t.width; x++) {
|
|
5318
|
+
charge();
|
|
5319
|
+
const gx = t.column + x, gy = t.row + y, local = sampleTerrainTriangleHeight(t.field, x / t.spacing, y / t.spacing);
|
|
5320
|
+
let owner = i, shared = false, missing = local === void 0;
|
|
5321
|
+
if (x === 0 || y === 0 || x === t.width - 1 || y === t.height - 1)
|
|
5322
|
+
for (const j of neighbors[i]) {
|
|
5323
|
+
charge();
|
|
5324
|
+
const b = boxes[j];
|
|
5325
|
+
if (gx >= b.minX && gx <= b.maxX && gy >= b.minY && gy <= b.maxY) {
|
|
5326
|
+
shared = true;
|
|
5327
|
+
const neighbor = sources[j];
|
|
5328
|
+
if (sampleTerrainTriangleHeight(neighbor.field, (gx - neighbor.column) / neighbor.spacing, (gy - neighbor.row) / neighbor.spacing) === void 0)
|
|
5329
|
+
missing = true;
|
|
5330
|
+
owner = Math.min(owner, j);
|
|
5331
|
+
}
|
|
5332
|
+
}
|
|
5333
|
+
const source = sources[owner], value = missing ? void 0 : owner === i ? local : sampleTerrainTriangleHeight(source.field, (gx - source.column) / source.spacing, (gy - source.row) / source.spacing);
|
|
5334
|
+
if (shared)
|
|
5335
|
+
sharedSamples++;
|
|
5336
|
+
if (local !== void 0 && value !== void 0) {
|
|
5337
|
+
const delta = Math.abs(value - local);
|
|
5338
|
+
if (!Number.isFinite(delta) || delta > adjustment)
|
|
5339
|
+
throw new Error("Mixed surface height adjustment exceeded");
|
|
5340
|
+
maxHeightAdjustment = Math.max(maxHeightAdjustment, delta);
|
|
5341
|
+
}
|
|
5342
|
+
if (value !== void 0) {
|
|
5343
|
+
const id = y * t.width + x;
|
|
5344
|
+
heights[id] = value;
|
|
5345
|
+
validity[id] = 1;
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
const props = {
|
|
5349
|
+
width: t.width,
|
|
5350
|
+
height: t.height,
|
|
5351
|
+
heights,
|
|
5352
|
+
validity,
|
|
5353
|
+
origin: [
|
|
5354
|
+
origin[0] + t.column * columnStep[0] + t.row * rowStep[0],
|
|
5355
|
+
origin[1] + t.column * columnStep[1] + t.row * rowStep[1]
|
|
5356
|
+
],
|
|
5357
|
+
columnStep: [...columnStep],
|
|
5358
|
+
rowStep: [...rowStep],
|
|
5359
|
+
registration: "vertex",
|
|
5360
|
+
diagonal: t.field.diagonal,
|
|
5361
|
+
heightReference: t.field.heightReference
|
|
5362
|
+
};
|
|
5363
|
+
return {
|
|
5364
|
+
column: t.column,
|
|
5365
|
+
row: t.row,
|
|
5366
|
+
spacing: 1,
|
|
5367
|
+
sourceSpacing: t.spacing,
|
|
5368
|
+
field: props
|
|
5369
|
+
};
|
|
5370
|
+
});
|
|
5371
|
+
return {
|
|
5372
|
+
origin,
|
|
5373
|
+
columnStep,
|
|
5374
|
+
rowStep,
|
|
5375
|
+
tiles: fields,
|
|
5376
|
+
maxHeightAdjustment,
|
|
5377
|
+
sharedSamples,
|
|
5378
|
+
tests
|
|
5379
|
+
};
|
|
5380
|
+
}
|
|
5381
|
+
|
|
5382
|
+
// dist/terrain/lod-coordinate.js
|
|
5383
|
+
function coordinateTerrainLodMorphs(tiles, options = {}) {
|
|
5384
|
+
const limit = options.maxSamples ?? 4e6;
|
|
5385
|
+
if (!Number.isSafeInteger(limit) || limit < 0)
|
|
5386
|
+
throw new Error("Invalid coordinated morph sample capacity");
|
|
5387
|
+
let count = 0;
|
|
5388
|
+
for (const t of tiles) {
|
|
5389
|
+
count += t.morph.width * t.morph.height;
|
|
5390
|
+
if (!Number.isSafeInteger(count) || count > limit)
|
|
5391
|
+
throw new Error("Coordinated morph sample capacity exceeded");
|
|
5392
|
+
}
|
|
5393
|
+
return reconcileMixedSurface(tiles.map((t) => {
|
|
5394
|
+
const evaluated = evaluateTerrainLodMorph(t.morph, t.factor);
|
|
5395
|
+
return {
|
|
5396
|
+
column: t.column,
|
|
5397
|
+
row: t.row,
|
|
5398
|
+
spacing: t.spacing,
|
|
5399
|
+
field: {
|
|
5400
|
+
...evaluated,
|
|
5401
|
+
width: t.morph.width,
|
|
5402
|
+
height: t.morph.height,
|
|
5403
|
+
origin: t.morph.origin,
|
|
5404
|
+
columnStep: t.morph.columnStep,
|
|
5405
|
+
rowStep: t.morph.rowStep,
|
|
5406
|
+
registration: "vertex",
|
|
5407
|
+
diagonal: t.morph.diagonal,
|
|
5408
|
+
heightReference: t.morph.heightReference
|
|
5409
|
+
}
|
|
5410
|
+
};
|
|
5411
|
+
}), { ...options, maxHeightAdjustment: options.maxHeightAdjustment ?? Infinity });
|
|
5412
|
+
}
|
|
5413
|
+
|
|
5414
|
+
// dist/terrain/isobands-mixed.js
|
|
5415
|
+
function createTerrainMixedIsobands(tiles, levels, options = {}) {
|
|
5416
|
+
const maxLevels = options.maxLevels ?? 256;
|
|
5417
|
+
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]))
|
|
5418
|
+
throw new Error("Invalid mixed isoband levels or capacity");
|
|
5419
|
+
const triangles = tiles.reduce((n, t) => n + 2 * (t.field.width - 1) * (t.field.height - 1) * t.spacing * t.spacing, 0);
|
|
5420
|
+
const maxTriangles = options.maxTriangles ?? 2e6;
|
|
5421
|
+
if (!Number.isSafeInteger(triangles) || !Number.isSafeInteger(maxTriangles) || maxTriangles < 0 || triangles > maxTriangles)
|
|
5422
|
+
throw new Error("Mixed isoband triangle capacity exceeded");
|
|
5423
|
+
const maxTests = options.maxTests ?? 2e7;
|
|
5424
|
+
const surface = reconcileMixedSurface(tiles, { ...options, maxTests });
|
|
5425
|
+
const bands = createTerrainIsobands(surface.tiles.map((t) => new HeightField(t.field)), levels, { ...options, maxTests: maxTests - surface.tests });
|
|
5426
|
+
return {
|
|
5427
|
+
...bands,
|
|
5428
|
+
maxHeightAdjustment: surface.maxHeightAdjustment,
|
|
5429
|
+
sharedSamples: surface.sharedSamples
|
|
5430
|
+
};
|
|
5431
|
+
}
|
|
3917
5432
|
//# sourceMappingURL=index.cjs.map
|