@math.gl/geospatial 5.0.0-beta.9 → 5.0.0-rc.1
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,118 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { sweepTerrainCapsule } from "./sweep-capsule.js";
|
|
5
|
+
/**
|
|
6
|
+
* Bracket first contact for a capsule under linear pivot translation and shortest-arc
|
|
7
|
+
* rotation. Coincident axis endpoints describe a sphere, including an off-pivot
|
|
8
|
+
* sphere whose center follows a curved path. Unresolved tangency returns incomplete.
|
|
9
|
+
* The witness is an axis/triangle pair within the radius at the upper fraction.
|
|
10
|
+
*/
|
|
11
|
+
export function sweepTerrainRotatingCapsule(surface, start, end, radius, { pivot, translation, rotation }, { maxWork = 100000, fractionTolerance = 1e-5 } = {}) {
|
|
12
|
+
const norm = Math.hypot(...rotation);
|
|
13
|
+
if (![start, end, pivot, translation].every(p => p.length === 3 && p.every(Number.isFinite)) ||
|
|
14
|
+
rotation.length !== 4 ||
|
|
15
|
+
!(norm > 0 && Number.isFinite(norm)) ||
|
|
16
|
+
!Number.isFinite(radius) ||
|
|
17
|
+
radius < 0 ||
|
|
18
|
+
!Number.isSafeInteger(maxWork) ||
|
|
19
|
+
maxWork < 0 ||
|
|
20
|
+
!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1))
|
|
21
|
+
throw new RangeError('Invalid terrain capsule rigid motion');
|
|
22
|
+
const sign = rotation[3] < 0 ? -1 : 1;
|
|
23
|
+
const axisLength = Math.hypot(rotation[0], rotation[1], rotation[2]);
|
|
24
|
+
const angle = 2 * Math.atan2(axisLength, Math.abs(rotation[3]));
|
|
25
|
+
if (angle === 0) {
|
|
26
|
+
return sweepTerrainCapsule(surface, start, end, translation, radius, {
|
|
27
|
+
maxWork,
|
|
28
|
+
fractionTolerance
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const x = (rotation[0] / axisLength) * sign;
|
|
32
|
+
const y = (rotation[1] / axisLength) * sign;
|
|
33
|
+
const z = (rotation[2] / axisLength) * sign;
|
|
34
|
+
const offsets = [start, end].map(p => p.map((v, i) => v - pivot[i]));
|
|
35
|
+
// A segment is a convex combination of its endpoints. The capsule's spherical
|
|
36
|
+
// dilation is rotation invariant, so only the axis motion contributes here.
|
|
37
|
+
const reach = Math.max(...offsets.map(p => Math.hypot(...p)));
|
|
38
|
+
const speed = Math.hypot(...translation) + angle * reach;
|
|
39
|
+
const scale = Math.max(Math.hypot(...pivot), reach, speed, radius);
|
|
40
|
+
if (!Number.isFinite(scale))
|
|
41
|
+
throw new RangeError('Terrain capsule rigid motion overflow');
|
|
42
|
+
let work = 0;
|
|
43
|
+
/** Query the axis at an exact pose, charging both the probe and index work. */
|
|
44
|
+
function probe(t) {
|
|
45
|
+
if (work >= maxWork)
|
|
46
|
+
return null;
|
|
47
|
+
work++;
|
|
48
|
+
const sin = Math.sin(angle * t);
|
|
49
|
+
const cos = Math.cos(angle * t);
|
|
50
|
+
const [a, b] = t === 0
|
|
51
|
+
? [start, end]
|
|
52
|
+
: offsets.map(([u, v, w]) => {
|
|
53
|
+
const d = (x * u + y * v + z * w) * (1 - cos);
|
|
54
|
+
const pos = [
|
|
55
|
+
pivot[0] + (translation[0] * t + u * cos + (y * w - z * v) * sin + x * d),
|
|
56
|
+
pivot[1] + (translation[1] * t + v * cos + (z * u - x * w) * sin + y * d),
|
|
57
|
+
pivot[2] + (translation[2] * t + w * cos + (x * v - y * u) * sin + z * d)
|
|
58
|
+
];
|
|
59
|
+
if (!pos.every(Number.isFinite))
|
|
60
|
+
throw new RangeError('Terrain capsule pose overflow');
|
|
61
|
+
return pos;
|
|
62
|
+
});
|
|
63
|
+
const query = surface.nearestSegmentQuery(a, b, { maxWork: maxWork - work });
|
|
64
|
+
work += query.work;
|
|
65
|
+
return query;
|
|
66
|
+
}
|
|
67
|
+
const initial = probe(0);
|
|
68
|
+
if (initial?.result && initial.result.distance <= radius)
|
|
69
|
+
return { status: 'hit', fraction: 0, lowerFraction: 0, work, contact: initial.result };
|
|
70
|
+
if (!initial?.complete)
|
|
71
|
+
return { status: 'incomplete', work };
|
|
72
|
+
if (!initial.result || speed === 0)
|
|
73
|
+
return { status: 'miss', work };
|
|
74
|
+
let clearUntil = 0;
|
|
75
|
+
let witness;
|
|
76
|
+
const pending = [[0, 1]];
|
|
77
|
+
while (pending.length) {
|
|
78
|
+
if (witness && witness.fraction - clearUntil <= fractionTolerance)
|
|
79
|
+
return { status: 'hit', lowerFraction: clearUntil, work, ...witness };
|
|
80
|
+
const [lo, hi] = pending.pop();
|
|
81
|
+
const mid = lo + (hi - lo) / 2;
|
|
82
|
+
const query = probe(mid);
|
|
83
|
+
const contact = query?.result;
|
|
84
|
+
if (contact && contact.distance <= radius) {
|
|
85
|
+
witness = { fraction: mid, contact };
|
|
86
|
+
if (mid - clearUntil <= fractionTolerance)
|
|
87
|
+
return { status: 'hit', lowerFraction: clearUntil, work, ...witness };
|
|
88
|
+
if (mid === lo || mid === hi)
|
|
89
|
+
return { status: 'incomplete', work };
|
|
90
|
+
pending.push([lo, mid]);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (!query?.complete)
|
|
94
|
+
return { status: 'incomplete', work };
|
|
95
|
+
const travel = speed * Math.max(mid - lo, hi - mid);
|
|
96
|
+
const allowance = 16 * Number.EPSILON * Math.max(scale, contact?.distance ?? 0);
|
|
97
|
+
if (!contact || contact.distance - radius > travel + allowance) {
|
|
98
|
+
clearUntil = hi;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (hi - clearUntil <= fractionTolerance) {
|
|
102
|
+
const final = witness?.fraction === hi ? witness.contact : probe(hi)?.result;
|
|
103
|
+
if (final && final.distance <= radius)
|
|
104
|
+
return { status: 'hit', fraction: hi, lowerFraction: clearUntil, work, contact: final };
|
|
105
|
+
}
|
|
106
|
+
if (mid === lo || mid === hi || hi - lo <= fractionTolerance / 4)
|
|
107
|
+
return { status: 'incomplete', work };
|
|
108
|
+
pending.push([mid, hi], [lo, mid]);
|
|
109
|
+
}
|
|
110
|
+
return witness
|
|
111
|
+
? { status: 'hit', lowerFraction: clearUntil, work, ...witness }
|
|
112
|
+
: { status: 'miss', work };
|
|
113
|
+
}
|
|
114
|
+
/** Sweep a sphere whose center may orbit an offset rigid-motion pivot. */
|
|
115
|
+
export function sweepTerrainRotatingSphere(surface, center, radius, motion, options) {
|
|
116
|
+
return sweepTerrainRotatingCapsule(surface, center, center, radius, motion, options);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=sweep-rotating-capsule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep-rotating-capsule.js","sourceRoot":"","sources":["../../src/terrain/sweep-rotating-capsule.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EAAC,mBAAmB,EAAiC,2BAAwB;AAQpF;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAoD,EACpD,KAAY,EACZ,GAAU,EACV,MAAc,EACd,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAqB,EAClD,EAAC,OAAO,GAAG,MAAO,EAAE,iBAAiB,GAAG,IAAI,KAA+B,EAAE;IAE7E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC;IACrC,IACE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxF,QAAQ,CAAC,MAAM,KAAK,CAAC;QACrB,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxB,MAAM,GAAG,CAAC;QACV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C9D,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,OAAO;QACZ,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,OAAO,EAAC;QAC9D,CAAC,CAAC,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;AAC7B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,0BAA0B,CACxC,OAAoD,EACpD,MAAa,EACb,MAAc,EACd,MAA0B,EAC1B,OAAmC;IAEnC,OAAO,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type TerrainPolytope, type TerrainPolytopeSweepResult } from "./sweep-polytope.js";
|
|
2
|
+
import type { TerrainSurface } from "./surface.js";
|
|
3
|
+
type Point = readonly [number, number, number];
|
|
4
|
+
type Surface = Pick<TerrainSurface, 'copyData' | 'origin'>;
|
|
5
|
+
export type TerrainRigidMotion = {
|
|
6
|
+
/** Pivot in the same Cartesian frame as the collider vertices. */
|
|
7
|
+
pivot: Point;
|
|
8
|
+
translation: Point;
|
|
9
|
+
/** Quaternion [x,y,z,w] relative to the initial pose. The shortest arc is used. */
|
|
10
|
+
rotation: readonly [number, number, number, number];
|
|
11
|
+
};
|
|
12
|
+
export type TerrainRotationalSweepResult = {
|
|
13
|
+
status: 'miss' | 'incomplete';
|
|
14
|
+
work: number;
|
|
15
|
+
} | (Extract<TerrainPolytopeSweepResult, {
|
|
16
|
+
status: 'hit';
|
|
17
|
+
}> & {
|
|
18
|
+
lowerFraction: number;
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Sweep a convex hull along linear translation and shortest-arc rotation.
|
|
22
|
+
* An expanded midpoint SAT can exclude an interval. An unexpanded pose supplies
|
|
23
|
+
* a hit witness. Unresolved grazing or exhausted work yields incomplete.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sweepTerrainRotatingPolytope(surface: Surface, collider: TerrainPolytope, { pivot, translation, rotation }: TerrainRigidMotion, { maxWork, fractionTolerance }?: {
|
|
26
|
+
maxWork?: number;
|
|
27
|
+
fractionTolerance?: number;
|
|
28
|
+
}): TerrainRotationalSweepResult;
|
|
29
|
+
/** Rotational sweep of a box that starts axis-aligned. */
|
|
30
|
+
export declare function sweepTerrainRotatingBox(surface: Surface, center: Point, halfExtents: Point, motion: TerrainRigidMotion, options?: {
|
|
31
|
+
maxWork?: number;
|
|
32
|
+
fractionTolerance?: number;
|
|
33
|
+
}): TerrainRotationalSweepResult;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=sweep-rotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep-rotation.d.ts","sourceRoot":"","sources":["../../src/terrain/sweep-rotation.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAChC,4BAAyB;AAC1B,OAAO,KAAK,EAAC,cAAc,EAAC,qBAAkB;AAE9C,KAAK,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/C,KAAK,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,QAAQ,CAAC,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kEAAkE;IAClE,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,KAAK,CAAC;IACnB,mFAAmF;IACnF,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC;IAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAC7C,CAAC,OAAO,CAAC,0BAA0B,EAAE;IAAC,MAAM,EAAE,KAAK,CAAA;CAAC,CAAC,GAAG;IAAC,aAAa,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC;AAErF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAC,EAAE,kBAAkB,EAClD,EAAC,OAAiB,EAAE,iBAAwB,EAAC,GAAE;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAM,GACjG,4BAA4B,CA+F9B;AAED,0DAA0D;AAC1D,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,KAAK,EAClB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAC,GACvD,4BAA4B,CAO9B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import { createSweepBox, queryTerrainPolytope } from "./sweep-polytope.js";
|
|
5
|
+
/**
|
|
6
|
+
* Sweep a convex hull along linear translation and shortest-arc rotation.
|
|
7
|
+
* An expanded midpoint SAT can exclude an interval. An unexpanded pose supplies
|
|
8
|
+
* a hit witness. Unresolved grazing or exhausted work yields incomplete.
|
|
9
|
+
*/
|
|
10
|
+
export function sweepTerrainRotatingPolytope(surface, collider, { pivot, translation, rotation }, { maxWork = 100000, fractionTolerance = 1e-5 } = {}) {
|
|
11
|
+
const norm = Math.hypot(...rotation);
|
|
12
|
+
if (pivot.length !== 3 ||
|
|
13
|
+
translation.length !== 3 ||
|
|
14
|
+
rotation.length !== 4 ||
|
|
15
|
+
!pivot.every(Number.isFinite) ||
|
|
16
|
+
!translation.every(Number.isFinite) ||
|
|
17
|
+
!(norm > 0 && Number.isFinite(norm)) ||
|
|
18
|
+
!Number.isSafeInteger(maxWork) ||
|
|
19
|
+
maxWork < 0 ||
|
|
20
|
+
!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1))
|
|
21
|
+
throw new RangeError('Invalid terrain rigid motion');
|
|
22
|
+
// Work in the surface frame before interpolating to preserve small offsets.
|
|
23
|
+
const localPivot = pivot.map((v, i) => v - surface.origin[i]);
|
|
24
|
+
const offsets = collider.vertices.map(v => v.map((x, i) => x - pivot[i]));
|
|
25
|
+
const radius = offsets.reduce((r, v) => Math.max(r, Math.hypot(...v)), 0);
|
|
26
|
+
const sign = rotation[3] < 0 ? -1 : 1;
|
|
27
|
+
const vectorNorm = Math.hypot(rotation[0], rotation[1], rotation[2]);
|
|
28
|
+
const angle = 2 * Math.atan2(vectorNorm, Math.abs(rotation[3]));
|
|
29
|
+
const speed = Math.hypot(...translation) + angle * radius;
|
|
30
|
+
if (!Number.isFinite(speed))
|
|
31
|
+
throw new RangeError('Terrain rigid motion overflow');
|
|
32
|
+
const data = surface.copyData();
|
|
33
|
+
if (angle === 0) {
|
|
34
|
+
const result = queryTerrainPolytope(data, surface.origin, collider, translation, maxWork);
|
|
35
|
+
return result.status === 'hit' ? { ...result, lowerFraction: result.fraction } : result;
|
|
36
|
+
}
|
|
37
|
+
const [x, y, z] = rotation.slice(0, 3).map(v => (v / vectorNorm) * sign);
|
|
38
|
+
const zero = [0, 0, 0];
|
|
39
|
+
let work = 0;
|
|
40
|
+
const pose = (t) => {
|
|
41
|
+
const sin = Math.sin(angle * t);
|
|
42
|
+
const cos = Math.cos(angle * t);
|
|
43
|
+
return {
|
|
44
|
+
faces: collider.faces,
|
|
45
|
+
vertices: offsets.map(([a, b, c]) => {
|
|
46
|
+
const projection = (x * a + y * b + z * c) * (1 - cos);
|
|
47
|
+
return [
|
|
48
|
+
localPivot[0] + translation[0] * t + a * cos + (y * c - z * b) * sin + x * projection,
|
|
49
|
+
localPivot[1] + translation[1] * t + b * cos + (z * a - x * c) * sin + y * projection,
|
|
50
|
+
localPivot[2] + translation[2] * t + c * cos + (x * b - y * a) * sin + z * projection
|
|
51
|
+
];
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
const probe = (shape, padding = 0) => {
|
|
56
|
+
if (work >= maxWork)
|
|
57
|
+
return { status: 'incomplete', work: 0 };
|
|
58
|
+
work++;
|
|
59
|
+
const result = queryTerrainPolytope(data, zero, shape, zero, maxWork - work, padding);
|
|
60
|
+
work += result.work;
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
const initial = probe(pose(0));
|
|
64
|
+
if (initial.status === 'hit')
|
|
65
|
+
return { ...initial, lowerFraction: 0, work };
|
|
66
|
+
if (initial.status === 'incomplete')
|
|
67
|
+
return { status: 'incomplete', work };
|
|
68
|
+
let clearUntil = 0;
|
|
69
|
+
let witness;
|
|
70
|
+
const pending = [[0, 1]];
|
|
71
|
+
while (pending.length) {
|
|
72
|
+
if (witness && witness.fraction - clearUntil <= fractionTolerance)
|
|
73
|
+
return { ...witness, lowerFraction: clearUntil, work };
|
|
74
|
+
const [lo, hi] = pending.pop();
|
|
75
|
+
const mid = lo + (hi - lo) / 2;
|
|
76
|
+
const shape = pose(mid);
|
|
77
|
+
const padding = speed * Math.max(mid - lo, hi - mid);
|
|
78
|
+
const expanded = probe(shape, padding + 8 * Number.EPSILON * (radius + padding));
|
|
79
|
+
if (expanded.status === 'miss') {
|
|
80
|
+
clearUntil = hi;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (expanded.status === 'incomplete')
|
|
84
|
+
return { status: 'incomplete', work };
|
|
85
|
+
const hit = probe(shape);
|
|
86
|
+
if (hit.status === 'incomplete')
|
|
87
|
+
return { status: 'incomplete', work };
|
|
88
|
+
if (hit.status === 'hit') {
|
|
89
|
+
witness = { ...hit, fraction: mid };
|
|
90
|
+
if (mid - clearUntil <= fractionTolerance)
|
|
91
|
+
return { ...witness, lowerFraction: clearUntil, work };
|
|
92
|
+
pending.push([lo, mid]);
|
|
93
|
+
}
|
|
94
|
+
else if (hi - clearUntil <= fractionTolerance) {
|
|
95
|
+
const end = witness?.fraction === hi ? witness : probe(pose(hi));
|
|
96
|
+
if (end?.status === 'hit')
|
|
97
|
+
return { ...end, fraction: hi, lowerFraction: clearUntil, work };
|
|
98
|
+
if (hi - lo <= fractionTolerance / 4)
|
|
99
|
+
return { status: 'incomplete', work };
|
|
100
|
+
pending.push([mid, hi], [lo, mid]);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (mid === lo || mid === hi || hi - lo <= fractionTolerance / 4)
|
|
104
|
+
return { status: 'incomplete', work };
|
|
105
|
+
pending.push([mid, hi], [lo, mid]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return witness ? { ...witness, lowerFraction: clearUntil, work } : { status: 'miss', work };
|
|
109
|
+
}
|
|
110
|
+
/** Rotational sweep of a box that starts axis-aligned. */
|
|
111
|
+
export function sweepTerrainRotatingBox(surface, center, halfExtents, motion, options) {
|
|
112
|
+
return sweepTerrainRotatingPolytope(surface, createSweepBox(center, halfExtents), motion, options);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=sweep-rotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep-rotation.js","sourceRoot":"","sources":["../../src/terrain/sweep-rotation.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,OAAO,EACL,cAAc,EACd,oBAAoB,EAGrB,4BAAyB;AAkB1B;;;;GAIG;AACH,M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"./surface.js";
|
|
2
|
+
type Point = readonly [number, number, number];
|
|
3
|
+
export type TerrainSphereSweepOptions = {
|
|
4
|
+
/** Maximum width of the returned impact interval, in units of motion fraction. */
|
|
5
|
+
fractionTolerance?: number;
|
|
6
|
+
/** Total spatial index work across all probes. */
|
|
7
|
+
maxWork?: number;
|
|
8
|
+
};
|
|
9
|
+
export type TerrainSphereSweepResult = {
|
|
10
|
+
status: 'miss' | 'incomplete';
|
|
11
|
+
work: number;
|
|
12
|
+
} | {
|
|
13
|
+
status: 'hit';
|
|
14
|
+
work: number;
|
|
15
|
+
fraction: number;
|
|
16
|
+
lowerFraction: number;
|
|
17
|
+
contact: TerrainCapsuleContact;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Find the first impact of a translating sphere against the two-sided terrain sheet.
|
|
21
|
+
* Bisection tests entire motion prefixes, so a brief or grazing contact can be
|
|
22
|
+
* found even when neither endpoint intersects. The returned contact is a witness
|
|
23
|
+
* inside the impact interval. An exhausted work budget returns 'incomplete'.
|
|
24
|
+
*/
|
|
25
|
+
export declare function sweepTerrainSphere(surface: Pick<TerrainSurface, 'intersectCapsule'>, start: Point, end: Point, radius: number, { fractionTolerance, maxWork }?: TerrainSphereSweepOptions): TerrainSphereSweepResult;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=sweep-sphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep-sphere.d.ts","sourceRoot":"","sources":["../../src/terrain/sweep-sphere.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,qBAAqB,EAAE,cAAc,EAAC,qBAAkB;AAErE,KAAK,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,MAAM,MAAM,yBAAyB,GAAG;IACtC,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAChC;IAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAC7C;IACE,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,qBAAqB,CAAC;CAChC,CAAC;AAEN;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC,EACjD,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,KAAK,EACV,MAAM,EAAE,MAAM,EACd,EAAC,iBAAwB,EAAE,OAAiB,EAAC,GAAE,yBAA8B,GAC5E,wBAAwB,CA8D1B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Find the first impact of a translating sphere against the two-sided terrain sheet.
|
|
6
|
+
* Bisection tests entire motion prefixes, so a brief or grazing contact can be
|
|
7
|
+
* found even when neither endpoint intersects. The returned contact is a witness
|
|
8
|
+
* inside the impact interval. An exhausted work budget returns 'incomplete'.
|
|
9
|
+
*/
|
|
10
|
+
export function sweepTerrainSphere(surface, start, end, radius, { fractionTolerance = 1e-6, maxWork = 100000 } = {}) {
|
|
11
|
+
if (!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1) ||
|
|
12
|
+
!Number.isSafeInteger(maxWork) ||
|
|
13
|
+
maxWork < 0)
|
|
14
|
+
throw new RangeError('Invalid terrain sphere sweep limits');
|
|
15
|
+
const delta = end.map((value, axis) => value - start[axis]);
|
|
16
|
+
if (start.length !== 3 ||
|
|
17
|
+
end.length !== 3 ||
|
|
18
|
+
!start.every(Number.isFinite) ||
|
|
19
|
+
!end.every(Number.isFinite) ||
|
|
20
|
+
!delta.every(Number.isFinite) ||
|
|
21
|
+
!Number.isFinite(radius) ||
|
|
22
|
+
radius < 0)
|
|
23
|
+
throw new RangeError('Invalid terrain sphere sweep motion or radius');
|
|
24
|
+
let work = 0;
|
|
25
|
+
let lower = 0;
|
|
26
|
+
let upper = 1;
|
|
27
|
+
const prefix = (fraction) => {
|
|
28
|
+
const endPoint = fraction === 0
|
|
29
|
+
? start
|
|
30
|
+
: fraction === 1
|
|
31
|
+
? end
|
|
32
|
+
: [
|
|
33
|
+
start[0] + delta[0] * fraction,
|
|
34
|
+
start[1] + delta[1] * fraction,
|
|
35
|
+
start[2] + delta[2] * fraction
|
|
36
|
+
];
|
|
37
|
+
const query = surface.intersectCapsule(start, endPoint, radius, {
|
|
38
|
+
maxWork: maxWork - work,
|
|
39
|
+
maxContacts: 1
|
|
40
|
+
});
|
|
41
|
+
work += query.work;
|
|
42
|
+
return query;
|
|
43
|
+
};
|
|
44
|
+
const initial = prefix(0);
|
|
45
|
+
if (initial.result[0])
|
|
46
|
+
return { status: 'hit', fraction: 0, lowerFraction: 0, contact: initial.result[0], work };
|
|
47
|
+
if (!initial.complete)
|
|
48
|
+
return { status: 'incomplete', work };
|
|
49
|
+
const full = prefix(1);
|
|
50
|
+
let contact = full.result[0];
|
|
51
|
+
if (!contact)
|
|
52
|
+
return { status: full.complete ? 'miss' : 'incomplete', work };
|
|
53
|
+
while (upper - lower > fractionTolerance) {
|
|
54
|
+
const middle = (lower + upper) / 2;
|
|
55
|
+
const query = prefix(middle);
|
|
56
|
+
if (query.result[0]) {
|
|
57
|
+
upper = middle;
|
|
58
|
+
contact = query.result[0];
|
|
59
|
+
}
|
|
60
|
+
else if (query.complete) {
|
|
61
|
+
lower = middle;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return { status: 'incomplete', work };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { status: 'hit', fraction: upper, lowerFraction: lower, contact, work };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=sweep-sphere.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sweep-sphere.js","sourceRoot":"","sources":["../../src/terrain/sweep-sphere.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAuB5D;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAiD,EACjD,KAAY,EACZ,GAAU,EACV,MAAc,EACd,EAAC,iBAAiB,GAAG,IAAI,EAAE,OAAO,GAAG,MAAO,KAA+B,EAAE;IAE7E,IACE,CAAC,CAAC,iBAAiB,IAAI,MAAM,CAAC,OAAO,IAAI,iBAAiB,IAAI,CAAC,CAAC;QAChE,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;QAC9B,OAAO,GAAG,CAAC;QAEX,MAAM,IAAI,UAAU,CAAC,qCAAqC,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IACE,KAAK,CAAC,MAAM,KAAK,CAAC;QAClB,GAAG,CAAC,MAAM,KAAK,CAAC;QAChB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC7B,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC3B,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC7B,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxB,MAAM,GAAG,CAAC;QAEV,MAAM,IAAI,UAAU,CAAC,+CAA+C,CAAC,CAAC;IACxE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAA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IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,EAAE,IAAI,EAAC,CAAC;IAE3E,OAAO,KAAK,GAAG,KAAK,GAAG,iBAAiB,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACpB,KAAK,GAAG,MAAM,CAAC;YACf,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1B,KAAK,GAAG,MAAM,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,OAAO,EAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC;QACtC,CAAC;IACH,CAAC;IACD,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type TerrainCutoutRegion } from "./cutout-region.js";
|
|
2
|
+
import { type TerrainCutout, type TerrainCutoutInput, type TerrainCutoutOptions } from "./mesh-cutout.js";
|
|
3
|
+
/** Stable resident identity and an explicit revision for in-place buffer edits. */
|
|
4
|
+
export type TerrainCutoutResident = {
|
|
5
|
+
/** Unique resident tile ID. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Nonnegative safe integer; increment after changing any mesh buffer. */
|
|
8
|
+
revision: number;
|
|
9
|
+
/** Conforming terrain in one shared Cartesian frame. Treat as immutable within a revision. */
|
|
10
|
+
mesh: TerrainCutoutInput;
|
|
11
|
+
};
|
|
12
|
+
/** Per-tile clipping limits plus bounds on resident-set reconciliation. */
|
|
13
|
+
export type TerrainTileCutoutUpdateOptions = TerrainCutoutOptions & {
|
|
14
|
+
/** Maximum residents. Default 512. */
|
|
15
|
+
maxTiles?: number;
|
|
16
|
+
/** Maximum tile-pair broad-phase checks per update. Default 131072. */
|
|
17
|
+
maxPairChecks?: number;
|
|
18
|
+
/** Maximum exposed piece edges across all residents. Default 1000000. */
|
|
19
|
+
maxBoundaryEdges?: number;
|
|
20
|
+
};
|
|
21
|
+
/** Directed boundary edge with exact coordinate keys and local vertex IDs. */
|
|
22
|
+
type Boundary = {
|
|
23
|
+
/** Incident face polygon index; remainder faces use the Uint32 sentinel 0xffffffff. */
|
|
24
|
+
polygon: number;
|
|
25
|
+
key: string;
|
|
26
|
+
start: string;
|
|
27
|
+
end: string;
|
|
28
|
+
a: number;
|
|
29
|
+
b: number;
|
|
30
|
+
side: 0 | 1;
|
|
31
|
+
};
|
|
32
|
+
/** Cached clipping and boundary summaries for one immutable tile revision. */
|
|
33
|
+
type Entry = {
|
|
34
|
+
resident: TerrainCutoutResident;
|
|
35
|
+
split: TerrainCutout;
|
|
36
|
+
displayed: TerrainCutout;
|
|
37
|
+
bounds: readonly [number, number, number, number];
|
|
38
|
+
edges: Boundary[];
|
|
39
|
+
};
|
|
40
|
+
/** Private cache brand; the cache is local to this module instance. */
|
|
41
|
+
declare const CACHE: unique symbol;
|
|
42
|
+
/** Opaque reusable cache. Do not mutate cached results or resident buffers without a new revision. */
|
|
43
|
+
export type TerrainTileCutoutCache = {
|
|
44
|
+
readonly [CACHE]: {
|
|
45
|
+
polygon: TerrainCutoutRegion;
|
|
46
|
+
options: Required<TerrainTileCutoutUpdateOptions>;
|
|
47
|
+
entries: ReadonlyMap<string, Entry>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** Detached update result, with unchanged surface buffers retained by identity. */
|
|
51
|
+
export type TerrainTileCutoutUpdate = {
|
|
52
|
+
/** Pass to the next update; no state is committed if an update throws. */
|
|
53
|
+
cache: TerrainTileCutoutCache;
|
|
54
|
+
/** Resident cuts. Source triangle references are local to the corresponding input tile. */
|
|
55
|
+
tiles: ReadonlyMap<string, TerrainCutout>;
|
|
56
|
+
/** Tiles whose surfaces or exposed cut edges changed. */
|
|
57
|
+
changed: string[];
|
|
58
|
+
/** Tiles removed from the previous resident set. */
|
|
59
|
+
removed: string[];
|
|
60
|
+
/** Tiles actually clipped in this update; unchanged tiles are not reclipped. */
|
|
61
|
+
rebuilt: string[];
|
|
62
|
+
};
|
|
63
|
+
/** Clip changed tiles independently and pair their exposed boundaries.
|
|
64
|
+
* Mixed-level inputs must already be reconciled. Cached source buffers and
|
|
65
|
+
* returned arrays are read-only by contract. Change revision after in-place
|
|
66
|
+
* edits; replacing the mesh object also invalidates its cache. Polygon or
|
|
67
|
+
* option changes invalidate all clips. Limits maxWork/maxVertices/maxTriangles
|
|
68
|
+
* apply per clip and per adjacent-pair validation, not to the entire update.
|
|
69
|
+
* Arrival/eviction can change a neighbor's cutEdges without rebuilding its mesh.
|
|
70
|
+
*/
|
|
71
|
+
export declare function updateTerrainTileCutouts(residents: readonly TerrainCutoutResident[], polygon: TerrainCutoutRegion, previous?: TerrainTileCutoutCache, options?: TerrainTileCutoutUpdateOptions): TerrainTileCutoutUpdate;
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=tile-cutout-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile-cutout-update.d.ts","sourceRoot":"","sources":["../../src/terrain/tile-cutout-update.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,mBAAmB,EACzB,2BAAwB;AAEzB,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAE1B,yBAAsB;AAGvB,mFAAmF;AACnF,MAAM,MAAM,qBAAqB,GAAG;IAClC,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACj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