Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@math.gl/culling

Package Overview
Dependencies
Maintainers
4
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/culling - npm Package Compare versions

Comparing version 3.1.3 to 3.2.0-alpha.1

src/algorithms/bounding-box-from-points.d.ts

24

dist/es5/algorithms/bounding-box-from-points.js

@@ -10,15 +10,15 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");
var _computeEigenDecomposition = _interopRequireDefault(require("./compute-eigen-decomposition"));
var scratchVector2 = new _math.Vector3();
var scratchVector3 = new _math.Vector3();
var scratchVector4 = new _math.Vector3();
var scratchVector5 = new _math.Vector3();
var scratchVector6 = new _math.Vector3();
var scratchCovarianceResult = new _math.Matrix3();
var scratchVector2 = new _core.Vector3();
var scratchVector3 = new _core.Vector3();
var scratchVector4 = new _core.Vector3();
var scratchVector5 = new _core.Vector3();
var scratchVector6 = new _core.Vector3();
var scratchCovarianceResult = new _core.Matrix3();
var scratchEigenResult = {
diagonal: new _math.Matrix3(),
unitary: new _math.Matrix3()
diagonal: new _core.Matrix3(),
unitary: new _core.Matrix3()
};

@@ -28,4 +28,4 @@

if (!positions || positions.length === 0) {
result.halfAxes = new _math.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
result.center = new _math.Vector3();
result.halfAxes = new _core.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
result.center = new _core.Vector3();
return result;

@@ -35,3 +35,3 @@ }

var length = positions.length;
var meanPoint = new _math.Vector3(0, 0, 0);
var meanPoint = new _core.Vector3(0, 0, 0);
var _iteratorNormalCompletion = true;

@@ -38,0 +38,0 @@ var _didIteratorError = false;

@@ -8,20 +8,20 @@ "use strict";

});
exports.makeBoundingSphereFromPoints = makeBoundingSphereFromPoints;
exports["default"] = makeBoundingSphereFromPoints;
var _math = require("math.gl");
var _core = require("@math.gl/core");
var _boundingSphere = _interopRequireDefault(require("../lib/bounding-sphere"));
var fromPointsXMin = new _math.Vector3();
var fromPointsYMin = new _math.Vector3();
var fromPointsZMin = new _math.Vector3();
var fromPointsXMax = new _math.Vector3();
var fromPointsYMax = new _math.Vector3();
var fromPointsZMax = new _math.Vector3();
var fromPointsCurrentPos = new _math.Vector3();
var fromPointsScratch = new _math.Vector3();
var fromPointsRitterCenter = new _math.Vector3();
var fromPointsMinBoxPt = new _math.Vector3();
var fromPointsMaxBoxPt = new _math.Vector3();
var fromPointsNaiveCenterScratch = new _math.Vector3();
var fromPointsXMin = new _core.Vector3();
var fromPointsYMin = new _core.Vector3();
var fromPointsZMin = new _core.Vector3();
var fromPointsXMax = new _core.Vector3();
var fromPointsYMax = new _core.Vector3();
var fromPointsZMax = new _core.Vector3();
var fromPointsCurrentPos = new _core.Vector3();
var fromPointsScratch = new _core.Vector3();
var fromPointsRitterCenter = new _core.Vector3();
var fromPointsMinBoxPt = new _core.Vector3();
var fromPointsMaxBoxPt = new _core.Vector3();
var fromPointsNaiveCenterScratch = new _core.Vector3();
var volumeConstant = 4.0 / 3.0 * Math.PI;

@@ -28,0 +28,0 @@

@@ -8,13 +8,13 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");
var scratchMatrix = new _math.Matrix3();
var scratchUnitary = new _math.Matrix3();
var scratchDiagonal = new _math.Matrix3();
var jMatrix = new _math.Matrix3();
var jMatrixTranspose = new _math.Matrix3();
var scratchMatrix = new _core.Matrix3();
var scratchUnitary = new _core.Matrix3();
var scratchDiagonal = new _core.Matrix3();
var jMatrix = new _core.Matrix3();
var jMatrixTranspose = new _core.Matrix3();
function computeEigenDecomposition(matrix) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var EIGEN_TOLERANCE = _math._MathUtils.EPSILON20;
var EIGEN_TOLERANCE = _core._MathUtils.EPSILON20;
var EIGEN_MAX_SWEEPS = 10;

@@ -73,3 +73,3 @@ var count = 0;

function shurDecomposition(matrix, result) {
var tolerance = _math._MathUtils.EPSILON15;
var tolerance = _core._MathUtils.EPSILON15;
var maxDiagonal = 0.0;

@@ -109,3 +109,3 @@ var rotAxis = 1;

_math.Matrix3.IDENTITY.to(result);
_core.Matrix3.IDENTITY.to(result);

@@ -112,0 +112,0 @@ result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;

@@ -6,4 +6,4 @@ "use strict";

});
exports.Intersect = exports.INTERSECT = void 0;
var INTERSECT = Object.freeze({
exports.INTERSECTION = void 0;
var INTERSECTION = Object.freeze({
OUTSIDE: -1,

@@ -13,5 +13,3 @@ INTERSECTING: 0,

});
exports.INTERSECT = INTERSECT;
var Intersect = INTERSECT;
exports.Intersect = Intersect;
exports.INTERSECTION = INTERSECTION;
//# sourceMappingURL=constants.js.map

@@ -8,6 +8,6 @@ "use strict";

});
Object.defineProperty(exports, "INTERSECT", {
Object.defineProperty(exports, "INTERSECTION", {
enumerable: true,
get: function get() {
return _constants.INTERSECT;
return _constants.INTERSECTION;
}

@@ -18,5 +18,11 @@ });

get: function get() {
return _constants.INTERSECT;
return _constants.INTERSECTION;
}
});
Object.defineProperty(exports, "INTERSECT", {
enumerable: true,
get: function get() {
return _constants.INTERSECTION;
}
});
Object.defineProperty(exports, "AxisAlignedBoundingBox", {

@@ -67,5 +73,17 @@ enumerable: true,

get: function get() {
return _boundingSphereFromPoints.makeBoundingSphereFromPoints;
return _boundingSphereFromPoints["default"];
}
});
Object.defineProperty(exports, "makeOrientedBoundingBoxFromPoints", {
enumerable: true,
get: function get() {
return _boundingBoxFromPoints["default"];
}
});
Object.defineProperty(exports, "computeEigenDecomposition", {
enumerable: true,
get: function get() {
return _computeEigenDecomposition["default"];
}
});

@@ -88,3 +106,7 @@ var _constants = require("./constants");

var _boundingSphereFromPoints = require("./algorithms/bounding-sphere-from-points");
var _boundingSphereFromPoints = _interopRequireDefault(require("./algorithms/bounding-sphere-from-points"));
var _boundingBoxFromPoints = _interopRequireDefault(require("./algorithms/bounding-box-from-points"));
var _computeEigenDecomposition = _interopRequireDefault(require("./algorithms/compute-eigen-decomposition"));
//# sourceMappingURL=index.js.map

@@ -14,8 +14,8 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");
var _constants = require("../constants");
var scratchVector = new _math.Vector3();
var scratchNormal = new _math.Vector3();
var scratchVector = new _core.Vector3();
var scratchNormal = new _core.Vector3();

@@ -29,5 +29,5 @@ var AxisAlignedBoundingBox = function () {

center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);
this.minimum = new _math.Vector3(minimum);
this.maximum = new _math.Vector3(maximum);
this.center = new _math.Vector3(center);
this.minimum = new _core.Vector3(minimum);
this.maximum = new _core.Vector3(maximum);
this.center = new _core.Vector3(center);
}

@@ -107,10 +107,10 @@

if (s - e > 0) {
return _constants.Intersect.INSIDE;
return _constants.INTERSECTION.INSIDE;
}
if (s + e < 0) {
return _constants.Intersect.OUTSIDE;
return _constants.INTERSECTION.OUTSIDE;
}
return _constants.Intersect.INTERSECTING;
return _constants.INTERSECTION.INTERSECTING;
}

@@ -117,0 +117,0 @@ }]);

@@ -16,3 +16,3 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");

@@ -23,4 +23,4 @@ var mat4 = _interopRequireWildcard(require("gl-matrix/mat4"));

var scratchVector = new _math.Vector3();
var scratchVector2 = new _math.Vector3();
var scratchVector = new _core.Vector3();
var scratchVector2 = new _core.Vector3();

@@ -33,3 +33,3 @@ var BoundingSphere = function () {

this.radius = -0;
this.center = new _math.Vector3();
this.center = new _core.Vector3();
this.fromCenterRadius(center, radius);

@@ -49,3 +49,3 @@ }

oppositeCorner = scratchVector.from(oppositeCorner);
this.center = new _math.Vector3().from(corner).add(oppositeCorner).scale(0.5);
this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
this.radius = this.center.distance(oppositeCorner);

@@ -109,10 +109,10 @@ return this;

if (distanceToPlane < -radius) {
return _constants.Intersect.OUTSIDE;
return _constants.INTERSECTION.OUTSIDE;
}
if (distanceToPlane < radius) {
return _constants.Intersect.INTERSECTING;
return _constants.INTERSECTION.INTERSECTING;
}
return _constants.Intersect.INSIDE;
return _constants.INTERSECTION.INSIDE;
}

@@ -119,0 +119,0 @@ }, {

@@ -14,3 +14,3 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");

@@ -21,6 +21,6 @@ var _constants = require("../constants");

var faces = [new _math.Vector3([1, 0, 0]), new _math.Vector3([0, 1, 0]), new _math.Vector3([0, 0, 1])];
var scratchPlaneCenter = new _math.Vector3();
var scratchPlaneNormal = new _math.Vector3();
var scratchPlane = new _plane["default"](new _math.Vector3(1.0, 0.0, 0.0), 0.0);
var faces = [new _core.Vector3([1, 0, 0]), new _core.Vector3([0, 1, 0]), new _core.Vector3([0, 0, 1])];
var scratchPlaneCenter = new _core.Vector3();
var scratchPlaneNormal = new _core.Vector3();
var scratchPlane = new _plane["default"](new _core.Vector3(1.0, 0.0, 0.0), 0.0);

@@ -49,3 +49,3 @@ var CullingVolume = function () {

this.planes = planes;
(0, _math.assert)(this.planes.every(function (plane) {
(0, _core.assert)(this.planes.every(function (plane) {
return plane instanceof _plane["default"];

@@ -109,4 +109,4 @@ }));

value: function computeVisibility(boundingVolume) {
(0, _math.assert)(boundingVolume);
var intersect = _constants.Intersect.INSIDE;
(0, _core.assert)(boundingVolume);
var intersect = _constants.INTERSECTION.INSIDE;
var _iteratorNormalCompletion2 = true;

@@ -122,7 +122,7 @@ var _didIteratorError2 = false;

switch (result) {
case _constants.Intersect.OUTSIDE:
return _constants.Intersect.OUTSIDE;
case _constants.INTERSECTION.OUTSIDE:
return _constants.INTERSECTION.OUTSIDE;
case _constants.Intersect.INTERSECTING:
intersect = _constants.Intersect.INTERSECTING;
case _constants.INTERSECTION.INTERSECTING:
intersect = _constants.INTERSECTION.INTERSECTING;
break;

@@ -153,4 +153,4 @@

value: function computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
(0, _math.assert)(boundingVolume, 'boundingVolume is required.');
(0, _math.assert)(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');
(0, _core.assert)(boundingVolume, 'boundingVolume is required.');
(0, _core.assert)(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');

@@ -174,5 +174,5 @@ if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {

if (result === _constants.Intersect.OUTSIDE) {
if (result === _constants.INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === _constants.Intersect.INTERSECTING) {
} else if (result === _constants.INTERSECTION.INTERSECTING) {
mask |= flag;

@@ -179,0 +179,0 @@ }

@@ -14,3 +14,3 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");

@@ -23,13 +23,13 @@ var _boundingSphere = _interopRequireDefault(require("./bounding-sphere"));

var scratchVector = new _math.Vector3();
var scratchOffset = new _math.Vector3();
var scratchVectorU = new _math.Vector3();
var scratchVectorV = new _math.Vector3();
var scratchVectorW = new _math.Vector3();
var scratchPPrime = new _math.Vector3();
var scratchCorner = new _math.Vector3();
var scratchToCenter = new _math.Vector3();
var fromOrientedBoundingBoxScratchU = new _math.Vector3();
var fromOrientedBoundingBoxScratchV = new _math.Vector3();
var fromOrientedBoundingBoxScratchW = new _math.Vector3();
var scratchVector = new _core.Vector3();
var scratchOffset = new _core.Vector3();
var scratchVectorU = new _core.Vector3();
var scratchVectorV = new _core.Vector3();
var scratchVectorW = new _core.Vector3();
var scratchPPrime = new _core.Vector3();
var scratchCorner = new _core.Vector3();
var scratchToCenter = new _core.Vector3();
var fromOrientedBoundingBoxScratchU = new _core.Vector3();
var fromOrientedBoundingBoxScratchV = new _core.Vector3();
var fromOrientedBoundingBoxScratchW = new _core.Vector3();
var MATRIX3 = {

@@ -52,4 +52,4 @@ COLUMN0ROW0: 0,

(0, _classCallCheck2["default"])(this, OrientedBoundingBox);
this.center = new _math.Vector3().from(center);
this.halfAxes = new _math.Matrix3(halfAxes);
this.center = new _core.Vector3().from(center);
this.halfAxes = new _core.Matrix3(halfAxes);
}

@@ -59,3 +59,3 @@

key: "clone",
value: function clone(result) {
value: function clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);

@@ -100,8 +100,8 @@ }

if (distanceToPlane <= -radEffective) {
return _constants.Intersect.OUTSIDE;
return _constants.INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return _constants.Intersect.INSIDE;
return _constants.INTERSECTION.INSIDE;
}
return _constants.Intersect.INTERSECTING;
return _constants.INTERSECTION.INTERSECTING;
}

@@ -163,3 +163,3 @@ }, {

value: function computePlaneDistances(position, direction) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [[], []];
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-0, -0];
var minDist = Number.POSITIVE_INFINITY;

@@ -212,4 +212,4 @@ var maxDist = Number.NEGATIVE_INFINITY;

maxDist = Math.max(mag, maxDist);
result.start = minDist;
result.stop = maxDist;
result[0] = minDist;
result[1] = maxDist;
return result;

@@ -216,0 +216,0 @@ }

@@ -16,3 +16,3 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");

@@ -120,9 +120,9 @@ var _perspectiveOffCenterFrustum = _interopRequireDefault(require("./perspective-off-center-frustum"));

function update(frustum) {
(0, _math.assert)(Number.isFinite(frustum.fov) && Number.isFinite(frustum.aspectRatio) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
(0, _core.assert)(Number.isFinite(frustum.fov) && Number.isFinite(frustum.aspectRatio) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
var f = frustum._offCenterFrustum;
if (frustum.fov !== frustum._fov || frustum.aspectRatio !== frustum._aspectRatio || frustum.near !== frustum._near || frustum.far !== frustum._far || frustum.xOffset !== frustum._xOffset || frustum.yOffset !== frustum._yOffset) {
(0, _math.assert)(frustum.fov >= 0 && frustum.fov < Math.PI);
(0, _math.assert)(frustum.aspectRatio > 0);
(0, _math.assert)(frustum.near >= 0 && frustum.near < frustum.far);
(0, _core.assert)(frustum.fov >= 0 && frustum.fov < Math.PI);
(0, _core.assert)(frustum.aspectRatio > 0);
(0, _core.assert)(frustum.near >= 0 && frustum.near < frustum.far);
frustum._aspectRatio = frustum.aspectRatio;

@@ -129,0 +129,0 @@ frustum._fov = frustum.fov;

@@ -16,3 +16,3 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");

@@ -27,7 +27,7 @@ var _cullingVolume = _interopRequireDefault(require("./culling-volume"));

var scratchPlaneUpVector = new _math.Vector3();
var scratchPlaneRightVector = new _math.Vector3();
var scratchPlaneNearCenter = new _math.Vector3();
var scratchPlaneFarCenter = new _math.Vector3();
var scratchPlaneNormal = new _math.Vector3();
var scratchPlaneUpVector = new _core.Vector3();
var scratchPlaneRightVector = new _core.Vector3();
var scratchPlaneNearCenter = new _core.Vector3();
var scratchPlaneFarCenter = new _core.Vector3();
var scratchPlaneNormal = new _core.Vector3();

@@ -55,4 +55,4 @@ var PerspectiveOffCenterFrustum = function () {

this._cullingVolume = new _cullingVolume["default"]([new _plane["default"](), new _plane["default"](), new _plane["default"](), new _plane["default"](), new _plane["default"](), new _plane["default"]()]);
this._perspectiveMatrix = new _math.Matrix4();
this._infinitePerspective = new _math.Matrix4();
this._perspectiveMatrix = new _core.Matrix4();
this._infinitePerspective = new _core.Matrix4();
}

@@ -80,5 +80,5 @@

value: function computeCullingVolume(position, direction, up) {
(0, _math.assert)(position, 'position is required.');
(0, _math.assert)(direction, 'direction is required.');
(0, _math.assert)(up, 'up is required.');
(0, _core.assert)(position, 'position is required.');
(0, _core.assert)(direction, 'direction is required.');
(0, _core.assert)(up, 'up is required.');
var planes = this._cullingVolume.planes;

@@ -98,3 +98,3 @@ up = scratchPlaneUpVector.copy(up).normalize();

planes[3].fromPointNormal(position, normal);
normal = new _math.Vector3().copy(direction);
normal = new _core.Vector3().copy(direction);
planes[4].fromPointNormal(nearCenter, normal);

@@ -109,7 +109,7 @@ normal.negate();

update(this);
(0, _math.assert)(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));
(0, _math.assert)(drawingBufferWidth > 0);
(0, _math.assert)(drawingBufferHeight > 0);
(0, _math.assert)(distance > 0);
(0, _math.assert)(result);
(0, _core.assert)(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));
(0, _core.assert)(drawingBufferWidth > 0);
(0, _core.assert)(drawingBufferHeight > 0);
(0, _core.assert)(distance > 0);
(0, _core.assert)(result);
var inverseNear = 1.0 / this.near;

@@ -143,3 +143,3 @@ var tanTheta = this.top * inverseNear;

function update(frustum) {
(0, _math.assert)(Number.isFinite(frustum.right) && Number.isFinite(frustum.left) && Number.isFinite(frustum.top) && Number.isFinite(frustum.bottom) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
(0, _core.assert)(Number.isFinite(frustum.right) && Number.isFinite(frustum.left) && Number.isFinite(frustum.top) && Number.isFinite(frustum.bottom) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
var top = frustum.top,

@@ -153,3 +153,3 @@ bottom = frustum.bottom,

if (top !== frustum._top || bottom !== frustum._bottom || left !== frustum._left || right !== frustum._right || near !== frustum._near || far !== frustum._far) {
(0, _math.assert)(frustum.near > 0 && frustum.near < frustum.far, 'near must be greater than zero and less than far.');
(0, _core.assert)(frustum.near > 0 && frustum.near < frustum.far, 'near must be greater than zero and less than far.');
frustum._left = left;

@@ -161,3 +161,3 @@ frustum._right = right;

frustum._far = far;
frustum._perspectiveMatrix = new _math.Matrix4().frustum({
frustum._perspectiveMatrix = new _core.Matrix4().frustum({
left: left,

@@ -170,3 +170,3 @@ right: right,

});
frustum._infinitePerspective = new _math.Matrix4().frustum({
frustum._infinitePerspective = new _core.Matrix4().frustum({
left: left,

@@ -173,0 +173,0 @@ right: right,

@@ -14,6 +14,6 @@ "use strict";

var _math = require("math.gl");
var _core = require("@math.gl/core");
var scratchPosition = new _math.Vector3();
var scratchNormal = new _math.Vector3();
var scratchPosition = new _core.Vector3();
var scratchNormal = new _core.Vector3();

@@ -25,3 +25,3 @@ var Plane = function () {

(0, _classCallCheck2["default"])(this, Plane);
this.normal = new _math.Vector3();
this.normal = new _core.Vector3();
this.distance = -0;

@@ -34,3 +34,3 @@ this.fromNormalDistance(normal, distance);

value: function fromNormalDistance(normal, distance) {
(0, _math.assert)(Number.isFinite(distance));
(0, _core.assert)(Number.isFinite(distance));
this.normal.from(normal).normalize();

@@ -53,3 +53,3 @@ this.distance = distance;

this.normal.set(a, b, c);
(0, _math.assert)((0, _math.equals)(this.normal.len(), 1));
(0, _core.assert)((0, _core.equals)(this.normal.len(), 1));
this.distance = d;

@@ -66,3 +66,3 @@ return this;

value: function equals(right) {
return (0, _math.equals)(this.distance, right.distance) && (0, _math.equals)(this.normal, right.normal);
return (0, _core.equals)(this.distance, right.distance) && (0, _core.equals)(this.normal, right.normal);
}

@@ -69,0 +69,0 @@ }, {

@@ -1,2 +0,2 @@

import { Vector3, Matrix3 } from 'math.gl';
import { Vector3, Matrix3 } from '@math.gl/core';
import computeEigenDecomposition from './compute-eigen-decomposition';

@@ -3,0 +3,0 @@ const scratchVector2 = new Vector3();

@@ -1,2 +0,2 @@

import { Vector3 } from 'math.gl';
import { Vector3 } from '@math.gl/core';
import BoundingSphere from '../lib/bounding-sphere';

@@ -16,3 +16,3 @@ const fromPointsXMin = new Vector3();

const volumeConstant = 4.0 / 3.0 * Math.PI;
export function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {
export default function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {
if (!positions || positions.length === 0) {

@@ -19,0 +19,0 @@ return result.fromCenterRadius([0, 0, 0], 0);

@@ -1,2 +0,2 @@

import { Matrix3, _MathUtils } from 'math.gl';
import { Matrix3, _MathUtils } from '@math.gl/core';
const scratchMatrix = new Matrix3();

@@ -3,0 +3,0 @@ const scratchUnitary = new Matrix3();

@@ -1,2 +0,2 @@

export const INTERSECT = Object.freeze({
export const INTERSECTION = Object.freeze({
OUTSIDE: -1,

@@ -6,3 +6,2 @@ INTERSECTING: 0,

});
export const Intersect = INTERSECT;
//# sourceMappingURL=constants.js.map

@@ -1,3 +0,2 @@

export { INTERSECT } from './constants';
export { INTERSECT as Intersect } from './constants';
export { INTERSECTION } from './constants';
export { default as AxisAlignedBoundingBox } from './lib/axis-aligned-bounding-box';

@@ -10,3 +9,7 @@ export { default as BoundingSphere } from './lib/bounding-sphere';

export { default as _PerspectiveFrustum } from './lib/perspective-frustum';
export { makeBoundingSphereFromPoints } from './algorithms/bounding-sphere-from-points';
export { default as makeBoundingSphereFromPoints } from './algorithms/bounding-sphere-from-points';
export { default as makeOrientedBoundingBoxFromPoints } from './algorithms/bounding-box-from-points';
export { default as computeEigenDecomposition } from './algorithms/compute-eigen-decomposition';
export { INTERSECTION as Intersect } from './constants';
export { INTERSECTION as INTERSECT } from './constants';
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import { Vector3 } from 'math.gl';
import { Intersect } from '../constants';
import { Vector3 } from '@math.gl/core';
import { INTERSECTION } from '../constants';
const scratchVector = new Vector3();

@@ -61,10 +61,10 @@ const scratchNormal = new Vector3();

if (s - e > 0) {
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}
if (s + e < 0) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}

@@ -71,0 +71,0 @@

@@ -1,4 +0,4 @@

import { Vector3, Matrix4 } from 'math.gl';
import { Vector3, Matrix4 } from '@math.gl/core';
import * as mat4 from 'gl-matrix/mat4';
import { Intersect } from '../constants';
import { INTERSECTION } from '../constants';
const scratchVector = new Vector3();

@@ -75,10 +75,10 @@ const scratchVector2 = new Vector3();

if (distanceToPlane < -radius) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
if (distanceToPlane < radius) {
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}

@@ -85,0 +85,0 @@

@@ -1,3 +0,3 @@

import { Vector3, Vector4, assert } from 'math.gl';
import { Intersect } from '../constants';
import { Vector3, Vector4, assert } from '@math.gl/core';
import { INTERSECTION } from '../constants';
import Plane from './plane';

@@ -59,3 +59,3 @@ const faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];

assert(boundingVolume);
let intersect = Intersect.INSIDE;
let intersect = INTERSECTION.INSIDE;

@@ -66,7 +66,7 @@ for (const plane of this.planes) {

switch (result) {
case Intersect.OUTSIDE:
return Intersect.OUTSIDE;
case INTERSECTION.OUTSIDE:
return INTERSECTION.OUTSIDE;
case Intersect.INTERSECTING:
intersect = Intersect.INTERSECTING;
case INTERSECTION.INTERSECTING:
intersect = INTERSECTION.INTERSECTING;
break;

@@ -102,5 +102,5 @@

if (result === Intersect.OUTSIDE) {
if (result === INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === Intersect.INTERSECTING) {
} else if (result === INTERSECTION.INTERSECTING) {
mask |= flag;

@@ -107,0 +107,0 @@ }

@@ -1,4 +0,4 @@

import { Vector3, Matrix3 } from 'math.gl';
import { Vector3, Matrix3 } from '@math.gl/core';
import BoundingSphere from './bounding-sphere';
import { Intersect } from '../constants';
import { INTERSECTION } from '../constants';
import makeOrientedBoundingBoxfromPoints from '../algorithms/bounding-box-from-points';

@@ -33,3 +33,3 @@ const scratchVector = new Vector3();

clone(result) {
clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);

@@ -68,8 +68,8 @@ }

if (distanceToPlane <= -radEffective) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}

@@ -127,3 +127,3 @@

computePlaneDistances(position, direction, result = [[], []]) {
computePlaneDistances(position, direction, result = [-0, -0]) {
let minDist = Number.POSITIVE_INFINITY;

@@ -176,4 +176,4 @@ let maxDist = Number.NEGATIVE_INFINITY;

maxDist = Math.max(mag, maxDist);
result.start = minDist;
result.stop = maxDist;
result[0] = minDist;
result[1] = maxDist;
return result;

@@ -180,0 +180,0 @@ }

@@ -7,3 +7,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

import { assert } from 'math.gl';
import { assert } from '@math.gl/core';
import PerspectiveOffCenterFrustum from './perspective-off-center-frustum';

@@ -10,0 +10,0 @@

@@ -7,3 +7,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

import { Vector3, Matrix4, assert } from 'math.gl';
import { Vector3, Matrix4, assert } from '@math.gl/core';
import CullingVolume from './culling-volume';

@@ -10,0 +10,0 @@ import Plane from './plane';

@@ -1,2 +0,2 @@

import { Vector3, equals, assert, MathUtils } from 'math.gl';
import { Vector3, equals, assert } from '@math.gl/core';
const scratchPosition = new Vector3();

@@ -3,0 +3,0 @@ const scratchNormal = new Vector3();

@@ -1,2 +0,2 @@

import { Vector3, Matrix3 } from 'math.gl';
import { Vector3, Matrix3 } from '@math.gl/core';
import computeEigenDecomposition from './compute-eigen-decomposition';

@@ -3,0 +3,0 @@ var scratchVector2 = new Vector3();

@@ -1,2 +0,2 @@

import { Vector3 } from 'math.gl';
import { Vector3 } from '@math.gl/core';
import BoundingSphere from '../lib/bounding-sphere';

@@ -16,3 +16,3 @@ var fromPointsXMin = new Vector3();

var volumeConstant = 4.0 / 3.0 * Math.PI;
export function makeBoundingSphereFromPoints(positions) {
export default function makeBoundingSphereFromPoints(positions) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new BoundingSphere();

@@ -19,0 +19,0 @@

@@ -1,2 +0,2 @@

import { Matrix3, _MathUtils } from 'math.gl';
import { Matrix3, _MathUtils } from '@math.gl/core';
var scratchMatrix = new Matrix3();

@@ -3,0 +3,0 @@ var scratchUnitary = new Matrix3();

@@ -1,2 +0,2 @@

export var INTERSECT = Object.freeze({
export var INTERSECTION = Object.freeze({
OUTSIDE: -1,

@@ -6,3 +6,2 @@ INTERSECTING: 0,

});
export var Intersect = INTERSECT;
//# sourceMappingURL=constants.js.map

@@ -1,3 +0,2 @@

export { INTERSECT } from './constants';
export { INTERSECT as Intersect } from './constants';
export { INTERSECTION } from './constants';
export { default as AxisAlignedBoundingBox } from './lib/axis-aligned-bounding-box';

@@ -10,3 +9,7 @@ export { default as BoundingSphere } from './lib/bounding-sphere';

export { default as _PerspectiveFrustum } from './lib/perspective-frustum';
export { makeBoundingSphereFromPoints } from './algorithms/bounding-sphere-from-points';
export { default as makeBoundingSphereFromPoints } from './algorithms/bounding-sphere-from-points';
export { default as makeOrientedBoundingBoxFromPoints } from './algorithms/bounding-box-from-points';
export { default as computeEigenDecomposition } from './algorithms/compute-eigen-decomposition';
export { INTERSECTION as Intersect } from './constants';
export { INTERSECTION as INTERSECT } from './constants';
//# sourceMappingURL=index.js.map
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3 } from 'math.gl';
import { Intersect } from '../constants';
import { Vector3 } from '@math.gl/core';
import { INTERSECTION } from '../constants';
var scratchVector = new Vector3();

@@ -94,10 +94,10 @@ var scratchNormal = new Vector3();

if (s - e > 0) {
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}
if (s + e < 0) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}

@@ -104,0 +104,0 @@ }]);

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3, Matrix4 } from 'math.gl';
import { Vector3, Matrix4 } from '@math.gl/core';
import * as mat4 from 'gl-matrix/mat4';
import { Intersect } from '../constants';
import { INTERSECTION } from '../constants';
var scratchVector = new Vector3();

@@ -91,10 +91,10 @@ var scratchVector2 = new Vector3();

if (distanceToPlane < -radius) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
if (distanceToPlane < radius) {
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}

@@ -101,0 +101,0 @@ }, {

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3, Vector4, assert } from 'math.gl';
import { Intersect } from '../constants';
import { Vector3, Vector4, assert } from '@math.gl/core';
import { INTERSECTION } from '../constants';
import Plane from './plane';

@@ -95,3 +95,3 @@ var faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];

assert(boundingVolume);
var intersect = Intersect.INSIDE;
var intersect = INTERSECTION.INSIDE;
var _iteratorNormalCompletion2 = true;

@@ -107,7 +107,7 @@ var _didIteratorError2 = false;

switch (result) {
case Intersect.OUTSIDE:
return Intersect.OUTSIDE;
case INTERSECTION.OUTSIDE:
return INTERSECTION.OUTSIDE;
case Intersect.INTERSECTING:
intersect = Intersect.INTERSECTING;
case INTERSECTION.INTERSECTING:
intersect = INTERSECTION.INTERSECTING;
break;

@@ -158,5 +158,5 @@

if (result === Intersect.OUTSIDE) {
if (result === INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === Intersect.INTERSECTING) {
} else if (result === INTERSECTION.INTERSECTING) {
mask |= flag;

@@ -163,0 +163,0 @@ }

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3, Matrix3 } from 'math.gl';
import { Vector3, Matrix3 } from '@math.gl/core';
import BoundingSphere from './bounding-sphere';
import { Intersect } from '../constants';
import { INTERSECTION } from '../constants';
import makeOrientedBoundingBoxfromPoints from '../algorithms/bounding-box-from-points';

@@ -43,3 +43,3 @@ var scratchVector = new Vector3();

key: "clone",
value: function clone(result) {
value: function clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);

@@ -84,8 +84,8 @@ }

if (distanceToPlane <= -radEffective) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}

@@ -147,3 +147,3 @@ }, {

value: function computePlaneDistances(position, direction) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [[], []];
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-0, -0];
var minDist = Number.POSITIVE_INFINITY;

@@ -196,4 +196,4 @@ var maxDist = Number.NEGATIVE_INFINITY;

maxDist = Math.max(mag, maxDist);
result.start = minDist;
result.stop = maxDist;
result[0] = minDist;
result[1] = maxDist;
return result;

@@ -200,0 +200,0 @@ }

@@ -9,3 +9,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

import { assert } from 'math.gl';
import { assert } from '@math.gl/core';
import PerspectiveOffCenterFrustum from './perspective-off-center-frustum';

@@ -12,0 +12,0 @@

@@ -9,3 +9,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

import { Vector3, Matrix4, assert } from 'math.gl';
import { Vector3, Matrix4, assert } from '@math.gl/core';
import CullingVolume from './culling-volume';

@@ -12,0 +12,0 @@ import Plane from './plane';

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3, equals as _equals, assert, MathUtils } from 'math.gl';
import { Vector3, equals as _equals, assert } from '@math.gl/core';
var scratchPosition = new Vector3();

@@ -5,0 +5,0 @@ var scratchNormal = new Vector3();

@@ -8,3 +8,3 @@ {

},
"version": "3.1.3",
"version": "3.2.0-alpha.1",
"keywords": [

@@ -30,2 +30,3 @@ "webgl",

},
"types": "src/index.d.ts",
"main": "dist/es5/index.js",

@@ -40,6 +41,6 @@ "module": "dist/esm/index.js",

"@babel/runtime": "^7.0.0",
"@math.gl/core": "3.1.3",
"@math.gl/core": "3.2.0-alpha.1",
"gl-matrix": "^3.0.0"
},
"gitHead": "51993e1f66ea6ccff5977f2d1466e636917061c9"
"gitHead": "f342933ca13fa606bd60ac82bb24bb2959b13b32"
}
// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
import {Vector3, Matrix3} from 'math.gl';
import {Vector3, Matrix3} from '@math.gl/core';
import computeEigenDecomposition from './compute-eigen-decomposition';

@@ -24,5 +24,2 @@

// Computes an instance of an OrientedBoundingBox of the given positions.
// This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).
// Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf
// eslint-disable-next-line max-statements

@@ -29,0 +26,0 @@ export default function makeOrientedBoundingBoxfromPoints(positions, result) {

// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
import {Vector3} from 'math.gl';
import {Vector3} from '@math.gl/core';
import BoundingSphere from '../lib/bounding-sphere';

@@ -22,15 +22,3 @@

/*
Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.
The bounding sphere is computed by running two algorithms, a naive algorithm and
Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.
*
@param {Vector3[]} [positions] An array of points that the bounding sphere will enclose. Each point must have <code>x</code>, <code>y</code>, and <code>z</code> properties.
@param {BoundingSphere} [result] The object onto which to store the result.
@returns {BoundingSphere} The modified result parameter or a new BoundingSphere instance if one was not provided.
*
@see {@link http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding/|Bounding Sphere computation article}
*/
export function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {
export default function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {
if (!positions || positions.length === 0) {

@@ -176,5 +164,7 @@ return result.fromCenterRadius([0, 0, 0], 0);

ritterCenter.to(result.center);
// @ts-ignore TS2540: Cannot assign to 'radius' because it is a read-only property.
result.radius = ritterRadius;
} else {
naiveCenter.to(result.center);
// @ts-ignore TS2540: Cannot assign to 'radius' because it is a read-only property.
result.radius = naiveRadius;

@@ -181,0 +171,0 @@ }

// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
import {Matrix3, _MathUtils} from 'math.gl';
import {Matrix3, _MathUtils} from '@math.gl/core';
const scratchMatrix = new Matrix3();
const scratchUnitary = new Matrix3();

@@ -14,36 +13,2 @@ const scratchDiagonal = new Matrix3();

/**
* Computes the eigenvectors and eigenvalues of a symmetric matrix.
* <p>
* Returns a diagonal matrix and unitary matrix such that:
* <code>matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)</code>
* </p>
* <p>
* The values along the diagonal of the diagonal matrix are the eigenvalues. The columns
* of the unitary matrix are the corresponding eigenvectors.
* </p>
*
* @param {Matrix3} matrix The matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.
* @param {Object} [result] An object with unitary and diagonal properties which are matrices onto which to store the result.
* @returns {Object} An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.
*
* @example
* const a = //... symmetric matrix
* const result = {
* unitary : new Matrix3(),
* diagonal : new Matrix3()
* };
* computeEigenDecomposition(a, result);
*
* const unitaryTranspose = Matrix3.transpose(result.unitary, new Matrix3());
* const b = Matrix3.multiply(result.unitary, result.diagonal, new Matrix3());
* Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a
*
* const lambda = result.diagonal.getColumn(0, new Vector3()).x; // first eigenvalue
* const v = result.unitary.getColumn(0, new Vector3()); // first eigenvector
* const c = v.multiplyByScalar(lambda); // equal to v.transformByMatrix3(a)
*/
// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,
// section 8.4.3 The Classical Jacobi Algorithm
export default function computeEigenDecomposition(matrix, result = {}) {

@@ -50,0 +15,0 @@ const EIGEN_TOLERANCE = _MathUtils.EPSILON20;

// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
export const INTERSECT = Object.freeze({
export const INTERSECTION = Object.freeze({
OUTSIDE: -1, // Represents that an object is not contained within the frustum.

@@ -9,3 +9,1 @@ INTERSECTING: 0, // Represents that an object intersects one of the frustum's planes.

});
export const Intersect = INTERSECT;
// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
export {INTERSECT} from './constants';
export {INTERSECT as Intersect} from './constants';
export {INTERSECTION} from './constants';

@@ -16,2 +15,8 @@ export {default as AxisAlignedBoundingBox} from './lib/axis-aligned-bounding-box';

export {makeBoundingSphereFromPoints} from './algorithms/bounding-sphere-from-points';
export {default as makeBoundingSphereFromPoints} from './algorithms/bounding-sphere-from-points';
export {default as makeOrientedBoundingBoxFromPoints} from './algorithms/bounding-box-from-points';
export {default as computeEigenDecomposition} from './algorithms/compute-eigen-decomposition';
// Deprecated
export {INTERSECTION as Intersect} from './constants';
export {INTERSECTION as INTERSECT} from './constants';

@@ -1,3 +0,3 @@

import {Vector3} from 'math.gl';
import {Intersect} from '../constants';
import {Vector3} from '@math.gl/core';
import {INTERSECTION} from '../constants';

@@ -7,14 +7,2 @@ const scratchVector = new Vector3();

/**
* Creates an instance of an AxisAlignedBoundingBox from the minimum and maximum points along the x, y, and z axes.
* @alias AxisAlignedBoundingBox
* @constructor
*
* @param {Vector3} [minimum=0, 0, 0] The minimum point along the x, y, and z axes.
* @param {Vector3} [maximum=0, 0, 0] The maximum point along the x, y, and z axes.
* @param {Vector3} [center] The center of the box; automatically computed if not supplied.
*
* @see BoundingSphere
* @see BoundingRectangle
*/
export default class AxisAlignedBoundingBox {

@@ -56,3 +44,2 @@ constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center = null) {

* @param {Vector3[]} positions List of points that the bounding box will enclose. Each point must have a <code>x</code>, <code>y</code>, and <code>z</code> properties.
* @param {AxisAlignedBoundingBox} [result] The object onto which to store the result.
* @returns {AxisAlignedBoundingBox} The modified result parameter or a new AxisAlignedBoundingBox instance if one was not provided.

@@ -132,8 +119,2 @@ *

* Determines which side of a plane a box is located.
*
* @param {Plane} plane The plane to test against.
* @returns {Intersect} {@link Intersect.INSIDE} if the entire box is on the side of the plane
* the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is
* on the opposite side, and {@link Intersect.INTERSECTING} if the box
* intersects the plane.
*/

@@ -150,3 +131,3 @@ intersectPlane(plane) {

if (s - e > 0) {
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}

@@ -156,7 +137,7 @@

// Not in front because normals point inward
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}
}

@@ -5,5 +5,5 @@ // This file is derived from the Cesium math library under Apache 2 license

/* eslint-disable */
import {Vector3, Matrix4} from 'math.gl';
import {Vector3, Matrix4} from '@math.gl/core';
import * as mat4 from 'gl-matrix/mat4';
import {Intersect} from '../constants';
import {INTERSECTION} from '../constants';

@@ -115,10 +115,10 @@ // import Rectangle from './rectangle';

if (distanceToPlane < -radius) {
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
}
// The center point is positive side of the plane, but radius extends beyond it; partial overlap
if (distanceToPlane < radius) {
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}
// The center point and radius is positive side of the plane
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}

@@ -125,0 +125,0 @@

@@ -5,4 +5,4 @@ // This file is derived from the Cesium math library under Apache 2 license

/* eslint-disable */
import {Vector3, Vector4, assert} from 'math.gl';
import {Intersect} from '../constants';
import {Vector3, Vector4, assert} from '@math.gl/core';
import {INTERSECTION} from '../constants';
import Plane from './plane';

@@ -93,13 +93,13 @@

// const planes = this.planes;
let intersect = Intersect.INSIDE;
let intersect = INTERSECTION.INSIDE;
for (const plane of this.planes) {
const result = boundingVolume.intersectPlane(plane);
switch (result) {
case Intersect.OUTSIDE:
case INTERSECTION.OUTSIDE:
// We are done
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
case Intersect.INTERSECTING:
case INTERSECTION.INTERSECTING:
// If no other intersection is outside, return INTERSECTING
intersect = Intersect.INTERSECTING;
intersect = INTERSECTION.INTERSECTING;
break;

@@ -148,5 +148,5 @@

const result = boundingVolume.intersectPlane(plane);
if (result === Intersect.OUTSIDE) {
if (result === INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === Intersect.INTERSECTING) {
} else if (result === INTERSECTION.INTERSECTING) {
mask |= flag;

@@ -153,0 +153,0 @@ }

// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
import {Vector3, Matrix3} from 'math.gl';
import {Vector3, Matrix3} from '@math.gl/core';
import BoundingSphere from './bounding-sphere';
import {Intersect} from '../constants';
import {INTERSECTION} from '../constants';
import makeOrientedBoundingBoxfromPoints from '../algorithms/bounding-box-from-points';
const scratchVector = new Vector3();
const scratchOffset = new Vector3();

@@ -35,3 +35,2 @@ const scratchVectorU = new Vector3();

export default class OrientedBoundingBox {
// An OrientedBoundingBox of some object is a closed and convex cuboid. It can provide a tighter bounding volume than {@link BoundingSphere} or {@link AxisAlignedBoundingBox} in many cases.
constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {

@@ -43,3 +42,3 @@ this.center = new Vector3().from(center);

// Duplicates a OrientedBoundingBox instance.
clone(result) {
clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);

@@ -82,5 +81,7 @@ }

*
* @param {OrientedBoundingBox} box The oriented bounding box to test.
* @param {Plane} plane The plane to test against.
* @returns {Intersect} {@link Intersect.INSIDE} if the entire box is on the side of the plane the normal is pointing, {@link Intersect.OUTSIDE} if the entire box is on the opposite side, and {@link Intersect.INTERSECTING} if the box intersects the plane.
* @param plane The plane to test against.
* @returns
* - `INTERSECTION.INSIDE` if the entire box is on the side of the plane the normal is pointing.
* - `INTERSECTION.OUTSIDE` if the entire box is on the opposite side.
* - `INTERSECTION.INTERSECTING` if the box intersects the plane.
*/

@@ -117,8 +118,8 @@ intersectPlane(plane) {

// The entire box is on the negative side of the plane normal
return Intersect.OUTSIDE;
return INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
// The entire box is on the positive side of the plane normal
return Intersect.INSIDE;
return INTERSECTION.INSIDE;
}
return Intersect.INTERSECTING;
return INTERSECTION.INTERSECTING;
}

@@ -190,3 +191,3 @@

// eslint-disable-next-line max-statements
computePlaneDistances(position, direction, result = [[], []]) {
computePlaneDistances(position, direction, result = [-0, -0]) {
let minDist = Number.POSITIVE_INFINITY;

@@ -306,4 +307,4 @@ let maxDist = Number.NEGATIVE_INFINITY;

result.start = minDist;
result.stop = maxDist;
result[0] = minDist;
result[1] = maxDist;
return result;

@@ -310,0 +311,0 @@ }

@@ -8,3 +8,5 @@ // This file is derived from the Cesium math library under Apache 2 license

import {assert} from 'math.gl';
// @ts-nocheck
import {assert} from '@math.gl/core';
import PerspectiveOffCenterFrustum from './perspective-off-center-frustum';

@@ -151,4 +153,2 @@

* @readonly
*
* @see PerspectiveFrustum#infiniteProjectionMatrix
*/

@@ -155,0 +155,0 @@ get projectionMatrix() {

@@ -8,3 +8,5 @@ // This file is derived from the Cesium math library under Apache 2 license

import {Vector3, Matrix4, assert} from 'math.gl';
// @ts-nocheck
import {Vector3, Matrix4, assert} from '@math.gl/core';
import CullingVolume from './culling-volume';

@@ -11,0 +13,0 @@ import Plane from './plane';

@@ -5,3 +5,3 @@ // This file is derived from the Cesium math library under Apache 2 license

/* eslint-disable */
import {Vector3, equals, assert, MathUtils} from 'math.gl';
import {Vector3, equals, assert} from '@math.gl/core';

@@ -8,0 +8,0 @@ const scratchPosition = new Vector3();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc