@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
|
@@ -37,7 +37,7 @@ export function createTerrainMixedVertexTileHalos(
|
|
|
37
37
|
|
|
38
38
|
/** Internal preparation shared only by immutable incremental snapshots. */
|
|
39
39
|
export type MixedHaloPreparation = {
|
|
40
|
-
|
|
40
|
+
tiles: WeakMap<TerrainMixedVertexTile, ReturnType<typeof prepareMixedHaloTile>>;
|
|
41
41
|
layout?: {keys: string[]; query: ReturnType<typeof createTerrainBoxIndex>};
|
|
42
42
|
};
|
|
43
43
|
|
|
@@ -53,89 +53,74 @@ export function buildMixedVertexTileHalos(
|
|
|
53
53
|
if (![maxSamples, maxTests].every(v => Number.isSafeInteger(v) && v >= 0))
|
|
54
54
|
throw new Error('Invalid mixed halo capacity');
|
|
55
55
|
let count = 0;
|
|
56
|
-
|
|
56
|
+
let previousKey: string | undefined;
|
|
57
57
|
let frame:
|
|
58
58
|
| {origin: number[]; column: number[]; row: number[]; reference: string; scale: number[]}
|
|
59
59
|
| undefined;
|
|
60
60
|
const sources = [...tiles]
|
|
61
61
|
.sort((a, b) => a.spacing - b.spacing || a.column - b.column || a.row - b.row)
|
|
62
62
|
.map(tile => {
|
|
63
|
-
if (
|
|
64
|
-
![tile.column, tile.row, tile.spacing].every(Number.isSafeInteger) ||
|
|
65
|
-
tile.spacing < 1 ||
|
|
66
|
-
2 ** Math.round(Math.log2(tile.spacing)) !== tile.spacing
|
|
67
|
-
)
|
|
68
|
-
throw new Error('Invalid mixed halo lattice');
|
|
69
|
-
const key = `${tile.spacing}/${tile.column}/${tile.row}`;
|
|
70
|
-
if (addresses.has(key)) throw new Error('Duplicate mixed halo tile');
|
|
71
|
-
addresses.add(key);
|
|
72
63
|
count += (tile.field.width + 2) * (tile.field.height + 2);
|
|
73
64
|
if (!Number.isSafeInteger(count) || count > maxSamples)
|
|
74
65
|
throw new Error('Mixed halo sample capacity exceeded');
|
|
75
|
-
let
|
|
76
|
-
if (!
|
|
77
|
-
|
|
78
|
-
preparation?.
|
|
66
|
+
let prepared = preparation?.tiles.get(tile);
|
|
67
|
+
if (!prepared) {
|
|
68
|
+
prepared = prepareMixedHaloTile(tile);
|
|
69
|
+
preparation?.tiles.set(tile, prepared);
|
|
70
|
+
}
|
|
71
|
+
const {
|
|
72
|
+
key,
|
|
73
|
+
source: field,
|
|
74
|
+
columnStep: column,
|
|
75
|
+
rowStep: row,
|
|
76
|
+
frameOrigin: origin,
|
|
77
|
+
scale
|
|
78
|
+
} = prepared;
|
|
79
|
+
// Address sorting makes duplicate tiles adjacent; no per-build Set is needed.
|
|
80
|
+
if (previousKey === key) throw new Error('Duplicate mixed halo tile');
|
|
81
|
+
previousKey = key;
|
|
82
|
+
if (frame) {
|
|
83
|
+
if (frame.reference !== field.heightReference)
|
|
84
|
+
throw new Error('Mixed halo frames or height references differ');
|
|
85
|
+
for (let i = 0; i < 2; i++) {
|
|
86
|
+
if (
|
|
87
|
+
column[i] !== frame.column[i] ||
|
|
88
|
+
row[i] !== frame.row[i] ||
|
|
89
|
+
(origin[i] !== frame.origin[i] &&
|
|
90
|
+
Math.abs(origin[i] - frame.origin[i]) >
|
|
91
|
+
Math.min(
|
|
92
|
+
16 * Number.EPSILON * Math.max(scale[i], frame.scale[i]),
|
|
93
|
+
1e-9 * Math.max(Math.abs(column[i]), Math.abs(row[i]))
|
|
94
|
+
))
|
|
95
|
+
)
|
|
96
|
+
throw new Error('Mixed halo frames or height references differ');
|
|
97
|
+
}
|
|
79
98
|
}
|
|
80
|
-
if (field.registration !== 'vertex')
|
|
81
|
-
throw new Error('Mixed halos require vertex registration');
|
|
82
|
-
const column = field.columnStep.map(v => v / tile.spacing);
|
|
83
|
-
const row = field.rowStep.map(v => v / tile.spacing);
|
|
84
|
-
const origin = field.origin.map(
|
|
85
|
-
(v, axis) => v - tile.column * column[axis] - tile.row * row[axis]
|
|
86
|
-
);
|
|
87
|
-
const scale = field.origin.map((v, i) =>
|
|
88
|
-
Math.max(1, Math.abs(v), Math.abs(tile.column * column[i]), Math.abs(tile.row * row[i]))
|
|
89
|
-
);
|
|
90
|
-
if (!origin.every(Number.isFinite)) throw new Error('Mixed halo coordinate overflow');
|
|
91
|
-
if (
|
|
92
|
-
frame &&
|
|
93
|
-
(frame.reference !== field.heightReference ||
|
|
94
|
-
column.some((v, i) => v !== frame!.column[i]) ||
|
|
95
|
-
row.some((v, i) => v !== frame!.row[i]) ||
|
|
96
|
-
origin.some(
|
|
97
|
-
(v, i) =>
|
|
98
|
-
Math.abs(v - frame!.origin[i]) >
|
|
99
|
-
Math.min(
|
|
100
|
-
16 * Number.EPSILON * Math.max(scale[i], frame!.scale[i]),
|
|
101
|
-
1e-9 * Math.max(Math.abs(column[i]), Math.abs(row[i]))
|
|
102
|
-
)
|
|
103
|
-
))
|
|
104
|
-
)
|
|
105
|
-
throw new Error('Mixed halo frames or height references differ');
|
|
106
99
|
frame ??= {origin, column, row, reference: field.heightReference, scale};
|
|
107
|
-
return
|
|
100
|
+
return prepared;
|
|
108
101
|
});
|
|
109
102
|
// Bound the full lattice span so relative coordinates remain exact integers.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
if (sources.length && !Number.isSafeInteger(max - min))
|
|
122
|
-
throw new Error('Mixed halo lattice span overflow');
|
|
103
|
+
let minX = Infinity,
|
|
104
|
+
minY = Infinity,
|
|
105
|
+
maxX = -Infinity,
|
|
106
|
+
maxY = -Infinity;
|
|
107
|
+
for (let i = 0; i < sources.length; i++) {
|
|
108
|
+
const {haloBounds} = sources[i];
|
|
109
|
+
minX = Math.min(minX, haloBounds.minX);
|
|
110
|
+
minY = Math.min(minY, haloBounds.minY);
|
|
111
|
+
maxX = Math.max(maxX, haloBounds.maxX);
|
|
112
|
+
maxY = Math.max(maxY, haloBounds.maxY);
|
|
123
113
|
}
|
|
114
|
+
if (sources.length && (!Number.isSafeInteger(maxX - minX) || !Number.isSafeInteger(maxY - minY)))
|
|
115
|
+
throw new Error('Mixed halo lattice span overflow');
|
|
124
116
|
if (targets && targets.size === 0) return {tiles: []};
|
|
125
117
|
let index: ReturnType<typeof createTerrainBoxIndex> | undefined;
|
|
126
118
|
if (sources.length > 8) {
|
|
127
|
-
const keys =
|
|
128
|
-
preparation &&
|
|
129
|
-
sources.map(
|
|
130
|
-
tile =>
|
|
131
|
-
`${tile.spacing}/${tile.column}/${tile.row}/${tile.source.width}/${tile.source.height}`
|
|
132
|
-
);
|
|
133
119
|
const cached = preparation?.layout;
|
|
134
120
|
if (
|
|
135
|
-
keys &&
|
|
136
121
|
cached &&
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
sources.length === cached.keys.length &&
|
|
123
|
+
sources.every((tile, i) => tile.layoutKey === cached.keys[i])
|
|
139
124
|
) {
|
|
140
125
|
index = cached.query;
|
|
141
126
|
} else {
|
|
@@ -147,7 +132,8 @@ export function buildMixedVertexTileHalos(
|
|
|
147
132
|
maxY: tile.row + (tile.source.height - 1) * tile.spacing
|
|
148
133
|
}))
|
|
149
134
|
);
|
|
150
|
-
if (preparation
|
|
135
|
+
if (preparation)
|
|
136
|
+
preparation.layout = {keys: sources.map(tile => tile.layoutKey), query: index};
|
|
151
137
|
}
|
|
152
138
|
}
|
|
153
139
|
let tests = 0;
|
|
@@ -156,7 +142,7 @@ export function buildMixedVertexTileHalos(
|
|
|
156
142
|
};
|
|
157
143
|
return {
|
|
158
144
|
tiles: sources
|
|
159
|
-
.filter(tile => !targets || targets.has(
|
|
145
|
+
.filter(tile => !targets || targets.has(tile.key))
|
|
160
146
|
.map(tile => {
|
|
161
147
|
const source = tile.source,
|
|
162
148
|
width = source.width + 2,
|
|
@@ -164,23 +150,15 @@ export function buildMixedVertexTileHalos(
|
|
|
164
150
|
const heights = new Float64Array(width * height),
|
|
165
151
|
validity = new Uint8Array(heights.length),
|
|
166
152
|
statuses = new Uint8Array(heights.length);
|
|
167
|
-
const candidates =
|
|
168
|
-
index?.(
|
|
169
|
-
{
|
|
170
|
-
minX: tile.column - tile.spacing,
|
|
171
|
-
minY: tile.row - tile.spacing,
|
|
172
|
-
maxX: tile.column + source.width * tile.spacing,
|
|
173
|
-
maxY: tile.row + source.height * tile.spacing
|
|
174
|
-
},
|
|
175
|
-
charge
|
|
176
|
-
).map(id => sources[id]) ?? sources;
|
|
153
|
+
const candidates = index?.(tile.haloBounds, charge).map(id => sources[id]) ?? sources;
|
|
177
154
|
for (let y = 0; y < height; y++)
|
|
178
155
|
for (let x = 0; x < width; x++) {
|
|
179
156
|
const gx = tile.column + (x - 1) * tile.spacing,
|
|
180
157
|
gy = tile.row + (y - 1) * tile.spacing;
|
|
181
|
-
if (!
|
|
158
|
+
if (!Number.isSafeInteger(gx) || !Number.isSafeInteger(gy))
|
|
182
159
|
throw new Error('Mixed halo lattice overflow');
|
|
183
|
-
for (
|
|
160
|
+
for (let candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) {
|
|
161
|
+
const candidate = candidates[candidateIndex];
|
|
184
162
|
charge();
|
|
185
163
|
const cx = (gx - candidate.column) / candidate.spacing,
|
|
186
164
|
cy = (gy - candidate.row) / candidate.spacing;
|
|
@@ -222,3 +200,41 @@ export function buildMixedVertexTileHalos(
|
|
|
222
200
|
})
|
|
223
201
|
};
|
|
224
202
|
}
|
|
203
|
+
|
|
204
|
+
/** Prepare immutable geometry and normalized data once per source descriptor. */
|
|
205
|
+
function prepareMixedHaloTile(tile: TerrainMixedVertexTile) {
|
|
206
|
+
const {column, row, spacing} = tile;
|
|
207
|
+
if (
|
|
208
|
+
![column, row, spacing].every(Number.isSafeInteger) ||
|
|
209
|
+
spacing < 1 ||
|
|
210
|
+
2 ** Math.round(Math.log2(spacing)) !== spacing
|
|
211
|
+
)
|
|
212
|
+
throw new Error('Invalid mixed halo lattice');
|
|
213
|
+
const source = new HeightField(tile.field);
|
|
214
|
+
if (source.registration !== 'vertex') throw new Error('Mixed halos require vertex registration');
|
|
215
|
+
const columnStep = source.columnStep.map(v => v / spacing);
|
|
216
|
+
const rowStep = source.rowStep.map(v => v / spacing);
|
|
217
|
+
const frameOrigin = source.origin.map((v, i) => v - column * columnStep[i] - row * rowStep[i]);
|
|
218
|
+
const scale = source.origin.map((v, i) =>
|
|
219
|
+
Math.max(1, Math.abs(v), Math.abs(column * columnStep[i]), Math.abs(row * rowStep[i]))
|
|
220
|
+
);
|
|
221
|
+
if (!frameOrigin.every(Number.isFinite)) throw new Error('Mixed halo coordinate overflow');
|
|
222
|
+
const minX = column - spacing,
|
|
223
|
+
minY = row - spacing;
|
|
224
|
+
const maxX = column + source.width * spacing,
|
|
225
|
+
maxY = row + source.height * spacing;
|
|
226
|
+
if (![minX, minY, maxX, maxY].every(Number.isSafeInteger))
|
|
227
|
+
throw new Error('Mixed halo lattice overflow');
|
|
228
|
+
const key = `${spacing}/${column}/${row}`;
|
|
229
|
+
return {
|
|
230
|
+
...tile,
|
|
231
|
+
source,
|
|
232
|
+
columnStep,
|
|
233
|
+
rowStep,
|
|
234
|
+
frameOrigin,
|
|
235
|
+
scale,
|
|
236
|
+
key,
|
|
237
|
+
layoutKey: `${key}/${source.width}/${source.height}`,
|
|
238
|
+
haloBounds: {minX, minY, maxX, maxY}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {compareTerrainSlopes} from './profile-slope';
|
|
6
|
+
import {TerrainSampleStatus, type TerrainSample} from './types';
|
|
7
|
+
|
|
8
|
+
/** Classification at each target grid node. */
|
|
9
|
+
export const TerrainRegionalViewStatus = {
|
|
10
|
+
VISIBLE: 0,
|
|
11
|
+
BLOCKED: 1,
|
|
12
|
+
UNKNOWN: 2,
|
|
13
|
+
MISSING_TARGET: 3,
|
|
14
|
+
OBSERVER: 4
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
/** Axis-aligned target grid in a local Cartesian or observer-centered distance frame. */
|
|
18
|
+
export type TerrainViewshedGrid = {
|
|
19
|
+
/** Number of target columns. */
|
|
20
|
+
width: number;
|
|
21
|
+
/** Number of target rows. */
|
|
22
|
+
height: number;
|
|
23
|
+
/** Coordinates of the first target in meters. */
|
|
24
|
+
origin: readonly [number, number];
|
|
25
|
+
/** Positive spacings in meters. */
|
|
26
|
+
spacing: readonly [number, number];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** Observer geometry and sampling limits. */
|
|
30
|
+
export type TerrainRegionalViewshedOptions = {
|
|
31
|
+
/** Observer XY and absolute eye elevation, in meters. */
|
|
32
|
+
observer: readonly [number, number, number];
|
|
33
|
+
/** Maximum spacing of sampled stations on each ray, in meters. */
|
|
34
|
+
sampleStep: number;
|
|
35
|
+
/** Height above terrain at each target, in meters. Defaults to zero. */
|
|
36
|
+
targetOffset?: number;
|
|
37
|
+
/** Spherical radius in meters. Distances from the observer are surface arc lengths. */
|
|
38
|
+
radius?: number;
|
|
39
|
+
/** Maximum target grid size. Defaults to 100,000. */
|
|
40
|
+
maxTargets?: number;
|
|
41
|
+
/** Total callback invocations allowed, including observer and targets. Defaults to 4,000,000. */
|
|
42
|
+
maxSamples?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** Row-major viewshed and coverage diagnostics. */
|
|
46
|
+
export type TerrainRegionalViewshed = {
|
|
47
|
+
/** View statuses from TerrainRegionalViewStatus. */
|
|
48
|
+
statuses: Uint8Array;
|
|
49
|
+
/** Target sample statuses from TerrainSampleStatus. */
|
|
50
|
+
targetStatuses: Uint8Array;
|
|
51
|
+
/** One when every sampled station including both endpoints was valid, otherwise zero. */
|
|
52
|
+
sampledCoverage: Uint8Array;
|
|
53
|
+
/** Total elevation callback invocations. */
|
|
54
|
+
samples: number;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Classify a regional raster of target nodes along sampled radial profiles.
|
|
59
|
+
* A known obstruction (including grazing) blocks even when other stations are missing.
|
|
60
|
+
* Missing support otherwise gives UNKNOWN. Results describe sampled stations only.
|
|
61
|
+
* Without a radius, XY and elevation use a local flat metric frame. With a radius,
|
|
62
|
+
* radial distance is spherical arc length and elevations are radial offsets from that sphere.
|
|
63
|
+
*/
|
|
64
|
+
export function createTerrainRegionalViewshed(
|
|
65
|
+
grid: TerrainViewshedGrid,
|
|
66
|
+
sample: (x: number, y: number) => Pick<TerrainSample, 'height' | 'status'>,
|
|
67
|
+
options: TerrainRegionalViewshedOptions
|
|
68
|
+
): TerrainRegionalViewshed {
|
|
69
|
+
const {width, height, origin, spacing} = grid;
|
|
70
|
+
const {
|
|
71
|
+
observer,
|
|
72
|
+
sampleStep,
|
|
73
|
+
radius,
|
|
74
|
+
targetOffset = 0,
|
|
75
|
+
maxTargets = 100_000,
|
|
76
|
+
maxSamples = 4_000_000
|
|
77
|
+
} = options;
|
|
78
|
+
const count = width * height;
|
|
79
|
+
if (
|
|
80
|
+
![width, height, count, maxTargets, maxSamples].every(Number.isSafeInteger) ||
|
|
81
|
+
width < 1 ||
|
|
82
|
+
height < 1 ||
|
|
83
|
+
count > maxTargets ||
|
|
84
|
+
maxSamples < 1 ||
|
|
85
|
+
origin.length !== 2 ||
|
|
86
|
+
spacing.length !== 2 ||
|
|
87
|
+
observer.length !== 3 ||
|
|
88
|
+
![...origin, ...spacing, ...observer, sampleStep, targetOffset].every(Number.isFinite) ||
|
|
89
|
+
spacing.some(value => value <= 0) ||
|
|
90
|
+
sampleStep <= 0 ||
|
|
91
|
+
targetOffset < 0 ||
|
|
92
|
+
(radius !== undefined && (!Number.isFinite(radius) || radius <= 0 || observer[2] <= -radius))
|
|
93
|
+
)
|
|
94
|
+
throw new RangeError('Invalid regional viewshed grid or options');
|
|
95
|
+
|
|
96
|
+
const statuses = new Uint8Array(count);
|
|
97
|
+
const targetStatuses = new Uint8Array(count);
|
|
98
|
+
const sampledCoverage = new Uint8Array(count);
|
|
99
|
+
let samples = 0;
|
|
100
|
+
/** Read one station, preserving the source coverage reason. */
|
|
101
|
+
function read(x: number, y: number) {
|
|
102
|
+
if (samples >= maxSamples) throw new RangeError('Regional viewshed sample budget exceeded');
|
|
103
|
+
samples++;
|
|
104
|
+
const result = sample(x, y);
|
|
105
|
+
if (
|
|
106
|
+
!Number.isInteger(result.status) ||
|
|
107
|
+
result.status < 0 ||
|
|
108
|
+
result.status > TerrainSampleStatus.NOT_RESIDENT ||
|
|
109
|
+
(result.status === TerrainSampleStatus.VALID &&
|
|
110
|
+
(!Number.isFinite(result.height) || (radius !== undefined && result.height <= -radius)))
|
|
111
|
+
)
|
|
112
|
+
throw new RangeError('Invalid regional viewshed sample');
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Express an elevation in the observer tangent frame without subtracting large radii. */
|
|
117
|
+
function sight(distance: number, elevation: number): readonly [number, number] {
|
|
118
|
+
let rise = elevation - observer[2];
|
|
119
|
+
let run = distance;
|
|
120
|
+
if (radius !== undefined) {
|
|
121
|
+
const theta = distance / radius;
|
|
122
|
+
const radial = radius + elevation;
|
|
123
|
+
const halfSine = Math.sin(theta / 2);
|
|
124
|
+
rise -= radial * (2 * halfSine * halfSine);
|
|
125
|
+
run = radial * Math.sin(theta);
|
|
126
|
+
}
|
|
127
|
+
if (!Number.isFinite(rise) || !Number.isFinite(run) || run <= 0)
|
|
128
|
+
throw new RangeError('Regional viewshed sight calculation overflow');
|
|
129
|
+
return [rise, run];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const observerSample = {...read(observer[0], observer[1])};
|
|
133
|
+
const observerValid = observerSample.status === TerrainSampleStatus.VALID;
|
|
134
|
+
for (let i = 0; i < count; i++) {
|
|
135
|
+
const x = origin[0] + (i % width) * spacing[0];
|
|
136
|
+
const y = origin[1] + Math.floor(i / width) * spacing[1];
|
|
137
|
+
const dx = x - observer[0];
|
|
138
|
+
const dy = y - observer[1];
|
|
139
|
+
const distance = Math.hypot(dx, dy);
|
|
140
|
+
if (!Number.isFinite(distance) || (radius !== undefined && distance / radius >= Math.PI))
|
|
141
|
+
throw new RangeError('Regional viewshed distance outside supported range');
|
|
142
|
+
const target = distance === 0 ? observerSample : read(x, y);
|
|
143
|
+
targetStatuses[i] = target.status;
|
|
144
|
+
if (target.status !== TerrainSampleStatus.VALID) {
|
|
145
|
+
statuses[i] = TerrainRegionalViewStatus.MISSING_TARGET;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (distance === 0) {
|
|
149
|
+
statuses[i] = TerrainRegionalViewStatus.OBSERVER;
|
|
150
|
+
sampledCoverage[i] = 1;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const [targetRise, targetRun] = sight(distance, target.height + targetOffset);
|
|
154
|
+
const segments = Math.max(1, Math.ceil(distance / sampleStep));
|
|
155
|
+
if (!Number.isSafeInteger(segments) || segments - 1 > maxSamples - samples)
|
|
156
|
+
throw new RangeError('Regional viewshed sample budget exceeded');
|
|
157
|
+
let complete = observerValid;
|
|
158
|
+
let blocked = observerValid && observerSample.height > observer[2];
|
|
159
|
+
for (let j = 1; j < segments; j++) {
|
|
160
|
+
const fraction = j / segments;
|
|
161
|
+
const station = read(observer[0] + dx * fraction, observer[1] + dy * fraction);
|
|
162
|
+
if (station.status !== TerrainSampleStatus.VALID) {
|
|
163
|
+
complete = false;
|
|
164
|
+
} else if (!blocked) {
|
|
165
|
+
const [rise, run] = sight(distance * fraction, station.height);
|
|
166
|
+
blocked = compareTerrainSlopes(rise, run, targetRise, targetRun) >= 0;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
sampledCoverage[i] = complete ? 1 : 0;
|
|
170
|
+
statuses[i] = blocked
|
|
171
|
+
? TerrainRegionalViewStatus.BLOCKED
|
|
172
|
+
: complete
|
|
173
|
+
? TerrainRegionalViewStatus.VISIBLE
|
|
174
|
+
: TerrainRegionalViewStatus.UNKNOWN;
|
|
175
|
+
}
|
|
176
|
+
return {statuses, targetStatuses, sampledCoverage, samples};
|
|
177
|
+
}
|
package/src/terrain/surface.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
BoxIndex,
|
|
8
8
|
type IndexQueryBudget,
|
|
9
9
|
type IndexQueryResult
|
|
10
|
-
} from '@math.gl/geometry';
|
|
10
|
+
} from '@math.gl/geometry/spatial-index';
|
|
11
11
|
import type {HeightField} from './height-field';
|
|
12
12
|
import {createTerrainMesh} from './mesh';
|
|
13
13
|
import {TerrainSampleStatus as Status, type TerrainSample} from './types';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {TerrainSegmentHit, TerrainSurface} from './surface';
|
|
6
|
+
import type {TerrainSphereSweepOptions} from './sweep-sphere';
|
|
7
|
+
|
|
8
|
+
type Point = readonly [number, number, number];
|
|
9
|
+
|
|
10
|
+
export type TerrainCapsuleSweepResult =
|
|
11
|
+
| {status: 'miss' | 'incomplete'; work: number}
|
|
12
|
+
| {
|
|
13
|
+
status: 'hit';
|
|
14
|
+
work: number;
|
|
15
|
+
fraction: number;
|
|
16
|
+
lowerFraction: number;
|
|
17
|
+
contact: TerrainSegmentHit;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Bracket the first contact of a translating capsule against the active triangle sheet.
|
|
22
|
+
* The axis direction and length stay fixed. Clearance changes by at most the distance
|
|
23
|
+
* traveled. Intervals that cannot be separated within the tolerance return incomplete
|
|
24
|
+
* when no contact witness is available, including unresolved tangencies.
|
|
25
|
+
*/
|
|
26
|
+
export function sweepTerrainCapsule(
|
|
27
|
+
surface: Pick<TerrainSurface, 'nearestSegmentQuery'>,
|
|
28
|
+
start: Point,
|
|
29
|
+
end: Point,
|
|
30
|
+
translation: Point,
|
|
31
|
+
radius: number,
|
|
32
|
+
{fractionTolerance = 1e-6, maxWork = 100_000}: TerrainSphereSweepOptions = {}
|
|
33
|
+
): TerrainCapsuleSweepResult {
|
|
34
|
+
const speed = Math.hypot(...translation);
|
|
35
|
+
if (
|
|
36
|
+
![start, end, translation].every(point => point.length === 3 && point.every(Number.isFinite)) ||
|
|
37
|
+
!Number.isFinite(speed) ||
|
|
38
|
+
!Number.isFinite(radius) ||
|
|
39
|
+
radius < 0 ||
|
|
40
|
+
!(fractionTolerance >= Number.EPSILON && fractionTolerance <= 1) ||
|
|
41
|
+
!Number.isSafeInteger(maxWork) ||
|
|
42
|
+
maxWork < 0
|
|
43
|
+
)
|
|
44
|
+
throw new RangeError('Invalid terrain capsule sweep');
|
|
45
|
+
|
|
46
|
+
let work = 0;
|
|
47
|
+
const probe = (fraction: number) => {
|
|
48
|
+
if (work >= maxWork) return null;
|
|
49
|
+
// Count the probe itself even if the index is empty.
|
|
50
|
+
work++;
|
|
51
|
+
const move = (point: Point): Point => [
|
|
52
|
+
point[0] + translation[0] * fraction,
|
|
53
|
+
point[1] + translation[1] * fraction,
|
|
54
|
+
point[2] + translation[2] * fraction
|
|
55
|
+
];
|
|
56
|
+
const query = surface.nearestSegmentQuery(move(start), move(end), {maxWork: maxWork - work});
|
|
57
|
+
work += query.work;
|
|
58
|
+
return query;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const initial = probe(0);
|
|
62
|
+
if (initial?.result && initial.result.distance <= radius)
|
|
63
|
+
return {status: 'hit', work, fraction: 0, lowerFraction: 0, contact: initial.result};
|
|
64
|
+
if (!initial?.complete) return {status: 'incomplete', work};
|
|
65
|
+
if (!initial.result || speed === 0) return {status: 'miss', work};
|
|
66
|
+
|
|
67
|
+
let clearUntil = 0;
|
|
68
|
+
let witness: {fraction: number; contact: TerrainSegmentHit} | undefined;
|
|
69
|
+
const pending: [number, number][] = [[0, 1]];
|
|
70
|
+
while (pending.length) {
|
|
71
|
+
const [lower, upper] = pending.pop()!;
|
|
72
|
+
if (witness && witness.fraction - clearUntil <= fractionTolerance)
|
|
73
|
+
return {status: 'hit', work, lowerFraction: clearUntil, ...witness};
|
|
74
|
+
const middle = lower + (upper - lower) / 2;
|
|
75
|
+
const query = probe(middle);
|
|
76
|
+
if (!query) return {status: 'incomplete', work};
|
|
77
|
+
const hit = query.result;
|
|
78
|
+
if (hit && hit.distance <= radius) {
|
|
79
|
+
witness = {fraction: middle, contact: hit};
|
|
80
|
+
if (middle - clearUntil <= fractionTolerance)
|
|
81
|
+
return {status: 'hit', work, lowerFraction: clearUntil, ...witness};
|
|
82
|
+
pending.push([lower, middle]);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (!query.complete) return {status: 'incomplete', work};
|
|
86
|
+
const travel = speed * Math.max(middle - lower, upper - middle);
|
|
87
|
+
const allowance = 8 * Number.EPSILON * Math.max(hit?.distance ?? 0, radius, travel);
|
|
88
|
+
if (!hit || hit.distance - radius > travel + allowance) {
|
|
89
|
+
clearUntil = upper;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (upper - lower <= fractionTolerance) {
|
|
93
|
+
// Check the right endpoint for impacts at the end of motion.
|
|
94
|
+
const final = probe(upper)?.result;
|
|
95
|
+
if (final && final.distance <= radius && upper - clearUntil <= fractionTolerance)
|
|
96
|
+
return {status: 'hit', work, fraction: upper, lowerFraction: clearUntil, contact: final};
|
|
97
|
+
return {status: 'incomplete', work};
|
|
98
|
+
}
|
|
99
|
+
pending.push([middle, upper], [lower, middle]);
|
|
100
|
+
}
|
|
101
|
+
return witness
|
|
102
|
+
? {status: 'hit', work, lowerFraction: clearUntil, ...witness}
|
|
103
|
+
: {status: 'miss', work};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Bracket the impact of the convex hull of two endpoint spheres with potentially
|
|
108
|
+
* different radii. Constant-radius inner and outer capsules bound the hull.
|
|
109
|
+
*/
|
|
110
|
+
export function sweepTerrainTaperedCapsule(
|
|
111
|
+
surface: Pick<TerrainSurface, 'nearestSegmentQuery'>,
|
|
112
|
+
start: Point,
|
|
113
|
+
end: Point,
|
|
114
|
+
translation: Point,
|
|
115
|
+
radiusStart: number,
|
|
116
|
+
radiusEnd: number,
|
|
117
|
+
{maxWork = 100_000, fractionTolerance}: TerrainSphereSweepOptions = {}
|
|
118
|
+
): TerrainCapsuleSweepResult {
|
|
119
|
+
if (![radiusStart, radiusEnd].every(radius => Number.isFinite(radius) && radius >= 0))
|
|
120
|
+
throw new RangeError('Invalid terrain tapered capsule radii');
|
|
121
|
+
const outer = sweepTerrainCapsule(
|
|
122
|
+
surface,
|
|
123
|
+
start,
|
|
124
|
+
end,
|
|
125
|
+
translation,
|
|
126
|
+
Math.max(radiusStart, radiusEnd),
|
|
127
|
+
{
|
|
128
|
+
maxWork,
|
|
129
|
+
fractionTolerance
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
if (outer.status !== 'hit' || radiusStart === radiusEnd) return outer;
|
|
133
|
+
const inner = sweepTerrainCapsule(
|
|
134
|
+
surface,
|
|
135
|
+
start,
|
|
136
|
+
end,
|
|
137
|
+
translation,
|
|
138
|
+
Math.min(radiusStart, radiusEnd),
|
|
139
|
+
{
|
|
140
|
+
maxWork: maxWork - outer.work,
|
|
141
|
+
fractionTolerance
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
const work = outer.work + inner.work;
|
|
145
|
+
return inner.status === 'hit' && outer.lowerFraction <= inner.fraction
|
|
146
|
+
? {...inner, lowerFraction: outer.lowerFraction, work}
|
|
147
|
+
: {status: 'incomplete', work};
|
|
148
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {sweepTerrainPolytope, type TerrainPolytopeSweepResult} from './sweep-polytope';
|
|
6
|
+
import type {TerrainSurface} from './surface';
|
|
7
|
+
|
|
8
|
+
type Point = readonly [number, number, number];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Sweep a fixed +Z cylinder or conical frustum. Inscribed and circumscribed
|
|
12
|
+
* polygonal bounds bracket contact. A hit reports the inner witness and a
|
|
13
|
+
* conservative outer lower fraction. An outer-only contact is incomplete.
|
|
14
|
+
*/
|
|
15
|
+
export function sweepTerrainCylinder(
|
|
16
|
+
surface: Pick<TerrainSurface, 'copyData' | 'origin'>,
|
|
17
|
+
center: Point,
|
|
18
|
+
height: number,
|
|
19
|
+
radiusBottom: number,
|
|
20
|
+
radiusTop: number,
|
|
21
|
+
translation: Point,
|
|
22
|
+
{sides = 16, maxWork = 100_000}: {sides?: number; maxWork?: number} = {}
|
|
23
|
+
): TerrainPolytopeSweepResult & {lowerFraction?: number} {
|
|
24
|
+
if (
|
|
25
|
+
center.length !== 3 ||
|
|
26
|
+
!center.every(Number.isFinite) ||
|
|
27
|
+
![height, radiusBottom, radiusTop].every(value => Number.isFinite(value) && value > 0) ||
|
|
28
|
+
!Number.isInteger(sides) ||
|
|
29
|
+
sides < 3 ||
|
|
30
|
+
sides > 128
|
|
31
|
+
)
|
|
32
|
+
throw new RangeError('Invalid terrain cylinder sweep');
|
|
33
|
+
const faces: [number, number, number][] = [];
|
|
34
|
+
for (let i = 0; i < sides; i++) {
|
|
35
|
+
const next = (i + 1) % sides;
|
|
36
|
+
faces.push([i, next, next + sides], [i, next + sides, i + sides]);
|
|
37
|
+
if (i > 0 && i < sides - 1) faces.push([0, i + 1, i], [sides, sides + i, sides + i + 1]);
|
|
38
|
+
}
|
|
39
|
+
const hull = (scale: number) => ({
|
|
40
|
+
faces,
|
|
41
|
+
vertices: Array.from({length: 2 * sides}, (_, i): Point => {
|
|
42
|
+
const top = i >= sides;
|
|
43
|
+
const angle = (2 * Math.PI * (i % sides)) / sides;
|
|
44
|
+
const radius = (top ? radiusTop : radiusBottom) * scale;
|
|
45
|
+
return [
|
|
46
|
+
center[0] + radius * Math.cos(angle),
|
|
47
|
+
center[1] + radius * Math.sin(angle),
|
|
48
|
+
center[2] + (top ? height : -height) / 2
|
|
49
|
+
];
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
const outer = sweepTerrainPolytope(surface, hull(1 / Math.cos(Math.PI / sides)), translation, {
|
|
53
|
+
maxWork
|
|
54
|
+
});
|
|
55
|
+
if (outer.status !== 'hit') return outer;
|
|
56
|
+
const inner = sweepTerrainPolytope(surface, hull(1), translation, {
|
|
57
|
+
maxWork: maxWork - outer.work
|
|
58
|
+
});
|
|
59
|
+
const work = outer.work + inner.work;
|
|
60
|
+
if (inner.status !== 'hit' || inner.fraction < outer.fraction)
|
|
61
|
+
return {status: 'incomplete', work};
|
|
62
|
+
// A polygonal witness does not establish the smooth cylinder's entry normal.
|
|
63
|
+
return {...inner, normal: null, lowerFraction: outer.fraction, work};
|
|
64
|
+
}
|