@math.gl/geospatial 5.0.0-beta.9 → 5.0.0-rc.2
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/README.md +3 -3
- package/dist/crs/crs-descriptor-types.d.ts +2 -1
- package/dist/crs/crs-descriptor-types.d.ts.map +1 -1
- package/dist/crs/index.cjs +54 -0
- package/dist/crs/index.cjs.map +2 -2
- package/dist/crs/index.d.ts +1 -0
- package/dist/crs/index.d.ts.map +1 -1
- package/dist/crs/index.js +1 -0
- package/dist/crs/index.js.map +1 -1
- package/dist/crs/spatial-reference-metadata.d.ts +20 -0
- package/dist/crs/spatial-reference-metadata.d.ts.map +1 -0
- package/dist/crs/spatial-reference-metadata.js +86 -0
- package/dist/crs/spatial-reference-metadata.js.map +1 -0
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.d.ts.map +1 -1
- package/dist/ellipsoid-helpers/ellipsoid-transform.js +2 -2
- package/dist/ellipsoid-helpers/ellipsoid-transform.js.map +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js +1 -1
- package/dist/ellipsoid-helpers/scale-to-geodetic-surface.js.map +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts +1 -1
- package/dist/ellipsoid-helpers/tangent-plane-numerics.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.d.ts +2 -2
- package/dist/ellipsoid-tangent-plane.d.ts.map +1 -1
- package/dist/ellipsoid-tangent-plane.js +1 -1
- package/dist/ellipsoid-tangent-plane.js.map +1 -1
- package/dist/ellipsoid-transforms.d.ts +2 -2
- package/dist/ellipsoid-transforms.d.ts.map +1 -1
- package/dist/ellipsoid-transforms.js +1 -1
- package/dist/ellipsoid-transforms.js.map +1 -1
- package/dist/ellipsoid.d.ts +2 -2
- package/dist/ellipsoid.d.ts.map +1 -1
- package/dist/ellipsoid.js +2 -2
- package/dist/ellipsoid.js.map +1 -1
- package/dist/expressions.d.ts +1 -1
- package/dist/expressions.d.ts.map +1 -1
- package/dist/expressions.js +1 -1
- package/dist/expressions.js.map +1 -1
- package/dist/geodesic-buffer.d.ts +1 -1
- package/dist/geodesic-buffer.d.ts.map +1 -1
- package/dist/geodesic-path.d.ts +1 -1
- package/dist/geodesic-path.d.ts.map +1 -1
- package/dist/geometry-constructors.d.ts +6 -0
- package/dist/geometry-constructors.d.ts.map +1 -0
- package/dist/geometry-constructors.js +37 -0
- package/dist/geometry-constructors.js.map +1 -0
- package/dist/geometry-inspection.d.ts +8 -0
- package/dist/geometry-inspection.d.ts.map +1 -0
- package/dist/geometry-inspection.js +61 -0
- package/dist/geometry-inspection.js.map +1 -0
- package/dist/index.cjs +2514 -558
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +164 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -1
- package/dist/line-simplification.d.ts +4 -0
- package/dist/line-simplification.d.ts.map +1 -0
- package/dist/line-simplification.js +83 -0
- package/dist/line-simplification.js.map +1 -0
- package/dist/linear-referencing.d.ts +6 -0
- package/dist/linear-referencing.d.ts.map +1 -0
- package/dist/linear-referencing.js +74 -0
- package/dist/linear-referencing.js.map +1 -0
- package/dist/lng-lat-rectangle.d.ts +1 -1
- package/dist/lng-lat-rectangle.d.ts.map +1 -1
- package/dist/lng-lat-rectangle.js +1 -1
- package/dist/lng-lat-rectangle.js.map +1 -1
- package/dist/local-reference-frame.d.ts +3 -3
- package/dist/local-reference-frame.d.ts.map +1 -1
- package/dist/local-reference-frame.js +2 -2
- package/dist/local-reference-frame.js.map +1 -1
- package/dist/make-obb-from-region.d.ts +1 -1
- package/dist/make-obb-from-region.d.ts.map +1 -1
- package/dist/make-obb-from-region.js +1 -1
- package/dist/make-obb-from-region.js.map +1 -1
- package/dist/maps/air-ocean-mesh.js +1 -1
- package/dist/maps/air-ocean-mesh.js.map +1 -1
- package/dist/maps/myriahedral/unfold.d.ts +1 -1
- package/dist/maps/myriahedral/unfold.d.ts.map +1 -1
- package/dist/maps/myriahedral/unfold.js +1 -1
- package/dist/maps/myriahedral/unfold.js.map +1 -1
- package/dist/maps/presets.cjs +6 -6
- package/dist/maps/presets.cjs.map +2 -2
- package/dist/maps.cjs +6 -6
- package/dist/maps.cjs.map +2 -2
- package/dist/projection/deformation.cjs +5 -5
- package/dist/projection/deformation.cjs.map +2 -2
- package/dist/projection/experimental/core.cjs +8 -4
- package/dist/projection/experimental/core.cjs.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.d.ts.map +1 -1
- package/dist/projection/experimental/crs/spatial-reference.js.map +1 -1
- package/dist/projection/experimental/crs/types.d.ts +1 -1
- package/dist/projection/experimental/crs/types.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.d.ts.map +1 -1
- package/dist/projection/experimental/crs-rendering-scale.js +13 -2
- package/dist/projection/experimental/crs-rendering-scale.js.map +1 -1
- package/dist/projection/experimental/datum.js +1 -1
- package/dist/projection/experimental/datum.js.map +1 -1
- package/dist/projection/experimental/entries/projections/geocent.cjs +3 -3
- package/dist/projection/experimental/entries/projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/aea.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/aea.js +4 -1
- package/dist/projection/experimental/lazy-projections/aea.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/bonne.js +4 -1
- package/dist/projection/experimental/lazy-projections/bonne.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/cass.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/cass.js +4 -1
- package/dist/projection/experimental/lazy-projections/cass.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eck6.js +4 -1
- package/dist/projection/experimental/lazy-projections/eck6.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqdc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js +4 -1
- package/dist/projection/experimental/lazy-projections/eqearth.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/equi.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/equi.js +4 -1
- package/dist/projection/experimental/lazy-projections/equi.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geocent.js +4 -1
- package/dist/projection/experimental/lazy-projections/geocent.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/geos.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/geos.js +4 -1
- package/dist/projection/experimental/lazy-projections/geos.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/gnom.js +4 -1
- package/dist/projection/experimental/lazy-projections/gnom.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/index.cjs +100 -27
- package/dist/projection/experimental/lazy-projections/index.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/krovak.js +4 -1
- package/dist/projection/experimental/lazy-projections/krovak.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/merc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/merc.js +4 -1
- package/dist/projection/experimental/lazy-projections/merc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/mill.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/mill.js +4 -1
- package/dist/projection/experimental/lazy-projections/mill.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/moll.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/moll.js +4 -1
- package/dist/projection/experimental/lazy-projections/moll.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js +4 -1
- package/dist/projection/experimental/lazy-projections/nzmg.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/omerc.js +4 -1
- package/dist/projection/experimental/lazy-projections/omerc.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/ortho.js +4 -1
- package/dist/projection/experimental/lazy-projections/ortho.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/poly.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/poly.js +4 -1
- package/dist/projection/experimental/lazy-projections/poly.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/robin.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/robin.js +4 -1
- package/dist/projection/experimental/lazy-projections/robin.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/sinu.js +4 -1
- package/dist/projection/experimental/lazy-projections/sinu.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/stere.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/stere.js +4 -1
- package/dist/projection/experimental/lazy-projections/stere.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/tpers.js +4 -1
- package/dist/projection/experimental/lazy-projections/tpers.js.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.cjs.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.d.ts.map +1 -1
- package/dist/projection/experimental/lazy-projections/vandg.js +4 -1
- package/dist/projection/experimental/lazy-projections/vandg.js.map +1 -1
- package/dist/projection/experimental/spatial-deformation.js +1 -1
- package/dist/projection/experimental/spatial-deformation.js.map +1 -1
- package/dist/projection/index.cjs +8 -4
- package/dist/projection/index.cjs.map +1 -1
- package/dist/projection/index.d.ts.map +1 -1
- package/dist/projection/index.js.map +1 -1
- package/dist/projection/lib/projection.js.map +1 -1
- package/dist/projection/pipeline.cjs +3 -3
- package/dist/projection/pipeline.cjs.map +1 -1
- package/dist/projection/temporal.cjs +5 -5
- package/dist/projection/temporal.cjs.map +2 -2
- package/dist/projection/transform-analysis.cjs +3 -3
- package/dist/projection/transform-analysis.cjs.map +1 -1
- package/dist/rhumb-path.d.ts +1 -1
- package/dist/rhumb-path.d.ts.map +1 -1
- package/dist/spatial-planar-intersects.d.ts +4 -0
- package/dist/spatial-planar-intersects.d.ts.map +1 -0
- package/dist/spatial-planar-intersects.js +108 -0
- package/dist/spatial-planar-intersects.js.map +1 -0
- package/dist/spatial-planar.d.ts +16 -0
- package/dist/spatial-planar.d.ts.map +1 -0
- package/dist/spatial-planar.js +240 -0
- package/dist/spatial-planar.js.map +1 -0
- package/dist/spatial-sql.d.ts +45 -0
- package/dist/spatial-sql.d.ts.map +1 -0
- package/dist/spatial-sql.js +192 -0
- package/dist/spatial-sql.js.map +1 -0
- package/dist/st-functions.cjs +1616 -0
- package/dist/st-functions.cjs.map +6 -0
- package/dist/st-functions.d.ts +307 -0
- package/dist/st-functions.d.ts.map +1 -0
- package/dist/st-functions.js +593 -0
- package/dist/st-functions.js.map +1 -0
- package/dist/subdivide-globe-mesh.js +1 -1
- package/dist/subdivide-globe-mesh.js.map +1 -1
- package/dist/tasks/index.cjs +216 -98
- package/dist/tasks/index.cjs.map +2 -2
- package/dist/tasks/terrain-residency.d.ts +9 -0
- package/dist/tasks/terrain-residency.d.ts.map +1 -1
- package/dist/tasks/terrain-residency.js +98 -19
- package/dist/tasks/terrain-residency.js.map +1 -1
- package/dist/terrain/cutout-polygons.d.ts +21 -0
- package/dist/terrain/cutout-polygons.d.ts.map +1 -0
- package/dist/terrain/cutout-polygons.js +172 -0
- package/dist/terrain/cutout-polygons.js.map +1 -0
- package/dist/terrain/cutout-region.d.ts +34 -0
- package/dist/terrain/cutout-region.d.ts.map +1 -0
- package/dist/terrain/cutout-region.js +33 -0
- package/dist/terrain/cutout-region.js.map +1 -0
- package/dist/terrain/cutout-skirts.d.ts +34 -0
- package/dist/terrain/cutout-skirts.d.ts.map +1 -0
- package/dist/terrain/cutout-skirts.js +29 -0
- package/dist/terrain/cutout-skirts.js.map +1 -0
- package/dist/terrain/depression-fill.d.ts +25 -0
- package/dist/terrain/depression-fill.d.ts.map +1 -0
- package/dist/terrain/depression-fill.js +106 -0
- package/dist/terrain/depression-fill.js.map +1 -0
- package/dist/terrain/geographic-cutout.d.ts +38 -0
- package/dist/terrain/geographic-cutout.d.ts.map +1 -0
- package/dist/terrain/geographic-cutout.js +120 -0
- package/dist/terrain/geographic-cutout.js.map +1 -0
- package/dist/terrain/geographic-lod-seams.d.ts +10 -0
- package/dist/terrain/geographic-lod-seams.d.ts.map +1 -0
- package/dist/terrain/geographic-lod-seams.js +100 -0
- package/dist/terrain/geographic-lod-seams.js.map +1 -0
- package/dist/terrain/geographic-neighbor.d.ts +18 -0
- package/dist/terrain/geographic-neighbor.d.ts.map +1 -0
- package/dist/terrain/geographic-neighbor.js +44 -0
- package/dist/terrain/geographic-neighbor.js.map +1 -0
- package/dist/terrain/geographic-poles.d.ts +24 -0
- package/dist/terrain/geographic-poles.d.ts.map +1 -0
- package/dist/terrain/geographic-poles.js +34 -0
- package/dist/terrain/geographic-poles.js.map +1 -0
- package/dist/terrain/hydrology.d.ts +42 -0
- package/dist/terrain/hydrology.d.ts.map +1 -0
- package/dist/terrain/hydrology.js +112 -0
- package/dist/terrain/hydrology.js.map +1 -0
- package/dist/terrain/index.cjs +2135 -161
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +23 -1
- 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/lod-screen-error.d.ts +28 -0
- package/dist/terrain/lod-screen-error.d.ts.map +1 -0
- package/dist/terrain/lod-screen-error.js +95 -0
- package/dist/terrain/lod-screen-error.js.map +1 -0
- package/dist/terrain/lod-select.d.ts +26 -10
- package/dist/terrain/lod-select.d.ts.map +1 -1
- package/dist/terrain/lod-select.js +27 -14
- package/dist/terrain/lod-select.js.map +1 -1
- package/dist/terrain/lod-stitch.d.ts +2 -0
- package/dist/terrain/lod-stitch.d.ts.map +1 -1
- package/dist/terrain/lod-stitch.js +21 -6
- package/dist/terrain/lod-stitch.js.map +1 -1
- package/dist/terrain/mesh-cutout.d.ts +45 -0
- package/dist/terrain/mesh-cutout.d.ts.map +1 -0
- package/dist/terrain/mesh-cutout.js +336 -0
- package/dist/terrain/mesh-cutout.js.map +1 -0
- package/dist/terrain/mesh-skirts.d.ts +8 -2
- package/dist/terrain/mesh-skirts.d.ts.map +1 -1
- package/dist/terrain/mesh-skirts.js +5 -4
- package/dist/terrain/mesh-skirts.js.map +1 -1
- package/dist/terrain/mixed-halo-update.d.ts.map +1 -1
- package/dist/terrain/mixed-halo-update.js +58 -23
- package/dist/terrain/mixed-halo-update.js.map +1 -1
- package/dist/terrain/mixed-vertex-halos.d.ts +24 -1
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -1
- package/dist/terrain/mixed-vertex-halos.js +75 -58
- package/dist/terrain/mixed-vertex-halos.js.map +1 -1
- package/dist/terrain/regional-viewshed.d.ts +55 -0
- package/dist/terrain/regional-viewshed.d.ts.map +1 -0
- package/dist/terrain/regional-viewshed.js +119 -0
- package/dist/terrain/regional-viewshed.js.map +1 -0
- package/dist/terrain/surface.d.ts +1 -1
- package/dist/terrain/surface.d.ts.map +1 -1
- package/dist/terrain/surface.js +1 -1
- package/dist/terrain/surface.js.map +1 -1
- package/dist/terrain/sweep-capsule.d.ts +27 -0
- package/dist/terrain/sweep-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-capsule.js +104 -0
- package/dist/terrain/sweep-capsule.js.map +1 -0
- package/dist/terrain/sweep-cylinder.d.ts +16 -0
- package/dist/terrain/sweep-cylinder.d.ts.map +1 -0
- package/dist/terrain/sweep-cylinder.js +52 -0
- package/dist/terrain/sweep-cylinder.js.map +1 -0
- package/dist/terrain/sweep-plane.d.ts +9 -0
- package/dist/terrain/sweep-plane.d.ts.map +1 -0
- package/dist/terrain/sweep-plane.js +52 -0
- package/dist/terrain/sweep-plane.js.map +1 -0
- package/dist/terrain/sweep-polytope.d.ts +42 -0
- package/dist/terrain/sweep-polytope.d.ts.map +1 -0
- package/dist/terrain/sweep-polytope.js +189 -0
- package/dist/terrain/sweep-polytope.js.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts +17 -0
- package/dist/terrain/sweep-rotating-capsule.d.ts.map +1 -0
- package/dist/terrain/sweep-rotating-capsule.js +118 -0
- package/dist/terrain/sweep-rotating-capsule.js.map +1 -0
- package/dist/terrain/sweep-rotation.d.ts +35 -0
- package/dist/terrain/sweep-rotation.d.ts.map +1 -0
- package/dist/terrain/sweep-rotation.js +114 -0
- package/dist/terrain/sweep-rotation.js.map +1 -0
- package/dist/terrain/sweep-sphere.d.ts +27 -0
- package/dist/terrain/sweep-sphere.d.ts.map +1 -0
- package/dist/terrain/sweep-sphere.js +69 -0
- package/dist/terrain/sweep-sphere.js.map +1 -0
- package/dist/terrain/tile-cutout-update.d.ts +73 -0
- package/dist/terrain/tile-cutout-update.d.ts.map +1 -0
- package/dist/terrain/tile-cutout-update.js +181 -0
- package/dist/terrain/tile-cutout-update.js.map +1 -0
- package/dist/terrain/tile-cutout.d.ts +33 -0
- package/dist/terrain/tile-cutout.d.ts.map +1 -0
- package/dist/terrain/tile-cutout.js +93 -0
- package/dist/terrain/tile-cutout.js.map +1 -0
- package/dist/terrain/watershed-accumulation.d.ts +20 -0
- package/dist/terrain/watershed-accumulation.d.ts.map +1 -0
- package/dist/terrain/watershed-accumulation.js +53 -0
- package/dist/terrain/watershed-accumulation.js.map +1 -0
- package/dist/triaxial.d.ts +1 -1
- package/dist/triaxial.d.ts.map +1 -1
- package/dist/turf-expressions.cjs +1997 -0
- package/dist/turf-expressions.cjs.map +6 -0
- package/dist/turf-expressions.d.ts +3 -0
- package/dist/turf-expressions.d.ts.map +1 -0
- package/dist/turf-expressions.js +7 -0
- package/dist/turf-expressions.js.map +1 -0
- package/dist/turf-functions.cjs +743 -0
- package/dist/turf-functions.cjs.map +6 -0
- package/dist/turf-functions.d.ts +90 -0
- package/dist/turf-functions.d.ts.map +1 -0
- package/dist/{turf/expressions.js → turf-functions.js} +51 -5
- package/dist/turf-functions.js.map +1 -0
- package/dist/turf.cjs +25 -25
- package/dist/turf.cjs.map +2 -2
- package/dist/turf.d.ts +1 -1
- package/dist/turf.d.ts.map +1 -1
- package/dist/turf.js +2 -2
- package/dist/turf.js.map +1 -1
- package/dist/type-utils.d.ts +1 -1
- package/dist/type-utils.d.ts.map +1 -1
- package/dist/type-utils.js +1 -1
- package/dist/type-utils.js.map +1 -1
- package/dist/web-mercator/assert.d.ts +2 -0
- package/dist/web-mercator/assert.d.ts.map +1 -0
- package/dist/web-mercator/assert.js +12 -0
- package/dist/web-mercator/assert.js.map +1 -0
- package/dist/web-mercator/fit-bounds.d.ts +52 -0
- package/dist/web-mercator/fit-bounds.d.ts.map +1 -0
- package/dist/web-mercator/fit-bounds.js +70 -0
- package/dist/web-mercator/fit-bounds.js.map +1 -0
- package/dist/web-mercator/fly-to-viewport.d.ts +19 -0
- package/dist/web-mercator/fly-to-viewport.d.ts.map +1 -0
- package/dist/web-mercator/fly-to-viewport.js +94 -0
- package/dist/web-mercator/fly-to-viewport.js.map +1 -0
- package/dist/web-mercator/get-bounds.d.ts +3 -0
- package/dist/web-mercator/get-bounds.d.ts.map +1 -0
- package/dist/web-mercator/get-bounds.js +56 -0
- package/dist/web-mercator/get-bounds.js.map +1 -0
- package/dist/web-mercator/index.cjs +705 -0
- package/dist/web-mercator/index.cjs.map +6 -0
- package/dist/web-mercator/index.d.ts +14 -0
- package/dist/web-mercator/index.d.ts.map +1 -0
- package/dist/web-mercator/index.js +14 -0
- package/dist/web-mercator/index.js.map +1 -0
- package/dist/web-mercator/math-utils.d.ts +7 -0
- package/dist/web-mercator/math-utils.d.ts.map +1 -0
- package/dist/web-mercator/math-utils.js +30 -0
- package/dist/web-mercator/math-utils.js.map +1 -0
- package/dist/web-mercator/mercator-meters.d.ts +29 -0
- package/dist/web-mercator/mercator-meters.d.ts.map +1 -0
- package/dist/web-mercator/mercator-meters.js +61 -0
- package/dist/web-mercator/mercator-meters.js.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts +16 -0
- package/dist/web-mercator/normalize-viewport-props.d.ts.map +1 -0
- package/dist/web-mercator/normalize-viewport-props.js +45 -0
- package/dist/web-mercator/normalize-viewport-props.js.map +1 -0
- package/dist/web-mercator/web-mercator-utils.d.ts +192 -0
- package/dist/web-mercator/web-mercator-utils.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-utils.js +321 -0
- package/dist/web-mercator/web-mercator-utils.js.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts +177 -0
- package/dist/web-mercator/web-mercator-viewport.d.ts.map +1 -0
- package/dist/web-mercator/web-mercator-viewport.js +276 -0
- package/dist/web-mercator/web-mercator-viewport.js.map +1 -0
- package/dist/web-mercator.d.ts +1 -1
- package/dist/web-mercator.d.ts.map +1 -1
- package/dist/web-mercator.js +1 -1
- package/dist/web-mercator.js.map +1 -1
- package/package.json +34 -462
- package/src/crs/crs-descriptor-types.ts +2 -1
- package/src/crs/index.ts +7 -0
- package/src/crs/spatial-reference-metadata.ts +118 -0
- package/src/ellipsoid-helpers/ellipsoid-transform.ts +3 -3
- package/src/ellipsoid-helpers/scale-to-geodetic-surface.ts +1 -1
- package/src/ellipsoid-helpers/tangent-plane-numerics.ts +1 -1
- package/src/ellipsoid-tangent-plane.ts +2 -2
- package/src/ellipsoid-transforms.ts +2 -2
- package/src/ellipsoid.ts +7 -3
- package/src/expressions.ts +2 -2
- package/src/geodesic-buffer.ts +1 -1
- package/src/geodesic-path.ts +1 -1
- package/src/geometry-constructors.ts +36 -0
- package/src/geometry-inspection.ts +66 -0
- package/src/index.ts +271 -4
- package/src/line-simplification.ts +97 -0
- package/src/linear-referencing.ts +94 -0
- package/src/lng-lat-rectangle.ts +1 -1
- package/src/local-reference-frame.ts +4 -4
- package/src/make-obb-from-region.ts +9 -1
- package/src/maps/air-ocean-mesh.ts +1 -1
- package/src/maps/myriahedral/unfold.ts +1 -1
- package/src/projection/experimental/crs/spatial-reference.ts +1 -6
- package/src/projection/experimental/crs/types.ts +2 -2
- package/src/projection/experimental/crs/wkt.ts +1 -1
- package/src/projection/experimental/crs-descriptor.ts +1 -1
- package/src/projection/experimental/crs-rendering-scale.ts +16 -4
- package/src/projection/experimental/datum.ts +1 -1
- package/src/projection/experimental/lazy-projections/aea.ts +4 -1
- package/src/projection/experimental/lazy-projections/bonne.ts +4 -1
- package/src/projection/experimental/lazy-projections/cass.ts +4 -1
- package/src/projection/experimental/lazy-projections/eck6.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqdc.ts +4 -1
- package/src/projection/experimental/lazy-projections/eqearth.ts +4 -1
- package/src/projection/experimental/lazy-projections/equi.ts +4 -1
- package/src/projection/experimental/lazy-projections/geocent.ts +4 -1
- package/src/projection/experimental/lazy-projections/geos.ts +4 -1
- package/src/projection/experimental/lazy-projections/gnom.ts +4 -1
- package/src/projection/experimental/lazy-projections/krovak.ts +4 -1
- package/src/projection/experimental/lazy-projections/merc.ts +4 -1
- package/src/projection/experimental/lazy-projections/mill.ts +4 -1
- package/src/projection/experimental/lazy-projections/moll.ts +4 -1
- package/src/projection/experimental/lazy-projections/nzmg.ts +4 -1
- package/src/projection/experimental/lazy-projections/omerc.ts +4 -1
- package/src/projection/experimental/lazy-projections/ortho.ts +4 -1
- package/src/projection/experimental/lazy-projections/poly.ts +4 -1
- package/src/projection/experimental/lazy-projections/robin.ts +4 -1
- package/src/projection/experimental/lazy-projections/sinu.ts +4 -1
- package/src/projection/experimental/lazy-projections/stere.ts +4 -1
- package/src/projection/experimental/lazy-projections/tpers.ts +4 -1
- package/src/projection/experimental/lazy-projections/vandg.ts +4 -1
- package/src/projection/experimental/spatial-deformation.ts +1 -1
- package/src/projection/index.ts +1 -1
- package/src/projection/lib/projection.ts +1 -1
- package/src/rhumb-path.ts +1 -1
- package/src/spatial-planar-intersects.ts +134 -0
- package/src/spatial-planar.ts +266 -0
- package/src/spatial-sql.ts +276 -0
- package/src/st-functions.ts +852 -0
- package/src/subdivide-globe-mesh.ts +1 -1
- package/src/tasks/terrain-residency.ts +120 -24
- package/src/terrain/cutout-polygons.ts +202 -0
- package/src/terrain/cutout-region.ts +54 -0
- package/src/terrain/cutout-skirts.ts +52 -0
- package/src/terrain/depression-fill.ts +125 -0
- package/src/terrain/geographic-cutout.ts +154 -0
- package/src/terrain/geographic-lod-seams.ts +109 -0
- package/src/terrain/geographic-neighbor.ts +58 -0
- package/src/terrain/geographic-poles.ts +52 -0
- package/src/terrain/hydrology.ts +149 -0
- package/src/terrain/index.ts +122 -1
- package/src/terrain/lod-screen-error.ts +128 -0
- package/src/terrain/lod-select.ts +65 -31
- package/src/terrain/lod-stitch.ts +25 -7
- package/src/terrain/mesh-cutout.ts +420 -0
- package/src/terrain/mesh-skirts.ts +10 -7
- package/src/terrain/mixed-halo-update.ts +54 -20
- package/src/terrain/mixed-vertex-halos.ts +94 -78
- package/src/terrain/regional-viewshed.ts +177 -0
- package/src/terrain/surface.ts +1 -1
- package/src/terrain/sweep-capsule.ts +148 -0
- package/src/terrain/sweep-cylinder.ts +64 -0
- package/src/terrain/sweep-plane.ts +61 -0
- package/src/terrain/sweep-polytope.ts +253 -0
- package/src/terrain/sweep-rotating-capsule.ts +139 -0
- package/src/terrain/sweep-rotation.ts +149 -0
- package/src/terrain/sweep-sphere.ts +100 -0
- package/src/terrain/tile-cutout-update.ts +293 -0
- package/src/terrain/tile-cutout.ts +123 -0
- package/src/terrain/watershed-accumulation.ts +67 -0
- package/src/triaxial.ts +1 -1
- package/src/turf-expressions.ts +7 -0
- package/src/{turf/expressions.ts → turf-functions.ts} +121 -6
- package/src/turf.ts +3 -7
- package/src/type-utils.ts +2 -2
- package/src/web-mercator/assert.ts +11 -0
- package/src/web-mercator/fit-bounds.ts +132 -0
- package/src/web-mercator/fly-to-viewport.ts +157 -0
- package/src/web-mercator/get-bounds.ts +62 -0
- package/src/web-mercator/index.ts +49 -0
- package/src/web-mercator/math-utils.ts +35 -0
- package/src/web-mercator/mercator-meters.ts +83 -0
- package/src/web-mercator/normalize-viewport-props.ts +58 -0
- package/src/web-mercator/web-mercator-utils.ts +468 -0
- package/src/web-mercator/web-mercator-viewport.ts +406 -0
- package/src/web-mercator.ts +1 -1
- package/dist/projection/experimental/index.cjs +0 -11707
- package/dist/projection/experimental/index.cjs.map +0 -6
- package/dist/turf/expressions.cjs +0 -87
- package/dist/turf/expressions.cjs.map +0 -6
- package/dist/turf/expressions.d.ts +0 -24
- package/dist/turf/expressions.d.ts.map +0 -1
- package/dist/turf/expressions.js.map +0 -1
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {getTerrainCutoutPlan, type TerrainCutoutRegion} from './cutout-region';
|
|
6
|
+
|
|
7
|
+
type XY = readonly [number, number];
|
|
8
|
+
type XYZ = readonly [number, number, number];
|
|
9
|
+
type Face = [number, number, number];
|
|
10
|
+
type Edge = [number, number];
|
|
11
|
+
|
|
12
|
+
/** Indexed upward-facing terrain in a shared local Cartesian frame. */
|
|
13
|
+
export type TerrainCutoutInput = {
|
|
14
|
+
positions: Float32Array | Float64Array;
|
|
15
|
+
indices: Uint16Array | Uint32Array;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** A detached surface with interpolation provenance in the original mesh. */
|
|
19
|
+
export type TerrainCutoutPiece = {
|
|
20
|
+
positions: Float64Array;
|
|
21
|
+
indices: Uint32Array;
|
|
22
|
+
/** Input triangle index for each output vertex. */
|
|
23
|
+
sourceTriangles: Uint32Array;
|
|
24
|
+
/** Three barycentric weights per output vertex in input triangle order. */
|
|
25
|
+
sourceWeights: Float64Array;
|
|
26
|
+
/** Input triangle index for each output triangle. */
|
|
27
|
+
sourceFaces: Uint32Array;
|
|
28
|
+
/** Directed boundary edges paired with the other piece in reverse order. */
|
|
29
|
+
cutEdges: Uint32Array;
|
|
30
|
+
/** Input polygon index per output face; 0 for raw convex rings, 0xffffffff for remainder. */
|
|
31
|
+
polygonIndices: Uint32Array;
|
|
32
|
+
/** Patch polygon index per directed cut edge, also present on the paired remainder edge. */
|
|
33
|
+
cutPolygonIndices: Uint32Array;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Bounds for the splitter's working storage and pair/fragment checks. */
|
|
37
|
+
export type TerrainCutoutOptions = {
|
|
38
|
+
/** Maximum candidate topology checks and clipping vertex visits. */
|
|
39
|
+
maxWork?: number;
|
|
40
|
+
/** Maximum working vertices and, independently, total output vertices. */
|
|
41
|
+
maxVertices?: number;
|
|
42
|
+
/** Maximum intermediate fragments and, independently, total output triangles. */
|
|
43
|
+
maxTriangles?: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** Both sides of a terrain cut, with matching directed edges along the opening. */
|
|
47
|
+
export type TerrainCutout = {patch: TerrainCutoutPiece; remainder: TerrainCutoutPiece};
|
|
48
|
+
|
|
49
|
+
type Fragment = {ids: number[]; inside: boolean};
|
|
50
|
+
/** Edge incidence and owning polygon while assembling one output piece. */
|
|
51
|
+
type Boundary = {
|
|
52
|
+
/** Directed output vertex IDs. */
|
|
53
|
+
edge: Edge;
|
|
54
|
+
/** Number of incident output faces. */
|
|
55
|
+
count: number;
|
|
56
|
+
/** Input polygon index of the incident face, or -1 for the remainder. */
|
|
57
|
+
polygon: number;
|
|
58
|
+
};
|
|
59
|
+
type PieceBuilder = {
|
|
60
|
+
ids: Map<number, number>;
|
|
61
|
+
positions: number[];
|
|
62
|
+
indices: number[];
|
|
63
|
+
sourceTriangles: number[];
|
|
64
|
+
sourceWeights: number[];
|
|
65
|
+
sourceFaces: number[];
|
|
66
|
+
boundary: Map<string, Boundary>;
|
|
67
|
+
cutEdges: number[];
|
|
68
|
+
/** One input polygon index per face; remainder -1 converts to Uint32 0xffffffff. */
|
|
69
|
+
polygonIndices: number[];
|
|
70
|
+
/** One owning patch polygon index per directed cut edge, on both sides. */
|
|
71
|
+
cutPolygonIndices: number[];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Split conforming 2.5D terrain by a convex ring or prepared polygon set in local XY.
|
|
75
|
+
* Either ring winding is accepted. Ring vertices must omit a closing duplicate.
|
|
76
|
+
* Rejects overlapping sheets, nonconforming edges and unrepresentable slivers.
|
|
77
|
+
*/
|
|
78
|
+
export function splitTerrainMesh(
|
|
79
|
+
mesh: TerrainCutoutInput,
|
|
80
|
+
polygon: TerrainCutoutRegion,
|
|
81
|
+
{maxWork = 4_000_000, maxVertices = 500_000, maxTriangles = 500_000}: TerrainCutoutOptions = {}
|
|
82
|
+
): TerrainCutout {
|
|
83
|
+
if (
|
|
84
|
+
![maxWork, maxVertices, maxTriangles].every(n => Number.isSafeInteger(n) && n >= 0) ||
|
|
85
|
+
maxVertices > 0xffffffff ||
|
|
86
|
+
maxTriangles > 0xffffffff ||
|
|
87
|
+
!(mesh.positions instanceof Float32Array || mesh.positions instanceof Float64Array) ||
|
|
88
|
+
!(mesh.indices instanceof Uint16Array || mesh.indices instanceof Uint32Array) ||
|
|
89
|
+
mesh.positions.length % 3 ||
|
|
90
|
+
mesh.indices.length % 3 ||
|
|
91
|
+
mesh.positions.length / 3 > maxVertices ||
|
|
92
|
+
mesh.indices.length / 3 > maxTriangles ||
|
|
93
|
+
!mesh.positions.every(Number.isFinite)
|
|
94
|
+
)
|
|
95
|
+
throw new RangeError('Invalid terrain cutout mesh or capacity');
|
|
96
|
+
|
|
97
|
+
let work = 0;
|
|
98
|
+
/** Charge bounded work before performing a topology or clipping operation. */
|
|
99
|
+
function charge(amount: number) {
|
|
100
|
+
work += amount;
|
|
101
|
+
if (work > maxWork) throw new RangeError('Terrain cutout work budget exceeded');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const prepared = getTerrainCutoutPlan(polygon);
|
|
105
|
+
const ring = prepared ? undefined : validatePolygon(polygon as readonly XY[], charge);
|
|
106
|
+
const lines = prepared?.lines ?? ring!.map((p, i) => [p, ring![(i + 1) % ring!.length]] as const);
|
|
107
|
+
const vertices: XYZ[] = [];
|
|
108
|
+
for (let i = 0; i < mesh.positions.length; i += 3)
|
|
109
|
+
vertices.push([mesh.positions[i], mesh.positions[i + 1], mesh.positions[i + 2]]);
|
|
110
|
+
const faces: Face[] = [];
|
|
111
|
+
for (let i = 0; i < mesh.indices.length; i += 3) {
|
|
112
|
+
const face: Face = [mesh.indices[i], mesh.indices[i + 1], mesh.indices[i + 2]];
|
|
113
|
+
if (face.some(id => id >= vertices.length))
|
|
114
|
+
throw new RangeError('Invalid terrain cutout index');
|
|
115
|
+
checkTriangle(vertices[face[0]], vertices[face[1]], vertices[face[2]]);
|
|
116
|
+
faces.push(face);
|
|
117
|
+
}
|
|
118
|
+
validateTopology(vertices, faces, charge);
|
|
119
|
+
|
|
120
|
+
const patch = createPiece();
|
|
121
|
+
const remainder = createPiece();
|
|
122
|
+
const intersections = lines.map(() => new Map<string, number>());
|
|
123
|
+
let fragmentCount = 0;
|
|
124
|
+
|
|
125
|
+
/** Allocate a vertex once for both pieces and every incident fragment. */
|
|
126
|
+
function addVertex(vertex: XYZ) {
|
|
127
|
+
if (vertices.length >= maxVertices || !vertex.every(Number.isFinite))
|
|
128
|
+
throw new RangeError('Terrain cutout vertex budget or coordinate range exceeded');
|
|
129
|
+
return vertices.push(vertex) - 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Get the same intersection even when a shared edge is traversed backwards. */
|
|
133
|
+
function intersection(a: number, b: number, da: number, db: number, line: number) {
|
|
134
|
+
const key = edgeKey(a, b);
|
|
135
|
+
const cache = intersections[line];
|
|
136
|
+
const saved = cache.get(key);
|
|
137
|
+
if (saved !== undefined) return saved;
|
|
138
|
+
// Canonical coordinate order also makes independently clipped tile edges
|
|
139
|
+
// bit-identical, regardless of their local vertex IDs or face traversal.
|
|
140
|
+
const pa = vertices[a],
|
|
141
|
+
pb = vertices[b];
|
|
142
|
+
if (
|
|
143
|
+
pa[0] > pb[0] ||
|
|
144
|
+
(pa[0] === pb[0] && (pa[1] > pb[1] || (pa[1] === pb[1] && pa[2] > pb[2])))
|
|
145
|
+
) {
|
|
146
|
+
[a, b] = [b, a];
|
|
147
|
+
[da, db] = [db, da];
|
|
148
|
+
}
|
|
149
|
+
const t = Math.abs(da) / (Math.abs(da) + Math.abs(db));
|
|
150
|
+
if (!(t > 0 && t < 1)) throw new RangeError('Unrepresentable terrain cut intersection');
|
|
151
|
+
const u = vertices[a];
|
|
152
|
+
const v = vertices[b];
|
|
153
|
+
const id = addVertex([
|
|
154
|
+
u[0] + t * (v[0] - u[0]),
|
|
155
|
+
u[1] + t * (v[1] - u[1]),
|
|
156
|
+
u[2] + t * (v[2] - u[2])
|
|
157
|
+
]);
|
|
158
|
+
cache.set(key, id);
|
|
159
|
+
return id;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
for (let source = 0; source < faces.length; source++) {
|
|
163
|
+
let fragments: Fragment[] = [{ids: faces[source], inside: true}];
|
|
164
|
+
// Split both sides by every supporting line. This preserves matching
|
|
165
|
+
// subdivisions on remainder edges beyond the finite polygon segments.
|
|
166
|
+
for (let line = 0; line < lines.length; line++) {
|
|
167
|
+
const next: Fragment[] = [];
|
|
168
|
+
const [a, b] = lines[line];
|
|
169
|
+
for (const fragment of fragments) {
|
|
170
|
+
const {ids} = fragment;
|
|
171
|
+
charge(ids.length);
|
|
172
|
+
const distances = ids.map(id => cross(a, b, vertices[id]));
|
|
173
|
+
if (distances.some(d => !Number.isFinite(d)))
|
|
174
|
+
throw new RangeError('Invalid terrain cut coordinates');
|
|
175
|
+
if (!distances.some(d => d < 0)) next.push(fragment);
|
|
176
|
+
else if (!distances.some(d => d > 0)) next.push({...fragment, inside: false});
|
|
177
|
+
else {
|
|
178
|
+
const positive: number[] = [];
|
|
179
|
+
const negative: number[] = [];
|
|
180
|
+
for (let i = 0; i < ids.length; i++) {
|
|
181
|
+
const j = (i + 1) % ids.length;
|
|
182
|
+
const d = distances[i];
|
|
183
|
+
const e = distances[j];
|
|
184
|
+
if (d >= 0) positive.push(ids[i]);
|
|
185
|
+
if (d <= 0) negative.push(ids[i]);
|
|
186
|
+
if ((d < 0 && e > 0) || (d > 0 && e < 0)) {
|
|
187
|
+
const id = intersection(ids[i], ids[j], d, e, line);
|
|
188
|
+
positive.push(id);
|
|
189
|
+
negative.push(id);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
next.push({ids: positive, inside: fragment.inside}, {ids: negative, inside: false});
|
|
193
|
+
}
|
|
194
|
+
if (fragmentCount + next.length > maxTriangles)
|
|
195
|
+
throw new RangeError('Terrain cutout fragment budget exceeded');
|
|
196
|
+
}
|
|
197
|
+
fragments = next;
|
|
198
|
+
}
|
|
199
|
+
fragmentCount += fragments.length;
|
|
200
|
+
for (const {ids, inside} of fragments) {
|
|
201
|
+
// A strict interior point classifies each arrangement cell. Its artificial
|
|
202
|
+
// subdivision edges disappear when same-piece boundary incidences cancel.
|
|
203
|
+
let center: [number, number, number] | undefined;
|
|
204
|
+
if (prepared || ids.length > 3) {
|
|
205
|
+
center = [...vertices[ids[0]]] as [number, number, number];
|
|
206
|
+
for (const id of ids) {
|
|
207
|
+
for (let k = 0; k < 3; k++)
|
|
208
|
+
center[k] += (vertices[id][k] - vertices[ids[0]][k]) / ids.length;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const polygonIndex = prepared
|
|
212
|
+
? prepared.classify([center![0], center![1]], charge)
|
|
213
|
+
: inside
|
|
214
|
+
? 0
|
|
215
|
+
: -1;
|
|
216
|
+
const piece = polygonIndex >= 0 ? patch : remainder;
|
|
217
|
+
if (ids.length === 3) emit(piece, ids as Face, source, polygonIndex);
|
|
218
|
+
else {
|
|
219
|
+
// A center fan retains collinear boundary vertices and therefore pairs
|
|
220
|
+
// every constrained boundary segment with its neighbor.
|
|
221
|
+
const hub = addVertex(center!);
|
|
222
|
+
for (let i = 0; i < ids.length; i++)
|
|
223
|
+
emit(piece, [ids[i], ids[(i + 1) % ids.length], hub], source, polygonIndex);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Emit a triangle and weld all of its edges by their shared topology IDs. */
|
|
229
|
+
function emit(piece: PieceBuilder, face: Face, source: number, polygonIndex: number) {
|
|
230
|
+
if (patch.sourceFaces.length + remainder.sourceFaces.length >= maxTriangles)
|
|
231
|
+
throw new RangeError('Terrain cutout triangle budget exceeded');
|
|
232
|
+
checkTriangle(vertices[face[0]], vertices[face[1]], vertices[face[2]]);
|
|
233
|
+
const [a, b, c] = faces[source].map(id => vertices[id]);
|
|
234
|
+
const area = cross(a, b, c);
|
|
235
|
+
for (let i = 0; i < 3; i++) {
|
|
236
|
+
const id = face[i];
|
|
237
|
+
if (!piece.ids.has(id)) {
|
|
238
|
+
if (patch.ids.size + remainder.ids.size >= maxVertices)
|
|
239
|
+
throw new RangeError('Terrain cutout output vertex budget exceeded');
|
|
240
|
+
piece.ids.set(id, piece.ids.size);
|
|
241
|
+
const p = vertices[id];
|
|
242
|
+
piece.positions.push(...p);
|
|
243
|
+
piece.sourceTriangles.push(source);
|
|
244
|
+
piece.sourceWeights.push(
|
|
245
|
+
cross(b, c, p) / area,
|
|
246
|
+
cross(c, a, p) / area,
|
|
247
|
+
cross(a, b, p) / area
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
piece.indices.push(piece.ids.get(id)!);
|
|
251
|
+
addEdge(piece.boundary, id, face[(i + 1) % 3], polygonIndex);
|
|
252
|
+
}
|
|
253
|
+
piece.sourceFaces.push(source);
|
|
254
|
+
piece.polygonIndices.push(polygonIndex);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
for (const [key, inside] of patch.boundary) {
|
|
258
|
+
const outside = remainder.boundary.get(key);
|
|
259
|
+
if (!outside) continue;
|
|
260
|
+
const [a, b] = inside.edge;
|
|
261
|
+
if (inside.count !== 1 || outside.count !== 1 || outside.edge[0] !== b)
|
|
262
|
+
throw new Error('Nonconforming terrain cut boundary');
|
|
263
|
+
patch.cutEdges.push(patch.ids.get(a)!, patch.ids.get(b)!);
|
|
264
|
+
remainder.cutEdges.push(remainder.ids.get(b)!, remainder.ids.get(a)!);
|
|
265
|
+
patch.cutPolygonIndices.push(inside.polygon);
|
|
266
|
+
remainder.cutPolygonIndices.push(inside.polygon);
|
|
267
|
+
}
|
|
268
|
+
return {patch: finish(patch), remainder: finish(remainder)};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Validate a simple strictly convex ring and normalize it to CCW. */
|
|
272
|
+
function validatePolygon(polygon: readonly XY[], charge: (amount: number) => void): XY[] {
|
|
273
|
+
if (polygon.length < 3 || polygon.some(p => p.length !== 2 || !p.every(Number.isFinite)))
|
|
274
|
+
throw new RangeError('Invalid terrain cut polygon');
|
|
275
|
+
const ring = [...polygon];
|
|
276
|
+
const orientation = cross(ring[0], ring[1], ring[2]);
|
|
277
|
+
if (orientation < 0) ring.reverse();
|
|
278
|
+
for (let i = 0; i < ring.length; i++) {
|
|
279
|
+
charge(ring.length);
|
|
280
|
+
const j = (i + 1) % ring.length;
|
|
281
|
+
for (let k = 0; k < ring.length; k++) {
|
|
282
|
+
if (k === i || k === j) continue;
|
|
283
|
+
const area = cross(ring[i], ring[j], ring[k]);
|
|
284
|
+
if (!(area > 0 && Number.isFinite(area)))
|
|
285
|
+
throw new RangeError('Terrain cut polygon must be strictly convex');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return ring;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Match TerrainSurface's relative degeneracy threshold without constructing an index. */
|
|
292
|
+
function checkTriangle(a: XYZ, b: XYZ, c: XYZ) {
|
|
293
|
+
const area = cross(a, b, c);
|
|
294
|
+
const scale = Math.hypot(b[0] - a[0], b[1] - a[1]) * Math.hypot(c[0] - a[0], c[1] - a[1]);
|
|
295
|
+
if (!(area > Number.EPSILON * scale && Number.isFinite(area)))
|
|
296
|
+
throw new RangeError('Terrain cut requires upward nondegenerate XY triangles');
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** Reject nonmanifold edges, overlaps and hanging vertices using an XY sweep. */
|
|
300
|
+
function validateTopology(vertices: XYZ[], faces: Face[], charge: (amount: number) => void) {
|
|
301
|
+
const edges = new Map<string, Boundary>();
|
|
302
|
+
const boxes = faces
|
|
303
|
+
.map(face => {
|
|
304
|
+
for (let i = 0; i < 3; i++) addEdge(edges, face[i], face[(i + 1) % 3]);
|
|
305
|
+
const points = face.map(id => vertices[id]);
|
|
306
|
+
return {
|
|
307
|
+
face,
|
|
308
|
+
points,
|
|
309
|
+
low: Math.min(...points.map(p => p[0])),
|
|
310
|
+
high: Math.max(...points.map(p => p[0])),
|
|
311
|
+
minY: Math.min(...points.map(p => p[1])),
|
|
312
|
+
maxY: Math.max(...points.map(p => p[1]))
|
|
313
|
+
};
|
|
314
|
+
})
|
|
315
|
+
.sort((a, b) => a.low - b.low);
|
|
316
|
+
for (let i = 0; i < boxes.length; i++) {
|
|
317
|
+
const a = boxes[i];
|
|
318
|
+
for (let j = i + 1; j < boxes.length && boxes[j].low <= a.high; j++) {
|
|
319
|
+
charge(1);
|
|
320
|
+
const b = boxes[j];
|
|
321
|
+
if (a.maxY < b.minY || b.maxY < a.minY) continue;
|
|
322
|
+
if (!separates(a.points, b.points) && !separates(b.points, a.points))
|
|
323
|
+
throw new RangeError('Terrain cut input has overlapping XY triangles');
|
|
324
|
+
checkJunctions(a.face, b.face, vertices);
|
|
325
|
+
checkJunctions(b.face, a.face, vertices);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** Find a triangle edge whose exterior closed half-plane contains the other triangle. */
|
|
331
|
+
function separates(a: XYZ[], b: XYZ[]) {
|
|
332
|
+
return a.some((p, i) => b.every(q => cross(p, a[(i + 1) % 3], q) <= 0));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Reject a hanging vertex or coincident edge with distinct topology IDs. */
|
|
336
|
+
function checkJunctions(a: Face, b: Face, vertices: XYZ[]) {
|
|
337
|
+
for (let i = 0; i < 3; i++) {
|
|
338
|
+
const u = vertices[a[i]];
|
|
339
|
+
const v = vertices[a[(i + 1) % 3]];
|
|
340
|
+
const overlaps = b.filter(id => {
|
|
341
|
+
const p = vertices[id];
|
|
342
|
+
if (cross(u, v, p) !== 0) return false;
|
|
343
|
+
const axis = Math.abs(v[0] - u[0]) >= Math.abs(v[1] - u[1]) ? 0 : 1;
|
|
344
|
+
const low = Math.min(u[axis], v[axis]);
|
|
345
|
+
const high = Math.max(u[axis], v[axis]);
|
|
346
|
+
if (p[axis] > low && p[axis] < high)
|
|
347
|
+
throw new RangeError('Terrain cut input has a T-junction');
|
|
348
|
+
return p[axis] >= low && p[axis] <= high;
|
|
349
|
+
});
|
|
350
|
+
if (overlaps.length >= 2 && (!overlaps.includes(a[i]) || !overlaps.includes(a[(i + 1) % 3])))
|
|
351
|
+
throw new RangeError('Terrain cut input has an unwelded shared edge');
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Track the first direction and incidence count of an indexed edge. */
|
|
356
|
+
function addEdge(edges: Map<string, Boundary>, a: number, b: number, polygon = -1) {
|
|
357
|
+
const key = edgeKey(a, b);
|
|
358
|
+
const entry = edges.get(key);
|
|
359
|
+
if (!entry) edges.set(key, {edge: [a, b], count: 1, polygon});
|
|
360
|
+
else {
|
|
361
|
+
if (entry.count !== 1 || entry.edge[0] !== b)
|
|
362
|
+
throw new RangeError('Terrain cut mesh has inconsistent or nonmanifold edges');
|
|
363
|
+
entry.count++;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/** Shared key independent of the edge direction. */
|
|
368
|
+
function edgeKey(a: number, b: number) {
|
|
369
|
+
return a < b ? a + ',' + b : b + ',' + a;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** Signed doubled triangle area in local XY. */
|
|
373
|
+
function cross(a: XY | XYZ, b: XY | XYZ, c: XY | XYZ) {
|
|
374
|
+
return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** Allocate detached output staging buffers. */
|
|
378
|
+
function createPiece(): PieceBuilder {
|
|
379
|
+
return {
|
|
380
|
+
ids: new Map(),
|
|
381
|
+
positions: [],
|
|
382
|
+
indices: [],
|
|
383
|
+
sourceTriangles: [],
|
|
384
|
+
sourceWeights: [],
|
|
385
|
+
sourceFaces: [],
|
|
386
|
+
boundary: new Map(),
|
|
387
|
+
cutEdges: [],
|
|
388
|
+
polygonIndices: [],
|
|
389
|
+
cutPolygonIndices: []
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/** Materialize the public typed arrays. */
|
|
394
|
+
function finish(piece: PieceBuilder): TerrainCutoutPiece {
|
|
395
|
+
return {
|
|
396
|
+
positions: Float64Array.from(piece.positions),
|
|
397
|
+
indices: Uint32Array.from(piece.indices),
|
|
398
|
+
sourceTriangles: Uint32Array.from(piece.sourceTriangles),
|
|
399
|
+
sourceWeights: Float64Array.from(piece.sourceWeights),
|
|
400
|
+
sourceFaces: Uint32Array.from(piece.sourceFaces),
|
|
401
|
+
cutEdges: Uint32Array.from(piece.cutEdges),
|
|
402
|
+
polygonIndices: Uint32Array.from(piece.polygonIndices),
|
|
403
|
+
cutPolygonIndices: Uint32Array.from(piece.cutPolygonIndices)
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** @internal Check topology of already range-validated assembled tile inputs. */
|
|
408
|
+
export function validateTerrainCutoutTopology(mesh: TerrainCutoutInput, maxWork: number) {
|
|
409
|
+
const vertices: XYZ[] = [];
|
|
410
|
+
const faces: Face[] = [];
|
|
411
|
+
for (let i = 0; i < mesh.positions.length; i += 3)
|
|
412
|
+
vertices.push([mesh.positions[i], mesh.positions[i + 1], mesh.positions[i + 2]]);
|
|
413
|
+
for (let i = 0; i < mesh.indices.length; i += 3)
|
|
414
|
+
faces.push([mesh.indices[i], mesh.indices[i + 1], mesh.indices[i + 2]]);
|
|
415
|
+
let work = 0;
|
|
416
|
+
validateTopology(vertices, faces, amount => {
|
|
417
|
+
work += amount;
|
|
418
|
+
if (work > maxWork) throw new RangeError('Terrain cutout topology work budget exceeded');
|
|
419
|
+
});
|
|
420
|
+
}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
/** Positive downward distance
|
|
7
|
-
|
|
5
|
+
type TerrainSkirtVertical =
|
|
6
|
+
| {/** Positive downward distance. */ height: number; baseZ?: never}
|
|
7
|
+
| {/** Local elevation below every selected boundary vertex. */ baseZ: number; height?: never};
|
|
8
|
+
|
|
9
|
+
export type TerrainSkirtOptions = TerrainSkirtVertical & {
|
|
8
10
|
/** Optional unordered pairs of boundary vertex IDs. Omit to skirt every boundary, including holes. */
|
|
9
11
|
edges?: Uint16Array | Uint32Array;
|
|
10
12
|
maxVertices?: number;
|
|
@@ -33,12 +35,13 @@ export function createTerrainSkirt(
|
|
|
33
35
|
options: TerrainSkirtOptions
|
|
34
36
|
): TerrainSkirtMesh {
|
|
35
37
|
const {positions, indices} = mesh,
|
|
36
|
-
{height, edges} = options;
|
|
38
|
+
{height, baseZ, edges} = options;
|
|
37
39
|
const maxVertices = options.maxVertices ?? 2_000_000,
|
|
38
40
|
maxTriangles = options.maxTriangles ?? 4_000_000;
|
|
39
41
|
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
(baseZ === undefined
|
|
43
|
+
? !(Number.isFinite(height) && height! > 0)
|
|
44
|
+
: height !== undefined || !Number.isFinite(baseZ)) ||
|
|
42
45
|
!Number.isSafeInteger(maxVertices) ||
|
|
43
46
|
maxVertices < 0 ||
|
|
44
47
|
maxVertices > 0xffffffff ||
|
|
@@ -133,7 +136,7 @@ export function createTerrainSkirt(
|
|
|
133
136
|
[b, lowerB]
|
|
134
137
|
]) {
|
|
135
138
|
resultPositions.set(positions.subarray(3 * source, 3 * source + 3), 3 * target);
|
|
136
|
-
resultPositions[3 * target + 2] = positions[3 * source + 2] - height
|
|
139
|
+
resultPositions[3 * target + 2] = baseZ ?? positions[3 * source + 2] - height!;
|
|
137
140
|
if (
|
|
138
141
|
!Number.isFinite(resultPositions[3 * target + 2]) ||
|
|
139
142
|
resultPositions[3 * target + 2] >= positions[3 * source + 2]
|
|
@@ -81,20 +81,29 @@ export function updateTerrainMixedVertexTileHalos(
|
|
|
81
81
|
const budget = options.maxDependencyTests ?? 10_000_000;
|
|
82
82
|
if (!Number.isSafeInteger(budget) || budget < 0)
|
|
83
83
|
throw new Error('Invalid mixed halo dependency budget');
|
|
84
|
-
const old = new Map(previous?.sources.map(t => [key(t), t]));
|
|
85
|
-
const current = new Map(resident.map(t => [key(t), t]));
|
|
86
|
-
const cached = new Map(previous?.tiles.map(t => [key(t), t]));
|
|
87
|
-
const targets = new Set<string>();
|
|
88
84
|
const unchangedLayout =
|
|
89
85
|
previous?.sources.length === resident.length &&
|
|
90
86
|
resident.every((tile, i) => {
|
|
91
87
|
const prior = previous.sources[i];
|
|
92
88
|
return (
|
|
93
|
-
|
|
94
|
-
prior.
|
|
95
|
-
|
|
89
|
+
prior === tile ||
|
|
90
|
+
(prior.column === tile.column &&
|
|
91
|
+
prior.row === tile.row &&
|
|
92
|
+
prior.spacing === tile.spacing &&
|
|
93
|
+
prior.field.width === tile.field.width &&
|
|
94
|
+
prior.field.height === tile.field.height)
|
|
96
95
|
);
|
|
97
96
|
});
|
|
97
|
+
const old = unchangedLayout ? undefined : new Map(previous?.sources.map(t => [key(t), t]));
|
|
98
|
+
const targets = new Set<string>();
|
|
99
|
+
const initialized = previous !== null && preparations.has(previous);
|
|
100
|
+
if (!initialized) {
|
|
101
|
+
const cached = new Set(previous?.tiles.map(key));
|
|
102
|
+
for (const tile of resident) {
|
|
103
|
+
const address = key(tile);
|
|
104
|
+
if (!cached.has(address)) targets.add(address);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
98
107
|
let index = unchangedLayout && previous ? targetIndexes.get(previous) : undefined;
|
|
99
108
|
let tests = 0;
|
|
100
109
|
const charge = () => {
|
|
@@ -104,11 +113,12 @@ export function updateTerrainMixedVertexTileHalos(
|
|
|
104
113
|
index ??= createTerrainBoxIndex(resident.map(tile => bounds(tile, tile.spacing)));
|
|
105
114
|
for (const id of index(box, charge)) targets.add(key(resident[id]));
|
|
106
115
|
}
|
|
107
|
-
for (
|
|
108
|
-
const
|
|
109
|
-
const prior = old
|
|
110
|
-
if (
|
|
111
|
-
|
|
116
|
+
for (let i = 0; i < resident.length; i++) {
|
|
117
|
+
const tile = resident[i];
|
|
118
|
+
const prior = unchangedLayout ? previous!.sources[i] : old?.get(key(tile));
|
|
119
|
+
if (prior === tile) continue;
|
|
120
|
+
targets.add(key(tile));
|
|
121
|
+
if (!previous) continue;
|
|
112
122
|
if (!prior) {
|
|
113
123
|
invalidate(bounds(tile));
|
|
114
124
|
} else if (prior.field.width !== tile.field.width || prior.field.height !== tile.field.height) {
|
|
@@ -119,24 +129,48 @@ export function updateTerrainMixedVertexTileHalos(
|
|
|
119
129
|
if (dirty) invalidate(dirty);
|
|
120
130
|
}
|
|
121
131
|
}
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
const removed: string[] = [];
|
|
133
|
+
if (old?.size) {
|
|
134
|
+
const current = new Set(resident.map(key));
|
|
135
|
+
for (const [address, tile] of old) {
|
|
136
|
+
if (current.has(address)) continue;
|
|
137
|
+
removed.push(address);
|
|
138
|
+
if (resident.length) invalidate(bounds(tile));
|
|
139
|
+
}
|
|
124
140
|
}
|
|
125
141
|
const priorPreparation = previous && preparations.get(previous);
|
|
126
142
|
const preparation: MixedHaloPreparation = {
|
|
127
|
-
|
|
143
|
+
tiles: priorPreparation?.tiles ?? new WeakMap(),
|
|
128
144
|
layout: priorPreparation?.layout
|
|
129
145
|
};
|
|
130
146
|
const built = buildMixedVertexTileHalos(resident, options, targets, preparation).tiles;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
let tiles: TerrainMixedHaloSnapshot['tiles'];
|
|
148
|
+
if (unchangedLayout && initialized) {
|
|
149
|
+
// Built halos form a sorted subsequence of the previous output.
|
|
150
|
+
let cursor = 0;
|
|
151
|
+
tiles = previous!.tiles.map(tile => {
|
|
152
|
+
const replacement = built[cursor];
|
|
153
|
+
if (
|
|
154
|
+
replacement?.spacing !== tile.spacing ||
|
|
155
|
+
replacement.column !== tile.column ||
|
|
156
|
+
replacement.row !== tile.row
|
|
157
|
+
)
|
|
158
|
+
return tile;
|
|
159
|
+
cursor++;
|
|
160
|
+
return replacement;
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
const cached = new Map(previous?.tiles.map(tile => [key(tile), tile]));
|
|
164
|
+
for (const tile of built) cached.set(key(tile), tile);
|
|
165
|
+
tiles = resident
|
|
166
|
+
.map(tile => cached.get(key(tile))!)
|
|
167
|
+
.sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row);
|
|
168
|
+
}
|
|
135
169
|
const snapshot = {
|
|
136
170
|
sources: resident.slice(),
|
|
137
171
|
tiles,
|
|
138
172
|
rebuilt: built.map(key),
|
|
139
|
-
removed:
|
|
173
|
+
removed: removed.sort()
|
|
140
174
|
};
|
|
141
175
|
preparations.set(snapshot, preparation);
|
|
142
176
|
if (index) targetIndexes.set(snapshot, index);
|