@math.gl/culling 4.2.0-alpha.5 → 4.2.0-alpha.6
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/dist/constants.d.ts +10 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +9 -5
- package/dist/constants.js.map +1 -1
- package/dist/index.cjs +29 -31
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +2 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.js +3 -4
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -1
- package/dist/lib/bounding-volumes/bounding-sphere.d.ts +2 -1
- package/dist/lib/bounding-volumes/bounding-sphere.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/bounding-sphere.js +3 -4
- package/dist/lib/bounding-volumes/bounding-sphere.js.map +1 -1
- package/dist/lib/bounding-volumes/bounding-volume.d.ts +5 -4
- package/dist/lib/bounding-volumes/bounding-volume.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/oriented-bounding-box.d.ts +2 -1
- package/dist/lib/bounding-volumes/oriented-bounding-box.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/oriented-bounding-box.js +3 -4
- package/dist/lib/bounding-volumes/oriented-bounding-box.js.map +1 -1
- package/dist/lib/culling-volume.d.ts +2 -1
- package/dist/lib/culling-volume.d.ts.map +1 -1
- package/dist/lib/culling-volume.js +7 -8
- package/dist/lib/culling-volume.js.map +1 -1
- package/dist/lib/shapes/implicit-shape.d.ts +2 -1
- package/dist/lib/shapes/implicit-shape.d.ts.map +1 -1
- package/dist/lib/shapes/implicit-shape.js +3 -4
- package/dist/lib/shapes/implicit-shape.js.map +1 -1
- package/dist/lib/shapes/plane-shape.d.ts +2 -1
- package/dist/lib/shapes/plane-shape.d.ts.map +1 -1
- package/dist/lib/shapes/plane-shape.js +4 -5
- package/dist/lib/shapes/plane-shape.js.map +1 -1
- package/package.json +4 -4
- package/src/constants.ts +11 -5
- package/src/index.ts +1 -0
- package/src/lib/bounding-volumes/axis-aligned-bounding-box.ts +5 -5
- package/src/lib/bounding-volumes/bounding-sphere.ts +5 -5
- package/src/lib/bounding-volumes/bounding-volume.ts +5 -4
- package/src/lib/bounding-volumes/oriented-bounding-box.ts +5 -5
- package/src/lib/culling-volume.ts +9 -9
- package/src/lib/shapes/implicit-shape.ts +5 -5
- package/src/lib/shapes/plane-shape.ts +6 -6
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Vector3} from '@math.gl/core';
|
|
6
|
-
import {
|
|
6
|
+
import type {CullingResult} from '../../constants';
|
|
7
7
|
import {ImplicitShapeBase, type ImplicitShape, type LocalRayIntersection} from './implicit-shape';
|
|
8
8
|
import type {AxisAlignedBoundingBox} from '../bounding-volumes/axis-aligned-bounding-box';
|
|
9
9
|
import type {BoundingSphere} from '../bounding-volumes/bounding-sphere';
|
|
@@ -58,16 +58,16 @@ export class PlaneShape extends ImplicitShapeBase {
|
|
|
58
58
|
if (this.sizeZ !== undefined && Math.abs(z) > this.sizeZ / 2 + 1e-12) return undefined;
|
|
59
59
|
return {distance, normal: [0, 1, 0]};
|
|
60
60
|
}
|
|
61
|
-
override intersectPlane(plane: Plane):
|
|
61
|
+
override intersectPlane(plane: Plane): CullingResult {
|
|
62
62
|
const boundaryPoint = new Vector3(0, 0, 0).transform(this.matrix);
|
|
63
63
|
const inverse = this.inverseMatrix;
|
|
64
64
|
const boundaryNormal = new Vector3(inverse[1], inverse[5], inverse[9]).normalize();
|
|
65
65
|
const alignment = boundaryNormal.dot(plane.normal);
|
|
66
|
-
if (Math.abs(Math.abs(alignment) - 1) > 1e-10) return
|
|
66
|
+
if (Math.abs(Math.abs(alignment) - 1) > 1e-10) return 'intersecting';
|
|
67
67
|
const boundaryDistance = plane.getPointDistance(boundaryPoint);
|
|
68
|
-
if (alignment < 0 && boundaryDistance > 0) return
|
|
69
|
-
if (alignment > 0 && boundaryDistance < 0) return
|
|
70
|
-
return
|
|
68
|
+
if (alignment < 0 && boundaryDistance > 0) return 'inside';
|
|
69
|
+
if (alignment > 0 && boundaryDistance < 0) return 'outside';
|
|
70
|
+
return 'intersecting';
|
|
71
71
|
}
|
|
72
72
|
override getAxisAlignedBoundingBox(): AxisAlignedBoundingBox | undefined {
|
|
73
73
|
return undefined;
|