@math.gl/geospatial 5.0.0-beta.8 → 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 +3773 -846
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +173 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -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 +1266 -155
- package/dist/tasks/index.cjs.map +3 -3
- package/dist/tasks/index.d.ts +12 -0
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +26 -0
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/terrain-coverage-worker.d.ts +2 -0
- package/dist/tasks/terrain-coverage-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage-worker.js +7 -0
- package/dist/tasks/terrain-coverage-worker.js.map +1 -0
- package/dist/tasks/terrain-coverage.d.ts +25 -0
- package/dist/tasks/terrain-coverage.d.ts.map +1 -0
- package/dist/tasks/terrain-coverage.js +15 -0
- package/dist/tasks/terrain-coverage.js.map +1 -0
- package/dist/tasks/terrain-residency-worker.d.ts +2 -0
- package/dist/tasks/terrain-residency-worker.d.ts.map +1 -0
- package/dist/tasks/terrain-residency-worker.js +7 -0
- package/dist/tasks/terrain-residency-worker.js.map +1 -0
- package/dist/tasks/terrain-residency.d.ts +73 -0
- package/dist/tasks/terrain-residency.d.ts.map +1 -0
- package/dist/tasks/terrain-residency.js +203 -0
- package/dist/tasks/terrain-residency.js.map +1 -0
- package/dist/terrain/breakline-mesh.d.ts +18 -0
- package/dist/terrain/breakline-mesh.d.ts.map +1 -0
- package/dist/terrain/breakline-mesh.js +126 -0
- package/dist/terrain/breakline-mesh.js.map +1 -0
- package/dist/terrain/breakline-preprocess.d.ts +11 -0
- package/dist/terrain/breakline-preprocess.d.ts.map +1 -0
- package/dist/terrain/breakline-preprocess.js +94 -0
- package/dist/terrain/breakline-preprocess.js.map +1 -0
- package/dist/terrain/continuous-mesh-error.d.ts +34 -0
- package/dist/terrain/continuous-mesh-error.d.ts.map +1 -0
- package/dist/terrain/continuous-mesh-error.js +221 -0
- package/dist/terrain/continuous-mesh-error.js.map +1 -0
- 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/geographic-seam.d.ts +21 -0
- package/dist/terrain/geographic-seam.d.ts.map +1 -0
- package/dist/terrain/geographic-seam.js +52 -0
- package/dist/terrain/geographic-seam.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 +3158 -213
- package/dist/terrain/index.cjs.map +3 -3
- package/dist/terrain/index.d.ts +32 -0
- package/dist/terrain/index.d.ts.map +1 -1
- package/dist/terrain/index.js +30 -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 +48 -0
- package/dist/terrain/lod-select.d.ts.map +1 -0
- package/dist/terrain/lod-select.js +73 -0
- package/dist/terrain/lod-select.js.map +1 -0
- package/dist/terrain/lod-stitch.d.ts +15 -0
- package/dist/terrain/lod-stitch.d.ts.map +1 -0
- package/dist/terrain/lod-stitch.js +64 -0
- package/dist/terrain/lod-stitch.js.map +1 -0
- package/dist/terrain/mesh-coverage.d.ts +35 -0
- package/dist/terrain/mesh-coverage.d.ts.map +1 -0
- package/dist/terrain/mesh-coverage.js +186 -0
- package/dist/terrain/mesh-coverage.js.map +1 -0
- 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-regions-data.d.ts +2 -2
- package/dist/terrain/mesh-regions-data.d.ts.map +1 -1
- package/dist/terrain/mesh-regions-data.js +20 -10
- package/dist/terrain/mesh-regions-data.js.map +1 -1
- 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 +138 -26
- package/dist/terrain/mixed-halo-update.js.map +1 -1
- package/dist/terrain/mixed-vertex-halos.d.ts +34 -1
- package/dist/terrain/mixed-vertex-halos.d.ts.map +1 -1
- package/dist/terrain/mixed-vertex-halos.js +98 -43
- 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/valid-domain-mesh.d.ts +29 -0
- package/dist/terrain/valid-domain-mesh.d.ts.map +1 -0
- package/dist/terrain/valid-domain-mesh.js +183 -0
- package/dist/terrain/valid-domain-mesh.js.map +1 -0
- package/dist/terrain/valid-domain-regions.d.ts +16 -0
- package/dist/terrain/valid-domain-regions.d.ts.map +1 -0
- package/dist/terrain/valid-domain-regions.js +19 -0
- package/dist/terrain/valid-domain-regions.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 +35 -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 +314 -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/index.ts +34 -0
- package/src/tasks/terrain-coverage-worker.ts +6 -0
- package/src/tasks/terrain-coverage.ts +25 -0
- package/src/tasks/terrain-residency-worker.ts +6 -0
- package/src/tasks/terrain-residency.ts +250 -0
- package/src/terrain/breakline-mesh.ts +164 -0
- package/src/terrain/breakline-preprocess.ts +106 -0
- package/src/terrain/cdt2d.d.ts +10 -0
- package/src/terrain/continuous-mesh-error.ts +321 -0
- 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/geographic-seam.ts +73 -0
- package/src/terrain/hydrology.ts +149 -0
- package/src/terrain/index.ts +160 -0
- package/src/terrain/lod-screen-error.ts +128 -0
- package/src/terrain/lod-select.ts +129 -0
- package/src/terrain/lod-stitch.ts +88 -0
- package/src/terrain/mesh-coverage.ts +215 -0
- package/src/terrain/mesh-cutout.ts +420 -0
- package/src/terrain/mesh-regions-data.ts +21 -13
- package/src/terrain/mesh-skirts.ts +10 -7
- package/src/terrain/mixed-halo-update.ts +147 -25
- package/src/terrain/mixed-vertex-halos.ts +125 -55
- 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/valid-domain-mesh.ts +221 -0
- package/src/terrain/valid-domain-regions.ts +41 -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,125 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {HeightField} from './height-field';
|
|
6
|
+
|
|
7
|
+
/** Outlet and allocation policy for four-neighbor terrain conditioning. */
|
|
8
|
+
export type TerrainDepressionFillOptions = {
|
|
9
|
+
/** Valid row-major cell indices that can drain. Exterior and nodata are closed. */
|
|
10
|
+
outlets: readonly number[];
|
|
11
|
+
/** Maximum grid cells before allocating buffers. Defaults to 4,194,304. */
|
|
12
|
+
maxCells?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** Conditioned terrain and its outlet-connected drainage forest. */
|
|
16
|
+
export type TerrainDepressionFill = {
|
|
17
|
+
/** Derived field, including the original heights of outlet-disconnected cells. */
|
|
18
|
+
field: HeightField;
|
|
19
|
+
/** Next face neighbor toward an outlet, -1 at outlets, -2 for nodata or disconnected cells. */
|
|
20
|
+
receiver: Int32Array;
|
|
21
|
+
/** Number of valid cells with no face-connected path to an outlet. */
|
|
22
|
+
disconnectedCells: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Raise each outlet-connected cell to the lowest spill elevation needed to reach
|
|
27
|
+
* a declared outlet by face neighbors. The returned forest routes across flats.
|
|
28
|
+
* Nodata blocks flow and disconnected components retain their source heights.
|
|
29
|
+
* The source is immutable. Time is O(cells log cells) and storage is O(cells).
|
|
30
|
+
*/
|
|
31
|
+
export function fillTerrainDepressions(
|
|
32
|
+
field: HeightField,
|
|
33
|
+
{outlets, maxCells = 4_194_304}: TerrainDepressionFillOptions
|
|
34
|
+
): TerrainDepressionFill {
|
|
35
|
+
if (field.registration !== 'cell')
|
|
36
|
+
throw new Error('Terrain depression fill requires cell registration');
|
|
37
|
+
const {width, height} = field;
|
|
38
|
+
const count = width * height;
|
|
39
|
+
if (!Number.isSafeInteger(maxCells) || maxCells < 0 || count > maxCells || count > 0x7fffffff)
|
|
40
|
+
throw new RangeError('Terrain depression fill exceeds its cell budget');
|
|
41
|
+
if (!outlets.length) throw new RangeError('Terrain depression fill requires an outlet');
|
|
42
|
+
for (const i of outlets) {
|
|
43
|
+
if (
|
|
44
|
+
!Number.isInteger(i) ||
|
|
45
|
+
i < 0 ||
|
|
46
|
+
i >= count ||
|
|
47
|
+
field.getHeight(i % width, Math.floor(i / width)) === undefined
|
|
48
|
+
)
|
|
49
|
+
throw new RangeError('Terrain outlet must identify a valid cell');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const {heights, validity} = field.copyData();
|
|
53
|
+
const receiver = new Int32Array(count).fill(-2);
|
|
54
|
+
const heap = new Int32Array(count);
|
|
55
|
+
let size = 0;
|
|
56
|
+
let disconnectedCells = field.validCount;
|
|
57
|
+
|
|
58
|
+
/** Sort by spill elevation, then by cell index for reproducible flat routing. */
|
|
59
|
+
const before = (a: number, b: number) =>
|
|
60
|
+
heights[a] < heights[b] || (heights[a] === heights[b] && a < b);
|
|
61
|
+
|
|
62
|
+
/** Insert a newly reached cell. Its finalized spill height never changes. */
|
|
63
|
+
function push(cell: number): void {
|
|
64
|
+
let slot = size++;
|
|
65
|
+
while (slot > 0) {
|
|
66
|
+
const parent = Math.floor((slot - 1) / 2);
|
|
67
|
+
if (!before(cell, heap[parent])) break;
|
|
68
|
+
heap[slot] = heap[parent];
|
|
69
|
+
slot = parent;
|
|
70
|
+
}
|
|
71
|
+
heap[slot] = cell;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Remove the cell with the lowest known spill elevation. */
|
|
75
|
+
function pop(): number {
|
|
76
|
+
const first = heap[0];
|
|
77
|
+
const tail = heap[--size];
|
|
78
|
+
let slot = 0;
|
|
79
|
+
let child = 1;
|
|
80
|
+
while (child < size) {
|
|
81
|
+
if (child + 1 < size && before(heap[child + 1], heap[child])) child++;
|
|
82
|
+
if (!before(heap[child], tail)) break;
|
|
83
|
+
heap[slot] = heap[child];
|
|
84
|
+
slot = child;
|
|
85
|
+
child = slot * 2 + 1;
|
|
86
|
+
}
|
|
87
|
+
if (size) heap[slot] = tail;
|
|
88
|
+
return first;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** First discovery from the minimum frontier finalizes the minimax path cost. */
|
|
92
|
+
function visit(cell: number, parent: number): void {
|
|
93
|
+
if (!validity[cell] || receiver[cell] !== -2) return;
|
|
94
|
+
receiver[cell] = parent;
|
|
95
|
+
disconnectedCells--;
|
|
96
|
+
if (parent >= 0) heights[cell] = Math.max(heights[cell], heights[parent]);
|
|
97
|
+
push(cell);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const outlet of outlets) visit(outlet, -1);
|
|
101
|
+
while (size) {
|
|
102
|
+
const cell = pop();
|
|
103
|
+
const column = cell % width;
|
|
104
|
+
if (column > 0) visit(cell - 1, cell);
|
|
105
|
+
if (column + 1 < width) visit(cell + 1, cell);
|
|
106
|
+
if (cell >= width) visit(cell - width, cell);
|
|
107
|
+
if (cell < count - width) visit(cell + width, cell);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
field: new HeightField({
|
|
111
|
+
width,
|
|
112
|
+
height,
|
|
113
|
+
heights,
|
|
114
|
+
validity,
|
|
115
|
+
origin: field.origin,
|
|
116
|
+
columnStep: field.columnStep,
|
|
117
|
+
rowStep: field.rowStep,
|
|
118
|
+
registration: field.registration,
|
|
119
|
+
diagonal: field.diagonal,
|
|
120
|
+
heightReference: field.heightReference
|
|
121
|
+
}),
|
|
122
|
+
receiver,
|
|
123
|
+
disconnectedCells
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** A spherical gnomonic chart with terrain height retained as the third ordinate. */
|
|
6
|
+
export type GeographicTerrainCutoutFrame = {
|
|
7
|
+
/** Central longitude/latitude in degrees. Longitude is normalized to [-180,180). */
|
|
8
|
+
center: readonly [number, number];
|
|
9
|
+
/** Sphere radius in meters; default WGS84 semi-major axis (6378137). */
|
|
10
|
+
radius: number;
|
|
11
|
+
/** Maximum angular distance from the center in degrees; must be below 90. */
|
|
12
|
+
maxAngularRadius: number;
|
|
13
|
+
};
|
|
14
|
+
/** Explicit chart choice for regional terrain cutting. */
|
|
15
|
+
export type GeographicTerrainCutoutFrameOptions = {
|
|
16
|
+
/** Center longitude/latitude in degrees; polar centers are supported. */
|
|
17
|
+
center: readonly [number, number];
|
|
18
|
+
/** Spherical radius in meters. This is not an ellipsoidal distance certificate. */
|
|
19
|
+
radius?: number;
|
|
20
|
+
/** Angular cap in degrees, default 30; positive and at most 80. */
|
|
21
|
+
maxAngularRadius?: number;
|
|
22
|
+
};
|
|
23
|
+
/** Degrees to radians. */
|
|
24
|
+
const RAD = Math.PI / 180;
|
|
25
|
+
|
|
26
|
+
/** Create a bounded chart that has no antimeridian cut and supports either pole.
|
|
27
|
+
* Great-circle segments project to straight lines. Mesh connectivity must
|
|
28
|
+
* already describe the intended local surface (polar fans rather than duplicate
|
|
29
|
+
* pole rows). Heights retain their input datum; Z is not ECEF or tangent-plane up.
|
|
30
|
+
*/
|
|
31
|
+
export function createGeographicTerrainCutoutFrame(
|
|
32
|
+
options: GeographicTerrainCutoutFrameOptions
|
|
33
|
+
): GeographicTerrainCutoutFrame {
|
|
34
|
+
if (options.center.length !== 2) throw new RangeError('Invalid geographic terrain cutout center');
|
|
35
|
+
const frame = {
|
|
36
|
+
center: [wrap(options.center[0]), options.center[1]] as const,
|
|
37
|
+
radius: options.radius ?? 6378137,
|
|
38
|
+
maxAngularRadius: options.maxAngularRadius ?? 30
|
|
39
|
+
};
|
|
40
|
+
validateFrame(frame);
|
|
41
|
+
return Object.freeze({...frame, center: Object.freeze(frame.center)});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Project packed longitude/latitude/height to chart X/Y/height in Float64.
|
|
45
|
+
* Longitude aliases are normalized relative to the chart center. Vertices at
|
|
46
|
+
* the same pole project identically regardless of longitude. No connectivity,
|
|
47
|
+
* height filling, edge densification or geographic winding repair is performed.
|
|
48
|
+
* Triangle edges and cut edges mean straight segments in this chart (minor
|
|
49
|
+
* great-circle arcs horizontally); interpolate terrain height in chart space.
|
|
50
|
+
*/
|
|
51
|
+
export function projectGeographicTerrainCutout(
|
|
52
|
+
positions: Float32Array | Float64Array,
|
|
53
|
+
frame: GeographicTerrainCutoutFrame
|
|
54
|
+
): Float64Array {
|
|
55
|
+
validateFrame(frame);
|
|
56
|
+
validatePositions(positions);
|
|
57
|
+
const result = new Float64Array(positions.length);
|
|
58
|
+
const [sin0, cos0] = latitude(frame.center[1]);
|
|
59
|
+
const maximum = chartLimit(frame);
|
|
60
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
61
|
+
const lon = positions[i],
|
|
62
|
+
lat = positions[i + 1];
|
|
63
|
+
if (lat < -90 || lat > 90) throw new RangeError('Invalid geographic terrain latitude');
|
|
64
|
+
const sin = Math.sin(lat * RAD);
|
|
65
|
+
const cos = Math.abs(lat) === 90 ? 0 : Math.cos(lat * RAD);
|
|
66
|
+
const delta = wrap(wrap(lon) - frame.center[0]) * RAD;
|
|
67
|
+
const dot = sin0 * sin + cos0 * cos * Math.cos(delta);
|
|
68
|
+
const x = (cos * Math.sin(delta)) / dot;
|
|
69
|
+
const y = (cos0 * sin - sin0 * cos * Math.cos(delta)) / dot;
|
|
70
|
+
if (!(dot > 0) || Math.hypot(x, y) > maximum)
|
|
71
|
+
throw new RangeError('Terrain coordinate exceeds geographic cutout chart');
|
|
72
|
+
result[i] = frame.radius * x;
|
|
73
|
+
result[i + 1] = frame.radius * y;
|
|
74
|
+
result[i] ||= 0;
|
|
75
|
+
result[i + 1] ||= 0;
|
|
76
|
+
result[i + 2] = positions[i + 2];
|
|
77
|
+
}
|
|
78
|
+
if (!result.every(Number.isFinite))
|
|
79
|
+
throw new RangeError('Geographic terrain projection overflow');
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Invert chart X/Y/height to canonical longitude/latitude/height.
|
|
84
|
+
* Points outside the declared cap are rejected. At the exact pole, longitude
|
|
85
|
+
* is the chart center's longitude. Height and vertical datum are unchanged.
|
|
86
|
+
*/
|
|
87
|
+
export function unprojectGeographicTerrainCutout(
|
|
88
|
+
positions: Float32Array | Float64Array,
|
|
89
|
+
frame: GeographicTerrainCutoutFrame
|
|
90
|
+
): Float64Array {
|
|
91
|
+
validateFrame(frame);
|
|
92
|
+
validatePositions(positions);
|
|
93
|
+
const result = new Float64Array(positions.length);
|
|
94
|
+
const [sin0, cos0] = latitude(frame.center[1]);
|
|
95
|
+
const maximum = chartLimit(frame);
|
|
96
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
97
|
+
const x = positions[i] / frame.radius,
|
|
98
|
+
y = positions[i + 1] / frame.radius;
|
|
99
|
+
const distance = Math.hypot(x, y);
|
|
100
|
+
if (!Number.isFinite(distance) || distance > maximum)
|
|
101
|
+
throw new RangeError('Terrain coordinate exceeds geographic cutout chart');
|
|
102
|
+
const horizontal = cos0 - y * sin0;
|
|
103
|
+
const vertical = sin0 + y * cos0;
|
|
104
|
+
const lat = Math.atan2(vertical, Math.hypot(horizontal, x)) / RAD;
|
|
105
|
+
result[i] =
|
|
106
|
+
Math.abs(lat) === 90
|
|
107
|
+
? frame.center[0]
|
|
108
|
+
: wrap(frame.center[0] + Math.atan2(x, horizontal) / RAD);
|
|
109
|
+
result[i + 1] = lat;
|
|
110
|
+
result[i + 2] = positions[i + 2];
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Normalize aliases before subtraction to avoid overflow and inconsistent seams. */
|
|
116
|
+
function wrap(longitude: number) {
|
|
117
|
+
const result = longitude % 360;
|
|
118
|
+
return result >= 180 ? result - 360 : result < -180 ? result + 360 : result;
|
|
119
|
+
}
|
|
120
|
+
/** Exact pole cosines prevent longitude-dependent roundoff at the poles. */
|
|
121
|
+
function latitude(degrees: number): readonly [number, number] {
|
|
122
|
+
return [Math.sin(degrees * RAD), Math.abs(degrees) === 90 ? 0 : Math.cos(degrees * RAD)];
|
|
123
|
+
}
|
|
124
|
+
/** Validate frames even when callers supply a structural object. */
|
|
125
|
+
function validateFrame(frame: GeographicTerrainCutoutFrame) {
|
|
126
|
+
if (
|
|
127
|
+
frame.center.length !== 2 ||
|
|
128
|
+
!frame.center.every(Number.isFinite) ||
|
|
129
|
+
frame.center[0] < -180 ||
|
|
130
|
+
frame.center[0] >= 180 ||
|
|
131
|
+
Math.abs(frame.center[1]) > 90 ||
|
|
132
|
+
!Number.isFinite(frame.radius) ||
|
|
133
|
+
frame.radius <= 0 ||
|
|
134
|
+
!Number.isFinite(frame.maxAngularRadius) ||
|
|
135
|
+
frame.maxAngularRadius <= 0 ||
|
|
136
|
+
frame.maxAngularRadius > 80
|
|
137
|
+
)
|
|
138
|
+
throw new RangeError('Invalid geographic terrain cutout frame');
|
|
139
|
+
}
|
|
140
|
+
/** Reject malformed or nonfinite packed XYZ before allocating output. */
|
|
141
|
+
function validatePositions(positions: Float32Array | Float64Array) {
|
|
142
|
+
if (
|
|
143
|
+
!(positions instanceof Float32Array || positions instanceof Float64Array) ||
|
|
144
|
+
positions.length % 3 ||
|
|
145
|
+
!positions.every(Number.isFinite)
|
|
146
|
+
)
|
|
147
|
+
throw new RangeError('Invalid geographic terrain cutout positions');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Shared roundoff allowance for inclusive forward/inverse angular caps. */
|
|
151
|
+
function chartLimit(frame: GeographicTerrainCutoutFrame) {
|
|
152
|
+
const distance = Math.tan(frame.maxAngularRadius * RAD);
|
|
153
|
+
return distance + 16 * Number.EPSILON * (1 + distance);
|
|
154
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {getGeographicTileBounds, type GeographicTile} from '../geographic-tiles';
|
|
6
|
+
import type {TerrainLodSeam} from './lod-stitch';
|
|
7
|
+
|
|
8
|
+
type Side = {tile: number; start: number; end: number};
|
|
9
|
+
type Line = {before: Side[]; after: Side[]};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Find positive-length mixed-level seams in a nonoverlapping equal-angle resident cut.
|
|
13
|
+
* Seam indices address the cut in input order. Mesh columns must run west to east and
|
|
14
|
+
* rows north to south. For wrapped seams, mesh X must be longitude in degrees with
|
|
15
|
+
* the same scale on both sides. The coarser tile owns each span.
|
|
16
|
+
*/
|
|
17
|
+
export function discoverGeographicTerrainLodSeams(
|
|
18
|
+
cut: readonly GeographicTile[]
|
|
19
|
+
): TerrainLodSeam[] {
|
|
20
|
+
const vertical = new Map<number, Line>();
|
|
21
|
+
const horizontal = new Map<number, Line>();
|
|
22
|
+
const world = 2 ** 30;
|
|
23
|
+
const addresses = new Set<string>();
|
|
24
|
+
const key = (level: number, x: number, y: number) => `${level}/${x}/${y}`;
|
|
25
|
+
|
|
26
|
+
for (const tile of cut) {
|
|
27
|
+
getGeographicTileBounds(tile);
|
|
28
|
+
const address = key(tile.level, tile.x, tile.y);
|
|
29
|
+
if (addresses.has(address)) throw new Error('Duplicate geographic terrain tile');
|
|
30
|
+
addresses.add(address);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function add(lines: Map<number, Line>, line: number, side: keyof Line, span: Side) {
|
|
34
|
+
let group = lines.get(line);
|
|
35
|
+
if (!group) {
|
|
36
|
+
group = {before: [], after: []};
|
|
37
|
+
lines.set(line, group);
|
|
38
|
+
}
|
|
39
|
+
group[side].push(span);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
cut.forEach(({level, x, y}, tile) => {
|
|
43
|
+
for (let parent = level - 1; parent >= 0; parent--) {
|
|
44
|
+
const scale = 2 ** (level - parent);
|
|
45
|
+
if (addresses.has(key(parent, Math.floor(x / scale), Math.floor(y / scale))))
|
|
46
|
+
throw new Error('Overlapping geographic terrain tiles');
|
|
47
|
+
}
|
|
48
|
+
const size = 2 ** (30 - level);
|
|
49
|
+
const west = x * size;
|
|
50
|
+
const north = y * size;
|
|
51
|
+
const east = west + size;
|
|
52
|
+
const south = north + size;
|
|
53
|
+
add(vertical, west, 'after', {tile, start: north, end: south});
|
|
54
|
+
add(vertical, east % world, 'before', {tile, start: north, end: south});
|
|
55
|
+
if (north !== 0) add(horizontal, north, 'after', {tile, start: west, end: east});
|
|
56
|
+
if (south !== world) add(horizontal, south, 'before', {tile, start: west, end: east});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const seams: TerrainLodSeam[] = [];
|
|
60
|
+
function match(lines: Map<number, Line>, column: boolean) {
|
|
61
|
+
const beforeEdge = column ? 'maxColumn' : 'maxRow';
|
|
62
|
+
const afterEdge = column ? 'minColumn' : 'minRow';
|
|
63
|
+
const byStart = (a: Side, b: Side) => a.start - b.start;
|
|
64
|
+
for (const [line, {before, after}] of lines) {
|
|
65
|
+
before.sort(byStart);
|
|
66
|
+
after.sort(byStart);
|
|
67
|
+
let i = 0;
|
|
68
|
+
let j = 0;
|
|
69
|
+
while (i < before.length && j < after.length) {
|
|
70
|
+
const left = before[i];
|
|
71
|
+
const right = after[j];
|
|
72
|
+
const start = Math.max(left.start, right.start);
|
|
73
|
+
const end = Math.min(left.end, right.end);
|
|
74
|
+
const leftLevel = cut[left.tile].level;
|
|
75
|
+
const rightLevel = cut[right.tile].level;
|
|
76
|
+
if (end > start && leftLevel !== rightLevel) {
|
|
77
|
+
const leftOwns = leftLevel < rightLevel;
|
|
78
|
+
const coarse = leftOwns ? left : right;
|
|
79
|
+
seams.push({
|
|
80
|
+
a: coarse.tile,
|
|
81
|
+
edgeA: leftOwns ? beforeEdge : afterEdge,
|
|
82
|
+
b: leftOwns ? right.tile : left.tile,
|
|
83
|
+
edgeB: leftOwns ? afterEdge : beforeEdge,
|
|
84
|
+
...(column && line === 0 ? {offsetBX: leftOwns ? 360 : -360} : {}),
|
|
85
|
+
options: {
|
|
86
|
+
rangeA: [
|
|
87
|
+
(start - coarse.start) / (coarse.end - coarse.start),
|
|
88
|
+
(end - coarse.start) / (coarse.end - coarse.start)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (left.end <= right.end) i++;
|
|
94
|
+
if (right.end <= left.end) j++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
match(vertical, true);
|
|
99
|
+
match(horizontal, false);
|
|
100
|
+
const edges = ['minColumn', 'maxColumn', 'minRow', 'maxRow'];
|
|
101
|
+
return seams.sort(
|
|
102
|
+
(a, b) =>
|
|
103
|
+
cut[a.a].level - cut[b.a].level ||
|
|
104
|
+
cut[a.a].y - cut[b.a].y ||
|
|
105
|
+
cut[a.a].x - cut[b.a].x ||
|
|
106
|
+
edges.indexOf(a.edgeA) - edges.indexOf(b.edgeA) ||
|
|
107
|
+
a.options!.rangeA![0] - b.options!.rangeA![0]
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {getGeographicTileBounds, type GeographicTile} from '../geographic-tiles';
|
|
6
|
+
|
|
7
|
+
export type TerrainGeographicEdge = 'west' | 'east' | 'north' | 'south';
|
|
8
|
+
|
|
9
|
+
/** Describe a same-level equal-angle seam in canonical order. */
|
|
10
|
+
export type TerrainGeographicNeighbor = {
|
|
11
|
+
owner: GeographicTile;
|
|
12
|
+
ownerEdge: 'west' | 'north';
|
|
13
|
+
other: GeographicTile;
|
|
14
|
+
otherEdge: 'east' | 'south';
|
|
15
|
+
crossesAntimeridian: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Discover the seam adjoining a tile edge. The tile whose west or north edge
|
|
20
|
+
* touches the seam owns it, including the westernmost tile at the antimeridian.
|
|
21
|
+
* Polar edges have no edge-adjacent tile. A level-zero tile can adjoin itself
|
|
22
|
+
* across longitude, with distinct west and east edges.
|
|
23
|
+
*/
|
|
24
|
+
export function getGeographicTerrainNeighbor(
|
|
25
|
+
tile: GeographicTile,
|
|
26
|
+
edge: TerrainGeographicEdge
|
|
27
|
+
): TerrainGeographicNeighbor | null {
|
|
28
|
+
getGeographicTileBounds(tile);
|
|
29
|
+
const {x, y, level} = tile;
|
|
30
|
+
const size = 2 ** level;
|
|
31
|
+
switch (edge) {
|
|
32
|
+
case 'west':
|
|
33
|
+
case 'east': {
|
|
34
|
+
const ownerX = edge === 'west' ? x : (x + 1) % size;
|
|
35
|
+
return {
|
|
36
|
+
owner: {x: ownerX, y, level},
|
|
37
|
+
ownerEdge: 'west',
|
|
38
|
+
other: {x: (ownerX + size - 1) % size, y, level},
|
|
39
|
+
otherEdge: 'east',
|
|
40
|
+
crossesAntimeridian: ownerX === 0
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
case 'north':
|
|
44
|
+
case 'south': {
|
|
45
|
+
const ownerY = edge === 'north' ? y : y + 1;
|
|
46
|
+
if (ownerY === 0 || ownerY === size) return null;
|
|
47
|
+
return {
|
|
48
|
+
owner: {x, y: ownerY, level},
|
|
49
|
+
ownerEdge: 'north',
|
|
50
|
+
other: {x, y: ownerY - 1, level},
|
|
51
|
+
otherEdge: 'south',
|
|
52
|
+
crossesAntimeridian: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
throw new RangeError('Invalid geographic terrain edge');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {getGeographicTileBounds, type GeographicTile} from '../geographic-tiles';
|
|
6
|
+
|
|
7
|
+
export type TerrainPoleIncidence = {
|
|
8
|
+
/** Index into the resident cut. */
|
|
9
|
+
tile: number;
|
|
10
|
+
edge: 'north' | 'south';
|
|
11
|
+
/** Interval in [-180, 180], increasing eastward. */
|
|
12
|
+
longitude: readonly [west: number, east: number];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type TerrainPoleCoverage = {
|
|
16
|
+
latitude: 90 | -90;
|
|
17
|
+
incident: TerrainPoleIncidence[];
|
|
18
|
+
/** Uncovered angular sectors around the pole. */
|
|
19
|
+
gaps: (readonly [west: number, east: number])[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Describe how a resident equal-angle cut approaches each pole. Incident edges
|
|
24
|
+
* collapse to one geographic point per pole. Gaps describe angular residency,
|
|
25
|
+
* independent of sample validity or agreement at that point.
|
|
26
|
+
*/
|
|
27
|
+
export function discoverGeographicTerrainPoles(cut: readonly GeographicTile[]): {
|
|
28
|
+
north: TerrainPoleCoverage;
|
|
29
|
+
south: TerrainPoleCoverage;
|
|
30
|
+
} {
|
|
31
|
+
function collect(latitude: 90 | -90, edge: 'north' | 'south'): TerrainPoleCoverage {
|
|
32
|
+
const incident: TerrainPoleIncidence[] = [];
|
|
33
|
+
for (let tile = 0; tile < cut.length; tile++) {
|
|
34
|
+
const [west, south, east, north] = getGeographicTileBounds(cut[tile]);
|
|
35
|
+
if ((edge === 'north' ? north : south) === latitude)
|
|
36
|
+
incident.push({tile, edge, longitude: [west, east]});
|
|
37
|
+
}
|
|
38
|
+
incident.sort((a, b) => a.longitude[0] - b.longitude[0]);
|
|
39
|
+
const gaps: TerrainPoleCoverage['gaps'] = [];
|
|
40
|
+
let cursor = -180;
|
|
41
|
+
for (const {
|
|
42
|
+
longitude: [west, east]
|
|
43
|
+
} of incident) {
|
|
44
|
+
if (west < cursor) throw new Error('Overlapping geographic terrain pole sectors');
|
|
45
|
+
if (west > cursor) gaps.push([cursor, west]);
|
|
46
|
+
cursor = east;
|
|
47
|
+
}
|
|
48
|
+
if (cursor < 180) gaps.push([cursor, 180]);
|
|
49
|
+
return {latitude, incident, gaps};
|
|
50
|
+
}
|
|
51
|
+
return {north: collect(90, 'north'), south: collect(-90, 'south')};
|
|
52
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {GeographicHeightField} from './geographic';
|
|
6
|
+
import {TerrainSampleStatus, type TerrainSampleOptions} from './types';
|
|
7
|
+
|
|
8
|
+
export type TerrainGeographicProbe = readonly [longitude: number, latitude: number];
|
|
9
|
+
|
|
10
|
+
/** Map longitude to the first equivalent value in the unwrapped interval, if one exists.
|
|
11
|
+
* The western endpoint owns the alias when the interval covers a full turn.
|
|
12
|
+
*/
|
|
13
|
+
export function wrapTerrainLongitude(
|
|
14
|
+
longitude: number,
|
|
15
|
+
west: number,
|
|
16
|
+
east: number
|
|
17
|
+
): number | undefined {
|
|
18
|
+
if (![longitude, west, east].every(Number.isFinite) || east <= west || east - west > 360)
|
|
19
|
+
throw new Error('Invalid terrain longitude interval or query');
|
|
20
|
+
if (longitude >= west && longitude < east) return longitude;
|
|
21
|
+
// Reduce separately before subtracting to avoid overflow and preserve modulo information.
|
|
22
|
+
const delta = ((longitude % 360) - (west % 360)) % 360;
|
|
23
|
+
const offset = delta < 0 ? delta + 360 : delta;
|
|
24
|
+
const mapped = west + offset;
|
|
25
|
+
return mapped <= east ? mapped : undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Compare independent one-sided stencils at the same geographic position.
|
|
29
|
+
* Exact poles remain outside the terrain derivative domain. No reflection or extrapolation.
|
|
30
|
+
*/
|
|
31
|
+
export function measureGeographicTerrainSeam(
|
|
32
|
+
a: GeographicHeightField | null,
|
|
33
|
+
b: GeographicHeightField | null,
|
|
34
|
+
probes: readonly TerrainGeographicProbe[],
|
|
35
|
+
options: TerrainSampleOptions = {}
|
|
36
|
+
) {
|
|
37
|
+
if (a && b && a.heightReference !== b.heightReference)
|
|
38
|
+
throw new Error('Terrain seam height references differ');
|
|
39
|
+
const sample = (field: GeographicHeightField | null, longitude: number, latitude: number) => {
|
|
40
|
+
if (!field || !Number.isFinite(longitude)) return field?.sample(longitude, latitude, options);
|
|
41
|
+
const mapped = wrapTerrainLongitude(longitude, field.bounds[0], field.bounds[2]);
|
|
42
|
+
return field.sample(mapped ?? longitude, latitude, options);
|
|
43
|
+
};
|
|
44
|
+
return probes.map(([longitude, latitude]) => {
|
|
45
|
+
const left = sample(a, longitude, latitude);
|
|
46
|
+
const right = sample(b, longitude, latitude);
|
|
47
|
+
const valid =
|
|
48
|
+
left?.status === TerrainSampleStatus.VALID && right?.status === TerrainSampleStatus.VALID;
|
|
49
|
+
const derivatives =
|
|
50
|
+
left?.gradientStatus === TerrainSampleStatus.VALID &&
|
|
51
|
+
right?.gradientStatus === TerrainSampleStatus.VALID;
|
|
52
|
+
const normalAngle = derivatives
|
|
53
|
+
? Math.atan2(
|
|
54
|
+
Math.hypot(
|
|
55
|
+
left.normalY * right.normalZ - left.normalZ * right.normalY,
|
|
56
|
+
left.normalZ * right.normalX - left.normalX * right.normalZ,
|
|
57
|
+
left.normalX * right.normalY - left.normalY * right.normalX
|
|
58
|
+
),
|
|
59
|
+
left.normalX * right.normalX + left.normalY * right.normalY + left.normalZ * right.normalZ
|
|
60
|
+
)
|
|
61
|
+
: null;
|
|
62
|
+
return {
|
|
63
|
+
longitude,
|
|
64
|
+
latitude,
|
|
65
|
+
statusA: left?.status ?? TerrainSampleStatus.NOT_RESIDENT,
|
|
66
|
+
statusB: right?.status ?? TerrainSampleStatus.NOT_RESIDENT,
|
|
67
|
+
gradientStatusA: left?.gradientStatus ?? TerrainSampleStatus.NOT_RESIDENT,
|
|
68
|
+
gradientStatusB: right?.gradientStatus ?? TerrainSampleStatus.NOT_RESIDENT,
|
|
69
|
+
heightJump: valid ? Math.abs(left.height - right.height) : null,
|
|
70
|
+
normalAngle
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
}
|