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

@math.gl/culling

Package Overview
Dependencies
Maintainers
3
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.5.6 to 3.6.0-alpha.1

dist/constants.d.ts

12

dist/es5/constants.js

@@ -7,8 +7,10 @@ "use strict";

exports.INTERSECTION = void 0;
var INTERSECTION = Object.freeze({
OUTSIDE: -1,
INTERSECTING: 0,
INSIDE: 1
});
let INTERSECTION;
exports.INTERSECTION = INTERSECTION;
(function (INTERSECTION) {
INTERSECTION[INTERSECTION["OUTSIDE"] = -1] = "OUTSIDE";
INTERSECTION[INTERSECTION["INTERSECTING"] = 0] = "INTERSECTING";
INTERSECTION[INTERSECTION["INSIDE"] = 1] = "INSIDE";
})(INTERSECTION || (exports.INTERSECTION = INTERSECTION = {}));
//# sourceMappingURL=constants.js.map

@@ -10,21 +10,9 @@ "use strict";

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

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

enumerable: true,
get: function get() {
get: function () {
return _boundingSphere.default;

@@ -42,3 +30,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _orientedBoundingBox.default;

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

enumerable: true,
get: function get() {
get: function () {
return _cullingVolume.default;

@@ -56,3 +44,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _plane.default;

@@ -63,3 +51,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _perspectiveOffCenterFrustum.default;

@@ -70,3 +58,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _perspectiveFrustum.default;

@@ -77,3 +65,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _boundingSphereFromPoints.default;

@@ -84,3 +72,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _boundingBoxFromPoints.makeAxisAlignedBoundingBoxFromPoints;

@@ -91,3 +79,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _boundingBoxFromPoints.makeOrientedBoundingBoxFromPoints;

@@ -98,3 +86,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _computeEigenDecomposition.default;

@@ -101,0 +89,0 @@ }

@@ -19,15 +19,9 @@ "use strict";

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
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 = {
const scratchVector2 = new _core.Vector3();
const scratchVector3 = new _core.Vector3();
const scratchVector4 = new _core.Vector3();
const scratchVector5 = new _core.Vector3();
const scratchVector6 = new _core.Vector3();
const scratchCovarianceResult = new _core.Matrix3();
const scratchEigenResult = {
diagonal: new _core.Matrix3(),

@@ -37,5 +31,3 @@ unitary: new _core.Matrix3()

function makeOrientedBoundingBoxFromPoints(positions) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _orientedBoundingBox.default();
function makeOrientedBoundingBoxFromPoints(positions, result = new _orientedBoundingBox.default()) {
if (!positions || positions.length === 0) {

@@ -47,46 +39,26 @@ result.halfAxes = new _core.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);

var length = positions.length;
var meanPoint = new _core.Vector3(0, 0, 0);
const length = positions.length;
const meanPoint = new _core.Vector3(0, 0, 0);
var _iterator = _createForOfIteratorHelper(positions),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var position = _step.value;
meanPoint.add(position);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (const position of positions) {
meanPoint.add(position);
}
var invLength = 1.0 / length;
const invLength = 1.0 / length;
meanPoint.multiplyByScalar(invLength);
var exx = 0.0;
var exy = 0.0;
var exz = 0.0;
var eyy = 0.0;
var eyz = 0.0;
var ezz = 0.0;
let exx = 0.0;
let exy = 0.0;
let exz = 0.0;
let eyy = 0.0;
let eyz = 0.0;
let ezz = 0.0;
var _iterator2 = _createForOfIteratorHelper(positions),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var _position = _step2.value;
var p = scratchVector2.copy(_position).subtract(meanPoint);
exx += p.x * p.x;
exy += p.x * p.y;
exz += p.x * p.z;
eyy += p.y * p.y;
eyz += p.y * p.z;
ezz += p.z * p.z;
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
for (const position of positions) {
const p = scratchVector2.copy(position).subtract(meanPoint);
exx += p.x * p.x;
exy += p.x * p.y;
exz += p.x * p.z;
eyy += p.y * p.y;
eyz += p.y * p.z;
ezz += p.z * p.z;
}

@@ -100,3 +72,3 @@

ezz *= invLength;
var covarianceMatrix = scratchCovarianceResult;
const covarianceMatrix = scratchCovarianceResult;
covarianceMatrix[0] = exx;

@@ -111,35 +83,24 @@ covarianceMatrix[1] = exy;

covarianceMatrix[8] = ezz;
const {
unitary
} = (0, _computeEigenDecomposition.default)(covarianceMatrix, scratchEigenResult);
const rotation = result.halfAxes.copy(unitary);
let v1 = rotation.getColumn(0, scratchVector4);
let v2 = rotation.getColumn(1, scratchVector5);
let v3 = rotation.getColumn(2, scratchVector6);
let u1 = -Number.MAX_VALUE;
let u2 = -Number.MAX_VALUE;
let u3 = -Number.MAX_VALUE;
let l1 = Number.MAX_VALUE;
let l2 = Number.MAX_VALUE;
let l3 = Number.MAX_VALUE;
var _computeEigenDecompos = (0, _computeEigenDecomposition.default)(covarianceMatrix, scratchEigenResult),
unitary = _computeEigenDecompos.unitary;
var rotation = result.halfAxes.copy(unitary);
var v1 = rotation.getColumn(0, scratchVector4);
var v2 = rotation.getColumn(1, scratchVector5);
var v3 = rotation.getColumn(2, scratchVector6);
var u1 = -Number.MAX_VALUE;
var u2 = -Number.MAX_VALUE;
var u3 = -Number.MAX_VALUE;
var l1 = Number.MAX_VALUE;
var l2 = Number.MAX_VALUE;
var l3 = Number.MAX_VALUE;
var _iterator3 = _createForOfIteratorHelper(positions),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var _position2 = _step3.value;
scratchVector2.copy(_position2);
u1 = Math.max(scratchVector2.dot(v1), u1);
u2 = Math.max(scratchVector2.dot(v2), u2);
u3 = Math.max(scratchVector2.dot(v3), u3);
l1 = Math.min(scratchVector2.dot(v1), l1);
l2 = Math.min(scratchVector2.dot(v2), l2);
l3 = Math.min(scratchVector2.dot(v3), l3);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
for (const position of positions) {
scratchVector2.copy(position);
u1 = Math.max(scratchVector2.dot(v1), u1);
u2 = Math.max(scratchVector2.dot(v2), u2);
u3 = Math.max(scratchVector2.dot(v3), u3);
l1 = Math.min(scratchVector2.dot(v1), l1);
l2 = Math.min(scratchVector2.dot(v2), l2);
l3 = Math.min(scratchVector2.dot(v3), l3);
}

@@ -151,4 +112,4 @@

result.center.copy(v1).add(v2).add(v3);
var scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
var scaleMatrix = new _core.Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);
const scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
const scaleMatrix = new _core.Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);
result.halfAxes.multiplyRight(scaleMatrix);

@@ -158,5 +119,3 @@ return result;

function makeAxisAlignedBoundingBoxFromPoints(positions) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _axisAlignedBoundingBox.default();
function makeAxisAlignedBoundingBoxFromPoints(positions, result = new _axisAlignedBoundingBox.default()) {
if (!positions || positions.length === 0) {

@@ -170,29 +129,19 @@ result.minimum.set(0, 0, 0);

var minimumX = positions[0][0];
var minimumY = positions[0][1];
var minimumZ = positions[0][2];
var maximumX = positions[0][0];
var maximumY = positions[0][1];
var maximumZ = positions[0][2];
let minimumX = positions[0][0];
let minimumY = positions[0][1];
let minimumZ = positions[0][2];
let maximumX = positions[0][0];
let maximumY = positions[0][1];
let maximumZ = positions[0][2];
var _iterator4 = _createForOfIteratorHelper(positions),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var p = _step4.value;
var x = p[0];
var y = p[1];
var z = p[2];
minimumX = Math.min(x, minimumX);
maximumX = Math.max(x, maximumX);
minimumY = Math.min(y, minimumY);
maximumY = Math.max(y, maximumY);
minimumZ = Math.min(z, minimumZ);
maximumZ = Math.max(z, maximumZ);
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
for (const p of positions) {
const x = p[0];
const y = p[1];
const z = p[2];
minimumX = Math.min(x, minimumX);
maximumX = Math.max(x, maximumX);
minimumY = Math.min(y, minimumY);
maximumY = Math.max(y, maximumY);
minimumZ = Math.min(z, minimumZ);
maximumZ = Math.max(z, maximumZ);
}

@@ -199,0 +148,0 @@

@@ -14,25 +14,17 @@ "use strict";

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
const fromPointsXMin = new _core.Vector3();
const fromPointsYMin = new _core.Vector3();
const fromPointsZMin = new _core.Vector3();
const fromPointsXMax = new _core.Vector3();
const fromPointsYMax = new _core.Vector3();
const fromPointsZMax = new _core.Vector3();
const fromPointsCurrentPos = new _core.Vector3();
const fromPointsScratch = new _core.Vector3();
const fromPointsRitterCenter = new _core.Vector3();
const fromPointsMinBoxPt = new _core.Vector3();
const fromPointsMaxBoxPt = new _core.Vector3();
const fromPointsNaiveCenterScratch = new _core.Vector3();
const volumeConstant = 4.0 / 3.0 * Math.PI;
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
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;
function makeBoundingSphereFromPoints(positions) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new _boundingSphere.default();
function makeBoundingSphereFromPoints(positions, result = new _boundingSphere.default()) {
if (!positions || positions.length === 0) {

@@ -42,57 +34,47 @@ return result.fromCenterRadius([0, 0, 0], 0);

var currentPos = fromPointsCurrentPos.copy(positions[0]);
var xMin = fromPointsXMin.copy(currentPos);
var yMin = fromPointsYMin.copy(currentPos);
var zMin = fromPointsZMin.copy(currentPos);
var xMax = fromPointsXMax.copy(currentPos);
var yMax = fromPointsYMax.copy(currentPos);
var zMax = fromPointsZMax.copy(currentPos);
const currentPos = fromPointsCurrentPos.copy(positions[0]);
const xMin = fromPointsXMin.copy(currentPos);
const yMin = fromPointsYMin.copy(currentPos);
const zMin = fromPointsZMin.copy(currentPos);
const xMax = fromPointsXMax.copy(currentPos);
const yMax = fromPointsYMax.copy(currentPos);
const zMax = fromPointsZMax.copy(currentPos);
var _iterator = _createForOfIteratorHelper(positions),
_step;
for (const position of positions) {
currentPos.copy(position);
const x = currentPos.x;
const y = currentPos.y;
const z = currentPos.z;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var position = _step.value;
currentPos.copy(position);
var x = currentPos.x;
var y = currentPos.y;
var z = currentPos.z;
if (x < xMin.x) {
xMin.copy(currentPos);
}
if (x < xMin.x) {
xMin.copy(currentPos);
}
if (x > xMax.x) {
xMax.copy(currentPos);
}
if (x > xMax.x) {
xMax.copy(currentPos);
}
if (y < yMin.y) {
yMin.copy(currentPos);
}
if (y < yMin.y) {
yMin.copy(currentPos);
}
if (y > yMax.y) {
yMax.copy(currentPos);
}
if (y > yMax.y) {
yMax.copy(currentPos);
}
if (z < zMin.z) {
zMin.copy(currentPos);
}
if (z < zMin.z) {
zMin.copy(currentPos);
}
if (z > zMax.z) {
zMax.copy(currentPos);
}
if (z > zMax.z) {
zMax.copy(currentPos);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
var xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();
var ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();
var zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();
var diameter1 = xMin;
var diameter2 = xMax;
var maxSpan = xSpan;
const xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();
const ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();
const zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();
let diameter1 = xMin;
let diameter2 = xMax;
let maxSpan = xSpan;

@@ -111,48 +93,38 @@ if (ySpan > maxSpan) {

var ritterCenter = fromPointsRitterCenter;
const ritterCenter = fromPointsRitterCenter;
ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
var radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();
var ritterRadius = Math.sqrt(radiusSquared);
var minBoxPt = fromPointsMinBoxPt;
let radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();
let ritterRadius = Math.sqrt(radiusSquared);
const minBoxPt = fromPointsMinBoxPt;
minBoxPt.x = xMin.x;
minBoxPt.y = yMin.y;
minBoxPt.z = zMin.z;
var maxBoxPt = fromPointsMaxBoxPt;
const maxBoxPt = fromPointsMaxBoxPt;
maxBoxPt.x = xMax.x;
maxBoxPt.y = yMax.y;
maxBoxPt.z = zMax.z;
var naiveCenter = fromPointsNaiveCenterScratch.copy(minBoxPt).add(maxBoxPt).multiplyByScalar(0.5);
var naiveRadius = 0;
const naiveCenter = fromPointsNaiveCenterScratch.copy(minBoxPt).add(maxBoxPt).multiplyByScalar(0.5);
let naiveRadius = 0;
var _iterator2 = _createForOfIteratorHelper(positions),
_step2;
for (const position of positions) {
currentPos.copy(position);
const r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var _position = _step2.value;
currentPos.copy(_position);
var r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();
if (r > naiveRadius) {
naiveRadius = r;
}
if (r > naiveRadius) {
naiveRadius = r;
}
const oldCenterToPointSquared = fromPointsScratch.copy(currentPos).subtract(ritterCenter).magnitudeSquared();
var oldCenterToPointSquared = fromPointsScratch.copy(currentPos).subtract(ritterCenter).magnitudeSquared();
if (oldCenterToPointSquared > radiusSquared) {
var oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
var oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
if (oldCenterToPointSquared > radiusSquared) {
const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
radiusSquared = ritterRadius * ritterRadius;
const oldToNew = oldCenterToPoint - ritterRadius;
ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}

@@ -159,0 +131,0 @@

@@ -10,19 +10,18 @@ "use strict";

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();
const scratchMatrix = new _core.Matrix3();
const scratchUnitary = new _core.Matrix3();
const scratchDiagonal = new _core.Matrix3();
const jMatrix = new _core.Matrix3();
const jMatrixTranspose = new _core.Matrix3();
function computeEigenDecomposition(matrix) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var EIGEN_TOLERANCE = _core._MathUtils.EPSILON20;
var EIGEN_MAX_SWEEPS = 10;
var count = 0;
var sweep = 0;
var unitaryMatrix = scratchUnitary;
var diagonalMatrix = scratchDiagonal;
function computeEigenDecomposition(matrix, result = {}) {
const EIGEN_TOLERANCE = _core._MathUtils.EPSILON20;
const EIGEN_MAX_SWEEPS = 10;
let count = 0;
let sweep = 0;
const unitaryMatrix = scratchUnitary;
const diagonalMatrix = scratchDiagonal;
unitaryMatrix.identity();
diagonalMatrix.copy(matrix);
var epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);
const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);

@@ -48,6 +47,6 @@ while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {

function computeFrobeniusNorm(matrix) {
var norm = 0.0;
let norm = 0.0;
for (var i = 0; i < 9; ++i) {
var temp = matrix[i];
for (let i = 0; i < 9; ++i) {
const temp = matrix[i];
norm += temp * temp;

@@ -59,10 +58,10 @@ }

var rowVal = [1, 0, 0];
var colVal = [2, 2, 1];
const rowVal = [1, 0, 0];
const colVal = [2, 2, 1];
function offDiagonalFrobeniusNorm(matrix) {
var norm = 0.0;
let norm = 0.0;
for (var i = 0; i < 3; ++i) {
var temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];
for (let i = 0; i < 3; ++i) {
const temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];
norm += 2.0 * temp * temp;

@@ -75,8 +74,8 @@ }

function shurDecomposition(matrix, result) {
var tolerance = _core._MathUtils.EPSILON15;
var maxDiagonal = 0.0;
var rotAxis = 1;
const tolerance = _core._MathUtils.EPSILON15;
let maxDiagonal = 0.0;
let rotAxis = 1;
for (var i = 0; i < 3; ++i) {
var temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);
for (let i = 0; i < 3; ++i) {
const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);

@@ -89,13 +88,13 @@ if (temp > maxDiagonal) {

var p = rowVal[rotAxis];
var q = colVal[rotAxis];
var c = 1.0;
var s = 0.0;
const p = rowVal[rotAxis];
const q = colVal[rotAxis];
let c = 1.0;
let s = 0.0;
if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p)]) > tolerance) {
var qq = matrix[scratchMatrix.getElementIndex(q, q)];
var pp = matrix[scratchMatrix.getElementIndex(p, p)];
var qp = matrix[scratchMatrix.getElementIndex(q, p)];
var tau = (qq - pp) / 2.0 / qp;
var t;
const qq = matrix[scratchMatrix.getElementIndex(q, q)];
const pp = matrix[scratchMatrix.getElementIndex(p, p)];
const qp = matrix[scratchMatrix.getElementIndex(q, p)];
const tau = (qq - pp) / 2.0 / qp;
let t;

@@ -102,0 +101,0 @@ if (tau < 0.0) {

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -19,11 +17,11 @@

var scratchVector = new _core.Vector3();
var scratchNormal = new _core.Vector3();
const scratchVector = new _core.Vector3();
const scratchNormal = new _core.Vector3();
var AxisAlignedBoundingBox = function () {
function AxisAlignedBoundingBox() {
var minimum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];
var maximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
var center = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
(0, _classCallCheck2.default)(this, AxisAlignedBoundingBox);
class AxisAlignedBoundingBox {
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center) {
(0, _defineProperty2.default)(this, "center", void 0);
(0, _defineProperty2.default)(this, "halfDiagonal", void 0);
(0, _defineProperty2.default)(this, "minimum", void 0);
(0, _defineProperty2.default)(this, "maximum", void 0);
center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);

@@ -36,76 +34,72 @@ this.center = new _core.Vector3(center);

(0, _createClass2.default)(AxisAlignedBoundingBox, [{
key: "clone",
value: function clone() {
return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);
}
}, {
key: "equals",
value: function equals(right) {
return this === right || Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum);
}
}, {
key: "transform",
value: function transform(transformation) {
this.center.transformAsPoint(transformation);
this.halfDiagonal.transform(transformation);
this.minimum.transform(transformation);
this.maximum.transform(transformation);
return this;
}
}, {
key: "intersectPlane",
value: function intersectPlane(plane) {
var halfDiagonal = this.halfDiagonal;
var normal = scratchNormal.from(plane.normal);
var e = halfDiagonal.x * Math.abs(normal.x) + halfDiagonal.y * Math.abs(normal.y) + halfDiagonal.z * Math.abs(normal.z);
var s = this.center.dot(normal) + plane.distance;
clone() {
return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);
}
if (s - e > 0) {
return _constants.INTERSECTION.INSIDE;
}
equals(right) {
return this === right || Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum);
}
if (s + e < 0) {
return _constants.INTERSECTION.OUTSIDE;
}
transform(transform) {
this.center.transformAsPoint(transform);
this.halfDiagonal.transform(transform);
this.minimum.transform(transform);
this.maximum.transform(transform);
return this;
}
return _constants.INTERSECTION.INTERSECTING;
intersectPlane(plane) {
const {
halfDiagonal
} = this;
const normal = scratchNormal.from(plane.normal);
const e = halfDiagonal.x * Math.abs(normal.x) + halfDiagonal.y * Math.abs(normal.y) + halfDiagonal.z * Math.abs(normal.z);
const s = this.center.dot(normal) + plane.distance;
if (s - e > 0) {
return _constants.INTERSECTION.INSIDE;
}
}, {
key: "distanceTo",
value: function distanceTo(point) {
return Math.sqrt(this.distanceSquaredTo(point));
if (s + e < 0) {
return _constants.INTERSECTION.OUTSIDE;
}
}, {
key: "distanceSquaredTo",
value: function distanceSquaredTo(point) {
var offset = scratchVector.from(point).subtract(this.center);
var halfDiagonal = this.halfDiagonal;
var distanceSquared = 0.0;
var d;
d = Math.abs(offset.x) - halfDiagonal.x;
if (d > 0) {
distanceSquared += d * d;
}
return _constants.INTERSECTION.INTERSECTING;
}
d = Math.abs(offset.y) - halfDiagonal.y;
distanceTo(point) {
return Math.sqrt(this.distanceSquaredTo(point));
}
if (d > 0) {
distanceSquared += d * d;
}
distanceSquaredTo(point) {
const offset = scratchVector.from(point).subtract(this.center);
const {
halfDiagonal
} = this;
let distanceSquared = 0.0;
let d;
d = Math.abs(offset.x) - halfDiagonal.x;
d = Math.abs(offset.z) - halfDiagonal.z;
if (d > 0) {
distanceSquared += d * d;
}
if (d > 0) {
distanceSquared += d * d;
}
d = Math.abs(offset.y) - halfDiagonal.y;
return distanceSquared;
if (d > 0) {
distanceSquared += d * d;
}
}]);
return AxisAlignedBoundingBox;
}();
d = Math.abs(offset.z) - halfDiagonal.z;
if (d > 0) {
distanceSquared += d * d;
}
return distanceSquared;
}
}
exports.default = AxisAlignedBoundingBox;
//# sourceMappingURL=axis-aligned-bounding-box.js.map

@@ -5,4 +5,2 @@ "use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -13,6 +11,4 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -24,14 +20,13 @@

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var scratchVector = new _core.Vector3();
var scratchVector2 = new _core.Vector3();
const scratchVector = new _core.Vector3();
const scratchVector2 = new _core.Vector3();
var BoundingSphere = function () {
function BoundingSphere() {
var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];
var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;
(0, _classCallCheck2.default)(this, BoundingSphere);
class BoundingSphere {
constructor(center = [0, 0, 0], radius = 0.0) {
(0, _defineProperty2.default)(this, "center", void 0);
(0, _defineProperty2.default)(this, "radius", void 0);
this.radius = -0;

@@ -42,107 +37,95 @@ this.center = new _core.Vector3();

(0, _createClass2.default)(BoundingSphere, [{
key: "fromCenterRadius",
value: function fromCenterRadius(center, radius) {
this.center.from(center);
this.radius = radius;
return this;
fromCenterRadius(center, radius) {
this.center.from(center);
this.radius = radius;
return this;
}
fromCornerPoints(corner, oppositeCorner) {
oppositeCorner = scratchVector.from(oppositeCorner);
this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
this.radius = this.center.distance(oppositeCorner);
return this;
}
equals(right) {
return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
}
clone() {
return new BoundingSphere(this.center, this.radius);
}
union(boundingSphere) {
const leftCenter = this.center;
const leftRadius = this.radius;
const rightCenter = boundingSphere.center;
const rightRadius = boundingSphere.radius;
const toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);
const centerSeparation = toRightCenter.magnitude();
if (leftRadius >= centerSeparation + rightRadius) {
return this.clone();
}
}, {
key: "fromCornerPoints",
value: function fromCornerPoints(corner, oppositeCorner) {
oppositeCorner = scratchVector.from(oppositeCorner);
this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
this.radius = this.center.distance(oppositeCorner);
return this;
if (rightRadius >= centerSeparation + leftRadius) {
return boundingSphere.clone();
}
}, {
key: "equals",
value: function equals(right) {
return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
}
}, {
key: "clone",
value: function clone() {
return new BoundingSphere(this.center, this.radius);
}
}, {
key: "union",
value: function union(boundingSphere) {
var leftCenter = this.center;
var leftRadius = this.radius;
var rightCenter = boundingSphere.center;
var rightRadius = boundingSphere.radius;
var toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);
var centerSeparation = toRightCenter.magnitude();
if (leftRadius >= centerSeparation + rightRadius) {
return this.clone();
}
const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
scratchVector2.copy(toRightCenter).scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation).add(leftCenter);
this.center.copy(scratchVector2);
this.radius = halfDistanceBetweenTangentPoints;
return this;
}
if (rightRadius >= centerSeparation + leftRadius) {
return boundingSphere.clone();
}
expand(point) {
const scratchPoint = scratchVector.from(point);
const radius = scratchPoint.subtract(this.center).magnitude();
var halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
scratchVector2.copy(toRightCenter).scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation).add(leftCenter);
this.center.copy(scratchVector2);
this.radius = halfDistanceBetweenTangentPoints;
return this;
if (radius > this.radius) {
this.radius = radius;
}
}, {
key: "expand",
value: function expand(point) {
point = scratchVector.from(point);
var radius = point.subtract(this.center).magnitude();
if (radius > this.radius) {
this.radius = radius;
}
return this;
}
return this;
transform(transform) {
this.center.transform(transform);
const scale = mat4.getScaling(scratchVector, transform);
this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
return this;
}
distanceSquaredTo(point) {
const d = this.distanceTo(point);
return d * d;
}
distanceTo(point) {
const scratchPoint = scratchVector.from(point);
const delta = scratchPoint.subtract(this.center);
return Math.max(0, delta.len() - this.radius);
}
intersectPlane(plane) {
const center = this.center;
const radius = this.radius;
const normal = plane.normal;
const distanceToPlane = normal.dot(center) + plane.distance;
if (distanceToPlane < -radius) {
return _constants.INTERSECTION.OUTSIDE;
}
}, {
key: "transform",
value: function transform(_transform) {
this.center.transform(_transform);
var scale = mat4.getScaling(scratchVector, _transform);
this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
return this;
if (distanceToPlane < radius) {
return _constants.INTERSECTION.INTERSECTING;
}
}, {
key: "distanceSquaredTo",
value: function distanceSquaredTo(point) {
var d = this.distanceTo(point);
return d * d;
}
}, {
key: "distanceTo",
value: function distanceTo(point) {
point = scratchVector.from(point);
var delta = point.subtract(this.center);
return Math.max(0, delta.len() - this.radius);
}
}, {
key: "intersectPlane",
value: function intersectPlane(plane) {
var center = this.center;
var radius = this.radius;
var normal = plane.normal;
var distanceToPlane = normal.dot(center) + plane.distance;
if (distanceToPlane < -radius) {
return _constants.INTERSECTION.OUTSIDE;
}
return _constants.INTERSECTION.INSIDE;
}
if (distanceToPlane < radius) {
return _constants.INTERSECTION.INTERSECTING;
}
}
return _constants.INTERSECTION.INSIDE;
}
}]);
return BoundingSphere;
}();
exports.default = BoundingSphere;
//# sourceMappingURL=bounding-sphere.js.map

@@ -10,8 +10,4 @@ "use strict";

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -23,10 +19,10 @@

var scratchVector3 = new _core.Vector3();
var scratchOffset = new _core.Vector3();
var scratchVectorU = new _core.Vector3();
var scratchVectorV = new _core.Vector3();
var scratchVectorW = new _core.Vector3();
var scratchCorner = new _core.Vector3();
var scratchToCenter = new _core.Vector3();
var MATRIX3 = {
const scratchVector3 = new _core.Vector3();
const scratchOffset = new _core.Vector3();
const scratchVectorU = new _core.Vector3();
const scratchVectorV = new _core.Vector3();
const scratchVectorW = new _core.Vector3();
const scratchCorner = new _core.Vector3();
const scratchToCenter = new _core.Vector3();
const MATRIX3 = {
COLUMN0ROW0: 0,

@@ -43,7 +39,6 @@ COLUMN0ROW1: 1,

var OrientedBoundingBox = function () {
function OrientedBoundingBox() {
var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0];
var halfAxes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0, 0, 0, 0, 0, 0];
(0, _classCallCheck2.default)(this, OrientedBoundingBox);
class OrientedBoundingBox {
constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
(0, _defineProperty2.default)(this, "center", void 0);
(0, _defineProperty2.default)(this, "halfAxes", void 0);
this.center = new _core.Vector3().from(center);

@@ -53,201 +48,185 @@ this.halfAxes = new _core.Matrix3(halfAxes);

(0, _createClass2.default)(OrientedBoundingBox, [{
key: "halfSize",
get: function get() {
var xAxis = this.halfAxes.getColumn(0);
var yAxis = this.halfAxes.getColumn(1);
var zAxis = this.halfAxes.getColumn(2);
return [new _core.Vector3(xAxis).len(), new _core.Vector3(yAxis).len(), new _core.Vector3(zAxis).len()];
get halfSize() {
const xAxis = this.halfAxes.getColumn(0);
const yAxis = this.halfAxes.getColumn(1);
const zAxis = this.halfAxes.getColumn(2);
return [new _core.Vector3(xAxis).len(), new _core.Vector3(yAxis).len(), new _core.Vector3(zAxis).len()];
}
get quaternion() {
const xAxis = this.halfAxes.getColumn(0);
const yAxis = this.halfAxes.getColumn(1);
const zAxis = this.halfAxes.getColumn(2);
const normXAxis = new _core.Vector3(xAxis).normalize();
const normYAxis = new _core.Vector3(yAxis).normalize();
const normZAxis = new _core.Vector3(zAxis).normalize();
return new _core.Quaternion().fromMatrix3(new _core.Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
}
fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
const quaternionObject = new _core.Quaternion(quaternion);
const directionsMatrix = new _core.Matrix3().fromQuaternion(quaternionObject);
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
directionsMatrix[1] = directionsMatrix[1] * halfSize[0];
directionsMatrix[2] = directionsMatrix[2] * halfSize[0];
directionsMatrix[3] = directionsMatrix[3] * halfSize[1];
directionsMatrix[4] = directionsMatrix[4] * halfSize[1];
directionsMatrix[5] = directionsMatrix[5] * halfSize[1];
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
this.center = new _core.Vector3().from(center);
this.halfAxes = directionsMatrix;
return this;
}
clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);
}
equals(right) {
return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
}
getBoundingSphere(result = new _boundingSphere.default()) {
const halfAxes = this.halfAxes;
const u = halfAxes.getColumn(0, scratchVectorU);
const v = halfAxes.getColumn(1, scratchVectorV);
const w = halfAxes.getColumn(2, scratchVectorW);
const cornerVector = scratchVector3.copy(u).add(v).add(w);
result.center.copy(this.center);
result.radius = cornerVector.magnitude();
return result;
}
intersectPlane(plane) {
const center = this.center;
const normal = plane.normal;
const halfAxes = this.halfAxes;
const normalX = normal.x;
const normalY = normal.y;
const normalZ = normal.z;
const radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] + normalY * halfAxes[MATRIX3.COLUMN0ROW1] + normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] + normalY * halfAxes[MATRIX3.COLUMN1ROW1] + normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] + normalY * halfAxes[MATRIX3.COLUMN2ROW1] + normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);
const distanceToPlane = normal.dot(center) + plane.distance;
if (distanceToPlane <= -radEffective) {
return _constants.INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return _constants.INTERSECTION.INSIDE;
}
}, {
key: "quaternion",
get: function get() {
var xAxis = this.halfAxes.getColumn(0);
var yAxis = this.halfAxes.getColumn(1);
var zAxis = this.halfAxes.getColumn(2);
var normXAxis = new _core.Vector3(xAxis).normalize();
var normYAxis = new _core.Vector3(yAxis).normalize();
var normZAxis = new _core.Vector3(zAxis).normalize();
return new _core.Quaternion().fromMatrix3(new _core.Matrix3([].concat((0, _toConsumableArray2.default)(normXAxis), (0, _toConsumableArray2.default)(normYAxis), (0, _toConsumableArray2.default)(normZAxis))));
return _constants.INTERSECTION.INTERSECTING;
}
distanceTo(point) {
return Math.sqrt(this.distanceSquaredTo(point));
}
distanceSquaredTo(point) {
const offset = scratchOffset.from(point).subtract(this.center);
const halfAxes = this.halfAxes;
const u = halfAxes.getColumn(0, scratchVectorU);
const v = halfAxes.getColumn(1, scratchVectorV);
const w = halfAxes.getColumn(2, scratchVectorW);
const uHalf = u.magnitude();
const vHalf = v.magnitude();
const wHalf = w.magnitude();
u.normalize();
v.normalize();
w.normalize();
let distanceSquared = 0.0;
let d;
d = Math.abs(offset.dot(u)) - uHalf;
if (d > 0) {
distanceSquared += d * d;
}
}, {
key: "fromCenterHalfSizeQuaternion",
value: function fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
var quaternionObject = new _core.Quaternion(quaternion);
var directionsMatrix = new _core.Matrix3().fromQuaternion(quaternionObject);
directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
directionsMatrix[1] = directionsMatrix[1] * halfSize[0];
directionsMatrix[2] = directionsMatrix[2] * halfSize[0];
directionsMatrix[3] = directionsMatrix[3] * halfSize[1];
directionsMatrix[4] = directionsMatrix[4] * halfSize[1];
directionsMatrix[5] = directionsMatrix[5] * halfSize[1];
directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
this.center = new _core.Vector3().from(center);
this.halfAxes = directionsMatrix;
return this;
d = Math.abs(offset.dot(v)) - vHalf;
if (d > 0) {
distanceSquared += d * d;
}
}, {
key: "clone",
value: function clone() {
return new OrientedBoundingBox(this.center, this.halfAxes);
}
}, {
key: "equals",
value: function equals(right) {
return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
}
}, {
key: "getBoundingSphere",
value: function getBoundingSphere() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new _boundingSphere.default();
var halfAxes = this.halfAxes;
var u = halfAxes.getColumn(0, scratchVectorU);
var v = halfAxes.getColumn(1, scratchVectorV);
var w = halfAxes.getColumn(2, scratchVectorW);
var cornerVector = scratchVector3.copy(u).add(v).add(w);
result.center.copy(this.center);
result.radius = cornerVector.magnitude();
return result;
}
}, {
key: "intersectPlane",
value: function intersectPlane(plane) {
var center = this.center;
var normal = plane.normal;
var halfAxes = this.halfAxes;
var normalX = normal.x;
var normalY = normal.y;
var normalZ = normal.z;
var radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] + normalY * halfAxes[MATRIX3.COLUMN0ROW1] + normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] + normalY * halfAxes[MATRIX3.COLUMN1ROW1] + normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] + normalY * halfAxes[MATRIX3.COLUMN2ROW1] + normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);
var distanceToPlane = normal.dot(center) + plane.distance;
if (distanceToPlane <= -radEffective) {
return _constants.INTERSECTION.OUTSIDE;
} else if (distanceToPlane >= radEffective) {
return _constants.INTERSECTION.INSIDE;
}
d = Math.abs(offset.dot(w)) - wHalf;
return _constants.INTERSECTION.INTERSECTING;
if (d > 0) {
distanceSquared += d * d;
}
}, {
key: "distanceTo",
value: function distanceTo(point) {
return Math.sqrt(this.distanceSquaredTo(point));
}
}, {
key: "distanceSquaredTo",
value: function distanceSquaredTo(point) {
var offset = scratchOffset.from(point).subtract(this.center);
var halfAxes = this.halfAxes;
var u = halfAxes.getColumn(0, scratchVectorU);
var v = halfAxes.getColumn(1, scratchVectorV);
var w = halfAxes.getColumn(2, scratchVectorW);
var uHalf = u.magnitude();
var vHalf = v.magnitude();
var wHalf = w.magnitude();
u.normalize();
v.normalize();
w.normalize();
var distanceSquared = 0.0;
var d;
d = Math.abs(offset.dot(u)) - uHalf;
if (d > 0) {
distanceSquared += d * d;
}
return distanceSquared;
}
d = Math.abs(offset.dot(v)) - vHalf;
computePlaneDistances(position, direction, result = [-0, -0]) {
let minDist = Number.POSITIVE_INFINITY;
let maxDist = Number.NEGATIVE_INFINITY;
const center = this.center;
const halfAxes = this.halfAxes;
const u = halfAxes.getColumn(0, scratchVectorU);
const v = halfAxes.getColumn(1, scratchVectorV);
const w = halfAxes.getColumn(2, scratchVectorW);
const corner = scratchCorner.copy(u).add(v).add(w).add(center);
const toCenter = scratchToCenter.copy(corner).subtract(position);
let mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).add(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).subtract(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).add(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).add(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).subtract(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
result[0] = minDist;
result[1] = maxDist;
return result;
}
if (d > 0) {
distanceSquared += d * d;
}
transform(transformation) {
this.center.transformAsPoint(transformation);
const xAxis = this.halfAxes.getColumn(0, scratchVectorU);
xAxis.transformAsPoint(transformation);
const yAxis = this.halfAxes.getColumn(1, scratchVectorV);
yAxis.transformAsPoint(transformation);
const zAxis = this.halfAxes.getColumn(2, scratchVectorW);
zAxis.transformAsPoint(transformation);
this.halfAxes = new _core.Matrix3([...xAxis, ...yAxis, ...zAxis]);
return this;
}
d = Math.abs(offset.dot(w)) - wHalf;
getTransform() {
throw new Error('not implemented');
}
if (d > 0) {
distanceSquared += d * d;
}
}
return distanceSquared;
}
}, {
key: "computePlaneDistances",
value: function computePlaneDistances(position, direction) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-0, -0];
var minDist = Number.POSITIVE_INFINITY;
var maxDist = Number.NEGATIVE_INFINITY;
var center = this.center;
var halfAxes = this.halfAxes;
var u = halfAxes.getColumn(0, scratchVectorU);
var v = halfAxes.getColumn(1, scratchVectorV);
var w = halfAxes.getColumn(2, scratchVectorW);
var corner = scratchCorner.copy(u).add(v).add(w).add(center);
var toCenter = scratchToCenter.copy(corner).subtract(position);
var mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).add(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).subtract(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
corner.copy(center).add(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).add(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).add(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).subtract(v).add(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
center.copy(corner).subtract(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);
maxDist = Math.max(mag, maxDist);
result[0] = minDist;
result[1] = maxDist;
return result;
}
}, {
key: "transform",
value: function transform(transformation) {
this.center.transformAsPoint(transformation);
var xAxis = this.halfAxes.getColumn(0, scratchVectorU);
xAxis.transformAsPoint(transformation);
var yAxis = this.halfAxes.getColumn(1, scratchVectorV);
yAxis.transformAsPoint(transformation);
var zAxis = this.halfAxes.getColumn(2, scratchVectorW);
zAxis.transformAsPoint(transformation);
this.halfAxes = new _core.Matrix3([].concat((0, _toConsumableArray2.default)(xAxis), (0, _toConsumableArray2.default)(yAxis), (0, _toConsumableArray2.default)(zAxis)));
return this;
}
}, {
key: "getTransform",
value: function getTransform() {
throw new Error('not implemented');
}
}]);
return OrientedBoundingBox;
}();
exports.default = OrientedBoundingBox;
//# sourceMappingURL=oriented-bounding-box.js.map

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -21,150 +19,101 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
const faces = [new _core.Vector3([1, 0, 0]), new _core.Vector3([0, 1, 0]), new _core.Vector3([0, 0, 1])];
const scratchPlaneCenter = new _core.Vector3();
const scratchPlaneNormal = new _core.Vector3();
const scratchPlane = new _plane.default(new _core.Vector3(1.0, 0.0, 0.0), 0.0);
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
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);
var CullingVolume = function () {
function CullingVolume() {
var planes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
(0, _classCallCheck2.default)(this, CullingVolume);
class CullingVolume {
constructor(planes = []) {
(0, _defineProperty2.default)(this, "planes", void 0);
this.planes = planes;
(0, _core.assert)(this.planes.every(function (plane) {
return plane instanceof _plane.default;
}));
}
(0, _createClass2.default)(CullingVolume, [{
key: "fromBoundingSphere",
value: function fromBoundingSphere(boundingSphere) {
this.planes.length = 2 * faces.length;
var center = boundingSphere.center;
var radius = boundingSphere.radius;
var planeIndex = 0;
fromBoundingSphere(boundingSphere) {
this.planes.length = 2 * faces.length;
const center = boundingSphere.center;
const radius = boundingSphere.radius;
let planeIndex = 0;
var _iterator = _createForOfIteratorHelper(faces),
_step;
for (const faceNormal of faces) {
let plane0 = this.planes[planeIndex];
let plane1 = this.planes[planeIndex + 1];
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var faceNormal = _step.value;
var plane0 = this.planes[planeIndex];
var plane1 = this.planes[planeIndex + 1];
if (!plane0) {
plane0 = this.planes[planeIndex] = new _plane.default();
}
if (!plane0) {
plane0 = this.planes[planeIndex] = new _plane.default();
}
if (!plane1) {
plane1 = this.planes[planeIndex + 1] = new _plane.default();
}
var plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
var plane0Distance = -faceNormal.dot(plane0Center);
plane0.fromPointNormal(plane0Center, faceNormal);
var plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
var negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
var plane1Distance = -negatedFaceNormal.dot(plane1Center);
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
planeIndex += 2;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
if (!plane1) {
plane1 = this.planes[planeIndex + 1] = new _plane.default();
}
return this;
const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
const plane0Distance = -faceNormal.dot(plane0Center);
plane0.fromPointNormal(plane0Center, faceNormal);
const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
const plane1Distance = -negatedFaceNormal.dot(plane1Center);
plane1.fromPointNormal(plane1Center, negatedFaceNormal);
planeIndex += 2;
}
}, {
key: "computeVisibility",
value: function computeVisibility(boundingVolume) {
(0, _core.assert)(boundingVolume);
var intersect = _constants.INTERSECTION.INSIDE;
var _iterator2 = _createForOfIteratorHelper(this.planes),
_step2;
return this;
}
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var plane = _step2.value;
var result = boundingVolume.intersectPlane(plane);
computeVisibility(boundingVolume) {
let intersect = _constants.INTERSECTION.INSIDE;
switch (result) {
case _constants.INTERSECTION.OUTSIDE:
return _constants.INTERSECTION.OUTSIDE;
for (const plane of this.planes) {
const result = boundingVolume.intersectPlane(plane);
case _constants.INTERSECTION.INTERSECTING:
intersect = _constants.INTERSECTION.INTERSECTING;
break;
switch (result) {
case _constants.INTERSECTION.OUTSIDE:
return _constants.INTERSECTION.OUTSIDE;
default:
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
case _constants.INTERSECTION.INTERSECTING:
intersect = _constants.INTERSECTION.INTERSECTING;
break;
default:
}
return intersect;
}
}, {
key: "computeVisibilityWithPlaneMask",
value: function computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
(0, _core.assert)(boundingVolume, 'boundingVolume is required.');
(0, _core.assert)(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');
if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
return parentPlaneMask;
}
return intersect;
}
var mask = CullingVolume.MASK_INSIDE;
var planes = this.planes;
computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
(0, _core.assert)(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');
for (var k = 0; k < this.planes.length; ++k) {
var flag = k < 31 ? 1 << k : 0;
if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
return parentPlaneMask;
}
if (k < 31 && (parentPlaneMask & flag) === 0) {
continue;
}
let mask = CullingVolume.MASK_INSIDE;
const planes = this.planes;
var plane = planes[k];
var result = boundingVolume.intersectPlane(plane);
for (let k = 0; k < this.planes.length; ++k) {
const flag = k < 31 ? 1 << k : 0;
if (result === _constants.INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === _constants.INTERSECTION.INTERSECTING) {
mask |= flag;
}
if (k < 31 && (parentPlaneMask & flag) === 0) {
continue;
}
return mask;
const plane = planes[k];
const result = boundingVolume.intersectPlane(plane);
if (result === _constants.INTERSECTION.OUTSIDE) {
return CullingVolume.MASK_OUTSIDE;
} else if (result === _constants.INTERSECTION.INTERSECTING) {
mask |= flag;
}
}
}], [{
key: "MASK_OUTSIDE",
get: function get() {
return 0xffffffff;
}
}, {
key: "MASK_INSIDE",
get: function get() {
return 0x00000000;
}
}, {
key: "MASK_INDETERMINATE",
get: function get() {
return 0x7fffffff;
}
}]);
return CullingVolume;
}();
return mask;
}
}
exports.default = CullingVolume;
(0, _defineProperty2.default)(CullingVolume, "MASK_OUTSIDE", 0xffffffff);
(0, _defineProperty2.default)(CullingVolume, "MASK_INSIDE", 0x00000000);
(0, _defineProperty2.default)(CullingVolume, "MASK_INDETERMINATE", 0x7fffffff);
//# sourceMappingURL=culling-volume.js.map

@@ -12,6 +12,2 @@ "use strict";

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -21,27 +17,30 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
const defined = val => val !== null && typeof val !== 'undefined';
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var defined = function defined(val) {
return val !== null && typeof val !== 'undefined';
};
var PerspectiveFrustum = function () {
function PerspectiveFrustum() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _classCallCheck2.default)(this, PerspectiveFrustum);
options = _objectSpread({
class PerspectiveFrustum {
constructor(options = {}) {
(0, _defineProperty2.default)(this, "_offCenterFrustum", new _perspectiveOffCenterFrustum.default());
(0, _defineProperty2.default)(this, "fov", void 0);
(0, _defineProperty2.default)(this, "_fov", void 0);
(0, _defineProperty2.default)(this, "_fovy", void 0);
(0, _defineProperty2.default)(this, "_sseDenominator", void 0);
(0, _defineProperty2.default)(this, "aspectRatio", void 0);
(0, _defineProperty2.default)(this, "_aspectRatio", void 0);
(0, _defineProperty2.default)(this, "near", void 0);
(0, _defineProperty2.default)(this, "_near", void 0);
(0, _defineProperty2.default)(this, "far", void 0);
(0, _defineProperty2.default)(this, "_far", void 0);
(0, _defineProperty2.default)(this, "xOffset", void 0);
(0, _defineProperty2.default)(this, "_xOffset", void 0);
(0, _defineProperty2.default)(this, "yOffset", void 0);
(0, _defineProperty2.default)(this, "_yOffset", void 0);
options = {
near: 1.0,
far: 500000000.0,
xOffset: 0.0,
yOffset: 0.0
}, options);
this._offCenterFrustum = new _perspectiveOffCenterFrustum.default();
yOffset: 0.0,
...options
};
this.fov = options.fov;
this._fov = undefined;
this._fovy = undefined;
this._sseDenominator = undefined;
this.aspectRatio = options.aspectRatio;
this._aspectRatio = undefined;
this.near = options.near;

@@ -57,63 +56,53 @@ this._near = this.near;

(0, _createClass2.default)(PerspectiveFrustum, [{
key: "clone",
value: function clone() {
return new PerspectiveFrustum({
aspectRatio: this.aspectRatio,
fov: this.fov,
near: this.near,
far: this.far
});
}
}, {
key: "equals",
value: function equals(other) {
if (!defined(other) || !(other instanceof PerspectiveFrustum)) {
return false;
}
clone() {
return new PerspectiveFrustum({
aspectRatio: this.aspectRatio,
fov: this.fov,
near: this.near,
far: this.far
});
}
update(this);
update(other);
return this.fov === other.fov && this.aspectRatio === other.aspectRatio && this.near === other.near && this.far === other.far && this._offCenterFrustum.equals(other._offCenterFrustum);
equals(other) {
if (!defined(other) || !(other instanceof PerspectiveFrustum)) {
return false;
}
}, {
key: "projectionMatrix",
get: function get() {
update(this);
return this._offCenterFrustum.projectionMatrix;
}
}, {
key: "infiniteProjectionMatrix",
get: function get() {
update(this);
return this._offCenterFrustum.infiniteProjectionMatrix;
}
}, {
key: "fovy",
get: function get() {
update(this);
return this._fovy;
}
}, {
key: "sseDenominator",
get: function get() {
update(this);
return this._sseDenominator;
}
}, {
key: "computeCullingVolume",
value: function computeCullingVolume(position, direction, up) {
update(this);
return this._offCenterFrustum.computeCullingVolume(position, direction, up);
}
}, {
key: "getPixelDimensions",
value: function getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
update(this);
return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result);
}
}]);
return PerspectiveFrustum;
}();
update(this);
update(other);
return this.fov === other.fov && this.aspectRatio === other.aspectRatio && this.near === other.near && this.far === other.far && this._offCenterFrustum.equals(other._offCenterFrustum);
}
get projectionMatrix() {
update(this);
return this._offCenterFrustum.projectionMatrix;
}
get infiniteProjectionMatrix() {
update(this);
return this._offCenterFrustum.infiniteProjectionMatrix;
}
get fovy() {
update(this);
return this._fovy;
}
get sseDenominator() {
update(this);
return this._sseDenominator;
}
computeCullingVolume(position, direction, up) {
update(this);
return this._offCenterFrustum.computeCullingVolume(position, direction, up);
}
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
update(this);
return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result);
}
}
exports.default = PerspectiveFrustum;

@@ -123,3 +112,3 @@

(0, _core.assert)(Number.isFinite(frustum.fov) && Number.isFinite(frustum.aspectRatio) && Number.isFinite(frustum.near) && Number.isFinite(frustum.far));
var f = frustum._offCenterFrustum;
const f = frustum._offCenterFrustum;

@@ -126,0 +115,0 @@ 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) {

@@ -12,6 +12,2 @@ "use strict";

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");

@@ -23,20 +19,30 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
const scratchPlaneUpVector = new _core.Vector3();
const scratchPlaneRightVector = new _core.Vector3();
const scratchPlaneNearCenter = new _core.Vector3();
const scratchPlaneFarCenter = new _core.Vector3();
const scratchPlaneNormal = new _core.Vector3();
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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();
var PerspectiveOffCenterFrustum = function () {
function PerspectiveOffCenterFrustum() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _classCallCheck2.default)(this, PerspectiveOffCenterFrustum);
options = _objectSpread({
class PerspectiveOffCenterFrustum {
constructor(options = {}) {
(0, _defineProperty2.default)(this, "left", void 0);
(0, _defineProperty2.default)(this, "_left", void 0);
(0, _defineProperty2.default)(this, "right", void 0);
(0, _defineProperty2.default)(this, "_right", void 0);
(0, _defineProperty2.default)(this, "top", void 0);
(0, _defineProperty2.default)(this, "_top", void 0);
(0, _defineProperty2.default)(this, "bottom", void 0);
(0, _defineProperty2.default)(this, "_bottom", void 0);
(0, _defineProperty2.default)(this, "near", void 0);
(0, _defineProperty2.default)(this, "_near", void 0);
(0, _defineProperty2.default)(this, "far", void 0);
(0, _defineProperty2.default)(this, "_far", void 0);
(0, _defineProperty2.default)(this, "_cullingVolume", new _cullingVolume.default([new _plane.default(), new _plane.default(), new _plane.default(), new _plane.default(), new _plane.default(), new _plane.default()]));
(0, _defineProperty2.default)(this, "_perspectiveMatrix", new _core.Matrix4());
(0, _defineProperty2.default)(this, "_infinitePerspective", new _core.Matrix4());
options = {
near: 1.0,
far: 500000000.0
}, options);
far: 500000000.0,
...options
};
this.left = options.left;

@@ -54,84 +60,73 @@ this._left = undefined;

this._far = this.far;
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 _core.Matrix4();
this._infinitePerspective = new _core.Matrix4();
}
(0, _createClass2.default)(PerspectiveOffCenterFrustum, [{
key: "clone",
value: function clone() {
return new PerspectiveOffCenterFrustum({
right: this.right,
left: this.left,
top: this.top,
bottom: this.bottom,
near: this.near,
far: this.far
});
}
}, {
key: "equals",
value: function equals(other) {
return other && other instanceof PerspectiveOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && this.bottom === other.bottom && this.near === other.near && this.far === other.far;
}
}, {
key: "projectionMatrix",
get: function get() {
update(this);
return this._perspectiveMatrix;
}
}, {
key: "infiniteProjectionMatrix",
get: function get() {
update(this);
return this._infinitePerspective;
}
}, {
key: "computeCullingVolume",
value: function computeCullingVolume(position, direction, up) {
(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;
up = scratchPlaneUpVector.copy(up).normalize();
var right = scratchPlaneRightVector.copy(direction).cross(up).normalize();
var nearCenter = scratchPlaneNearCenter.copy(direction).multiplyByScalar(this.near).add(position);
var farCenter = scratchPlaneFarCenter.copy(direction).multiplyByScalar(this.far).add(position);
var normal = scratchPlaneNormal;
normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);
planes[0].fromPointNormal(position, normal);
normal.copy(right).multiplyByScalar(this.right).add(nearCenter).subtract(position).cross(up).negate();
planes[1].fromPointNormal(position, normal);
normal.copy(up).multiplyByScalar(this.bottom).add(nearCenter).subtract(position).cross(right).negate();
planes[2].fromPointNormal(position, normal);
normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);
planes[3].fromPointNormal(position, normal);
normal = new _core.Vector3().copy(direction);
planes[4].fromPointNormal(nearCenter, normal);
normal.negate();
planes[5].fromPointNormal(farCenter, normal);
return this._cullingVolume;
}
}, {
key: "getPixelDimensions",
value: function getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
update(this);
(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;
var tanTheta = this.top * inverseNear;
var pixelHeight = 2.0 * distance * tanTheta / drawingBufferHeight;
tanTheta = this.right * inverseNear;
var pixelWidth = 2.0 * distance * tanTheta / drawingBufferWidth;
result.x = pixelWidth;
result.y = pixelHeight;
return result;
}
}]);
return PerspectiveOffCenterFrustum;
}();
clone() {
return new PerspectiveOffCenterFrustum({
right: this.right,
left: this.left,
top: this.top,
bottom: this.bottom,
near: this.near,
far: this.far
});
}
equals(other) {
return other && other instanceof PerspectiveOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && this.bottom === other.bottom && this.near === other.near && this.far === other.far;
}
get projectionMatrix() {
update(this);
return this._perspectiveMatrix;
}
get infiniteProjectionMatrix() {
update(this);
return this._infinitePerspective;
}
computeCullingVolume(position, direction, up) {
(0, _core.assert)(position, 'position is required.');
(0, _core.assert)(direction, 'direction is required.');
(0, _core.assert)(up, 'up is required.');
const planes = this._cullingVolume.planes;
up = scratchPlaneUpVector.copy(up).normalize();
const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();
const nearCenter = scratchPlaneNearCenter.copy(direction).multiplyByScalar(this.near).add(position);
const farCenter = scratchPlaneFarCenter.copy(direction).multiplyByScalar(this.far).add(position);
let normal = scratchPlaneNormal;
normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);
planes[0].fromPointNormal(position, normal);
normal.copy(right).multiplyByScalar(this.right).add(nearCenter).subtract(position).cross(up).negate();
planes[1].fromPointNormal(position, normal);
normal.copy(up).multiplyByScalar(this.bottom).add(nearCenter).subtract(position).cross(right).negate();
planes[2].fromPointNormal(position, normal);
normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);
planes[3].fromPointNormal(position, normal);
normal = new _core.Vector3().copy(direction);
planes[4].fromPointNormal(nearCenter, normal);
normal.negate();
planes[5].fromPointNormal(farCenter, normal);
return this._cullingVolume;
}
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
update(this);
(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);
const inverseNear = 1.0 / this.near;
let tanTheta = this.top * inverseNear;
const pixelHeight = 2.0 * distance * tanTheta / drawingBufferHeight;
tanTheta = this.right * inverseNear;
const pixelWidth = 2.0 * distance * tanTheta / drawingBufferWidth;
result.x = pixelWidth;
result.y = pixelHeight;
return result;
}
}
exports.default = PerspectiveOffCenterFrustum;

@@ -141,8 +136,10 @@

(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,
bottom = frustum.bottom,
right = frustum.right,
left = frustum.left,
near = frustum.near,
far = frustum.far;
const {
top,
bottom,
right,
left,
near,
far
} = frustum;

@@ -158,15 +155,15 @@ if (top !== frustum._top || bottom !== frustum._bottom || left !== frustum._left || right !== frustum._right || near !== frustum._near || far !== frustum._far) {

frustum._perspectiveMatrix = new _core.Matrix4().frustum({
left: left,
right: right,
bottom: bottom,
top: top,
near: near,
far: far
left,
right,
bottom,
top,
near,
far
});
frustum._infinitePerspective = new _core.Matrix4().frustum({
left: left,
right: right,
bottom: bottom,
top: top,
near: near,
left,
right,
bottom,
top,
near,
far: Infinity

@@ -173,0 +170,0 @@ });

@@ -10,16 +10,13 @@ "use strict";

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _core = require("@math.gl/core");
var scratchPosition = new _core.Vector3();
var scratchNormal = new _core.Vector3();
const scratchPosition = new _core.Vector3();
const scratchNormal = new _core.Vector3();
var Plane = function () {
function Plane() {
var normal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 1];
var distance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
(0, _classCallCheck2.default)(this, Plane);
class Plane {
constructor(normal = [0, 0, 1], distance = 0) {
(0, _defineProperty2.default)(this, "normal", void 0);
(0, _defineProperty2.default)(this, "distance", void 0);
this.normal = new _core.Vector3();

@@ -30,63 +27,52 @@ this.distance = -0;

(0, _createClass2.default)(Plane, [{
key: "fromNormalDistance",
value: function fromNormalDistance(normal, distance) {
(0, _core.assert)(Number.isFinite(distance));
this.normal.from(normal).normalize();
this.distance = distance;
return this;
}
}, {
key: "fromPointNormal",
value: function fromPointNormal(point, normal) {
point = scratchPosition.from(point);
this.normal.from(normal).normalize();
var distance = -this.normal.dot(point);
this.distance = distance;
return this;
}
}, {
key: "fromCoefficients",
value: function fromCoefficients(a, b, c, d) {
this.normal.set(a, b, c);
(0, _core.assert)((0, _core.equals)(this.normal.len(), 1));
this.distance = d;
return this;
}
}, {
key: "clone",
value: function clone(plane) {
return new Plane(this.normal, this.distance);
}
}, {
key: "equals",
value: function equals(right) {
return (0, _core.equals)(this.distance, right.distance) && (0, _core.equals)(this.normal, right.normal);
}
}, {
key: "getPointDistance",
value: function getPointDistance(point) {
return this.normal.dot(point) + this.distance;
}
}, {
key: "transform",
value: function transform(matrix4) {
var normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();
var point = this.normal.scale(-this.distance).transform(matrix4);
return this.fromPointNormal(point, normal);
}
}, {
key: "projectPointOntoPlane",
value: function projectPointOntoPlane(point) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
point = scratchPosition.from(point);
var pointDistance = this.getPointDistance(point);
var scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);
return point.subtract(scaledNormal).to(result);
}
}]);
return Plane;
}();
fromNormalDistance(normal, distance) {
(0, _core.assert)(Number.isFinite(distance));
this.normal.from(normal).normalize();
this.distance = distance;
return this;
}
fromPointNormal(point, normal) {
point = scratchPosition.from(point);
this.normal.from(normal).normalize();
const distance = -this.normal.dot(point);
this.distance = distance;
return this;
}
fromCoefficients(a, b, c, d) {
this.normal.set(a, b, c);
(0, _core.assert)((0, _core.equals)(this.normal.len(), 1));
this.distance = d;
return this;
}
clone() {
return new Plane(this.normal, this.distance);
}
equals(right) {
return (0, _core.equals)(this.distance, right.distance) && (0, _core.equals)(this.normal, right.normal);
}
getPointDistance(point) {
return this.normal.dot(point) + this.distance;
}
transform(matrix4) {
const normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();
const point = this.normal.scale(-this.distance).transform(matrix4);
return this.fromPointNormal(point, normal);
}
projectPointOntoPlane(point, result = [0, 0, 0]) {
point = scratchPosition.from(point);
const pointDistance = this.getPointDistance(point);
const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);
return point.subtract(scaledNormal).to(result);
}
}
exports.default = Plane;
//# sourceMappingURL=plane.js.map

@@ -1,6 +0,8 @@

export const INTERSECTION = Object.freeze({
OUTSIDE: -1,
INTERSECTING: 0,
INSIDE: 1
});
export let INTERSECTION;
(function (INTERSECTION) {
INTERSECTION[INTERSECTION["OUTSIDE"] = -1] = "OUTSIDE";
INTERSECTION[INTERSECTION["INTERSECTING"] = 0] = "INTERSECTING";
INTERSECTION[INTERSECTION["INSIDE"] = 1] = "INSIDE";
})(INTERSECTION || (INTERSECTION = {}));
//# sourceMappingURL=constants.js.map

@@ -12,4 +12,2 @@ export { INTERSECTION } from './constants';

export { default as computeEigenDecomposition } from './lib/algorithms/compute-eigen-decomposition';
export { INTERSECTION as Intersect } from './constants';
export { INTERSECTION as INTERSECT } from './constants';
//# sourceMappingURL=index.js.map

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3 } from '@math.gl/core';

@@ -6,3 +7,11 @@ import { INTERSECTION } from '../../constants';

export default class AxisAlignedBoundingBox {
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center = null) {
constructor(minimum = [0, 0, 0], maximum = [0, 0, 0], center) {
_defineProperty(this, "center", void 0);
_defineProperty(this, "halfDiagonal", void 0);
_defineProperty(this, "minimum", void 0);
_defineProperty(this, "maximum", void 0);
center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);

@@ -23,7 +32,7 @@ this.center = new Vector3(center);

transform(transformation) {
this.center.transformAsPoint(transformation);
this.halfDiagonal.transform(transformation);
this.minimum.transform(transformation);
this.maximum.transform(transformation);
transform(transform) {
this.center.transformAsPoint(transform);
this.halfDiagonal.transform(transform);
this.minimum.transform(transform);
this.maximum.transform(transform);
return this;

@@ -30,0 +39,0 @@ }

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3 } from '@math.gl/core';

@@ -8,2 +9,6 @@ import * as mat4 from 'gl-matrix/mat4';

constructor(center = [0, 0, 0], radius = 0.0) {
_defineProperty(this, "center", void 0);
_defineProperty(this, "radius", void 0);
this.radius = -0;

@@ -59,4 +64,4 @@ this.center = new Vector3();

expand(point) {
point = scratchVector.from(point);
const radius = point.subtract(this.center).magnitude();
const scratchPoint = scratchVector.from(point);
const radius = scratchPoint.subtract(this.center).magnitude();

@@ -83,4 +88,4 @@ if (radius > this.radius) {

distanceTo(point) {
point = scratchVector.from(point);
const delta = point.subtract(this.center);
const scratchPoint = scratchVector.from(point);
const delta = scratchPoint.subtract(this.center);
return Math.max(0, delta.len() - this.radius);

@@ -87,0 +92,0 @@ }

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3, Matrix3, Quaternion } from '@math.gl/core';

@@ -24,2 +25,6 @@ import BoundingSphere from './bounding-sphere';

constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
_defineProperty(this, "center", void 0);
_defineProperty(this, "halfAxes", void 0);
this.center = new Vector3().from(center);

@@ -26,0 +31,0 @@ this.halfAxes = new Matrix3(halfAxes);

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

import { Vector3, Vector4, assert } from '@math.gl/core';
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3, assert } from '@math.gl/core';
import { INTERSECTION } from '../constants';

@@ -9,17 +10,6 @@ import Plane from './plane';

export default class CullingVolume {
static get MASK_OUTSIDE() {
return 0xffffffff;
}
constructor(planes = []) {
_defineProperty(this, "planes", void 0);
static get MASK_INSIDE() {
return 0x00000000;
}
static get MASK_INDETERMINATE() {
return 0x7fffffff;
}
constructor(planes = []) {
this.planes = planes;
assert(this.planes.every(plane => plane instanceof Plane));
}

@@ -59,3 +49,2 @@

computeVisibility(boundingVolume) {
assert(boundingVolume);
let intersect = INTERSECTION.INSIDE;

@@ -82,3 +71,2 @@

computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
assert(boundingVolume, 'boundingVolume is required.');
assert(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');

@@ -114,2 +102,8 @@

}
_defineProperty(CullingVolume, "MASK_OUTSIDE", 0xffffffff);
_defineProperty(CullingVolume, "MASK_INSIDE", 0x00000000);
_defineProperty(CullingVolume, "MASK_INDETERMINATE", 0x7fffffff);
//# sourceMappingURL=culling-volume.js.map

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { assert } from '@math.gl/core';

@@ -8,2 +9,32 @@ import PerspectiveOffCenterFrustum from './perspective-off-center-frustum';

constructor(options = {}) {
_defineProperty(this, "_offCenterFrustum", new PerspectiveOffCenterFrustum());
_defineProperty(this, "fov", void 0);
_defineProperty(this, "_fov", void 0);
_defineProperty(this, "_fovy", void 0);
_defineProperty(this, "_sseDenominator", void 0);
_defineProperty(this, "aspectRatio", void 0);
_defineProperty(this, "_aspectRatio", void 0);
_defineProperty(this, "near", void 0);
_defineProperty(this, "_near", void 0);
_defineProperty(this, "far", void 0);
_defineProperty(this, "_far", void 0);
_defineProperty(this, "xOffset", void 0);
_defineProperty(this, "_xOffset", void 0);
_defineProperty(this, "yOffset", void 0);
_defineProperty(this, "_yOffset", void 0);
options = {

@@ -16,9 +47,4 @@ near: 1.0,

};
this._offCenterFrustum = new PerspectiveOffCenterFrustum();
this.fov = options.fov;
this._fov = undefined;
this._fovy = undefined;
this._sseDenominator = undefined;
this.aspectRatio = options.aspectRatio;
this._aspectRatio = undefined;
this.near = options.near;

@@ -25,0 +51,0 @@ this._near = this.near;

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3, Matrix4, assert } from '@math.gl/core';

@@ -11,2 +12,32 @@ import CullingVolume from './culling-volume';

constructor(options = {}) {
_defineProperty(this, "left", void 0);
_defineProperty(this, "_left", void 0);
_defineProperty(this, "right", void 0);
_defineProperty(this, "_right", void 0);
_defineProperty(this, "top", void 0);
_defineProperty(this, "_top", void 0);
_defineProperty(this, "bottom", void 0);
_defineProperty(this, "_bottom", void 0);
_defineProperty(this, "near", void 0);
_defineProperty(this, "_near", void 0);
_defineProperty(this, "far", void 0);
_defineProperty(this, "_far", void 0);
_defineProperty(this, "_cullingVolume", new CullingVolume([new Plane(), new Plane(), new Plane(), new Plane(), new Plane(), new Plane()]));
_defineProperty(this, "_perspectiveMatrix", new Matrix4());
_defineProperty(this, "_infinitePerspective", new Matrix4());
options = {

@@ -29,5 +60,2 @@ near: 1.0,

this._far = this.far;
this._cullingVolume = new CullingVolume([new Plane(), new Plane(), new Plane(), new Plane(), new Plane(), new Plane()]);
this._perspectiveMatrix = new Matrix4();
this._infinitePerspective = new Matrix4();
}

@@ -34,0 +62,0 @@

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

import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { Vector3, equals, assert } from '@math.gl/core';

@@ -6,2 +7,6 @@ const scratchPosition = new Vector3();

constructor(normal = [0, 0, 1], distance = 0) {
_defineProperty(this, "normal", void 0);
_defineProperty(this, "distance", void 0);
this.normal = new Vector3();

@@ -34,3 +39,3 @@ this.distance = -0;

clone(plane) {
clone() {
return new Plane(this.normal, this.distance);

@@ -37,0 +42,0 @@ }

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

},
"version": "3.5.6",
"version": "3.6.0-alpha.1",
"keywords": [

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

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

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

"@babel/runtime": "^7.12.0",
"@math.gl/core": "3.5.6",
"@math.gl/core": "3.6.0-alpha.1",
"gl-matrix": "~3.3.0"
},
"gitHead": "0e69c70ff2e6373fed84d303cbf8198a6972944f"
"gitHead": "45386981340895bf201c2ebb76257c9bbffd8ff6"
}

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