@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,61 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {TerrainPolytopeSweepResult} from './sweep-polytope';
|
|
6
|
+
import type {TerrainSurface} from './surface';
|
|
7
|
+
|
|
8
|
+
type Point = readonly [number, number, number];
|
|
9
|
+
|
|
10
|
+
/** Sweep an infinite two-sided plane under translation. Work counts active triangles. */
|
|
11
|
+
export function sweepTerrainPlane(
|
|
12
|
+
surface: Pick<TerrainSurface, 'copyData' | 'origin'>,
|
|
13
|
+
point: Point,
|
|
14
|
+
normal: Point,
|
|
15
|
+
translation: Point,
|
|
16
|
+
{maxWork = 100_000}: {maxWork?: number} = {}
|
|
17
|
+
): TerrainPolytopeSweepResult {
|
|
18
|
+
const length = Math.hypot(...normal);
|
|
19
|
+
if (
|
|
20
|
+
![point, normal, translation].every(v => v.length === 3 && v.every(Number.isFinite)) ||
|
|
21
|
+
!(length > 0 && Number.isFinite(length)) ||
|
|
22
|
+
!Number.isSafeInteger(maxWork) ||
|
|
23
|
+
maxWork < 0
|
|
24
|
+
)
|
|
25
|
+
throw new RangeError('Invalid terrain plane sweep');
|
|
26
|
+
const unit: Point = [normal[0] / length, normal[1] / length, normal[2] / length];
|
|
27
|
+
const velocity = translation[0] * unit[0] + translation[1] * unit[1] + translation[2] * unit[2];
|
|
28
|
+
if (!Number.isFinite(velocity)) throw new RangeError('Terrain plane velocity overflow');
|
|
29
|
+
const {positions, indices, triangleValidity} = surface.copyData();
|
|
30
|
+
const local = point.map((value, axis) => value - surface.origin[axis]);
|
|
31
|
+
let work = 0;
|
|
32
|
+
let fraction = Infinity;
|
|
33
|
+
let triangleIndex = -1;
|
|
34
|
+
for (let i = 0; i < triangleValidity.length; i++) {
|
|
35
|
+
if (!triangleValidity[i]) continue;
|
|
36
|
+
if (work >= maxWork) return {status: 'incomplete', work};
|
|
37
|
+
work++;
|
|
38
|
+
let min = Infinity;
|
|
39
|
+
let max = -Infinity;
|
|
40
|
+
for (let j = 0; j < 3; j++) {
|
|
41
|
+
const k = indices[3 * i + j] * 3;
|
|
42
|
+
const distance =
|
|
43
|
+
(positions[k] - local[0]) * unit[0] +
|
|
44
|
+
(positions[k + 1] - local[1]) * unit[1] +
|
|
45
|
+
(positions[k + 2] - local[2]) * unit[2];
|
|
46
|
+
if (!Number.isFinite(distance)) throw new RangeError('Terrain plane projection overflow');
|
|
47
|
+
min = Math.min(min, distance);
|
|
48
|
+
max = Math.max(max, distance);
|
|
49
|
+
}
|
|
50
|
+
if (min <= 0 && max >= 0)
|
|
51
|
+
return {status: 'hit', fraction: 0, triangleIndex: i, normal: null, work};
|
|
52
|
+
const entry = velocity > 0 ? min / velocity : max / velocity;
|
|
53
|
+
if (velocity !== 0 && entry > 0 && entry <= 1 && entry < fraction) {
|
|
54
|
+
triangleIndex = i;
|
|
55
|
+
fraction = entry;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (triangleIndex < 0) return {status: 'miss', work};
|
|
59
|
+
const entryNormal: Point = velocity < 0 ? unit : [-unit[0], -unit[1], -unit[2]];
|
|
60
|
+
return {status: 'hit', fraction, triangleIndex, normal: entryNormal, work};
|
|
61
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {TerrainSurface} from './surface';
|
|
6
|
+
|
|
7
|
+
type Point = readonly [number, number, number];
|
|
8
|
+
export type TerrainPolytope = {
|
|
9
|
+
/** Local Cartesian vertices in the same world frame as the sweep. */
|
|
10
|
+
vertices: readonly Point[];
|
|
11
|
+
/** Triangulated closed convex boundary. */
|
|
12
|
+
faces: readonly (readonly [number, number, number])[];
|
|
13
|
+
};
|
|
14
|
+
type Triangle = readonly [Point, Point, Point];
|
|
15
|
+
const sub = (a: Point, b: Point): Point => [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
|
16
|
+
const cross = (a: Point, b: Point): Point => [
|
|
17
|
+
a[1] * b[2] - a[2] * b[1],
|
|
18
|
+
a[2] * b[0] - a[0] * b[2],
|
|
19
|
+
a[0] * b[1] - a[1] * b[0]
|
|
20
|
+
];
|
|
21
|
+
const dot = (a: Point, b: Point) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
22
|
+
const edges = ([a, b, c]: Triangle) => [sub(b, a), sub(c, b), sub(a, c)];
|
|
23
|
+
|
|
24
|
+
export type TerrainPolytopeSweepResult =
|
|
25
|
+
| {status: 'miss' | 'incomplete'; work: number}
|
|
26
|
+
| {status: 'hit'; fraction: number; triangleIndex: number; normal: Point | null; work: number};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sweep a closed convex polytope under translation against active terrain triangles.
|
|
30
|
+
* Uses continuous separating-axis tests. The caller supplies a convex triangulated
|
|
31
|
+
* boundary in a numerically well-conditioned Cartesian frame. Initial overlap has
|
|
32
|
+
* no unique entry normal. Work counts tested axes across all active triangles.
|
|
33
|
+
*/
|
|
34
|
+
export function sweepTerrainPolytope(
|
|
35
|
+
surface: Pick<TerrainSurface, 'copyData' | 'origin'>,
|
|
36
|
+
collider: TerrainPolytope,
|
|
37
|
+
translation: Point,
|
|
38
|
+
{maxWork = 100_000}: {maxWork?: number} = {}
|
|
39
|
+
): TerrainPolytopeSweepResult {
|
|
40
|
+
return queryTerrainPolytope(surface.copyData(), surface.origin, collider, translation, maxWork);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** @internal Test a conservative projection expansion along each separating axis. */
|
|
44
|
+
export function queryTerrainPolytope(
|
|
45
|
+
data: ReturnType<TerrainSurface['copyData']>,
|
|
46
|
+
origin: Point,
|
|
47
|
+
collider: TerrainPolytope,
|
|
48
|
+
translation: Point,
|
|
49
|
+
maxWork: number,
|
|
50
|
+
padding = 0
|
|
51
|
+
): TerrainPolytopeSweepResult {
|
|
52
|
+
if (
|
|
53
|
+
!Number.isSafeInteger(maxWork) ||
|
|
54
|
+
maxWork < 0 ||
|
|
55
|
+
translation.length !== 3 ||
|
|
56
|
+
!translation.every(Number.isFinite) ||
|
|
57
|
+
collider.vertices.length < 4 ||
|
|
58
|
+
collider.faces.length < 4 ||
|
|
59
|
+
collider.vertices.some(point => point.length !== 3 || !point.every(Number.isFinite))
|
|
60
|
+
)
|
|
61
|
+
throw new RangeError('Invalid terrain polytope sweep');
|
|
62
|
+
const vertices = collider.vertices.map(point => sub(point, origin));
|
|
63
|
+
const normals: Point[] = [];
|
|
64
|
+
const directions: Point[] = [];
|
|
65
|
+
for (const face of collider.faces) {
|
|
66
|
+
if (face.length !== 3 || face.some(i => !Number.isSafeInteger(i) || !vertices[i]))
|
|
67
|
+
throw new RangeError('Invalid terrain polytope face');
|
|
68
|
+
const side = edges([vertices[face[0]], vertices[face[1]], vertices[face[2]]]);
|
|
69
|
+
const normal = cross(side[0], side[1]);
|
|
70
|
+
if (!normal.every(Number.isFinite) || !normal.some(Boolean))
|
|
71
|
+
throw new RangeError('Degenerate terrain polytope face');
|
|
72
|
+
normals.push(normal);
|
|
73
|
+
directions.push(...side);
|
|
74
|
+
}
|
|
75
|
+
return sweepTriangles(
|
|
76
|
+
data,
|
|
77
|
+
vertices,
|
|
78
|
+
normals,
|
|
79
|
+
directions,
|
|
80
|
+
translation,
|
|
81
|
+
maxWork,
|
|
82
|
+
undefined,
|
|
83
|
+
padding
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Sweep a two-sided triangle mesh under translation. A finite plane can be
|
|
88
|
+
* represented by two coplanar triangles. Work is shared across moving faces. */
|
|
89
|
+
export function sweepTerrainTriangleMesh(
|
|
90
|
+
surface: Pick<TerrainSurface, 'copyData' | 'origin'>,
|
|
91
|
+
collider: TerrainPolytope,
|
|
92
|
+
translation: Point,
|
|
93
|
+
{maxWork = 100_000}: {maxWork?: number} = {}
|
|
94
|
+
): TerrainPolytopeSweepResult {
|
|
95
|
+
if (
|
|
96
|
+
!Number.isSafeInteger(maxWork) ||
|
|
97
|
+
maxWork < 0 ||
|
|
98
|
+
translation.length !== 3 ||
|
|
99
|
+
!translation.every(Number.isFinite)
|
|
100
|
+
)
|
|
101
|
+
throw new RangeError('Invalid terrain triangle mesh sweep');
|
|
102
|
+
const data = surface.copyData();
|
|
103
|
+
let work = 0;
|
|
104
|
+
let best: Extract<TerrainPolytopeSweepResult, {status: 'hit'}> | undefined;
|
|
105
|
+
for (const face of collider.faces) {
|
|
106
|
+
if (face.length !== 3) throw new RangeError('Invalid terrain sweep mesh face');
|
|
107
|
+
const vertices = face.map(index => {
|
|
108
|
+
const point = collider.vertices[index];
|
|
109
|
+
if (
|
|
110
|
+
!Number.isSafeInteger(index) ||
|
|
111
|
+
!point ||
|
|
112
|
+
point.length !== 3 ||
|
|
113
|
+
!point.every(Number.isFinite)
|
|
114
|
+
)
|
|
115
|
+
throw new RangeError('Invalid terrain sweep mesh vertex');
|
|
116
|
+
return sub(point, surface.origin);
|
|
117
|
+
});
|
|
118
|
+
const directions = edges(vertices as unknown as Triangle);
|
|
119
|
+
const normal = cross(directions[0], directions[1]);
|
|
120
|
+
if (!normal.every(Number.isFinite) || !normal.some(Boolean))
|
|
121
|
+
throw new RangeError('Degenerate terrain sweep mesh face');
|
|
122
|
+
const result = sweepTriangles(
|
|
123
|
+
data,
|
|
124
|
+
vertices,
|
|
125
|
+
[normal],
|
|
126
|
+
directions,
|
|
127
|
+
translation,
|
|
128
|
+
maxWork - work,
|
|
129
|
+
normal
|
|
130
|
+
);
|
|
131
|
+
work += result.work;
|
|
132
|
+
if (result.status === 'incomplete') return {status: 'incomplete', work};
|
|
133
|
+
if (result.status === 'hit' && (!best || result.fraction < best.fraction)) best = result;
|
|
134
|
+
}
|
|
135
|
+
return best ? {...best, work} : {status: 'miss', work};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function sweepTriangles(
|
|
139
|
+
data: ReturnType<TerrainSurface['copyData']>,
|
|
140
|
+
vertices: readonly Point[],
|
|
141
|
+
normals: readonly Point[],
|
|
142
|
+
directions: readonly Point[],
|
|
143
|
+
translation: Point,
|
|
144
|
+
maxWork: number,
|
|
145
|
+
movingTriangleNormal?: Point,
|
|
146
|
+
padding = 0
|
|
147
|
+
): TerrainPolytopeSweepResult {
|
|
148
|
+
let work = 0;
|
|
149
|
+
let best: Extract<TerrainPolytopeSweepResult, {status: 'hit'}> | undefined;
|
|
150
|
+
const vertex = (index: number): Point => {
|
|
151
|
+
const i = 3 * data.indices[index];
|
|
152
|
+
return [data.positions[i], data.positions[i + 1], data.positions[i + 2]];
|
|
153
|
+
};
|
|
154
|
+
for (let i = 0; i < data.triangleValidity.length; i++) {
|
|
155
|
+
if (!data.triangleValidity[i]) continue;
|
|
156
|
+
const triangle: Triangle = [vertex(3 * i), vertex(3 * i + 1), vertex(3 * i + 2)];
|
|
157
|
+
const sides = edges(triangle);
|
|
158
|
+
let enter = 0;
|
|
159
|
+
let exit = best?.fraction ?? 1;
|
|
160
|
+
let normal: Point | null = null;
|
|
161
|
+
function* axes() {
|
|
162
|
+
const terrainNormal = cross(sides[0], sides[1]);
|
|
163
|
+
yield terrainNormal;
|
|
164
|
+
if (movingTriangleNormal) {
|
|
165
|
+
for (const side of sides) yield cross(terrainNormal, side);
|
|
166
|
+
for (const direction of directions) yield cross(movingTriangleNormal, direction);
|
|
167
|
+
}
|
|
168
|
+
yield* normals;
|
|
169
|
+
for (const side of sides) for (const direction of directions) yield cross(side, direction);
|
|
170
|
+
}
|
|
171
|
+
for (const axis of axes()) {
|
|
172
|
+
if (work >= maxWork) return {status: 'incomplete', work};
|
|
173
|
+
work++;
|
|
174
|
+
const length = Math.hypot(...axis);
|
|
175
|
+
if (length === 0) continue;
|
|
176
|
+
const unit: Point = [axis[0] / length, axis[1] / length, axis[2] / length];
|
|
177
|
+
const low = Math.min(...triangle.map(point => dot(point, unit)));
|
|
178
|
+
const high = Math.max(...triangle.map(point => dot(point, unit)));
|
|
179
|
+
let min = Infinity;
|
|
180
|
+
let max = -Infinity;
|
|
181
|
+
for (const point of vertices) {
|
|
182
|
+
const projection = dot(point, unit);
|
|
183
|
+
min = Math.min(min, projection);
|
|
184
|
+
max = Math.max(max, projection);
|
|
185
|
+
}
|
|
186
|
+
min -= padding;
|
|
187
|
+
max += padding;
|
|
188
|
+
const speed = dot(translation, unit);
|
|
189
|
+
if (![low, high, min, max, speed, length].every(Number.isFinite))
|
|
190
|
+
throw new RangeError('Terrain polytope projection overflow');
|
|
191
|
+
if (speed === 0) {
|
|
192
|
+
if (min > high || max < low) exit = -1;
|
|
193
|
+
} else {
|
|
194
|
+
const first = (low - max) / speed;
|
|
195
|
+
const last = (high - min) / speed;
|
|
196
|
+
const entry = Math.min(first, last);
|
|
197
|
+
if (entry > enter) {
|
|
198
|
+
enter = entry;
|
|
199
|
+
normal = speed < 0 ? unit : [-unit[0], -unit[1], -unit[2]];
|
|
200
|
+
}
|
|
201
|
+
exit = Math.min(exit, Math.max(first, last));
|
|
202
|
+
}
|
|
203
|
+
if (enter > exit) break;
|
|
204
|
+
}
|
|
205
|
+
if (enter <= exit && (!best || enter < best.fraction)) {
|
|
206
|
+
best = {status: 'hit', fraction: enter, triangleIndex: i, normal, work};
|
|
207
|
+
if (enter === 0) break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return best ? {...best, work} : {status: 'miss', work};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Sweep an axis-aligned box with positive half extents. */
|
|
214
|
+
export function sweepTerrainBox(
|
|
215
|
+
surface: Pick<TerrainSurface, 'copyData' | 'origin'>,
|
|
216
|
+
center: Point,
|
|
217
|
+
halfExtents: Point,
|
|
218
|
+
translation: Point,
|
|
219
|
+
options?: {maxWork?: number}
|
|
220
|
+
): TerrainPolytopeSweepResult {
|
|
221
|
+
return sweepTerrainPolytope(surface, createSweepBox(center, halfExtents), translation, options);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** @internal */
|
|
225
|
+
export function createSweepBox(center: Point, halfExtents: Point): TerrainPolytope {
|
|
226
|
+
if (halfExtents.length !== 3 || halfExtents.some(value => !(value > 0)))
|
|
227
|
+
throw new RangeError('Terrain box half extents must be positive');
|
|
228
|
+
const vertices = Array.from(
|
|
229
|
+
{length: 8},
|
|
230
|
+
(_, i): Point => [
|
|
231
|
+
center[0] + (i & 1 ? 1 : -1) * halfExtents[0],
|
|
232
|
+
center[1] + (i & 2 ? 1 : -1) * halfExtents[1],
|
|
233
|
+
center[2] + (i & 4 ? 1 : -1) * halfExtents[2]
|
|
234
|
+
]
|
|
235
|
+
);
|
|
236
|
+
return {
|
|
237
|
+
vertices,
|
|
238
|
+
faces: [
|
|
239
|
+
[0, 1, 3],
|
|
240
|
+
[0, 3, 2],
|
|
241
|
+
[4, 6, 7],
|
|
242
|
+
[4, 7, 5],
|
|
243
|
+
[0, 4, 5],
|
|
244
|
+
[0, 5, 1],
|
|
245
|
+
[2, 3, 7],
|
|
246
|
+
[2, 7, 6],
|
|
247
|
+
[0, 2, 6],
|
|
248
|
+
[0, 6, 4],
|
|
249
|
+
[1, 5, 7],
|
|
250
|
+
[1, 7, 3]
|
|
251
|
+
]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {sweepTerrainCapsule, type TerrainCapsuleSweepResult} from './sweep-capsule';
|
|
6
|
+
import type {TerrainRigidMotion} from './sweep-rotation';
|
|
7
|
+
import type {TerrainSphereSweepOptions} from './sweep-sphere';
|
|
8
|
+
import type {TerrainSegmentHit, TerrainSurface} from './surface';
|
|
9
|
+
|
|
10
|
+
/** Cartesian point in the terrain surface frame. */
|
|
11
|
+
type Point = readonly [number, number, number];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Bracket first contact for a capsule under linear pivot translation and shortest-arc
|
|
15
|
+
* rotation. Coincident axis endpoints describe a sphere, including an off-pivot
|
|
16
|
+
* sphere whose center follows a curved path. Unresolved tangency returns incomplete.
|
|
17
|
+
* The witness is an axis/triangle pair within the radius at the upper fraction.
|
|
18
|
+
*/
|
|
19
|
+
export function sweepTerrainRotatingCapsule(
|
|
20
|
+
surface: Pick<TerrainSurface, 'nearestSegmentQuery'>,
|
|
21
|
+
start: Point,
|
|
22
|
+
end: Point,
|
|
23
|
+
radius: number,
|
|
24
|
+
{pivot, translation, rotation}: TerrainRigidMotion,
|
|
25
|
+
{maxWork = 100_000, fractionTolerance = 1e-5}: TerrainSphereSweepOptions = {}
|
|
26
|
+
): TerrainCapsuleSweepResult {
|
|
27
|
+
const norm = Math.hypot(...rotation);
|
|
28
|
+
if (
|
|
29
|
+
![start, end, pivot, translation].every(p => p.length === 3 && p.every(Number.isFinite)) ||
|
|
30
|
+
rotation.length !== 4 ||
|
|
31
|
+
!(norm > 0 && Number.isFinite(norm)) ||
|
|
32
|
+
!Number.isFinite(radius) ||
|
|
33
|
+
radius < 0 ||
|
|
34
|
+
!Number.isSafeInteger(maxWork) ||
|
|
35
|
+
maxWork < 0 ||
|
|
36
|
+
!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1)
|
|
37
|
+
)
|
|
38
|
+
throw new RangeError('Invalid terrain capsule rigid motion');
|
|
39
|
+
|
|
40
|
+
const sign = rotation[3] < 0 ? -1 : 1;
|
|
41
|
+
const axisLength = Math.hypot(rotation[0], rotation[1], rotation[2]);
|
|
42
|
+
const angle = 2 * Math.atan2(axisLength, Math.abs(rotation[3]));
|
|
43
|
+
if (angle === 0) {
|
|
44
|
+
return sweepTerrainCapsule(surface, start, end, translation, radius, {
|
|
45
|
+
maxWork,
|
|
46
|
+
fractionTolerance
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const x = (rotation[0] / axisLength) * sign;
|
|
50
|
+
const y = (rotation[1] / axisLength) * sign;
|
|
51
|
+
const z = (rotation[2] / axisLength) * sign;
|
|
52
|
+
const offsets = [start, end].map(p => p.map((v, i) => v - pivot[i]));
|
|
53
|
+
// A segment is a convex combination of its endpoints. The capsule's spherical
|
|
54
|
+
// dilation is rotation invariant, so only the axis motion contributes here.
|
|
55
|
+
const reach = Math.max(...offsets.map(p => Math.hypot(...p)));
|
|
56
|
+
const speed = Math.hypot(...translation) + angle * reach;
|
|
57
|
+
const scale = Math.max(Math.hypot(...pivot), reach, speed, radius);
|
|
58
|
+
if (!Number.isFinite(scale)) throw new RangeError('Terrain capsule rigid motion overflow');
|
|
59
|
+
|
|
60
|
+
let work = 0;
|
|
61
|
+
/** Query the axis at an exact pose, charging both the probe and index work. */
|
|
62
|
+
function probe(t: number) {
|
|
63
|
+
if (work >= maxWork) return null;
|
|
64
|
+
work++;
|
|
65
|
+
const sin = Math.sin(angle * t);
|
|
66
|
+
const cos = Math.cos(angle * t);
|
|
67
|
+
const [a, b] =
|
|
68
|
+
t === 0
|
|
69
|
+
? [start, end]
|
|
70
|
+
: offsets.map(([u, v, w]): Point => {
|
|
71
|
+
const d = (x * u + y * v + z * w) * (1 - cos);
|
|
72
|
+
const pos: Point = [
|
|
73
|
+
pivot[0] + (translation[0] * t + u * cos + (y * w - z * v) * sin + x * d),
|
|
74
|
+
pivot[1] + (translation[1] * t + v * cos + (z * u - x * w) * sin + y * d),
|
|
75
|
+
pivot[2] + (translation[2] * t + w * cos + (x * v - y * u) * sin + z * d)
|
|
76
|
+
];
|
|
77
|
+
if (!pos.every(Number.isFinite)) throw new RangeError('Terrain capsule pose overflow');
|
|
78
|
+
return pos;
|
|
79
|
+
});
|
|
80
|
+
const query = surface.nearestSegmentQuery(a, b, {maxWork: maxWork - work});
|
|
81
|
+
work += query.work;
|
|
82
|
+
return query;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const initial = probe(0);
|
|
86
|
+
if (initial?.result && initial.result.distance <= radius)
|
|
87
|
+
return {status: 'hit', fraction: 0, lowerFraction: 0, work, contact: initial.result};
|
|
88
|
+
if (!initial?.complete) return {status: 'incomplete', work};
|
|
89
|
+
if (!initial.result || speed === 0) return {status: 'miss', work};
|
|
90
|
+
|
|
91
|
+
let clearUntil = 0;
|
|
92
|
+
let witness: {fraction: number; contact: TerrainSegmentHit} | undefined;
|
|
93
|
+
const pending: [number, number][] = [[0, 1]];
|
|
94
|
+
while (pending.length) {
|
|
95
|
+
if (witness && witness.fraction - clearUntil <= fractionTolerance)
|
|
96
|
+
return {status: 'hit', lowerFraction: clearUntil, work, ...witness};
|
|
97
|
+
const [lo, hi] = pending.pop()!;
|
|
98
|
+
const mid = lo + (hi - lo) / 2;
|
|
99
|
+
const query = probe(mid);
|
|
100
|
+
const contact = query?.result;
|
|
101
|
+
if (contact && contact.distance <= radius) {
|
|
102
|
+
witness = {fraction: mid, contact};
|
|
103
|
+
if (mid - clearUntil <= fractionTolerance)
|
|
104
|
+
return {status: 'hit', lowerFraction: clearUntil, work, ...witness};
|
|
105
|
+
if (mid === lo || mid === hi) return {status: 'incomplete', work};
|
|
106
|
+
pending.push([lo, mid]);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!query?.complete) return {status: 'incomplete', work};
|
|
110
|
+
const travel = speed * Math.max(mid - lo, hi - mid);
|
|
111
|
+
const allowance = 16 * Number.EPSILON * Math.max(scale, contact?.distance ?? 0);
|
|
112
|
+
if (!contact || contact.distance - radius > travel + allowance) {
|
|
113
|
+
clearUntil = hi;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (hi - clearUntil <= fractionTolerance) {
|
|
117
|
+
const final = witness?.fraction === hi ? witness.contact : probe(hi)?.result;
|
|
118
|
+
if (final && final.distance <= radius)
|
|
119
|
+
return {status: 'hit', fraction: hi, lowerFraction: clearUntil, work, contact: final};
|
|
120
|
+
}
|
|
121
|
+
if (mid === lo || mid === hi || hi - lo <= fractionTolerance / 4)
|
|
122
|
+
return {status: 'incomplete', work};
|
|
123
|
+
pending.push([mid, hi], [lo, mid]);
|
|
124
|
+
}
|
|
125
|
+
return witness
|
|
126
|
+
? {status: 'hit', lowerFraction: clearUntil, work, ...witness}
|
|
127
|
+
: {status: 'miss', work};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Sweep a sphere whose center may orbit an offset rigid-motion pivot. */
|
|
131
|
+
export function sweepTerrainRotatingSphere(
|
|
132
|
+
surface: Pick<TerrainSurface, 'nearestSegmentQuery'>,
|
|
133
|
+
center: Point,
|
|
134
|
+
radius: number,
|
|
135
|
+
motion: TerrainRigidMotion,
|
|
136
|
+
options?: TerrainSphereSweepOptions
|
|
137
|
+
): TerrainCapsuleSweepResult {
|
|
138
|
+
return sweepTerrainRotatingCapsule(surface, center, center, radius, motion, options);
|
|
139
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createSweepBox,
|
|
7
|
+
queryTerrainPolytope,
|
|
8
|
+
type TerrainPolytope,
|
|
9
|
+
type TerrainPolytopeSweepResult
|
|
10
|
+
} from './sweep-polytope';
|
|
11
|
+
import type {TerrainSurface} from './surface';
|
|
12
|
+
|
|
13
|
+
type Point = readonly [number, number, number];
|
|
14
|
+
type Surface = Pick<TerrainSurface, 'copyData' | 'origin'>;
|
|
15
|
+
|
|
16
|
+
export type TerrainRigidMotion = {
|
|
17
|
+
/** Pivot in the same Cartesian frame as the collider vertices. */
|
|
18
|
+
pivot: Point;
|
|
19
|
+
translation: Point;
|
|
20
|
+
/** Quaternion [x,y,z,w] relative to the initial pose. The shortest arc is used. */
|
|
21
|
+
rotation: readonly [number, number, number, number];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type TerrainRotationalSweepResult =
|
|
25
|
+
| {status: 'miss' | 'incomplete'; work: number}
|
|
26
|
+
| (Extract<TerrainPolytopeSweepResult, {status: 'hit'}> & {lowerFraction: number});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Sweep a convex hull along linear translation and shortest-arc rotation.
|
|
30
|
+
* An expanded midpoint SAT can exclude an interval. An unexpanded pose supplies
|
|
31
|
+
* a hit witness. Unresolved grazing or exhausted work yields incomplete.
|
|
32
|
+
*/
|
|
33
|
+
export function sweepTerrainRotatingPolytope(
|
|
34
|
+
surface: Surface,
|
|
35
|
+
collider: TerrainPolytope,
|
|
36
|
+
{pivot, translation, rotation}: TerrainRigidMotion,
|
|
37
|
+
{maxWork = 100_000, fractionTolerance = 1e-5}: {maxWork?: number; fractionTolerance?: number} = {}
|
|
38
|
+
): TerrainRotationalSweepResult {
|
|
39
|
+
const norm = Math.hypot(...rotation);
|
|
40
|
+
if (
|
|
41
|
+
pivot.length !== 3 ||
|
|
42
|
+
translation.length !== 3 ||
|
|
43
|
+
rotation.length !== 4 ||
|
|
44
|
+
!pivot.every(Number.isFinite) ||
|
|
45
|
+
!translation.every(Number.isFinite) ||
|
|
46
|
+
!(norm > 0 && Number.isFinite(norm)) ||
|
|
47
|
+
!Number.isSafeInteger(maxWork) ||
|
|
48
|
+
maxWork < 0 ||
|
|
49
|
+
!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1)
|
|
50
|
+
)
|
|
51
|
+
throw new RangeError('Invalid terrain rigid motion');
|
|
52
|
+
|
|
53
|
+
// Work in the surface frame before interpolating to preserve small offsets.
|
|
54
|
+
const localPivot = pivot.map((v, i) => v - surface.origin[i]);
|
|
55
|
+
const offsets = collider.vertices.map(v => v.map((x, i) => x - pivot[i]));
|
|
56
|
+
const radius = offsets.reduce((r, v) => Math.max(r, Math.hypot(...v)), 0);
|
|
57
|
+
const sign = rotation[3] < 0 ? -1 : 1;
|
|
58
|
+
const vectorNorm = Math.hypot(rotation[0], rotation[1], rotation[2]);
|
|
59
|
+
const angle = 2 * Math.atan2(vectorNorm, Math.abs(rotation[3]));
|
|
60
|
+
const speed = Math.hypot(...translation) + angle * radius;
|
|
61
|
+
if (!Number.isFinite(speed)) throw new RangeError('Terrain rigid motion overflow');
|
|
62
|
+
|
|
63
|
+
const data = surface.copyData();
|
|
64
|
+
if (angle === 0) {
|
|
65
|
+
const result = queryTerrainPolytope(data, surface.origin, collider, translation, maxWork);
|
|
66
|
+
return result.status === 'hit' ? {...result, lowerFraction: result.fraction} : result;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const [x, y, z] = rotation.slice(0, 3).map(v => (v / vectorNorm) * sign);
|
|
70
|
+
const zero = [0, 0, 0] as const;
|
|
71
|
+
let work = 0;
|
|
72
|
+
const pose = (t: number): TerrainPolytope => {
|
|
73
|
+
const sin = Math.sin(angle * t);
|
|
74
|
+
const cos = Math.cos(angle * t);
|
|
75
|
+
return {
|
|
76
|
+
faces: collider.faces,
|
|
77
|
+
vertices: offsets.map(([a, b, c]): Point => {
|
|
78
|
+
const projection = (x * a + y * b + z * c) * (1 - cos);
|
|
79
|
+
return [
|
|
80
|
+
localPivot[0] + translation[0] * t + a * cos + (y * c - z * b) * sin + x * projection,
|
|
81
|
+
localPivot[1] + translation[1] * t + b * cos + (z * a - x * c) * sin + y * projection,
|
|
82
|
+
localPivot[2] + translation[2] * t + c * cos + (x * b - y * a) * sin + z * projection
|
|
83
|
+
];
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const probe = (shape: TerrainPolytope, padding = 0) => {
|
|
88
|
+
if (work >= maxWork) return {status: 'incomplete', work: 0} as const;
|
|
89
|
+
work++;
|
|
90
|
+
const result = queryTerrainPolytope(data, zero, shape, zero, maxWork - work, padding);
|
|
91
|
+
work += result.work;
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
const initial = probe(pose(0));
|
|
95
|
+
if (initial.status === 'hit') return {...initial, lowerFraction: 0, work};
|
|
96
|
+
if (initial.status === 'incomplete') return {status: 'incomplete', work};
|
|
97
|
+
|
|
98
|
+
let clearUntil = 0;
|
|
99
|
+
let witness: Extract<TerrainPolytopeSweepResult, {status: 'hit'}> | undefined;
|
|
100
|
+
const pending: [number, number][] = [[0, 1]];
|
|
101
|
+
while (pending.length) {
|
|
102
|
+
if (witness && witness.fraction - clearUntil <= fractionTolerance)
|
|
103
|
+
return {...witness, lowerFraction: clearUntil, work};
|
|
104
|
+
const [lo, hi] = pending.pop()!;
|
|
105
|
+
const mid = lo + (hi - lo) / 2;
|
|
106
|
+
const shape = pose(mid);
|
|
107
|
+
const padding = speed * Math.max(mid - lo, hi - mid);
|
|
108
|
+
const expanded = probe(shape, padding + 8 * Number.EPSILON * (radius + padding));
|
|
109
|
+
if (expanded.status === 'miss') {
|
|
110
|
+
clearUntil = hi;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (expanded.status === 'incomplete') return {status: 'incomplete', work};
|
|
114
|
+
const hit = probe(shape);
|
|
115
|
+
if (hit.status === 'incomplete') return {status: 'incomplete', work};
|
|
116
|
+
if (hit.status === 'hit') {
|
|
117
|
+
witness = {...hit, fraction: mid};
|
|
118
|
+
if (mid - clearUntil <= fractionTolerance)
|
|
119
|
+
return {...witness, lowerFraction: clearUntil, work};
|
|
120
|
+
pending.push([lo, mid]);
|
|
121
|
+
} else if (hi - clearUntil <= fractionTolerance) {
|
|
122
|
+
const end = witness?.fraction === hi ? witness : probe(pose(hi));
|
|
123
|
+
if (end?.status === 'hit') return {...end, fraction: hi, lowerFraction: clearUntil, work};
|
|
124
|
+
if (hi - lo <= fractionTolerance / 4) return {status: 'incomplete', work};
|
|
125
|
+
pending.push([mid, hi], [lo, mid]);
|
|
126
|
+
} else {
|
|
127
|
+
if (mid === lo || mid === hi || hi - lo <= fractionTolerance / 4)
|
|
128
|
+
return {status: 'incomplete', work};
|
|
129
|
+
pending.push([mid, hi], [lo, mid]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return witness ? {...witness, lowerFraction: clearUntil, work} : {status: 'miss', work};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Rotational sweep of a box that starts axis-aligned. */
|
|
136
|
+
export function sweepTerrainRotatingBox(
|
|
137
|
+
surface: Surface,
|
|
138
|
+
center: Point,
|
|
139
|
+
halfExtents: Point,
|
|
140
|
+
motion: TerrainRigidMotion,
|
|
141
|
+
options?: {maxWork?: number; fractionTolerance?: number}
|
|
142
|
+
): TerrainRotationalSweepResult {
|
|
143
|
+
return sweepTerrainRotatingPolytope(
|
|
144
|
+
surface,
|
|
145
|
+
createSweepBox(center, halfExtents),
|
|
146
|
+
motion,
|
|
147
|
+
options
|
|
148
|
+
);
|
|
149
|
+
}
|