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

@math.gl/culling

Package Overview
Dependencies
Maintainers
4
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/culling - npm Package Compare versions

Comparing version 3.3.0-beta.1 to 3.3.0-beta.2

11

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

@@ -20,2 +20,11 @@ import Plane from './plane';

// Returns halfSize array corresponding to I3S OBB halfSize (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get halfSize(): number[];
// Returns quaternion corresponding to I3S OBB quaternion (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get quaternion(): Quaternion;
// Create OrientedBoundingBox from I3S OBB (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
fromCenterHalfSizeQuaternion(center: number[], halfSize: number[], quaternion: number[]): OrientedBoundingBox;
// Duplicates a OrientedBoundingBox instance.

@@ -22,0 +31,0 @@ clone(): OrientedBoundingBox;

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

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

@@ -53,2 +55,20 @@

(0, _createClass2["default"])(OrientedBoundingBox, [{
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;
}
}, {
key: "clone",

@@ -195,2 +215,21 @@ value: function clone() {

value: function getTransform() {}
}, {
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()];
}
}, {
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))));
}
}]);

@@ -197,0 +236,0 @@ return OrientedBoundingBox;

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

@@ -20,2 +20,11 @@ import Plane from './plane';

// Returns halfSize array corresponding to I3S OBB halfSize (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get halfSize(): number[];
// Returns quaternion corresponding to I3S OBB quaternion (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get quaternion(): Quaternion;
// Create OrientedBoundingBox from I3S OBB (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
fromCenterHalfSizeQuaternion(center: number[], halfSize: number[], quaternion: number[]): OrientedBoundingBox;
// Duplicates a OrientedBoundingBox instance.

@@ -22,0 +31,0 @@ clone(): OrientedBoundingBox;

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

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

@@ -31,2 +31,36 @@ import { INTERSECTION } from '../constants';

get halfSize() {
const xAxis = this.halfAxes.getColumn(0);
const yAxis = this.halfAxes.getColumn(1);
const zAxis = this.halfAxes.getColumn(2);
return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new 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 Vector3(xAxis).normalize();
const normYAxis = new Vector3(yAxis).normalize();
const normZAxis = new Vector3(zAxis).normalize();
return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
}
fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
const quaternionObject = new Quaternion(quaternion);
const directionsMatrix = new 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 Vector3().from(center);
this.halfAxes = directionsMatrix;
return this;
}
clone() {

@@ -33,0 +67,0 @@ return new OrientedBoundingBox(this.center, this.halfAxes);

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

@@ -20,2 +20,11 @@ import Plane from './plane';

// Returns halfSize array corresponding to I3S OBB halfSize (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get halfSize(): number[];
// Returns quaternion corresponding to I3S OBB quaternion (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get quaternion(): Quaternion;
// Create OrientedBoundingBox from I3S OBB (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
fromCenterHalfSizeQuaternion(center: number[], halfSize: number[], quaternion: number[]): OrientedBoundingBox;
// Duplicates a OrientedBoundingBox instance.

@@ -22,0 +31,0 @@ clone(): OrientedBoundingBox;

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

import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import { Vector3, Matrix3 } from '@math.gl/core';
import { Vector3, Matrix3, Quaternion } from '@math.gl/core';
import BoundingSphere from './bounding-sphere';

@@ -40,2 +41,20 @@ import { INTERSECTION } from '../constants';

_createClass(OrientedBoundingBox, [{
key: "fromCenterHalfSizeQuaternion",
value: function fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
var quaternionObject = new Quaternion(quaternion);
var directionsMatrix = new 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 Vector3().from(center);
this.halfAxes = directionsMatrix;
return this;
}
}, {
key: "clone",

@@ -182,2 +201,21 @@ value: function clone() {

value: function getTransform() {}
}, {
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 Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];
}
}, {
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 Vector3(xAxis).normalize();
var normYAxis = new Vector3(yAxis).normalize();
var normZAxis = new Vector3(zAxis).normalize();
return new Quaternion().fromMatrix3(new Matrix3([].concat(_toConsumableArray(normXAxis), _toConsumableArray(normYAxis), _toConsumableArray(normZAxis))));
}
}]);

@@ -184,0 +222,0 @@

6

package.json

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

},
"version": "3.3.0-beta.1",
"version": "3.3.0-beta.2",
"keywords": [

@@ -40,6 +40,6 @@ "webgl",

"@babel/runtime": "^7.0.0",
"@math.gl/core": "3.3.0-beta.1",
"@math.gl/core": "3.3.0-beta.2",
"gl-matrix": "^3.0.0"
},
"gitHead": "db59b4278852a96ec11cc5d3cb6db1f41d22f28e"
"gitHead": "17388afddc2c3e32c0cac8f09c6be07252d5fc65"
}
// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
import {Vector3, Matrix3} from '@math.gl/core';
import {Vector3, Matrix3, Quaternion} from '@math.gl/core';
import BoundingSphere from './bounding-sphere';

@@ -20,2 +20,11 @@ import Plane from './plane';

// Returns halfSize array corresponding to I3S OBB halfSize (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get halfSize(): number[];
// Returns quaternion corresponding to I3S OBB quaternion (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
get quaternion(): Quaternion;
// Create OrientedBoundingBox from I3S OBB (https://github.com/Esri/i3s-spec/blob/master/docs/1.7/obb.cmn.md)
fromCenterHalfSizeQuaternion(center: number[], halfSize: number[], quaternion: number[]): OrientedBoundingBox;
// Duplicates a OrientedBoundingBox instance.

@@ -22,0 +31,0 @@ clone(): OrientedBoundingBox;

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

@@ -38,2 +38,37 @@ import {INTERSECTION} from '../constants';

get halfSize() {
const xAxis = this.halfAxes.getColumn(0);
const yAxis = this.halfAxes.getColumn(1);
const zAxis = this.halfAxes.getColumn(2);
return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new 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 Vector3(xAxis).normalize();
const normYAxis = new Vector3(yAxis).normalize();
const normZAxis = new Vector3(zAxis).normalize();
return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
}
// Generate OrientedBoundingBox from OBB based on quaternion
fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
const quaternionObject = new Quaternion(quaternion);
const directionsMatrix = new 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 Vector3().from(center);
this.halfAxes = directionsMatrix;
return this;
}
// Duplicates a OrientedBoundingBox instance.

@@ -40,0 +75,0 @@ clone() {

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