@math.gl/geometry 5.0.0-alpha.9 → 5.0.0-beta.10
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/LICENSE +97 -49
- package/README.md +77 -1
- package/THIRD-PARTY-NOTICES.md +18 -0
- package/dist/color/color-lut-types.d.ts +16 -0
- package/dist/color/color-lut-types.d.ts.map +1 -0
- package/dist/color/color-lut-types.js +5 -0
- package/dist/color/color-lut-types.js.map +1 -0
- package/dist/color/index.cjs +132 -0
- package/dist/color/index.cjs.map +6 -0
- package/dist/color/index.d.ts +4 -0
- package/dist/color/index.d.ts.map +1 -0
- package/dist/color/index.js +5 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/sample-lut.d.ts +13 -0
- package/dist/color/sample-lut.d.ts.map +1 -0
- package/dist/color/sample-lut.js +132 -0
- package/dist/color/sample-lut.js.map +1 -0
- package/dist/culling/bounds.d.ts +20 -0
- package/dist/culling/bounds.d.ts.map +1 -0
- package/dist/culling/bounds.js +121 -0
- package/dist/culling/bounds.js.map +1 -0
- package/dist/culling/constants.d.ts +3 -0
- package/dist/culling/constants.d.ts.map +1 -0
- package/dist/culling/constants.js +5 -0
- package/dist/culling/constants.js.map +1 -0
- package/dist/culling/frustum-planes.d.ts +5 -0
- package/dist/culling/frustum-planes.d.ts.map +1 -0
- package/dist/culling/frustum-planes.js +37 -0
- package/dist/culling/frustum-planes.js.map +1 -0
- package/dist/culling/geometric-queries.d.ts +34 -0
- package/dist/culling/geometric-queries.d.ts.map +1 -0
- package/dist/culling/geometric-queries.js +208 -0
- package/dist/culling/geometric-queries.js.map +1 -0
- package/dist/culling/index.cjs +2560 -0
- package/dist/culling/index.cjs.map +6 -0
- package/dist/culling/index.d.ts +37 -0
- package/dist/culling/index.d.ts.map +1 -0
- package/dist/culling/index.js +29 -0
- package/dist/culling/index.js.map +1 -0
- package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts +15 -0
- package/dist/culling/lib/algorithms/bounding-box-from-points.d.ts.map +1 -0
- package/dist/culling/lib/algorithms/bounding-box-from-points.js +137 -0
- package/dist/culling/lib/algorithms/bounding-box-from-points.js.map +1 -0
- package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts +14 -0
- package/dist/culling/lib/algorithms/bounding-sphere-from-points.d.ts.map +1 -0
- package/dist/culling/lib/algorithms/bounding-sphere-from-points.js +146 -0
- package/dist/culling/lib/algorithms/bounding-sphere-from-points.js.map +1 -0
- package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts +37 -0
- package/dist/culling/lib/algorithms/compute-eigen-decomposition.d.ts.map +1 -0
- package/dist/culling/lib/algorithms/compute-eigen-decomposition.js +137 -0
- package/dist/culling/lib/algorithms/compute-eigen-decomposition.js.map +1 -0
- package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts +7 -0
- package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.d.ts.map +1 -0
- package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js +26 -0
- package/dist/culling/lib/algorithms/oriented-bounding-box-quaternion.js.map +1 -0
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +56 -0
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -0
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js +133 -0
- package/dist/culling/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -0
- package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts +40 -0
- package/dist/culling/lib/bounding-volumes/bounding-sphere.d.ts.map +1 -0
- package/dist/culling/lib/bounding-volumes/bounding-sphere.js +123 -0
- package/dist/culling/lib/bounding-volumes/bounding-sphere.js.map +1 -0
- package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts +30 -0
- package/dist/culling/lib/bounding-volumes/bounding-volume.d.ts.map +1 -0
- package/dist/culling/lib/bounding-volumes/bounding-volume.js +7 -0
- package/dist/culling/lib/bounding-volumes/bounding-volume.js.map +1 -0
- package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts +62 -0
- package/dist/culling/lib/bounding-volumes/oriented-bounding-box.d.ts.map +1 -0
- package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js +230 -0
- package/dist/culling/lib/bounding-volumes/oriented-bounding-box.js.map +1 -0
- package/dist/culling/lib/culling-volume.d.ts +49 -0
- package/dist/culling/lib/culling-volume.d.ts.map +1 -0
- package/dist/culling/lib/culling-volume.js +133 -0
- package/dist/culling/lib/culling-volume.js.map +1 -0
- package/dist/culling/lib/perspective-frustum.d.ts +153 -0
- package/dist/culling/lib/perspective-frustum.d.ts.map +1 -0
- package/dist/culling/lib/perspective-frustum.js +191 -0
- package/dist/culling/lib/perspective-frustum.js.map +1 -0
- package/dist/culling/lib/perspective-off-center-frustum.d.ts +158 -0
- package/dist/culling/lib/perspective-off-center-frustum.d.ts.map +1 -0
- package/dist/culling/lib/perspective-off-center-frustum.js +276 -0
- package/dist/culling/lib/perspective-off-center-frustum.js.map +1 -0
- package/dist/culling/lib/plane.d.ts +35 -0
- package/dist/culling/lib/plane.d.ts.map +1 -0
- package/dist/culling/lib/plane.js +90 -0
- package/dist/culling/lib/plane.js.map +1 -0
- package/dist/culling/lib/ray.d.ts +18 -0
- package/dist/culling/lib/ray.d.ts.map +1 -0
- package/dist/culling/lib/ray.js +51 -0
- package/dist/culling/lib/ray.js.map +1 -0
- package/dist/culling/lib/shapes/box-shape.d.ts +19 -0
- package/dist/culling/lib/shapes/box-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/box-shape.js +69 -0
- package/dist/culling/lib/shapes/box-shape.js.map +1 -0
- package/dist/culling/lib/shapes/capsule-shape.d.ts +23 -0
- package/dist/culling/lib/shapes/capsule-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/capsule-shape.js +151 -0
- package/dist/culling/lib/shapes/capsule-shape.js.map +1 -0
- package/dist/culling/lib/shapes/cylinder-shape.d.ts +22 -0
- package/dist/culling/lib/shapes/cylinder-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/cylinder-shape.js +99 -0
- package/dist/culling/lib/shapes/cylinder-shape.js.map +1 -0
- package/dist/culling/lib/shapes/implicit-shape.d.ts +56 -0
- package/dist/culling/lib/shapes/implicit-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/implicit-shape.js +142 -0
- package/dist/culling/lib/shapes/implicit-shape.js.map +1 -0
- package/dist/culling/lib/shapes/plane-shape.d.ts +27 -0
- package/dist/culling/lib/shapes/plane-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/plane-shape.js +71 -0
- package/dist/culling/lib/shapes/plane-shape.js.map +1 -0
- package/dist/culling/lib/shapes/sphere-shape.d.ts +18 -0
- package/dist/culling/lib/shapes/sphere-shape.d.ts.map +1 -0
- package/dist/culling/lib/shapes/sphere-shape.js +43 -0
- package/dist/culling/lib/shapes/sphere-shape.js.map +1 -0
- package/dist/culling/oriented-box-2d.d.ts +22 -0
- package/dist/culling/oriented-box-2d.d.ts.map +1 -0
- package/dist/culling/oriented-box-2d.js +86 -0
- package/dist/culling/oriented-box-2d.js.map +1 -0
- package/dist/culling/queries.d.ts +44 -0
- package/dist/culling/queries.d.ts.map +1 -0
- package/dist/culling/queries.js +259 -0
- package/dist/culling/queries.js.map +1 -0
- package/dist/culling/screen-ray.d.ts +22 -0
- package/dist/culling/screen-ray.d.ts.map +1 -0
- package/dist/culling/screen-ray.js +55 -0
- package/dist/culling/screen-ray.js.map +1 -0
- package/dist/curves/adaptive-sampling.d.ts +16 -0
- package/dist/curves/adaptive-sampling.d.ts.map +1 -0
- package/dist/curves/adaptive-sampling.js +59 -0
- package/dist/curves/adaptive-sampling.js.map +1 -0
- package/dist/curves/bezier-curves.d.ts +18 -0
- package/dist/curves/bezier-curves.d.ts.map +1 -0
- package/dist/curves/bezier-curves.js +54 -0
- package/dist/curves/bezier-curves.js.map +1 -0
- package/dist/curves/catmull-rom-curve.d.ts +15 -0
- package/dist/curves/catmull-rom-curve.d.ts.map +1 -0
- package/dist/curves/catmull-rom-curve.js +77 -0
- package/dist/curves/catmull-rom-curve.js.map +1 -0
- package/dist/curves/curve-arc-length.d.ts +17 -0
- package/dist/curves/curve-arc-length.d.ts.map +1 -0
- package/dist/curves/curve-arc-length.js +58 -0
- package/dist/curves/curve-arc-length.js.map +1 -0
- package/dist/curves/curve.d.ts +23 -0
- package/dist/curves/curve.d.ts.map +1 -0
- package/dist/curves/curve.js +77 -0
- package/dist/curves/curve.js.map +1 -0
- package/dist/curves/hermite-curve.d.ts +9 -0
- package/dist/curves/hermite-curve.d.ts.map +1 -0
- package/dist/curves/hermite-curve.js +24 -0
- package/dist/curves/hermite-curve.js.map +1 -0
- package/dist/curves/index.d.ts +12 -0
- package/dist/curves/index.d.ts.map +1 -0
- package/dist/curves/index.js +11 -0
- package/dist/curves/index.js.map +1 -0
- package/dist/curves/parallel-transport.d.ts +12 -0
- package/dist/curves/parallel-transport.d.ts.map +1 -0
- package/dist/curves/parallel-transport.js +83 -0
- package/dist/curves/parallel-transport.js.map +1 -0
- package/dist/geometries/box-geometry.js +1 -1
- package/dist/geometries/box-geometry.js.map +1 -1
- package/dist/geometries/capsule-geometry.js +1 -1
- package/dist/geometries/capsule-geometry.js.map +1 -1
- package/dist/geometries/cylinder-geometry.js +1 -1
- package/dist/geometries/cylinder-geometry.js.map +1 -1
- package/dist/geometries/geometry-helpers.js +1 -1
- package/dist/geometries/geometry-helpers.js.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +1 -1
- package/dist/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/geometries/plane-geometry.js +1 -1
- package/dist/geometries/plane-geometry.js.map +1 -1
- package/dist/geometries/primitive-mesh-builder.d.ts +24 -0
- package/dist/geometries/primitive-mesh-builder.d.ts.map +1 -0
- package/dist/geometries/primitive-mesh-builder.js +74 -0
- package/dist/geometries/primitive-mesh-builder.js.map +1 -0
- package/dist/geometries/prism-geometry.d.ts +13 -0
- package/dist/geometries/prism-geometry.d.ts.map +1 -0
- package/dist/geometries/prism-geometry.js +34 -0
- package/dist/geometries/prism-geometry.js.map +1 -0
- package/dist/geometries/ring-geometry.d.ts +15 -0
- package/dist/geometries/ring-geometry.d.ts.map +1 -0
- package/dist/geometries/ring-geometry.js +64 -0
- package/dist/geometries/ring-geometry.js.map +1 -0
- package/dist/geometries/sphere-geometry.js +1 -1
- package/dist/geometries/sphere-geometry.js.map +1 -1
- package/dist/geometries/surface-of-revolution.js +1 -1
- package/dist/geometries/surface-of-revolution.js.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +1 -1
- package/dist/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/index.cjs +6993 -37
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/geometry-utils.js +1 -1
- package/dist/lib/geometry-utils.js.map +1 -1
- package/dist/lib/geometry.d.ts +1 -1
- package/dist/lib/geometry.d.ts.map +1 -1
- package/dist/lib/geometry.js +1 -1
- package/dist/lib/geometry.js.map +1 -1
- package/dist/lib/hinge-tree.d.ts +33 -0
- package/dist/lib/hinge-tree.d.ts.map +1 -0
- package/dist/lib/hinge-tree.js +144 -0
- package/dist/lib/hinge-tree.js.map +1 -0
- package/dist/lighting/index.cjs +175 -0
- package/dist/lighting/index.cjs.map +6 -0
- package/dist/lighting/index.d.ts +4 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +5 -0
- package/dist/lighting/index.js.map +1 -0
- package/dist/lighting/lighting-types.d.ts +16 -0
- package/dist/lighting/lighting-types.d.ts.map +1 -0
- package/dist/lighting/lighting-types.js +5 -0
- package/dist/lighting/lighting-types.js.map +1 -0
- package/dist/lighting/photometry.d.ts +36 -0
- package/dist/lighting/photometry.d.ts.map +1 -0
- package/dist/lighting/photometry.js +181 -0
- package/dist/lighting/photometry.js.map +1 -0
- package/dist/parametric/lathe-geometry.d.ts +14 -0
- package/dist/parametric/lathe-geometry.d.ts.map +1 -0
- package/dist/parametric/lathe-geometry.js +48 -0
- package/dist/parametric/lathe-geometry.js.map +1 -0
- package/dist/parametric/parametric-geometry.d.ts +20 -0
- package/dist/parametric/parametric-geometry.d.ts.map +1 -0
- package/dist/parametric/parametric-geometry.js +88 -0
- package/dist/parametric/parametric-geometry.js.map +1 -0
- package/dist/parametric/torus-geometry.d.ts +19 -0
- package/dist/parametric/torus-geometry.d.ts.map +1 -0
- package/dist/parametric/torus-geometry.js +89 -0
- package/dist/parametric/torus-geometry.js.map +1 -0
- package/dist/parametric.d.ts +7 -0
- package/dist/parametric.d.ts.map +1 -0
- package/dist/parametric.js +7 -0
- package/dist/parametric.js.map +1 -0
- package/dist/polygon/clip-triangle-mesh.d.ts +41 -0
- package/dist/polygon/clip-triangle-mesh.d.ts.map +1 -0
- package/dist/polygon/clip-triangle-mesh.js +155 -0
- package/dist/polygon/clip-triangle-mesh.js.map +1 -0
- package/dist/polygon/cut-by-grid.d.ts +24 -0
- package/dist/polygon/cut-by-grid.d.ts.map +1 -0
- package/dist/polygon/cut-by-grid.js +221 -0
- package/dist/polygon/cut-by-grid.js.map +1 -0
- package/dist/polygon/cut-by-mercator-bounds.d.ts +17 -0
- package/dist/polygon/cut-by-mercator-bounds.d.ts.map +1 -0
- package/dist/polygon/cut-by-mercator-bounds.js +149 -0
- package/dist/polygon/cut-by-mercator-bounds.js.map +1 -0
- package/dist/polygon/earcut.d.ts +13 -0
- package/dist/polygon/earcut.d.ts.map +1 -0
- package/dist/polygon/earcut.js +693 -0
- package/dist/polygon/earcut.js.map +1 -0
- package/dist/polygon/index.d.ts +16 -0
- package/dist/polygon/index.d.ts.map +1 -0
- package/dist/polygon/index.js +14 -0
- package/dist/polygon/index.js.map +1 -0
- package/dist/polygon/lineclip.d.ts +31 -0
- package/dist/polygon/lineclip.d.ts.map +1 -0
- package/dist/polygon/lineclip.js +184 -0
- package/dist/polygon/lineclip.js.map +1 -0
- package/dist/polygon/pole-of-inaccessibility.d.ts +21 -0
- package/dist/polygon/pole-of-inaccessibility.d.ts.map +1 -0
- package/dist/polygon/pole-of-inaccessibility.js +285 -0
- package/dist/polygon/pole-of-inaccessibility.js.map +1 -0
- package/dist/polygon/polygon-utils.d.ts +103 -0
- package/dist/polygon/polygon-utils.d.ts.map +1 -0
- package/dist/polygon/polygon-utils.js +155 -0
- package/dist/polygon/polygon-utils.js.map +1 -0
- package/dist/polygon/polygon.d.ts +41 -0
- package/dist/polygon/polygon.d.ts.map +1 -0
- package/dist/polygon/polygon.js +76 -0
- package/dist/polygon/polygon.js.map +1 -0
- package/dist/polygon/subdivide-polyline.d.ts +56 -0
- package/dist/polygon/subdivide-polyline.d.ts.map +1 -0
- package/dist/polygon/subdivide-polyline.js +141 -0
- package/dist/polygon/subdivide-polyline.js.map +1 -0
- package/dist/polygon/subdivide-triangle-mesh.d.ts +78 -0
- package/dist/polygon/subdivide-triangle-mesh.d.ts.map +1 -0
- package/dist/polygon/subdivide-triangle-mesh.js +238 -0
- package/dist/polygon/subdivide-triangle-mesh.js.map +1 -0
- package/dist/polygon/utils.d.ts +5 -0
- package/dist/polygon/utils.d.ts.map +1 -0
- package/dist/polygon/utils.js +38 -0
- package/dist/polygon/utils.js.map +1 -0
- package/dist/spatial-index/box-index.d.ts +86 -0
- package/dist/spatial-index/box-index.d.ts.map +1 -0
- package/dist/spatial-index/box-index.js +335 -0
- package/dist/spatial-index/box-index.js.map +1 -0
- package/dist/spatial-index/index.d.ts +7 -0
- package/dist/spatial-index/index.d.ts.map +1 -0
- package/dist/spatial-index/index.js +6 -0
- package/dist/spatial-index/index.js.map +1 -0
- package/dist/spatial-index/triangle-bvh.d.ts +74 -0
- package/dist/spatial-index/triangle-bvh.d.ts.map +1 -0
- package/dist/spatial-index/triangle-bvh.js +221 -0
- package/dist/spatial-index/triangle-bvh.js.map +1 -0
- package/dist/utils/attribute-compression.d.ts +50 -0
- package/dist/utils/attribute-compression.d.ts.map +1 -0
- package/dist/utils/attribute-compression.js +186 -0
- package/dist/utils/attribute-compression.js.map +1 -0
- package/dist/utils/attribute-iterator.d.ts +8 -0
- package/dist/utils/attribute-iterator.d.ts.map +1 -0
- package/dist/utils/attribute-iterator.js +25 -0
- package/dist/utils/attribute-iterator.js.map +1 -0
- package/dist/utils/compose-attribute-provenance.d.ts +13 -0
- package/dist/utils/compose-attribute-provenance.d.ts.map +1 -0
- package/dist/utils/compose-attribute-provenance.js +63 -0
- package/dist/utils/compose-attribute-provenance.js.map +1 -0
- package/dist/utils/compute-vertex-normals.d.ts +4 -0
- package/dist/utils/compute-vertex-normals.d.ts.map +1 -0
- package/dist/utils/compute-vertex-normals.js +54 -0
- package/dist/utils/compute-vertex-normals.js.map +1 -0
- package/dist/utils/constants.d.ts +52 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +39 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coordinates.d.ts +3 -0
- package/dist/utils/coordinates.d.ts.map +1 -0
- package/dist/utils/coordinates.js +8 -0
- package/dist/utils/coordinates.js.map +1 -0
- package/dist/utils/geometry.d.ts +20 -0
- package/dist/utils/geometry.d.ts.map +1 -0
- package/dist/utils/geometry.js +31 -0
- package/dist/utils/geometry.js.map +1 -0
- package/dist/utils/gl-type.d.ts +17 -0
- package/dist/utils/gl-type.d.ts.map +1 -0
- package/dist/utils/gl-type.js +69 -0
- package/dist/utils/gl-type.js.map +1 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/interpolate-packed-attributes.d.ts +43 -0
- package/dist/utils/interpolate-packed-attributes.d.ts.map +1 -0
- package/dist/utils/interpolate-packed-attributes.js +192 -0
- package/dist/utils/interpolate-packed-attributes.js.map +1 -0
- package/dist/utils/mesh-processing.d.ts +18 -0
- package/dist/utils/mesh-processing.d.ts.map +1 -0
- package/dist/utils/mesh-processing.js +300 -0
- package/dist/utils/mesh-processing.js.map +1 -0
- package/dist/utils/primitive-iterator.d.ts +21 -0
- package/dist/utils/primitive-iterator.d.ts.map +1 -0
- package/dist/utils/primitive-iterator.js +117 -0
- package/dist/utils/primitive-iterator.js.map +1 -0
- package/dist/utils/project-bounds.d.ts +44 -0
- package/dist/utils/project-bounds.d.ts.map +1 -0
- package/dist/utils/project-bounds.js +93 -0
- package/dist/utils/project-bounds.js.map +1 -0
- package/dist/utils/project-texture-coordinates.d.ts +19 -0
- package/dist/utils/project-texture-coordinates.d.ts.map +1 -0
- package/dist/utils/project-texture-coordinates.js +49 -0
- package/dist/utils/project-texture-coordinates.js.map +1 -0
- package/dist/utils/qualify-surface-transition.d.ts +21 -0
- package/dist/utils/qualify-surface-transition.d.ts.map +1 -0
- package/dist/utils/qualify-surface-transition.js +140 -0
- package/dist/utils/qualify-surface-transition.js.map +1 -0
- package/dist/utils/rgb565.d.ts +5 -0
- package/dist/utils/rgb565.d.ts.map +1 -0
- package/dist/utils/rgb565.js +24 -0
- package/dist/utils/rgb565.js.map +1 -0
- package/dist/utils/typed-array-utils.d.ts +3 -0
- package/dist/utils/typed-array-utils.d.ts.map +1 -0
- package/dist/utils/typed-array-utils.js +16 -0
- package/dist/utils/typed-array-utils.js.map +1 -0
- package/package.json +24 -4
- package/src/color/color-lut-types.ts +19 -0
- package/src/color/index.ts +6 -0
- package/src/color/sample-lut.ts +175 -0
- package/src/culling/bounds.ts +152 -0
- package/src/culling/constants.ts +6 -0
- package/src/culling/frustum-planes.ts +41 -0
- package/src/culling/geometric-queries.ts +299 -0
- package/src/culling/index.ts +93 -0
- package/src/culling/lib/algorithms/bounding-box-from-points.ts +174 -0
- package/src/culling/lib/algorithms/bounding-sphere-from-points.ts +175 -0
- package/src/culling/lib/algorithms/compute-eigen-decomposition.ts +171 -0
- package/src/culling/lib/algorithms/oriented-bounding-box-quaternion.ts +32 -0
- package/src/culling/lib/bounding-volumes/axis-aligned-bounding-box.ts +171 -0
- package/src/culling/lib/bounding-volumes/bounding-sphere.ts +154 -0
- package/src/culling/lib/bounding-volumes/bounding-volume.ts +38 -0
- package/src/culling/lib/bounding-volumes/oriented-bounding-box.ts +320 -0
- package/src/culling/lib/culling-volume.ts +171 -0
- package/src/culling/lib/perspective-frustum.ts +288 -0
- package/src/culling/lib/perspective-off-center-frustum.ts +381 -0
- package/src/culling/lib/plane.ts +118 -0
- package/src/culling/lib/ray.ts +54 -0
- package/src/culling/lib/shapes/box-shape.ts +78 -0
- package/src/culling/lib/shapes/capsule-shape.ts +232 -0
- package/src/culling/lib/shapes/cylinder-shape.ts +133 -0
- package/src/culling/lib/shapes/implicit-shape.ts +209 -0
- package/src/culling/lib/shapes/plane-shape.ts +78 -0
- package/src/culling/lib/shapes/sphere-shape.ts +60 -0
- package/src/culling/oriented-box-2d.ts +165 -0
- package/src/culling/queries.ts +332 -0
- package/src/culling/screen-ray.ts +75 -0
- package/src/curves/adaptive-sampling.ts +85 -0
- package/src/curves/bezier-curves.ts +62 -0
- package/src/curves/catmull-rom-curve.ts +89 -0
- package/src/curves/curve-arc-length.ts +70 -0
- package/src/curves/curve.ts +96 -0
- package/src/curves/hermite-curve.ts +34 -0
- package/src/curves/index.ts +19 -0
- package/src/curves/parallel-transport.ts +104 -0
- package/src/geometries/box-geometry.ts +1 -1
- package/src/geometries/capsule-geometry.ts +1 -1
- package/src/geometries/cylinder-geometry.ts +1 -1
- package/src/geometries/geometry-helpers.ts +1 -1
- package/src/geometries/ico-sphere-geometry.ts +1 -1
- package/src/geometries/plane-geometry.ts +1 -1
- package/src/geometries/primitive-mesh-builder.ts +84 -0
- package/src/geometries/prism-geometry.ts +57 -0
- package/src/geometries/ring-geometry.ts +102 -0
- package/src/geometries/sphere-geometry.ts +1 -1
- package/src/geometries/surface-of-revolution.ts +1 -1
- package/src/geometries/truncated-cone-geometry.ts +1 -1
- package/src/index.ts +226 -1
- package/src/lib/geometry-utils.ts +2 -2
- package/src/lib/geometry.ts +2 -2
- package/src/lib/hinge-tree.ts +170 -0
- package/src/lighting/index.ts +10 -0
- package/src/lighting/lighting-types.ts +20 -0
- package/src/lighting/photometry.ts +264 -0
- package/src/parametric/lathe-geometry.ts +70 -0
- package/src/parametric/parametric-geometry.ts +118 -0
- package/src/parametric/torus-geometry.ts +118 -0
- package/src/parametric.ts +9 -0
- package/src/polygon/clip-triangle-mesh.ts +218 -0
- package/src/polygon/cut-by-grid.ts +313 -0
- package/src/polygon/cut-by-mercator-bounds.ts +204 -0
- package/src/polygon/earcut.ts +859 -0
- package/src/polygon/index.ts +48 -0
- package/src/polygon/lineclip.ts +218 -0
- package/src/polygon/pole-of-inaccessibility.ts +330 -0
- package/src/polygon/polygon-utils.ts +273 -0
- package/src/polygon/polygon.ts +105 -0
- package/src/polygon/subdivide-polyline.ts +223 -0
- package/src/polygon/subdivide-triangle-mesh.ts +342 -0
- package/src/polygon/utils.ts +50 -0
- package/src/spatial-index/box-index.ts +452 -0
- package/src/spatial-index/index.ts +20 -0
- package/src/spatial-index/triangle-bvh.ts +345 -0
- package/src/utils/attribute-compression.ts +234 -0
- package/src/utils/attribute-iterator.ts +28 -0
- package/src/utils/compose-attribute-provenance.ts +74 -0
- package/src/utils/compute-vertex-normals.ts +63 -0
- package/src/utils/constants.ts +42 -0
- package/src/utils/coordinates.ts +8 -0
- package/src/utils/geometry.ts +49 -0
- package/src/utils/gl-type.ts +87 -0
- package/src/utils/index.ts +55 -0
- package/src/utils/interpolate-packed-attributes.ts +284 -0
- package/src/utils/mesh-processing.ts +377 -0
- package/src/utils/primitive-iterator.ts +145 -0
- package/src/utils/project-bounds.ts +154 -0
- package/src/utils/project-texture-coordinates.ts +67 -0
- package/src/utils/qualify-surface-transition.ts +169 -0
- package/src/utils/rgb565.ts +26 -0
- package/src/utils/typed-array-utils.ts +16 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Projects packed source vertices into an explicitly located image rectangle. */
|
|
6
|
+
export type ProjectTextureCoordinatesOptions = {
|
|
7
|
+
/** Prepared synchronous source-to-image transform. Receives a fresh source array.
|
|
8
|
+
* Null or nonfinite XY rejects the operation; exceptions propagate unchanged.
|
|
9
|
+
*/
|
|
10
|
+
transform: (position: readonly number[]) => ArrayLike<number> | null;
|
|
11
|
+
/** Image rectangle [left, bottom, right, top], in the transform's output coordinates. */
|
|
12
|
+
bounds: readonly [number, number, number, number];
|
|
13
|
+
/** Number of packed source components per vertex. Default 3. */
|
|
14
|
+
size?: 2 | 3;
|
|
15
|
+
/** Texture origin. Default 'top-left'; bottom-left makes V increase with image Y. */
|
|
16
|
+
origin?: 'top-left' | 'bottom-left';
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Generates detached float64 UVs without changing positions, indices or vertex order.
|
|
20
|
+
* Outside-image coordinates remain outside [0, 1]. This performs no subdivision,
|
|
21
|
+
* seam inference, domain clipping, GPU readback, or asynchronous preparation.
|
|
22
|
+
*/
|
|
23
|
+
export function projectTextureCoordinates(
|
|
24
|
+
positions: ArrayLike<number>,
|
|
25
|
+
options: ProjectTextureCoordinatesOptions
|
|
26
|
+
): Float64Array {
|
|
27
|
+
const {transform, bounds, size = 3, origin = 'top-left'} = options;
|
|
28
|
+
if (size !== 2 && size !== 3) throw new RangeError('Source size must be 2 or 3');
|
|
29
|
+
if (!Number.isSafeInteger(positions.length) || positions.length < 0 || positions.length % size) {
|
|
30
|
+
throw new RangeError('Positions must contain complete packed vertices');
|
|
31
|
+
}
|
|
32
|
+
if (origin !== 'top-left' && origin !== 'bottom-left') {
|
|
33
|
+
throw new RangeError('Invalid texture origin');
|
|
34
|
+
}
|
|
35
|
+
if (bounds.length !== 4 || !bounds.every(Number.isFinite)) {
|
|
36
|
+
throw new RangeError('Image bounds must contain four finite values');
|
|
37
|
+
}
|
|
38
|
+
const [left, bottom, right, top] = bounds;
|
|
39
|
+
const width = right - left;
|
|
40
|
+
const height = top - bottom;
|
|
41
|
+
if (!(width > 0) || !(height > 0) || !Number.isFinite(width) || !Number.isFinite(height)) {
|
|
42
|
+
throw new RangeError('Image bounds must have finite positive extents');
|
|
43
|
+
}
|
|
44
|
+
const count = positions.length / size;
|
|
45
|
+
const result = new Float64Array(count * 2);
|
|
46
|
+
for (let index = 0; index < count; index++) {
|
|
47
|
+
const source = Array.from({length: size}, (_, axis) => positions[index * size + axis]);
|
|
48
|
+
if (!source.every(Number.isFinite)) throw new RangeError(`Invalid source vertex ${index}`);
|
|
49
|
+
const projected = transform(source);
|
|
50
|
+
if (
|
|
51
|
+
!projected ||
|
|
52
|
+
projected.length < 2 ||
|
|
53
|
+
!Number.isFinite(projected[0]) ||
|
|
54
|
+
!Number.isFinite(projected[1])
|
|
55
|
+
) {
|
|
56
|
+
throw new RangeError(`Invalid projected vertex ${index}`);
|
|
57
|
+
}
|
|
58
|
+
const u = (projected[0] - left) / width;
|
|
59
|
+
const v =
|
|
60
|
+
origin === 'top-left' ? (top - projected[1]) / height : (projected[1] - bottom) / height;
|
|
61
|
+
if (!Number.isFinite(u) || !Number.isFinite(v))
|
|
62
|
+
throw new RangeError(`Invalid UV at vertex ${index}`);
|
|
63
|
+
result[index * 2] = u;
|
|
64
|
+
result[index * 2 + 1] = v;
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
import type {TriangleMesh} from '../polygon/subdivide-triangle-mesh';
|
|
5
|
+
|
|
6
|
+
export type SurfaceTransitionQualification = {
|
|
7
|
+
/** A fixed indexed disk stays a graph over XY throughout linear vertex interpolation. */
|
|
8
|
+
scope: 'convex-xy-disk-linear';
|
|
9
|
+
minimumProjectedDoubleArea: number;
|
|
10
|
+
boundary: Uint32Array;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Qualify a conservative subset of 3D mesh morphs, without time sampling.
|
|
14
|
+
* Input is an oriented, connected triangulated disk. Both endpoints share indices.
|
|
15
|
+
* Every triangle must retain positive XY orientation and the boundary must stay
|
|
16
|
+
* convex throughout linear vertex motion. Quadratic extrema test the full [0,1].
|
|
17
|
+
* This excludes holes, folded surfaces, most global globe meshes and curved vertex
|
|
18
|
+
* trajectories. It qualifies the piecewise-linear mesh, not its underlying smooth
|
|
19
|
+
* projection or a camera's approximation error. Floating-point margins reject
|
|
20
|
+
* near-degeneracy; this is not a formal interval-arithmetic certificate.
|
|
21
|
+
*/
|
|
22
|
+
export function qualifySurfaceTransition(
|
|
23
|
+
mesh: TriangleMesh,
|
|
24
|
+
targetPositions: ArrayLike<number>,
|
|
25
|
+
options: {minimumDoubleArea?: number; maxChecks?: number} = {}
|
|
26
|
+
): SurfaceTransitionQualification {
|
|
27
|
+
const from = Array.from(mesh.positions),
|
|
28
|
+
to = Array.from(targetPositions),
|
|
29
|
+
indices = Array.from(mesh.indices),
|
|
30
|
+
count = from.length / 3,
|
|
31
|
+
maxChecks = options.maxChecks ?? 1000000;
|
|
32
|
+
if (
|
|
33
|
+
!from.length ||
|
|
34
|
+
from.length % 3 ||
|
|
35
|
+
to.length !== from.length ||
|
|
36
|
+
!indices.length ||
|
|
37
|
+
indices.length % 3 ||
|
|
38
|
+
!from.every(Number.isFinite) ||
|
|
39
|
+
!to.every(Number.isFinite) ||
|
|
40
|
+
!indices.every(i => Number.isSafeInteger(i) && i >= 0 && i < count) ||
|
|
41
|
+
!Number.isSafeInteger(maxChecks) ||
|
|
42
|
+
maxChecks < 0
|
|
43
|
+
)
|
|
44
|
+
throw new RangeError('Invalid surface transition mesh or budget');
|
|
45
|
+
let scale = 0;
|
|
46
|
+
for (const positions of [from, to])
|
|
47
|
+
for (let i = 0; i < indices.length; i += 3)
|
|
48
|
+
for (let j = 0; j < 3; j++) {
|
|
49
|
+
const a = indices[i + j] * 3,
|
|
50
|
+
b = indices[i + ((j + 1) % 3)] * 3;
|
|
51
|
+
scale = Math.max(
|
|
52
|
+
scale,
|
|
53
|
+
Math.hypot(positions[b] - positions[a], positions[b + 1] - positions[a + 1])
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
const margin = options.minimumDoubleArea ?? scale * scale * 1e-12;
|
|
57
|
+
if (!Number.isFinite(margin) || margin <= 0)
|
|
58
|
+
throw new RangeError('Expected positive finite area margin');
|
|
59
|
+
let checks = 0;
|
|
60
|
+
const tick = () => {
|
|
61
|
+
if (++checks > maxChecks) throw new RangeError('Surface qualification exceeded maxChecks');
|
|
62
|
+
};
|
|
63
|
+
const edges = new Map<string, {a: number; b: number; faces: number}>(),
|
|
64
|
+
used = new Set(indices);
|
|
65
|
+
let minimum = Infinity;
|
|
66
|
+
const orientation = (a: number, b: number, c: number, t: number) => {
|
|
67
|
+
// Interpolate relative edges, avoiding cancellation from translating a patch
|
|
68
|
+
// across large world-coordinate origins before subtracting vertex positions.
|
|
69
|
+
const edge = (v: number, k: number) =>
|
|
70
|
+
(from[3 * v + k] - from[3 * a + k]) * (1 - t) + (to[3 * v + k] - to[3 * a + k]) * t;
|
|
71
|
+
return edge(b, 0) * edge(c, 1) - edge(b, 1) * edge(c, 0);
|
|
72
|
+
};
|
|
73
|
+
const minimumOrientation = (a: number, b: number, c: number) => {
|
|
74
|
+
tick();
|
|
75
|
+
return quadraticMinimum(t => orientation(a, b, c, t));
|
|
76
|
+
};
|
|
77
|
+
for (let i = 0; i < indices.length; i += 3) {
|
|
78
|
+
const tri = indices.slice(i, i + 3);
|
|
79
|
+
const area = minimumOrientation(tri[0], tri[1], tri[2]);
|
|
80
|
+
if (area < margin) throw new RangeError('Triangle collapses or reverses during transition');
|
|
81
|
+
minimum = Math.min(minimum, area);
|
|
82
|
+
for (let j = 0; j < 3; j++) {
|
|
83
|
+
const a = tri[j],
|
|
84
|
+
b = tri[(j + 1) % 3],
|
|
85
|
+
key = a < b ? `${a}:${b}` : `${b}:${a}`,
|
|
86
|
+
edge = edges.get(key);
|
|
87
|
+
if (edge) {
|
|
88
|
+
if (edge.faces !== 1 || edge.a !== b || edge.b !== a)
|
|
89
|
+
throw new RangeError('Expected oriented manifold edges');
|
|
90
|
+
edge.faces++;
|
|
91
|
+
} else edges.set(key, {a, b, faces: 1});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const next = new Map<number, number>();
|
|
95
|
+
for (const edge of edges.values())
|
|
96
|
+
if (edge.faces === 1) {
|
|
97
|
+
if (next.has(edge.a)) throw new RangeError('Nonmanifold boundary');
|
|
98
|
+
next.set(edge.a, edge.b);
|
|
99
|
+
}
|
|
100
|
+
if (!next.size || used.size !== count || used.size - edges.size + indices.length / 3 !== 1)
|
|
101
|
+
throw new RangeError('Expected a triangulated disk without unused vertices');
|
|
102
|
+
const start = next.keys().next().value!,
|
|
103
|
+
boundary: number[] = [];
|
|
104
|
+
const visitedBoundary = new Set<number>();
|
|
105
|
+
let v = start;
|
|
106
|
+
do {
|
|
107
|
+
if (visitedBoundary.has(v) || !next.has(v)) throw new RangeError('Expected one boundary cycle');
|
|
108
|
+
visitedBoundary.add(v);
|
|
109
|
+
boundary.push(v);
|
|
110
|
+
v = next.get(v)!;
|
|
111
|
+
} while (v !== start);
|
|
112
|
+
if (boundary.length !== next.size) throw new RangeError('Multiple boundary cycles');
|
|
113
|
+
// Every boundary vertex stays left of each directed support edge. This allows
|
|
114
|
+
// collinear refinement vertices while rejecting a nonconvex or crossing outline.
|
|
115
|
+
for (let i = 0; i < boundary.length; i++) {
|
|
116
|
+
const a = boundary[i],
|
|
117
|
+
b = boundary[(i + 1) % boundary.length];
|
|
118
|
+
// Distinct boundary vertices rule out multiple winding of a convex outline
|
|
119
|
+
// (a locally positive double-cover fan would otherwise pass support tests).
|
|
120
|
+
for (let j = i + 1; j < boundary.length; j++) {
|
|
121
|
+
tick();
|
|
122
|
+
const c = boundary[j];
|
|
123
|
+
const separation = quadraticMinimum(t => {
|
|
124
|
+
const dx = (from[3 * c] - from[3 * a]) * (1 - t) + (to[3 * c] - to[3 * a]) * t,
|
|
125
|
+
dy = (from[3 * c + 1] - from[3 * a + 1]) * (1 - t) + (to[3 * c + 1] - to[3 * a + 1]) * t;
|
|
126
|
+
return dx * dx + dy * dy;
|
|
127
|
+
});
|
|
128
|
+
if (separation < margin) throw new RangeError('Boundary vertices meet during transition');
|
|
129
|
+
}
|
|
130
|
+
for (const c of boundary)
|
|
131
|
+
if (c !== a && c !== b && minimumOrientation(a, b, c) < -margin * 1e-3)
|
|
132
|
+
throw new RangeError('Boundary is not convex throughout transition');
|
|
133
|
+
}
|
|
134
|
+
// Euler characteristic plus one boundary is insufficient if a closed component
|
|
135
|
+
// is present. Explicitly require connectivity of the vertex graph.
|
|
136
|
+
const neighbors = Array.from({length: count}, () => [] as number[]);
|
|
137
|
+
for (const {a, b} of edges.values()) {
|
|
138
|
+
neighbors[a].push(b);
|
|
139
|
+
neighbors[b].push(a);
|
|
140
|
+
}
|
|
141
|
+
const seen = new Set<number>([start]),
|
|
142
|
+
queue = [start];
|
|
143
|
+
for (let i = 0; i < queue.length; i++)
|
|
144
|
+
for (const n of neighbors[queue[i]])
|
|
145
|
+
if (!seen.has(n)) {
|
|
146
|
+
seen.add(n);
|
|
147
|
+
queue.push(n);
|
|
148
|
+
}
|
|
149
|
+
if (seen.size !== count) throw new RangeError('Disconnected surface mesh');
|
|
150
|
+
return {
|
|
151
|
+
scope: 'convex-xy-disk-linear',
|
|
152
|
+
minimumProjectedDoubleArea: minimum,
|
|
153
|
+
boundary: new Uint32Array(boundary)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function quadraticMinimum(value: (t: number) => number): number {
|
|
158
|
+
const f = value(0),
|
|
159
|
+
g = value(1),
|
|
160
|
+
h = value(0.5),
|
|
161
|
+
a = 2 * (f + g - 2 * h),
|
|
162
|
+
b = g - f - a;
|
|
163
|
+
if (![f, g, h, a, b].every(Number.isFinite))
|
|
164
|
+
throw new RangeError('Nonfinite surface orientation polynomial');
|
|
165
|
+
const t = a > 0 ? -b / (2 * a) : -1;
|
|
166
|
+
const result = Math.min(f, g, t > 0 && t < 1 ? value(t) : Infinity);
|
|
167
|
+
if (!Number.isFinite(result)) throw new RangeError('Nonfinite surface orientation');
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Decodes a packed RGB565 value into 8-bit RGB components. */
|
|
6
|
+
export function decodeRGB565(rgb565: number, target: number[] = [0, 0, 0]): number[] {
|
|
7
|
+
const red = (rgb565 >> 11) & 31;
|
|
8
|
+
const green = (rgb565 >> 5) & 63;
|
|
9
|
+
const blue = rgb565 & 31;
|
|
10
|
+
target[0] = (red << 3) | (red >> 2);
|
|
11
|
+
target[1] = (green << 2) | (green >> 4);
|
|
12
|
+
target[2] = (blue << 3) | (blue >> 2);
|
|
13
|
+
return target;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Encodes 8-bit RGB components into a packed RGB565 value. */
|
|
17
|
+
export function encodeRGB565(rgb: ArrayLike<number>): number {
|
|
18
|
+
const red = Math.round(clampByte(rgb[0] ?? 0) * (31 / 255));
|
|
19
|
+
const green = Math.round(clampByte(rgb[1] ?? 0) * (63 / 255));
|
|
20
|
+
const blue = Math.round(clampByte(rgb[2] ?? 0) * (31 / 255));
|
|
21
|
+
return (red << 11) | (green << 5) | blue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function clampByte(value: number): number {
|
|
25
|
+
return Math.max(0, Math.min(255, value));
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
/** Concatenates the visible bytes of multiple typed-array or DataView instances. */
|
|
6
|
+
export function concatTypedArrays(arrays: readonly ArrayBufferView[] = []): Uint8Array {
|
|
7
|
+
const byteLength = arrays.reduce((length, array) => length + array.byteLength, 0);
|
|
8
|
+
const result = new Uint8Array(byteLength);
|
|
9
|
+
let byteOffset = 0;
|
|
10
|
+
for (const array of arrays) {
|
|
11
|
+
const bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
12
|
+
result.set(bytes, byteOffset);
|
|
13
|
+
byteOffset += bytes.byteLength;
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|