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

@math.gl/culling

Package Overview
Dependencies
Maintainers
2
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.0.0-alpha.3 to 3.0.0-alpha.4

26

dist/es5/lib/culling-volume.js

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

get: function get() {
return 0xffffffff;
return 0x00000000;
}

@@ -73,3 +73,3 @@ }, {

scratchPlaneCenter.set(faceNormal).scale(-radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
plane0.x = faceNormal.x;

@@ -79,3 +79,3 @@ plane0.y = faceNormal.y;

plane0.w = -faceNormal.dot(scratchPlaneCenter);
scratchPlaneCenter.set(faceNormal).scale(radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
plane1.x = -faceNormal.x;

@@ -88,3 +88,3 @@ plane1.y = -faceNormal.y;

return result;
return this;
}

@@ -96,3 +96,3 @@ }, {

var planes = this.planes;
var intersecting = false;
var intersect = _constants.Intersect.INSIDE;
var _iteratorNormalCompletion = true;

@@ -105,11 +105,13 @@ var _didIteratorError = false;

var plane = _step.value;
var result = boundingVolume.intersectPlane(plane);
var _result = boundingVolume.intersectPlane(_plane["default"].fromCartesian4(plane, scratchPlane));
switch (result) {
case _constants.Intersect.OUTSIDE:
return _constants.Intersect.OUTSIDE;
if (_result === _constants.Intersect.OUTSIDE) {
return _constants.Intersect.OUTSIDE;
}
case _constants.Intersect.INTERSECTING:
intersect = ((0, _readOnlyError2["default"])("intersect"), _constants.Intersect.INTERSECTING);
break;
if (_result === _constants.Intersect.INTERSECTING) {
intersecting = ((0, _readOnlyError2["default"])("intersecting"), true);
default:
}

@@ -132,3 +134,3 @@ }

return intersecting ? _constants.Intersect.INTERSECTING : _constants.Intersect.INSIDE;
return intersect;
}

@@ -135,0 +137,0 @@ }]);

@@ -111,4 +111,3 @@ "use strict";

value: function distanceSquaredTo(point) {
var offset = _math.Vector3.subtract(point, this.center, scratchOffset);
var offset = scratchOffset.copy(point).subtract(this.center);
var halfAxes = this.halfAxes;

@@ -159,106 +158,49 @@ var u = halfAxes.getColumn(0, scratchVectorU);

key: "computePlaneDistances",
value: function computePlaneDistances(box, position, direction) {
var result = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [[], []];
value: function computePlaneDistances(position, direction) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [[], []];
var minDist = Number.POSITIVE_INFINITY;
var maxDist = Number.NEGATIVE_INFINITY;
var center = box.center;
var halfAxes = box.halfAxes;
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 = _math.Vector3.add(u, v, scratchCorner);
_math.Vector3.add(corner, w, corner);
_math.Vector3.add(corner, center, corner);
var toCenter = _math.Vector3.subtract(corner, position, scratchToCenter);
var mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.add(center, u, corner);
_math.Vector3.add(corner, v, corner);
_math.Vector3.subtract(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.add(center, u, corner);
_math.Vector3.subtract(corner, v, corner);
_math.Vector3.add(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.add(center, u, corner);
_math.Vector3.subtract(corner, v, corner);
_math.Vector3.subtract(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.subtract(center, u, corner);
_math.Vector3.add(corner, v, corner);
_math.Vector3.add(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.subtract(center, u, corner);
_math.Vector3.add(corner, v, corner);
_math.Vector3.subtract(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.subtract(center, u, corner);
_math.Vector3.subtract(corner, v, corner);
_math.Vector3.add(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
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);
_math.Vector3.subtract(center, u, corner);
_math.Vector3.subtract(corner, v, corner);
_math.Vector3.subtract(corner, w, corner);
_math.Vector3.subtract(corner, position, toCenter);
mag = _math.Vector3.dot(direction, toCenter);
center.copy(corner).subtract(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);

@@ -265,0 +207,0 @@ maxDist = Math.max(mag, maxDist);

@@ -14,3 +14,3 @@ import { Vector3, Vector4, assert } from 'math.gl';

static get MASK_INSIDE() {
return 0xffffffff;
return 0x00000000;
}

@@ -34,4 +34,4 @@

for (const faceNormal of faces) {
const plane0 = this.planes[planeIndex];
const plane1 = this.planes[planeIndex + 1];
let plane0 = this.planes[planeIndex];
let plane1 = this.planes[planeIndex + 1];

@@ -46,3 +46,3 @@ if (!plane0) {

scratchPlaneCenter.set(faceNormal).scale(-radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
plane0.x = faceNormal.x;

@@ -52,3 +52,3 @@ plane0.y = faceNormal.y;

plane0.w = -faceNormal.dot(scratchPlaneCenter);
scratchPlaneCenter.set(faceNormal).scale(radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
plane1.x = -faceNormal.x;

@@ -61,3 +61,3 @@ plane1.y = -faceNormal.y;

return result;
return this;
}

@@ -68,17 +68,20 @@

const planes = this.planes;
const intersecting = false;
const intersect = Intersect.INSIDE;
for (const plane of this.planes) {
const result = boundingVolume.intersectPlane(Plane.fromCartesian4(plane, scratchPlane));
const result = boundingVolume.intersectPlane(plane);
if (result === Intersect.OUTSIDE) {
return Intersect.OUTSIDE;
}
switch (result) {
case Intersect.OUTSIDE:
return Intersect.OUTSIDE;
if (result === Intersect.INTERSECTING) {
intersecting = true;
case Intersect.INTERSECTING:
intersect = Intersect.INTERSECTING;
break;
default:
}
}
return intersecting ? Intersect.INTERSECTING : Intersect.INSIDE;
return intersect;
}

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

@@ -84,3 +84,3 @@ import { Vector3, Matrix3 } from 'math.gl';

distanceSquaredTo(point) {
const offset = Vector3.subtract(point, this.center, scratchOffset);
const offset = scratchOffset.copy(point).subtract(this.center);
const halfAxes = this.halfAxes;

@@ -130,65 +130,49 @@ const u = halfAxes.getColumn(0, scratchVectorU);

computePlaneDistances(box, position, direction) {
let result = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [[], []];
computePlaneDistances(position, direction) {
let result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [[], []];
let minDist = Number.POSITIVE_INFINITY;
let maxDist = Number.NEGATIVE_INFINITY;
const center = box.center;
const halfAxes = box.halfAxes;
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 = Vector3.add(u, v, scratchCorner);
Vector3.add(corner, w, corner);
Vector3.add(corner, center, corner);
const toCenter = Vector3.subtract(corner, position, scratchToCenter);
let mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
center.copy(corner).subtract(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);

@@ -195,0 +179,0 @@ maxDist = Math.max(mag, maxDist);

@@ -21,3 +21,3 @@ import _readOnlyError from "@babel/runtime/helpers/esm/readOnlyError";

get: function get() {
return 0xffffffff;
return 0x00000000;
}

@@ -60,3 +60,3 @@ }, {

scratchPlaneCenter.set(faceNormal).scale(-radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
plane0.x = faceNormal.x;

@@ -66,3 +66,3 @@ plane0.y = faceNormal.y;

plane0.w = -faceNormal.dot(scratchPlaneCenter);
scratchPlaneCenter.set(faceNormal).scale(radius).add(center);
scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
plane1.x = -faceNormal.x;

@@ -75,3 +75,3 @@ plane1.y = -faceNormal.y;

return result;
return this;
}

@@ -83,3 +83,3 @@ }, {

var planes = this.planes;
var intersecting = false;
var intersect = Intersect.INSIDE;
var _iteratorNormalCompletion = true;

@@ -92,11 +92,13 @@ var _didIteratorError = false;

var plane = _step.value;
var result = boundingVolume.intersectPlane(plane);
var _result = boundingVolume.intersectPlane(Plane.fromCartesian4(plane, scratchPlane));
switch (result) {
case Intersect.OUTSIDE:
return Intersect.OUTSIDE;
if (_result === Intersect.OUTSIDE) {
return Intersect.OUTSIDE;
}
case Intersect.INTERSECTING:
intersect = (_readOnlyError("intersect"), Intersect.INTERSECTING);
break;
if (_result === Intersect.INTERSECTING) {
intersecting = (_readOnlyError("intersecting"), true);
default:
}

@@ -119,3 +121,3 @@ }

return intersecting ? Intersect.INTERSECTING : Intersect.INSIDE;
return intersect;
}

@@ -122,0 +124,0 @@ }]);

@@ -98,3 +98,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

value: function distanceSquaredTo(point) {
var offset = Vector3.subtract(point, this.center, scratchOffset);
var offset = scratchOffset.copy(point).subtract(this.center);
var halfAxes = this.halfAxes;

@@ -145,65 +145,49 @@ var u = halfAxes.getColumn(0, scratchVectorU);

key: "computePlaneDistances",
value: function computePlaneDistances(box, position, direction) {
var result = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [[], []];
value: function computePlaneDistances(position, direction) {
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [[], []];
var minDist = Number.POSITIVE_INFINITY;
var maxDist = Number.NEGATIVE_INFINITY;
var center = box.center;
var halfAxes = box.halfAxes;
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 = Vector3.add(u, v, scratchCorner);
Vector3.add(corner, w, corner);
Vector3.add(corner, center, corner);
var toCenter = Vector3.subtract(corner, position, scratchToCenter);
var mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
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);
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
center.copy(corner).subtract(u).subtract(v).subtract(w);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);
minDist = Math.min(mag, minDist);

@@ -210,0 +194,0 @@ maxDist = Math.max(mag, maxDist);

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

},
"version": "3.0.0-alpha.3",
"version": "3.0.0-alpha.4",
"keywords": [

@@ -40,5 +40,5 @@ "webgl",

"gl-matrix": "^3.0.0",
"math.gl": "3.0.0-alpha.3"
"math.gl": "3.0.0-alpha.4"
},
"gitHead": "1294046057e49eeb197023cf86bb100fb49382d5"
"gitHead": "90158f9659da040d75517b7f07c169fd0d015577"
}

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

static get MASK_INSIDE() {
return 0xffffffff;
return 0x00000000;
}

@@ -53,4 +53,4 @@

for (const faceNormal of faces) {
const plane0 = this.planes[planeIndex];
const plane1 = this.planes[planeIndex + 1];
let plane0 = this.planes[planeIndex];
let plane1 = this.planes[planeIndex + 1];

@@ -65,3 +65,3 @@ if (!plane0) {

scratchPlaneCenter
.set(faceNormal)
.copy(faceNormal)
.scale(-radius)

@@ -76,3 +76,3 @@ .add(center);

scratchPlaneCenter
.set(faceNormal)
.copy(faceNormal)
.scale(radius)

@@ -89,3 +89,3 @@ .add(center);

return result;
return this;
}

@@ -97,14 +97,20 @@

const planes = this.planes;
const intersecting = false;
const intersect = Intersect.INSIDE;
for (const plane of this.planes) {
const result = boundingVolume.intersectPlane(Plane.fromCartesian4(plane, scratchPlane));
if (result === Intersect.OUTSIDE) {
return Intersect.OUTSIDE;
const result = boundingVolume.intersectPlane(plane);
switch (result) {
case Intersect.OUTSIDE:
// We are done
return Intersect.OUTSIDE;
case Intersect.INTERSECTING:
// If no other intersection is outside, return INTERSECTING
intersect = Intersect.INTERSECTING;
break;
default:
}
if (result === Intersect.INTERSECTING) {
intersecting = true;
}
}
return intersecting ? Intersect.INTERSECTING : Intersect.INSIDE;
return intersect;
}

@@ -111,0 +117,0 @@

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

distanceSquaredTo(point) {
const offset = Vector3.subtract(point, this.center, scratchOffset);
const offset = scratchOffset.copy(point).subtract(this.center);

@@ -187,8 +187,8 @@ const halfAxes = this.halfAxes;

// eslint-disable-next-line max-statements
computePlaneDistances(box, position, direction, result = [[], []]) {
computePlaneDistances(position, direction, result = [[], []]) {
let minDist = Number.POSITIVE_INFINITY;
let maxDist = Number.NEGATIVE_INFINITY;
const center = box.center;
const halfAxes = box.halfAxes;
const center = this.center;
const halfAxes = this.halfAxes;

@@ -200,8 +200,10 @@ const u = halfAxes.getColumn(0, scratchVectorU);

// project first corner
const corner = Vector3.add(u, v, scratchCorner);
Vector3.add(corner, w, corner);
Vector3.add(corner, center, corner);
const corner = scratchCorner
.copy(u)
.add(v)
.add(w)
.add(center);
const toCenter = Vector3.subtract(corner, position, scratchToCenter);
let mag = Vector3.dot(direction, toCenter);
const toCenter = scratchToCenter.copy(corner).subtract(position);
let mag = direction.dot(toCenter);

@@ -212,8 +214,10 @@ minDist = Math.min(mag, minDist);

// project second corner
Vector3.add(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
corner
.copy(center)
.add(u)
.add(v)
.subtract(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -224,8 +228,10 @@ minDist = Math.min(mag, minDist);

// project third corner
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
corner
.copy(center)
.add(u)
.subtract(v)
.add(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -236,8 +242,10 @@ minDist = Math.min(mag, minDist);

// project fourth corner
Vector3.add(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
corner
.copy(center)
.add(u)
.subtract(v)
.subtract(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -248,8 +256,10 @@ minDist = Math.min(mag, minDist);

// project fifth corner
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.add(corner, w, corner);
center
.copy(corner)
.subtract(u)
.add(v)
.add(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -260,8 +270,10 @@ minDist = Math.min(mag, minDist);

// project sixth corner
Vector3.subtract(center, u, corner);
Vector3.add(corner, v, corner);
Vector3.subtract(corner, w, corner);
center
.copy(corner)
.subtract(u)
.add(v)
.subtract(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -272,8 +284,10 @@ minDist = Math.min(mag, minDist);

// project seventh corner
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.add(corner, w, corner);
center
.copy(corner)
.subtract(u)
.subtract(v)
.add(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -284,8 +298,10 @@ minDist = Math.min(mag, minDist);

// project eighth corner
Vector3.subtract(center, u, corner);
Vector3.subtract(corner, v, corner);
Vector3.subtract(corner, w, corner);
center
.copy(corner)
.subtract(u)
.subtract(v)
.subtract(w);
Vector3.subtract(corner, position, toCenter);
mag = Vector3.dot(direction, toCenter);
toCenter.copy(corner).subtract(position);
mag = direction.dot(toCenter);

@@ -292,0 +308,0 @@ minDist = Math.min(mag, minDist);

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