@math.gl/culling 4.0.0-alpha.1 → 4.0.0-alpha.2
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/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/algorithms/bounding-box-from-points.d.ts +2 -2
- package/dist/lib/algorithms/bounding-box-from-points.d.ts.map +1 -1
- package/dist/lib/algorithms/bounding-box-from-points.js +3 -3
- package/dist/lib/algorithms/bounding-box-from-points.js.map +1 -1
- package/dist/lib/algorithms/bounding-sphere-from-points.d.ts +2 -2
- package/dist/lib/algorithms/bounding-sphere-from-points.d.ts.map +1 -1
- package/dist/lib/algorithms/bounding-sphere-from-points.js +2 -2
- package/dist/lib/algorithms/bounding-sphere-from-points.js.map +1 -1
- package/dist/lib/algorithms/compute-eigen-decomposition.d.ts +2 -2
- package/dist/lib/algorithms/compute-eigen-decomposition.d.ts.map +1 -1
- package/dist/lib/algorithms/compute-eigen-decomposition.js +1 -1
- package/dist/lib/algorithms/compute-eigen-decomposition.js.map +1 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.d.ts +2 -2
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.js +1 -1
- package/dist/lib/bounding-volumes/axis-aligned-bounding-box.js.map +1 -1
- package/dist/lib/bounding-volumes/bounding-sphere.d.ts +2 -2
- package/dist/lib/bounding-volumes/bounding-sphere.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/bounding-sphere.js +1 -1
- package/dist/lib/bounding-volumes/bounding-sphere.js.map +1 -1
- package/dist/lib/bounding-volumes/bounding-volume.d.ts +1 -1
- package/dist/lib/bounding-volumes/bounding-volume.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/oriented-bounding-box.d.ts +3 -3
- package/dist/lib/bounding-volumes/oriented-bounding-box.d.ts.map +1 -1
- package/dist/lib/bounding-volumes/oriented-bounding-box.js +2 -2
- package/dist/lib/bounding-volumes/oriented-bounding-box.js.map +1 -1
- package/dist/lib/culling-volume.d.ts +3 -3
- package/dist/lib/culling-volume.d.ts.map +1 -1
- package/dist/lib/culling-volume.js +2 -2
- package/dist/lib/culling-volume.js.map +1 -1
- package/dist/lib/perspective-frustum.d.ts +3 -3
- package/dist/lib/perspective-frustum.d.ts.map +1 -1
- package/dist/lib/perspective-frustum.js +2 -2
- package/dist/lib/perspective-frustum.js.map +1 -1
- package/dist/lib/perspective-off-center-frustum.d.ts +3 -3
- package/dist/lib/perspective-off-center-frustum.d.ts.map +1 -1
- package/dist/lib/perspective-off-center-frustum.js +3 -3
- package/dist/lib/perspective-off-center-frustum.js.map +1 -1
- package/dist/lib/plane.d.ts +1 -1
- package/dist/lib/plane.d.ts.map +1 -1
- package/dist/lib/plane.js +1 -1
- package/dist/lib/plane.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +9 -9
- package/src/lib/algorithms/bounding-box-from-points.ts +3 -3
- package/src/lib/algorithms/bounding-sphere-from-points.ts +2 -2
- package/src/lib/algorithms/compute-eigen-decomposition.ts +1 -1
- package/src/lib/bounding-volumes/axis-aligned-bounding-box.ts +2 -2
- package/src/lib/bounding-volumes/bounding-sphere.ts +2 -2
- package/src/lib/bounding-volumes/bounding-volume.ts +1 -1
- package/src/lib/bounding-volumes/oriented-bounding-box.ts +3 -3
- package/src/lib/culling-volume.ts +3 -3
- package/src/lib/perspective-frustum.ts +3 -3
- package/src/lib/perspective-off-center-frustum.ts +3 -3
- package/src/lib/plane.ts +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
|
|
3
3
|
|
|
4
4
|
import {Vector3} from '@math.gl/core';
|
|
5
|
-
import BoundingSphere from '../bounding-volumes/bounding-sphere';
|
|
5
|
+
import {BoundingSphere} from '../bounding-volumes/bounding-sphere';
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
const fromPointsXMin = new Vector3();
|
|
@@ -30,7 +30,7 @@ const fromPointsNaiveCenterScratch = new Vector3();
|
|
|
30
30
|
* @param result Optional object onto which to store the result.
|
|
31
31
|
* @returns The modified result parameter or a new `BoundingSphere` instance if not provided.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export function makeBoundingSphereFromPoints(
|
|
34
34
|
positions: number[][],
|
|
35
35
|
result: BoundingSphere = new BoundingSphere()
|
|
36
36
|
): BoundingSphere {
|
|
@@ -45,7 +45,7 @@ export type EigenDecomposition = {
|
|
|
45
45
|
* const v = result.unitary.getColumn(0, new Vector3()); // first eigenvector
|
|
46
46
|
* const c = v.multiplyByScalar(lambda); // equal to v.transformByMatrix3(a)
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
48
|
+
export function computeEigenDecomposition(
|
|
49
49
|
matrix: number[],
|
|
50
50
|
// @ts-expect-error accept empty object type
|
|
51
51
|
result: EigenDecomposition = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {BoundingVolume} from './bounding-volume';
|
|
2
2
|
import {Vector3} from '@math.gl/core';
|
|
3
|
-
import Plane from '../plane';
|
|
3
|
+
import {Plane} from '../plane';
|
|
4
4
|
import {INTERSECTION} from '../../constants';
|
|
5
5
|
|
|
6
6
|
const scratchVector = new Vector3();
|
|
@@ -12,7 +12,7 @@ const scratchNormal = new Vector3();
|
|
|
12
12
|
* @see BoundingRectangle
|
|
13
13
|
* @see OrientedBoundingBox
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export class AxisAlignedBoundingBox implements BoundingVolume {
|
|
16
16
|
/** The center point of the bounding box. */
|
|
17
17
|
readonly center: Vector3;
|
|
18
18
|
/** The positive half diagonal of the bounding box. */
|
|
@@ -7,13 +7,13 @@ import * as mat4 from 'gl-matrix/mat4';
|
|
|
7
7
|
|
|
8
8
|
import {INTERSECTION} from '../../constants';
|
|
9
9
|
import {BoundingVolume} from './bounding-volume';
|
|
10
|
-
import Plane from '../plane';
|
|
10
|
+
import {Plane} from '../plane';
|
|
11
11
|
|
|
12
12
|
const scratchVector = new Vector3();
|
|
13
13
|
const scratchVector2 = new Vector3();
|
|
14
14
|
|
|
15
15
|
/** A BoundingSphere */
|
|
16
|
-
export
|
|
16
|
+
export class BoundingSphere implements BoundingVolume {
|
|
17
17
|
center: Vector3;
|
|
18
18
|
radius: number;
|
|
19
19
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
import {Vector3, Matrix3, Matrix4, Quaternion, NumericArray} from '@math.gl/core';
|
|
5
5
|
import type {BoundingVolume} from './bounding-volume';
|
|
6
|
-
import BoundingSphere from './bounding-sphere';
|
|
7
|
-
import type Plane from '../plane';
|
|
6
|
+
import {BoundingSphere} from './bounding-sphere';
|
|
7
|
+
import type {Plane} from '../plane';
|
|
8
8
|
import {INTERSECTION} from '../../constants';
|
|
9
9
|
|
|
10
10
|
const scratchVector3 = new Vector3();
|
|
@@ -32,7 +32,7 @@ const MATRIX3 = {
|
|
|
32
32
|
* It can provide a tighter bounding volume than `BoundingSphere` or
|
|
33
33
|
* `AxisAlignedBoundingBox` in many cases.
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export class OrientedBoundingBox implements BoundingVolume {
|
|
36
36
|
center: Vector3;
|
|
37
37
|
halfAxes: Matrix3;
|
|
38
38
|
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
/* eslint-disable */
|
|
5
5
|
import {Vector3, assert} from '@math.gl/core';
|
|
6
6
|
import {INTERSECTION} from '../constants';
|
|
7
|
-
import Plane from './plane';
|
|
7
|
+
import {Plane} from './plane';
|
|
8
8
|
import type {BoundingVolume} from './bounding-volumes/bounding-volume';
|
|
9
|
-
import type BoundingSphere from './bounding-volumes/bounding-sphere';
|
|
9
|
+
import type {BoundingSphere} from './bounding-volumes/bounding-sphere';
|
|
10
10
|
|
|
11
11
|
// X, Y, Z Unit vectors
|
|
12
12
|
const faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];
|
|
@@ -16,7 +16,7 @@ const scratchPlaneNormal = new Vector3();
|
|
|
16
16
|
// const scratchPlane = new Plane(new Vector3(1.0, 0.0, 0.0), 0.0);
|
|
17
17
|
|
|
18
18
|
/** A culling volume defined by planes. */
|
|
19
|
-
export
|
|
19
|
+
export class CullingVolume {
|
|
20
20
|
/**
|
|
21
21
|
* For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value
|
|
22
22
|
* represents the case where the object bounding volume is entirely outside the culling volume.
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// - Documentation has not been ported
|
|
7
7
|
|
|
8
8
|
import {assert, Matrix4, NumericArray, Vector2} from '@math.gl/core';
|
|
9
|
-
import PerspectiveOffCenterFrustum from './perspective-off-center-frustum';
|
|
10
|
-
import CullingVolume from './culling-volume';
|
|
9
|
+
import {PerspectiveOffCenterFrustum} from './perspective-off-center-frustum';
|
|
10
|
+
import {CullingVolume} from './culling-volume';
|
|
11
11
|
|
|
12
12
|
const defined = (val: unknown) => val !== null && typeof val !== 'undefined';
|
|
13
13
|
|
|
@@ -44,7 +44,7 @@ type PerspectiveFrustumOptions = {
|
|
|
44
44
|
*
|
|
45
45
|
* @see PerspectiveOffCenterFrustum
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export class PerspectiveFrustum {
|
|
48
48
|
private _offCenterFrustum = new PerspectiveOffCenterFrustum();
|
|
49
49
|
/**
|
|
50
50
|
* The angle of the field of view (FOV), in radians. This angle will be used
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// - Documentation has not been ported
|
|
7
7
|
|
|
8
8
|
import {Vector3, Vector2, Matrix4, assert, NumericArray} from '@math.gl/core';
|
|
9
|
-
import CullingVolume from './culling-volume';
|
|
10
|
-
import Plane from './plane';
|
|
9
|
+
import {CullingVolume} from './culling-volume';
|
|
10
|
+
import {Plane} from './plane';
|
|
11
11
|
|
|
12
12
|
const scratchPlaneUpVector = new Vector3();
|
|
13
13
|
const scratchPlaneRightVector = new Vector3();
|
|
@@ -24,7 +24,7 @@ type PerspectiveOffCenterFrustumOptions = {
|
|
|
24
24
|
far?: number;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export class PerspectiveOffCenterFrustum {
|
|
28
28
|
/**
|
|
29
29
|
* Defines the left clipping plane.
|
|
30
30
|
* @type {Number}
|