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

@math.gl/core

Package Overview
Dependencies
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@math.gl/core - npm Package Compare versions

Comparing version 3.5.6 to 3.6.0-alpha.1

dist/classes/base/math-array.d.ts

427

dist/es5/classes/base/math-array.js

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _common = require("../../lib/common");

@@ -25,6 +15,2 @@

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _extendableBuiltin(cls) {

@@ -55,301 +41,242 @@ function ExtendableBuiltin() {

var MathArray = function (_extendableBuiltin2) {
(0, _inherits2.default)(MathArray, _extendableBuiltin2);
class MathArray extends _extendableBuiltin(Array) {
get ELEMENTS() {
(0, _assert.default)(false);
return 0;
}
var _super = _createSuper(MathArray);
clone() {
return new this.constructor().copy(this);
}
function MathArray() {
(0, _classCallCheck2.default)(this, MathArray);
return _super.apply(this, arguments);
from(arrayOrObject) {
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
}
(0, _createClass2.default)(MathArray, [{
key: "ELEMENTS",
get: function get() {
(0, _assert.default)(false);
return 0;
fromArray(array, offset = 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = array[i + offset];
}
}, {
key: "clone",
value: function clone() {
return new this.constructor().copy(this);
}
}, {
key: "from",
value: function from(arrayOrObject) {
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
}
}, {
key: "fromArray",
value: function fromArray(array) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = array[i + offset];
}
return this.check();
}
return this.check();
to(arrayOrObject) {
if (arrayOrObject === this) {
return this;
}
}, {
key: "to",
value: function to(arrayOrObject) {
if (arrayOrObject === this) {
return this;
}
return (0, _common.isArray)(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
return (0, _common.isArray)(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
}
toTarget(target) {
return target ? this.to(target) : this;
}
toArray(array = [], offset = 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
array[offset + i] = this[i];
}
}, {
key: "toTarget",
value: function toTarget(target) {
return target ? this.to(target) : this;
}
}, {
key: "toArray",
value: function toArray() {
var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
for (var i = 0; i < this.ELEMENTS; ++i) {
array[offset + i] = this[i];
}
return array;
}
return array;
toFloat32Array() {
return new Float32Array(this);
}
toString() {
return this.formatString(_common.config);
}
formatString(opts) {
let string = '';
for (let i = 0; i < this.ELEMENTS; ++i) {
string += (i > 0 ? ', ' : '') + (0, _common.formatValue)(this[i], opts);
}
}, {
key: "toFloat32Array",
value: function toFloat32Array() {
return new Float32Array(this);
}
}, {
key: "toString",
value: function toString() {
return this.formatString(_common.config);
}
}, {
key: "formatString",
value: function formatString(opts) {
var string = '';
for (var i = 0; i < this.ELEMENTS; ++i) {
string += (i > 0 ? ', ' : '') + (0, _common.formatValue)(this[i], opts);
}
return "".concat(opts.printTypes ? this.constructor.name : '', "[").concat(string, "]");
}
return "".concat(opts.printTypes ? this.constructor.name : '', "[").concat(string, "]");
equals(array) {
if (!array || this.length !== array.length) {
return false;
}
}, {
key: "equals",
value: function equals(array) {
if (!array || this.length !== array.length) {
for (let i = 0; i < this.ELEMENTS; ++i) {
if (!(0, _common.equals)(this[i], array[i])) {
return false;
}
}
for (var i = 0; i < this.ELEMENTS; ++i) {
if (!(0, _common.equals)(this[i], array[i])) {
return false;
}
}
return true;
}
return true;
exactEquals(array) {
if (!array || this.length !== array.length) {
return false;
}
}, {
key: "exactEquals",
value: function exactEquals(array) {
if (!array || this.length !== array.length) {
for (let i = 0; i < this.ELEMENTS; ++i) {
if (this[i] !== array[i]) {
return false;
}
}
for (var i = 0; i < this.ELEMENTS; ++i) {
if (this[i] !== array[i]) {
return false;
}
}
return true;
}
return true;
negate() {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = -this[i];
}
}, {
key: "negate",
value: function negate() {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = -this[i];
}
return this.check();
return this.check();
}
lerp(a, b, t) {
if (t === undefined) {
t = b;
b = a;
a = this;
}
}, {
key: "lerp",
value: function lerp(a, b, t) {
if (t === undefined) {
t = b;
b = a;
a = this;
}
for (var i = 0; i < this.ELEMENTS; ++i) {
var ai = a[i];
this[i] = ai + t * (b[i] - ai);
}
return this.check();
for (let i = 0; i < this.ELEMENTS; ++i) {
const ai = a[i];
this[i] = ai + t * (b[i] - ai);
}
}, {
key: "min",
value: function min(vector) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(vector[i], this[i]);
}
return this.check();
return this.check();
}
min(vector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(vector[i], this[i]);
}
}, {
key: "max",
value: function max(vector) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.max(vector[i], this[i]);
}
return this.check();
return this.check();
}
max(vector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.max(vector[i], this[i]);
}
}, {
key: "clamp",
value: function clamp(minVector, maxVector) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);
}
return this.check();
return this.check();
}
clamp(minVector, maxVector) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);
}
}, {
key: "add",
value: function add() {
for (var _len = arguments.length, vectors = new Array(_len), _key = 0; _key < _len; _key++) {
vectors[_key] = arguments[_key];
}
for (var _i = 0, _vectors = vectors; _i < _vectors.length; _i++) {
var vector = _vectors[_i];
return this.check();
}
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] += vector[i];
}
add(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] += vector[i];
}
return this.check();
}
}, {
key: "subtract",
value: function subtract() {
for (var _len2 = arguments.length, vectors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
vectors[_key2] = arguments[_key2];
}
for (var _i2 = 0, _vectors2 = vectors; _i2 < _vectors2.length; _i2++) {
var vector = _vectors2[_i2];
return this.check();
}
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] -= vector[i];
}
subtract(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] -= vector[i];
}
return this.check();
}
}, {
key: "scale",
value: function scale(_scale) {
if (Array.isArray(_scale)) {
return this.multiply(_scale);
}
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] *= _scale;
}
return this.check();
}
return this.check();
scale(scale) {
if (Array.isArray(scale)) {
return this.multiply(scale);
}
}, {
key: "sub",
value: function sub(a) {
return this.subtract(a);
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= scale;
}
}, {
key: "setScalar",
value: function setScalar(a) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = a;
}
return this.check();
return this.check();
}
sub(a) {
return this.subtract(a);
}
setScalar(a) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = a;
}
}, {
key: "addScalar",
value: function addScalar(a) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] += a;
}
return this.check();
return this.check();
}
addScalar(a) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] += a;
}
}, {
key: "subScalar",
value: function subScalar(a) {
return this.addScalar(-a);
}
}, {
key: "multiplyScalar",
value: function multiplyScalar(scalar) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] *= scalar;
}
return this.check();
return this.check();
}
subScalar(a) {
return this.addScalar(-a);
}
multiplyScalar(scalar) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= scalar;
}
}, {
key: "divideScalar",
value: function divideScalar(a) {
return this.scale(1 / a);
}
}, {
key: "clampScalar",
value: function clampScalar(min, max) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], min), max);
}
return this.check();
return this.check();
}
divideScalar(a) {
return this.scale(1 / a);
}
clampScalar(min, max) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] = Math.min(Math.max(this[i], min), max);
}
}, {
key: "multiplyByScalar",
value: function multiplyByScalar(scalar) {
return this.scale(scalar);
}
}, {
key: "elements",
get: function get() {
return this;
}
}, {
key: "check",
value: function check() {
if (_common.config.debug && !this.validate()) {
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
}
return this;
return this.check();
}
multiplyByScalar(scalar) {
return this.scale(scalar);
}
get elements() {
return this;
}
check() {
if (_common.config.debug && !this.validate()) {
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
}
}, {
key: "validate",
value: function validate() {
var valid = this.length === this.ELEMENTS;
for (var i = 0; i < this.ELEMENTS; ++i) {
valid = valid && Number.isFinite(this[i]);
}
return this;
}
return valid;
validate() {
let valid = this.length === this.ELEMENTS;
for (let i = 0; i < this.ELEMENTS; ++i) {
valid = valid && Number.isFinite(this[i]);
}
}]);
return MathArray;
}(_extendableBuiltin(Array));
return valid;
}
}
exports.default = MathArray;
//# sourceMappingURL=math-array.js.map

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _mathArray = _interopRequireDefault(require("./math-array"));

@@ -29,96 +19,72 @@

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
class Matrix extends _mathArray.default {
get ELEMENTS() {
(0, _assert.default)(false);
return 0;
}
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
get RANK() {
(0, _assert.default)(false);
return 0;
}
var Matrix = function (_MathArray) {
(0, _inherits2.default)(Matrix, _MathArray);
toString() {
let string = '[';
var _super = _createSuper(Matrix);
if (_common.config.printRowMajor) {
string += 'row-major:';
function Matrix() {
(0, _classCallCheck2.default)(this, Matrix);
return _super.apply(this, arguments);
}
for (let row = 0; row < this.RANK; ++row) {
for (let col = 0; col < this.RANK; ++col) {
string += " ".concat(this[col * this.RANK + row]);
}
}
} else {
string += 'column-major:';
(0, _createClass2.default)(Matrix, [{
key: "ELEMENTS",
get: function get() {
(0, _assert.default)(false);
return 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
string += " ".concat(this[i]);
}
}
}, {
key: "RANK",
get: function get() {
(0, _assert.default)(false);
return 0;
}
}, {
key: "toString",
value: function toString() {
var string = '[';
if (_common.config.printRowMajor) {
string += 'row-major:';
string += ']';
return string;
}
for (var row = 0; row < this.RANK; ++row) {
for (var col = 0; col < this.RANK; ++col) {
string += " ".concat(this[col * this.RANK + row]);
}
}
} else {
string += 'column-major:';
getElementIndex(row, col) {
return col * this.RANK + row;
}
for (var i = 0; i < this.ELEMENTS; ++i) {
string += " ".concat(this[i]);
}
}
getElement(row, col) {
return this[col * this.RANK + row];
}
string += ']';
return string;
}
}, {
key: "getElementIndex",
value: function getElementIndex(row, col) {
return col * this.RANK + row;
}
}, {
key: "getElement",
value: function getElement(row, col) {
return this[col * this.RANK + row];
}
}, {
key: "setElement",
value: function setElement(row, col, value) {
this[col * this.RANK + row] = (0, _validators.checkNumber)(value);
return this;
}
}, {
key: "getColumn",
value: function getColumn(columnIndex) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Array(this.RANK).fill(-0);
var firstIndex = columnIndex * this.RANK;
setElement(row, col, value) {
this[col * this.RANK + row] = (0, _validators.checkNumber)(value);
return this;
}
for (var i = 0; i < this.RANK; ++i) {
result[i] = this[firstIndex + i];
}
getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
const firstIndex = columnIndex * this.RANK;
return result;
for (let i = 0; i < this.RANK; ++i) {
result[i] = this[firstIndex + i];
}
}, {
key: "setColumn",
value: function setColumn(columnIndex, columnVector) {
var firstIndex = columnIndex * this.RANK;
for (var i = 0; i < this.RANK; ++i) {
this[firstIndex + i] = columnVector[i];
}
return result;
}
return this;
setColumn(columnIndex, columnVector) {
const firstIndex = columnIndex * this.RANK;
for (let i = 0; i < this.RANK; ++i) {
this[firstIndex + i] = columnVector[i];
}
}]);
return Matrix;
}(_mathArray.default);
return this;
}
}
exports.default = Matrix;
//# sourceMappingURL=matrix.js.map

@@ -10,214 +10,156 @@ "use strict";

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _mathArray = _interopRequireDefault(require("./math-array"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _validators = require("../../lib/validators");
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _assert = _interopRequireDefault(require("../../lib/assert"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
class Vector extends _mathArray.default {
get ELEMENTS() {
(0, _assert.default)(false);
return 0;
}
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
copy(vector) {
(0, _assert.default)(false);
return this;
}
var _mathArray = _interopRequireDefault(require("./math-array"));
get x() {
return this[0];
}
var _validators = require("../../lib/validators");
set x(value) {
this[0] = (0, _validators.checkNumber)(value);
}
var _assert = _interopRequireDefault(require("../../lib/assert"));
get y() {
return this[1];
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
set y(value) {
this[1] = (0, _validators.checkNumber)(value);
}
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
len() {
return Math.sqrt(this.lengthSquared());
}
var Vector = function (_MathArray) {
(0, _inherits2.default)(Vector, _MathArray);
magnitude() {
return this.len();
}
var _super = _createSuper(Vector);
lengthSquared() {
let length = 0;
function Vector() {
(0, _classCallCheck2.default)(this, Vector);
return _super.apply(this, arguments);
for (let i = 0; i < this.ELEMENTS; ++i) {
length += this[i] * this[i];
}
return length;
}
(0, _createClass2.default)(Vector, [{
key: "ELEMENTS",
get: function get() {
(0, _assert.default)(false);
return 0;
}
}, {
key: "copy",
value: function copy(vector) {
(0, _assert.default)(false);
return this;
}
}, {
key: "x",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "y",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "len",
value: function len() {
return Math.sqrt(this.lengthSquared());
}
}, {
key: "magnitude",
value: function magnitude() {
return this.len();
}
}, {
key: "lengthSquared",
value: function lengthSquared() {
var length = 0;
magnitudeSquared() {
return this.lengthSquared();
}
for (var i = 0; i < this.ELEMENTS; ++i) {
length += this[i] * this[i];
}
distance(mathArray) {
return Math.sqrt(this.distanceSquared(mathArray));
}
return length;
distanceSquared(mathArray) {
let length = 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
const dist = this[i] - mathArray[i];
length += dist * dist;
}
}, {
key: "magnitudeSquared",
value: function magnitudeSquared() {
return this.lengthSquared();
}
}, {
key: "distance",
value: function distance(mathArray) {
return Math.sqrt(this.distanceSquared(mathArray));
}
}, {
key: "distanceSquared",
value: function distanceSquared(mathArray) {
var length = 0;
for (var i = 0; i < this.ELEMENTS; ++i) {
var dist = this[i] - mathArray[i];
length += dist * dist;
}
return (0, _validators.checkNumber)(length);
}
return (0, _validators.checkNumber)(length);
dot(mathArray) {
let product = 0;
for (let i = 0; i < this.ELEMENTS; ++i) {
product += this[i] * mathArray[i];
}
}, {
key: "dot",
value: function dot(mathArray) {
var product = 0;
for (var i = 0; i < this.ELEMENTS; ++i) {
product += this[i] * mathArray[i];
}
return (0, _validators.checkNumber)(product);
}
return (0, _validators.checkNumber)(product);
}
}, {
key: "normalize",
value: function normalize() {
var length = this.magnitude();
normalize() {
const length = this.magnitude();
if (length !== 0) {
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] /= length;
}
if (length !== 0) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] /= length;
}
return this.check();
}
}, {
key: "multiply",
value: function multiply() {
for (var _len = arguments.length, vectors = new Array(_len), _key = 0; _key < _len; _key++) {
vectors[_key] = arguments[_key];
}
for (var _i = 0, _vectors = vectors; _i < _vectors.length; _i++) {
var vector = _vectors[_i];
return this.check();
}
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] *= vector[i];
}
multiply(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] *= vector[i];
}
return this.check();
}
}, {
key: "divide",
value: function divide() {
for (var _len2 = arguments.length, vectors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
vectors[_key2] = arguments[_key2];
}
for (var _i2 = 0, _vectors2 = vectors; _i2 < _vectors2.length; _i2++) {
var vector = _vectors2[_i2];
return this.check();
}
for (var i = 0; i < this.ELEMENTS; ++i) {
this[i] /= vector[i];
}
divide(...vectors) {
for (const vector of vectors) {
for (let i = 0; i < this.ELEMENTS; ++i) {
this[i] /= vector[i];
}
return this.check();
}
}, {
key: "lengthSq",
value: function lengthSq() {
return this.lengthSquared();
}
}, {
key: "distanceTo",
value: function distanceTo(vector) {
return this.distance(vector);
}
}, {
key: "distanceToSquared",
value: function distanceToSquared(vector) {
return this.distanceSquared(vector);
}
}, {
key: "getComponent",
value: function getComponent(i) {
(0, _assert.default)(i >= 0 && i < this.ELEMENTS, 'index is out of range');
return (0, _validators.checkNumber)(this[i]);
}
}, {
key: "setComponent",
value: function setComponent(i, value) {
(0, _assert.default)(i >= 0 && i < this.ELEMENTS, 'index is out of range');
this[i] = value;
return this.check();
}
}, {
key: "addVectors",
value: function addVectors(a, b) {
return this.copy(a).add(b);
}
}, {
key: "subVectors",
value: function subVectors(a, b) {
return this.copy(a).subtract(b);
}
}, {
key: "multiplyVectors",
value: function multiplyVectors(a, b) {
return this.copy(a).multiply(b);
}
}, {
key: "addScaledVector",
value: function addScaledVector(a, b) {
return this.add(new this.constructor(a).multiplyScalar(b));
}
}]);
return Vector;
}(_mathArray.default);
return this.check();
}
lengthSq() {
return this.lengthSquared();
}
distanceTo(vector) {
return this.distance(vector);
}
distanceToSquared(vector) {
return this.distanceSquared(vector);
}
getComponent(i) {
(0, _assert.default)(i >= 0 && i < this.ELEMENTS, 'index is out of range');
return (0, _validators.checkNumber)(this[i]);
}
setComponent(i, value) {
(0, _assert.default)(i >= 0 && i < this.ELEMENTS, 'index is out of range');
this[i] = value;
return this.check();
}
addVectors(a, b) {
return this.copy(a).add(b);
}
subVectors(a, b) {
return this.copy(a).subtract(b);
}
multiplyVectors(a, b) {
return this.copy(a).multiply(b);
}
addScaledVector(a, b) {
return this.add(new this.constructor(a).multiplyScalar(b));
}
}
exports.default = Vector;
//# sourceMappingURL=vector.js.map

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

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _mathArray = _interopRequireDefault(require("./base/math-array"));

@@ -29,11 +17,7 @@

var _quaternion2 = _interopRequireDefault(require("./quaternion"));
var _quaternion = _interopRequireDefault(require("./quaternion"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
const ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
const ALMOST_ONE = 0.99999;
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
var ALMOST_ONE = 0.99999;
function validateOrder(value) {

@@ -51,593 +35,528 @@ return value >= 0 && value < 6;

var Euler = function (_MathArray) {
(0, _inherits2.default)(Euler, _MathArray);
class Euler extends _mathArray.default {
static get ZYX() {
return 0;
}
var _super = _createSuper(Euler);
static get YXZ() {
return 1;
}
function Euler() {
var _this;
static get XZY() {
return 2;
}
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Euler.DefaultOrder;
(0, _classCallCheck2.default)(this, Euler);
_this = _super.call(this, -0, -0, -0, -0);
static get ZXY() {
return 3;
}
static get YZX() {
return 4;
}
static get XYZ() {
return 5;
}
static get RollPitchYaw() {
return 0;
}
static get DefaultOrder() {
return Euler.ZYX;
}
static get RotationOrders() {
return ['ZYX', 'YXZ', 'XZY', 'ZXY', 'YZX', 'XYZ'];
}
static rotationOrder(order) {
return Euler.RotationOrders[order];
}
get ELEMENTS() {
return 4;
}
constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
super(-0, -0, -0, -0);
if (arguments.length > 0 && Array.isArray(arguments[0])) {
var _this2;
(_this2 = _this).fromVector3.apply(_this2, arguments);
this.fromVector3(...arguments);
} else {
_this.set(x, y, z, order);
this.set(x, y, z, order);
}
}
return _this;
fromQuaternion(quaternion) {
const [x, y, z, w] = quaternion;
const ysqr = y * y;
const t0 = -2.0 * (ysqr + z * z) + 1.0;
const t1 = +2.0 * (x * y + w * z);
let t2 = -2.0 * (x * z - w * y);
const t3 = +2.0 * (y * z + w * x);
const t4 = -2.0 * (x * x + ysqr) + 1.0;
t2 = t2 > 1.0 ? 1.0 : t2;
t2 = t2 < -1.0 ? -1.0 : t2;
const roll = Math.atan2(t3, t4);
const pitch = Math.asin(t2);
const yaw = Math.atan2(t1, t0);
return new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
}
(0, _createClass2.default)(Euler, [{
key: "ELEMENTS",
get: function get() {
return 4;
}
}, {
key: "fromQuaternion",
value: function fromQuaternion(quaternion) {
var _quaternion = (0, _slicedToArray2.default)(quaternion, 4),
x = _quaternion[0],
y = _quaternion[1],
z = _quaternion[2],
w = _quaternion[3];
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = Number.isFinite(array[3]) || this.order;
return this.check();
}
var ysqr = y * y;
var t0 = -2.0 * (ysqr + z * z) + 1.0;
var t1 = +2.0 * (x * y + w * z);
var t2 = -2.0 * (x * z - w * y);
var t3 = +2.0 * (y * z + w * x);
var t4 = -2.0 * (x * x + ysqr) + 1.0;
t2 = t2 > 1.0 ? 1.0 : t2;
t2 = t2 < -1.0 ? -1.0 : t2;
var roll = Math.atan2(t3, t4);
var pitch = Math.asin(t2);
var yaw = Math.atan2(t1, t0);
return new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = Number.isFinite(array[3]) || this.order;
return this.check();
}
}, {
key: "set",
value: function set() {
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var order = arguments.length > 3 ? arguments[3] : undefined;
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = Number.isFinite(order) ? order : this[3];
return this.check();
}
}, {
key: "validate",
value: function validate() {
return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
}
}, {
key: "toArray",
value: function toArray() {
var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
return array;
}
}, {
key: "toArray4",
value: function toArray4() {
var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
array[offset + 3] = this[3];
return array;
}
}, {
key: "toVector3",
value: function toVector3() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [-0, -0, -0];
result[0] = this[0];
result[1] = this[1];
result[2] = this[2];
return result;
}
}, {
key: "x",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "y",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "z",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "alpha",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "beta",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "gamma",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "phi",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "theta",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "psi",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "roll",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "pitch",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "yaw",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "order",
get: function get() {
return this[3];
},
set: function set(value) {
this[3] = checkOrder(value);
}
}, {
key: "fromVector3",
value: function fromVector3(v, order) {
return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
}
}, {
key: "fromArray",
value: function fromArray(array) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
this[0] = array[0 + offset];
this[1] = array[1 + offset];
this[2] = array[2 + offset];
set(x = 0, y = 0, z = 0, order) {
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = Number.isFinite(order) ? order : this[3];
return this.check();
}
if (array[3] !== undefined) {
this[3] = array[3];
}
validate() {
return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
}
return this.check();
}
}, {
key: "fromRollPitchYaw",
value: function fromRollPitchYaw(roll, pitch, yaw) {
return this.set(roll, pitch, yaw, Euler.ZYX);
}
}, {
key: "fromRotationMatrix",
value: function fromRotationMatrix(m) {
var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Euler.DefaultOrder;
toArray(array = [], offset = 0) {
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
return array;
}
this._fromRotationMatrix(m, order);
toArray4(array = [], offset = 0) {
array[offset] = this[0];
array[offset + 1] = this[1];
array[offset + 2] = this[2];
array[offset + 3] = this[3];
return array;
}
return this.check();
toVector3(result = [-0, -0, -0]) {
result[0] = this[0];
result[1] = this[1];
result[2] = this[2];
return result;
}
get x() {
return this[0];
}
set x(value) {
this[0] = (0, _validators.checkNumber)(value);
}
get y() {
return this[1];
}
set y(value) {
this[1] = (0, _validators.checkNumber)(value);
}
get z() {
return this[2];
}
set z(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get alpha() {
return this[0];
}
set alpha(value) {
this[0] = (0, _validators.checkNumber)(value);
}
get beta() {
return this[1];
}
set beta(value) {
this[1] = (0, _validators.checkNumber)(value);
}
get gamma() {
return this[2];
}
set gamma(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get phi() {
return this[0];
}
set phi(value) {
this[0] = (0, _validators.checkNumber)(value);
}
get theta() {
return this[1];
}
set theta(value) {
this[1] = (0, _validators.checkNumber)(value);
}
get psi() {
return this[2];
}
set psi(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get roll() {
return this[0];
}
set roll(value) {
this[0] = (0, _validators.checkNumber)(value);
}
get pitch() {
return this[1];
}
set pitch(value) {
this[1] = (0, _validators.checkNumber)(value);
}
get yaw() {
return this[2];
}
set yaw(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get order() {
return this[3];
}
set order(value) {
this[3] = checkOrder(value);
}
fromVector3(v, order) {
return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
}
fromArray(array, offset = 0) {
this[0] = array[0 + offset];
this[1] = array[1 + offset];
this[2] = array[2 + offset];
if (array[3] !== undefined) {
this[3] = array[3];
}
}, {
key: "getRotationMatrix",
value: function getRotationMatrix(m) {
return this._getRotationMatrix(m);
}
}, {
key: "getQuaternion",
value: function getQuaternion() {
var q = new _quaternion2.default();
switch (this[3]) {
case Euler.XYZ:
return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
return this.check();
}
case Euler.YXZ:
return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);
fromRollPitchYaw(roll, pitch, yaw) {
return this.set(roll, pitch, yaw, Euler.ZYX);
}
case Euler.ZXY:
return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);
fromRotationMatrix(m, order = Euler.DefaultOrder) {
this._fromRotationMatrix(m, order);
case Euler.ZYX:
return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);
return this.check();
}
case Euler.YZX:
return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);
getRotationMatrix(m) {
return this._getRotationMatrix(m);
}
case Euler.XZY:
return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);
getQuaternion() {
const q = new _quaternion.default();
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
switch (this[3]) {
case Euler.XYZ:
return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
case Euler.YXZ:
return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);
case Euler.ZXY:
return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);
case Euler.ZYX:
return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);
case Euler.YZX:
return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);
case Euler.XZY:
return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
}, {
key: "_fromRotationMatrix",
value: function _fromRotationMatrix(m) {
var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Euler.DefaultOrder;
var te = m.elements;
var m11 = te[0],
}
_fromRotationMatrix(m, order = Euler.DefaultOrder) {
const te = m.elements;
const m11 = te[0],
m12 = te[4],
m13 = te[8];
var m21 = te[1],
const m21 = te[1],
m22 = te[5],
m23 = te[9];
var m31 = te[2],
const m31 = te[2],
m32 = te[6],
m33 = te[10];
order = order || this[3];
order = order || this[3];
switch (order) {
case Euler.XYZ:
this[1] = Math.asin((0, _common.clamp)(m13, -1, 1));
switch (order) {
case Euler.XYZ:
this[1] = Math.asin((0, _common.clamp)(m13, -1, 1));
if (Math.abs(m13) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m33);
this[2] = Math.atan2(-m12, m11);
} else {
this[0] = Math.atan2(m32, m22);
this[2] = 0;
}
if (Math.abs(m13) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m33);
this[2] = Math.atan2(-m12, m11);
} else {
this[0] = Math.atan2(m32, m22);
this[2] = 0;
}
break;
break;
case Euler.YXZ:
this[0] = Math.asin(-(0, _common.clamp)(m23, -1, 1));
case Euler.YXZ:
this[0] = Math.asin(-(0, _common.clamp)(m23, -1, 1));
if (Math.abs(m23) < ALMOST_ONE) {
this[1] = Math.atan2(m13, m33);
this[2] = Math.atan2(m21, m22);
} else {
this[1] = Math.atan2(-m31, m11);
this[2] = 0;
}
if (Math.abs(m23) < ALMOST_ONE) {
this[1] = Math.atan2(m13, m33);
this[2] = Math.atan2(m21, m22);
} else {
this[1] = Math.atan2(-m31, m11);
this[2] = 0;
}
break;
break;
case Euler.ZXY:
this[0] = Math.asin((0, _common.clamp)(m32, -1, 1));
case Euler.ZXY:
this[0] = Math.asin((0, _common.clamp)(m32, -1, 1));
if (Math.abs(m32) < ALMOST_ONE) {
this[1] = Math.atan2(-m31, m33);
this[2] = Math.atan2(-m12, m22);
} else {
this[1] = 0;
this[2] = Math.atan2(m21, m11);
}
if (Math.abs(m32) < ALMOST_ONE) {
this[1] = Math.atan2(-m31, m33);
this[2] = Math.atan2(-m12, m22);
} else {
this[1] = 0;
this[2] = Math.atan2(m21, m11);
}
break;
break;
case Euler.ZYX:
this[1] = Math.asin(-(0, _common.clamp)(m31, -1, 1));
case Euler.ZYX:
this[1] = Math.asin(-(0, _common.clamp)(m31, -1, 1));
if (Math.abs(m31) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m33);
this[2] = Math.atan2(m21, m11);
} else {
this[0] = 0;
this[2] = Math.atan2(-m12, m22);
}
if (Math.abs(m31) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m33);
this[2] = Math.atan2(m21, m11);
} else {
this[0] = 0;
this[2] = Math.atan2(-m12, m22);
}
break;
break;
case Euler.YZX:
this[2] = Math.asin((0, _common.clamp)(m21, -1, 1));
case Euler.YZX:
this[2] = Math.asin((0, _common.clamp)(m21, -1, 1));
if (Math.abs(m21) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m22);
this[1] = Math.atan2(-m31, m11);
} else {
this[0] = 0;
this[1] = Math.atan2(m13, m33);
}
if (Math.abs(m21) < ALMOST_ONE) {
this[0] = Math.atan2(-m23, m22);
this[1] = Math.atan2(-m31, m11);
} else {
this[0] = 0;
this[1] = Math.atan2(m13, m33);
}
break;
break;
case Euler.XZY:
this[2] = Math.asin(-(0, _common.clamp)(m12, -1, 1));
case Euler.XZY:
this[2] = Math.asin(-(0, _common.clamp)(m12, -1, 1));
if (Math.abs(m12) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m22);
this[1] = Math.atan2(m13, m11);
} else {
this[0] = Math.atan2(-m23, m33);
this[1] = 0;
}
if (Math.abs(m12) < ALMOST_ONE) {
this[0] = Math.atan2(m32, m22);
this[1] = Math.atan2(m13, m11);
} else {
this[0] = Math.atan2(-m23, m33);
this[1] = 0;
}
break;
break;
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
this[3] = order;
return this;
}
}, {
key: "_getRotationMatrix",
value: function _getRotationMatrix(result) {
var te = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
var x = this.x,
this[3] = order;
return this;
}
_getRotationMatrix(result) {
const te = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
const x = this.x,
y = this.y,
z = this.z;
var a = Math.cos(x);
var c = Math.cos(y);
var e = Math.cos(z);
var b = Math.sin(x);
var d = Math.sin(y);
var f = Math.sin(z);
const a = Math.cos(x);
const c = Math.cos(y);
const e = Math.cos(z);
const b = Math.sin(x);
const d = Math.sin(y);
const f = Math.sin(z);
switch (this[3]) {
case Euler.XYZ:
{
var ae = a * e,
switch (this[3]) {
case Euler.XYZ:
{
const ae = a * e,
af = a * f,
be = b * e,
bf = b * f;
te[0] = c * e;
te[4] = -c * f;
te[8] = d;
te[1] = af + be * d;
te[5] = ae - bf * d;
te[9] = -b * c;
te[2] = bf - ae * d;
te[6] = be + af * d;
te[10] = a * c;
break;
}
te[0] = c * e;
te[4] = -c * f;
te[8] = d;
te[1] = af + be * d;
te[5] = ae - bf * d;
te[9] = -b * c;
te[2] = bf - ae * d;
te[6] = be + af * d;
te[10] = a * c;
break;
}
case Euler.YXZ:
{
var ce = c * e,
case Euler.YXZ:
{
const ce = c * e,
cf = c * f,
de = d * e,
df = d * f;
te[0] = ce + df * b;
te[4] = de * b - cf;
te[8] = a * d;
te[1] = a * f;
te[5] = a * e;
te[9] = -b;
te[2] = cf * b - de;
te[6] = df + ce * b;
te[10] = a * c;
break;
}
te[0] = ce + df * b;
te[4] = de * b - cf;
te[8] = a * d;
te[1] = a * f;
te[5] = a * e;
te[9] = -b;
te[2] = cf * b - de;
te[6] = df + ce * b;
te[10] = a * c;
break;
}
case Euler.ZXY:
{
var _ce = c * e,
_cf = c * f,
_de = d * e,
_df = d * f;
case Euler.ZXY:
{
const ce = c * e,
cf = c * f,
de = d * e,
df = d * f;
te[0] = ce - df * b;
te[4] = -a * f;
te[8] = de + cf * b;
te[1] = cf + de * b;
te[5] = a * e;
te[9] = df - ce * b;
te[2] = -a * d;
te[6] = b;
te[10] = a * c;
break;
}
te[0] = _ce - _df * b;
te[4] = -a * f;
te[8] = _de + _cf * b;
te[1] = _cf + _de * b;
te[5] = a * e;
te[9] = _df - _ce * b;
te[2] = -a * d;
te[6] = b;
te[10] = a * c;
break;
}
case Euler.ZYX:
{
const ae = a * e,
af = a * f,
be = b * e,
bf = b * f;
te[0] = c * e;
te[4] = be * d - af;
te[8] = ae * d + bf;
te[1] = c * f;
te[5] = bf * d + ae;
te[9] = af * d - be;
te[2] = -d;
te[6] = b * c;
te[10] = a * c;
break;
}
case Euler.ZYX:
{
var _ae = a * e,
_af = a * f,
_be = b * e,
_bf = b * f;
case Euler.YZX:
{
const ac = a * c,
ad = a * d,
bc = b * c,
bd = b * d;
te[0] = c * e;
te[4] = bd - ac * f;
te[8] = bc * f + ad;
te[1] = f;
te[5] = a * e;
te[9] = -b * e;
te[2] = -d * e;
te[6] = ad * f + bc;
te[10] = ac - bd * f;
break;
}
te[0] = c * e;
te[4] = _be * d - _af;
te[8] = _ae * d + _bf;
te[1] = c * f;
te[5] = _bf * d + _ae;
te[9] = _af * d - _be;
te[2] = -d;
te[6] = b * c;
te[10] = a * c;
break;
}
case Euler.YZX:
{
var ac = a * c,
case Euler.XZY:
{
const ac = a * c,
ad = a * d,
bc = b * c,
bd = b * d;
te[0] = c * e;
te[4] = bd - ac * f;
te[8] = bc * f + ad;
te[1] = f;
te[5] = a * e;
te[9] = -b * e;
te[2] = -d * e;
te[6] = ad * f + bc;
te[10] = ac - bd * f;
break;
}
te[0] = c * e;
te[4] = -f;
te[8] = d * e;
te[1] = ac * f + bd;
te[5] = a * e;
te[9] = ad * f - bc;
te[2] = bc * f - ad;
te[6] = b * e;
te[10] = bd * f + ac;
break;
}
case Euler.XZY:
{
var _ac = a * c,
_ad = a * d,
_bc = b * c,
_bd = b * d;
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
te[0] = c * e;
te[4] = -f;
te[8] = d * e;
te[1] = _ac * f + _bd;
te[5] = a * e;
te[9] = _ad * f - _bc;
te[2] = _bc * f - _ad;
te[6] = b * e;
te[10] = _bd * f + _ac;
break;
}
te[3] = 0;
te[7] = 0;
te[11] = 0;
te[12] = 0;
te[13] = 0;
te[14] = 0;
te[15] = 1;
return te;
}
default:
throw new Error(ERR_UNKNOWN_ORDER);
}
toQuaternion() {
const cy = Math.cos(this.yaw * 0.5);
const sy = Math.sin(this.yaw * 0.5);
const cr = Math.cos(this.roll * 0.5);
const sr = Math.sin(this.roll * 0.5);
const cp = Math.cos(this.pitch * 0.5);
const sp = Math.sin(this.pitch * 0.5);
const w = cy * cr * cp + sy * sr * sp;
const x = cy * sr * cp - sy * cr * sp;
const y = cy * cr * sp + sy * sr * cp;
const z = sy * cr * cp - cy * sr * sp;
return new _quaternion.default(x, y, z, w);
}
te[3] = 0;
te[7] = 0;
te[11] = 0;
te[12] = 0;
te[13] = 0;
te[14] = 0;
te[15] = 1;
return te;
}
}, {
key: "toQuaternion",
value: function toQuaternion() {
var cy = Math.cos(this.yaw * 0.5);
var sy = Math.sin(this.yaw * 0.5);
var cr = Math.cos(this.roll * 0.5);
var sr = Math.sin(this.roll * 0.5);
var cp = Math.cos(this.pitch * 0.5);
var sp = Math.sin(this.pitch * 0.5);
var w = cy * cr * cp + sy * sr * sp;
var x = cy * sr * cp - sy * cr * sp;
var y = cy * cr * sp + sy * sr * cp;
var z = sy * cr * cp - cy * sr * sp;
return new _quaternion2.default(x, y, z, w);
}
}], [{
key: "ZYX",
get: function get() {
return 0;
}
}, {
key: "YXZ",
get: function get() {
return 1;
}
}, {
key: "XZY",
get: function get() {
return 2;
}
}, {
key: "ZXY",
get: function get() {
return 3;
}
}, {
key: "YZX",
get: function get() {
return 4;
}
}, {
key: "XYZ",
get: function get() {
return 5;
}
}, {
key: "RollPitchYaw",
get: function get() {
return 0;
}
}, {
key: "DefaultOrder",
get: function get() {
return Euler.ZYX;
}
}, {
key: "RotationOrders",
get: function get() {
return ['ZYX', 'YXZ', 'XZY', 'ZXY', 'YZX', 'XYZ'];
}
}, {
key: "rotationOrder",
value: function rotationOrder(order) {
return Euler.RotationOrders[order];
}
}]);
return Euler;
}(_mathArray.default);
}
exports.default = Euler;
//# sourceMappingURL=euler.js.map

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

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

@@ -13,12 +11,2 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _matrix = _interopRequireDefault(require("./base/matrix"));

@@ -36,13 +24,9 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var IDENTITY = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
var ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0]);
var INDICES = Object.freeze({
const IDENTITY = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
const ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0]);
const INDICES = Object.freeze({
COL0ROW0: 0,

@@ -58,202 +42,169 @@ COL0ROW1: 1,

});
var constants = {};
const constants = {};
var Matrix3 = function (_Matrix) {
(0, _inherits2.default)(Matrix3, _Matrix);
class Matrix3 extends _matrix.default {
static get IDENTITY() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix3(IDENTITY));
return constants.IDENTITY;
}
var _super = _createSuper(Matrix3);
static get ZERO() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix3(ZERO));
return constants.ZERO;
}
function Matrix3(array) {
var _this;
get ELEMENTS() {
return 9;
}
(0, _classCallCheck2.default)(this, Matrix3);
_this = _super.call(this, -0, -0, -0, -0, -0, -0, -0, -0, -0);
get RANK() {
return 3;
}
get INDICES() {
return INDICES;
}
constructor(array) {
super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
if (arguments.length === 1 && Array.isArray(array)) {
_this.copy(array);
this.copy(array);
} else {
_this.identity();
this.identity();
}
}
return _this;
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
return this.check();
}
(0, _createClass2.default)(Matrix3, [{
key: "ELEMENTS",
get: function get() {
return 9;
}
}, {
key: "RANK",
get: function get() {
return 3;
}
}, {
key: "INDICES",
get: function get() {
return INDICES;
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
return this.check();
}
}, {
key: "set",
value: function set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
}, {
key: "setRowMajor",
value: function setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
}, {
key: "determinant",
value: function determinant() {
return mat3.determinant(this);
}
}, {
key: "identity",
value: function identity() {
return this.copy(IDENTITY);
}
}, {
key: "fromQuaternion",
value: function fromQuaternion(q) {
mat3.fromQuat(this, q);
return this.check();
}
}, {
key: "transpose",
value: function transpose() {
mat3.transpose(this, this);
return this.check();
}
}, {
key: "invert",
value: function invert() {
mat3.invert(this, this);
return this.check();
}
}, {
key: "multiplyLeft",
value: function multiplyLeft(a) {
mat3.multiply(this, a, this);
return this.check();
}
}, {
key: "multiplyRight",
value: function multiplyRight(a) {
mat3.multiply(this, this, a);
return this.check();
}
}, {
key: "rotate",
value: function rotate(radians) {
mat3.rotate(this, this, radians);
return this.check();
}
}, {
key: "scale",
value: function scale(factor) {
if (Array.isArray(factor)) {
mat3.scale(this, this, factor);
} else {
mat3.scale(this, this, [factor, factor, factor]);
}
set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
return this.check();
setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m01;
this[4] = m11;
this[5] = m21;
this[6] = m02;
this[7] = m12;
this[8] = m22;
return this.check();
}
determinant() {
return mat3.determinant(this);
}
identity() {
return this.copy(IDENTITY);
}
fromQuaternion(q) {
mat3.fromQuat(this, q);
return this.check();
}
transpose() {
mat3.transpose(this, this);
return this.check();
}
invert() {
mat3.invert(this, this);
return this.check();
}
multiplyLeft(a) {
mat3.multiply(this, a, this);
return this.check();
}
multiplyRight(a) {
mat3.multiply(this, this, a);
return this.check();
}
rotate(radians) {
mat3.rotate(this, this, radians);
return this.check();
}
scale(factor) {
if (Array.isArray(factor)) {
mat3.scale(this, this, factor);
} else {
mat3.scale(this, this, [factor, factor, factor]);
}
}, {
key: "translate",
value: function translate(vec) {
mat3.translate(this, this, vec);
return this.check();
}
}, {
key: "transform",
value: function transform(vector, result) {
switch (vector.length) {
case 2:
result = vec2.transformMat3(result || [-0, -0], vector, this);
break;
case 3:
result = vec3.transformMat3(result || [-0, -0, -0], vector, this);
break;
return this.check();
}
case 4:
result = (0, _glMatrixExtras.vec4_transformMat3)(result || [-0, -0, -0, -0], vector, this);
break;
translate(vec) {
mat3.translate(this, this, vec);
return this.check();
}
default:
throw new Error('Illegal vector');
}
transform(vector, result) {
switch (vector.length) {
case 2:
result = vec2.transformMat3(result || [-0, -0], vector, this);
break;
(0, _validators.checkVector)(result, vector.length);
return result;
case 3:
result = vec3.transformMat3(result || [-0, -0, -0], vector, this);
break;
case 4:
result = (0, _glMatrixExtras.vec4_transformMat3)(result || [-0, -0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
}, {
key: "transformVector",
value: function transformVector(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
}, {
key: "transformVector2",
value: function transformVector2(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
}, {
key: "transformVector3",
value: function transformVector3(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
}], [{
key: "IDENTITY",
get: function get() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix3(IDENTITY));
return constants.IDENTITY;
}
}, {
key: "ZERO",
get: function get() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix3(ZERO));
return constants.ZERO;
}
}]);
return Matrix3;
}(_matrix.default);
(0, _validators.checkVector)(result, vector.length);
return result;
}
transformVector(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
transformVector2(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
transformVector3(vector, result) {
(0, _validators.deprecated)('Matrix3.transformVector');
return this.transform(vector, result);
}
}
exports.default = Matrix3;
//# sourceMappingURL=matrix3.js.map

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

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

@@ -13,14 +11,2 @@ value: true

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _validators = require("../lib/validators");

@@ -40,13 +26,9 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
var ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
var INDICES = Object.freeze({
const IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
const ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
const INDICES = Object.freeze({
COL0ROW0: 0,

@@ -69,504 +51,432 @@ COL0ROW1: 1,

});
var constants = {};
const constants = {};
var Matrix4 = function (_Matrix) {
(0, _inherits2.default)(Matrix4, _Matrix);
class Matrix4 extends _matrix.default {
static get IDENTITY() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
return constants.IDENTITY;
}
var _super = _createSuper(Matrix4);
static get ZERO() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix4(ZERO));
return constants.ZERO;
}
function Matrix4(array) {
var _this;
get INDICES() {
return INDICES;
}
(0, _classCallCheck2.default)(this, Matrix4);
_this = _super.call(this, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
get ELEMENTS() {
return 16;
}
get RANK() {
return 4;
}
constructor(array) {
super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
if (arguments.length === 1 && Array.isArray(array)) {
_this.copy(array);
this.copy(array);
} else {
_this.identity();
this.identity();
}
}
return _this;
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
this[9] = array[9];
this[10] = array[10];
this[11] = array[11];
this[12] = array[12];
this[13] = array[13];
this[14] = array[14];
this[15] = array[15];
return this.check();
}
(0, _createClass2.default)(Matrix4, [{
key: "INDICES",
get: function get() {
return INDICES;
}
}, {
key: "ELEMENTS",
get: function get() {
return 16;
}
}, {
key: "RANK",
get: function get() {
return 4;
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
this[4] = array[4];
this[5] = array[5];
this[6] = array[6];
this[7] = array[7];
this[8] = array[8];
this[9] = array[9];
this[10] = array[10];
this[11] = array[11];
this[12] = array[12];
this[13] = array[13];
this[14] = array[14];
this[15] = array[15];
return this.check();
}
}, {
key: "set",
value: function set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
}, {
key: "setRowMajor",
value: function setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
}, {
key: "toRowMajor",
value: function toRowMajor(result) {
result[0] = this[0];
result[1] = this[4];
result[2] = this[8];
result[3] = this[12];
result[4] = this[1];
result[5] = this[5];
result[6] = this[9];
result[7] = this[13];
result[8] = this[2];
result[9] = this[6];
result[10] = this[10];
result[11] = this[14];
result[12] = this[3];
result[13] = this[7];
result[14] = this[11];
result[15] = this[15];
return result;
}
}, {
key: "identity",
value: function identity() {
return this.copy(IDENTITY);
}
}, {
key: "fromQuaternion",
value: function fromQuaternion(q) {
mat4.fromQuat(this, q);
return this.check();
}
}, {
key: "frustum",
value: function frustum(_ref) {
var left = _ref.left,
right = _ref.right,
bottom = _ref.bottom,
top = _ref.top,
near = _ref.near,
far = _ref.far;
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
if (far === Infinity) {
Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
} else {
mat4.frustum(this, left, right, bottom, top, near, far);
}
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
this[0] = m00;
this[1] = m10;
this[2] = m20;
this[3] = m30;
this[4] = m01;
this[5] = m11;
this[6] = m21;
this[7] = m31;
this[8] = m02;
this[9] = m12;
this[10] = m22;
this[11] = m32;
this[12] = m03;
this[13] = m13;
this[14] = m23;
this[15] = m33;
return this.check();
}
return this.check();
}
}, {
key: "lookAt",
value: function lookAt(eye, center, up) {
if (arguments.length === 1) {
var _eye = eye;
eye = _eye.eye;
center = _eye.center;
up = _eye.up;
}
toRowMajor(result) {
result[0] = this[0];
result[1] = this[4];
result[2] = this[8];
result[3] = this[12];
result[4] = this[1];
result[5] = this[5];
result[6] = this[9];
result[7] = this[13];
result[8] = this[2];
result[9] = this[6];
result[10] = this[10];
result[11] = this[14];
result[12] = this[3];
result[13] = this[7];
result[14] = this[11];
result[15] = this[15];
return result;
}
center = center || [0, 0, 0];
up = up || [0, 1, 0];
mat4.lookAt(this, eye, center, up);
return this.check();
}
}, {
key: "ortho",
value: function ortho(_ref2) {
var left = _ref2.left,
right = _ref2.right,
bottom = _ref2.bottom,
top = _ref2.top,
_ref2$near = _ref2.near,
near = _ref2$near === void 0 ? 0.1 : _ref2$near,
_ref2$far = _ref2.far,
far = _ref2$far === void 0 ? 500 : _ref2$far;
mat4.ortho(this, left, right, bottom, top, near, far);
return this.check();
}
}, {
key: "orthographic",
value: function orthographic(_ref3) {
var _ref3$fovy = _ref3.fovy,
fovy = _ref3$fovy === void 0 ? 45 * Math.PI / 180 : _ref3$fovy,
_ref3$aspect = _ref3.aspect,
aspect = _ref3$aspect === void 0 ? 1 : _ref3$aspect,
_ref3$focalDistance = _ref3.focalDistance,
focalDistance = _ref3$focalDistance === void 0 ? 1 : _ref3$focalDistance,
_ref3$near = _ref3.near,
near = _ref3$near === void 0 ? 0.1 : _ref3$near,
_ref3$far = _ref3.far,
far = _ref3$far === void 0 ? 500 : _ref3$far;
identity() {
return this.copy(IDENTITY);
}
if (fovy > Math.PI * 2) {
throw Error('radians');
}
fromQuaternion(q) {
mat4.fromQuat(this, q);
return this.check();
}
var halfY = fovy / 2;
var top = focalDistance * Math.tan(halfY);
var right = top * aspect;
return new Matrix4().ortho({
left: -right,
right: right,
bottom: -top,
top: top,
near: near,
far: far
});
frustum({
left,
right,
bottom,
top,
near,
far
}) {
if (far === Infinity) {
Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
} else {
mat4.frustum(this, left, right, bottom, top, near, far);
}
}, {
key: "perspective",
value: function perspective() {
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref4$fovy = _ref4.fovy,
fovy = _ref4$fovy === void 0 ? undefined : _ref4$fovy,
_ref4$fov = _ref4.fov,
fov = _ref4$fov === void 0 ? 45 * Math.PI / 180 : _ref4$fov,
_ref4$aspect = _ref4.aspect,
aspect = _ref4$aspect === void 0 ? 1 : _ref4$aspect,
_ref4$near = _ref4.near,
near = _ref4$near === void 0 ? 0.1 : _ref4$near,
_ref4$far = _ref4.far,
far = _ref4$far === void 0 ? 500 : _ref4$far;
fovy = fovy || fov;
return this.check();
}
if (fovy > Math.PI * 2) {
throw Error('radians');
}
static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
const column0Row0 = 2.0 * near / (right - left);
const column1Row1 = 2.0 * near / (top - bottom);
const column2Row0 = (right + left) / (right - left);
const column2Row1 = (top + bottom) / (top - bottom);
const column2Row2 = -1.0;
const column2Row3 = -1.0;
const column3Row2 = -2.0 * near;
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
}
mat4.perspective(this, fovy, aspect, near, far);
return this.check();
lookAt(eye, center, up) {
if (arguments.length === 1) {
({
eye,
center,
up
} = eye);
}
}, {
key: "determinant",
value: function determinant() {
return mat4.determinant(this);
}
}, {
key: "getScale",
value: function getScale() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [-0, -0, -0];
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
return result;
}
}, {
key: "getTranslation",
value: function getTranslation() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [-0, -0, -0];
result[0] = this[12];
result[1] = this[13];
result[2] = this[14];
return result;
}
}, {
key: "getRotation",
value: function getRotation() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
var scaleResult = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var scale = this.getScale(scaleResult || [-0, -0, -0]);
var inverseScale0 = 1 / scale[0];
var inverseScale1 = 1 / scale[1];
var inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = 0;
result[4] = this[4] * inverseScale0;
result[5] = this[5] * inverseScale1;
result[6] = this[6] * inverseScale2;
result[7] = 0;
result[8] = this[8] * inverseScale0;
result[9] = this[9] * inverseScale1;
result[10] = this[10] * inverseScale2;
result[11] = 0;
result[12] = 0;
result[13] = 0;
result[14] = 0;
result[15] = 1;
return result;
}
}, {
key: "getRotationMatrix3",
value: function getRotationMatrix3() {
var result = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [-0, -0, -0, -0, -0, -0, -0, -0, -0];
var scaleResult = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var scale = this.getScale(scaleResult || [-0, -0, -0]);
var inverseScale0 = 1 / scale[0];
var inverseScale1 = 1 / scale[1];
var inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = this[4] * inverseScale0;
result[4] = this[5] * inverseScale1;
result[5] = this[6] * inverseScale2;
result[6] = this[8] * inverseScale0;
result[7] = this[9] * inverseScale1;
result[8] = this[10] * inverseScale2;
return result;
}
}, {
key: "transpose",
value: function transpose() {
mat4.transpose(this, this);
return this.check();
}
}, {
key: "invert",
value: function invert() {
mat4.invert(this, this);
return this.check();
}
}, {
key: "multiplyLeft",
value: function multiplyLeft(a) {
mat4.multiply(this, a, this);
return this.check();
}
}, {
key: "multiplyRight",
value: function multiplyRight(a) {
mat4.multiply(this, this, a);
return this.check();
}
}, {
key: "rotateX",
value: function rotateX(radians) {
mat4.rotateX(this, this, radians);
return this.check();
}
}, {
key: "rotateY",
value: function rotateY(radians) {
mat4.rotateY(this, this, radians);
return this.check();
}
}, {
key: "rotateZ",
value: function rotateZ(radians) {
mat4.rotateZ(this, this, radians);
return this.check();
}
}, {
key: "rotateXYZ",
value: function rotateXYZ(_ref5) {
var _ref6 = (0, _slicedToArray2.default)(_ref5, 3),
rx = _ref6[0],
ry = _ref6[1],
rz = _ref6[2];
return this.rotateX(rx).rotateY(ry).rotateZ(rz);
}
}, {
key: "rotateAxis",
value: function rotateAxis(radians, axis) {
mat4.rotate(this, this, radians, axis);
return this.check();
}
}, {
key: "scale",
value: function scale(factor) {
if (Array.isArray(factor)) {
mat4.scale(this, this, factor);
} else {
mat4.scale(this, this, [factor, factor, factor]);
}
center = center || [0, 0, 0];
up = up || [0, 1, 0];
mat4.lookAt(this, eye, center, up);
return this.check();
}
return this.check();
ortho({
left,
right,
bottom,
top,
near = 0.1,
far = 500
}) {
mat4.ortho(this, left, right, bottom, top, near, far);
return this.check();
}
orthographic({
fovy = 45 * Math.PI / 180,
aspect = 1,
focalDistance = 1,
near = 0.1,
far = 500
}) {
if (fovy > Math.PI * 2) {
throw Error('radians');
}
}, {
key: "translate",
value: function translate(vec) {
mat4.translate(this, this, vec);
return this.check();
}
}, {
key: "transform",
value: function transform(vector, result) {
if (vector.length === 4) {
result = vec4.transformMat4(result || [-0, -0, -0, -0], vector, this);
(0, _validators.checkVector)(result, 4);
return result;
}
return this.transformAsPoint(vector, result);
const halfY = fovy / 2;
const top = focalDistance * Math.tan(halfY);
const right = top * aspect;
return new Matrix4().ortho({
left: -right,
right,
bottom: -top,
top,
near,
far
});
}
perspective({
fovy = undefined,
fov = 45 * Math.PI / 180,
aspect = 1,
near = 0.1,
far = 500
} = {}) {
fovy = fovy || fov;
if (fovy > Math.PI * 2) {
throw Error('radians');
}
}, {
key: "transformAsPoint",
value: function transformAsPoint(vector, result) {
var length = vector.length;
switch (length) {
case 2:
result = vec2.transformMat4(result || [-0, -0], vector, this);
break;
mat4.perspective(this, fovy, aspect, near, far);
return this.check();
}
case 3:
result = vec3.transformMat4(result || [-0, -0, -0], vector, this);
break;
determinant() {
return mat4.determinant(this);
}
default:
throw new Error('Illegal vector');
}
getScale(result = [-0, -0, -0]) {
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
return result;
}
(0, _validators.checkVector)(result, vector.length);
return result;
getTranslation(result = [-0, -0, -0]) {
result[0] = this[12];
result[1] = this[13];
result[2] = this[14];
return result;
}
getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
const scale = this.getScale(scaleResult || [-0, -0, -0]);
const inverseScale0 = 1 / scale[0];
const inverseScale1 = 1 / scale[1];
const inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = 0;
result[4] = this[4] * inverseScale0;
result[5] = this[5] * inverseScale1;
result[6] = this[6] * inverseScale2;
result[7] = 0;
result[8] = this[8] * inverseScale0;
result[9] = this[9] * inverseScale1;
result[10] = this[10] * inverseScale2;
result[11] = 0;
result[12] = 0;
result[13] = 0;
result[14] = 0;
result[15] = 1;
return result;
}
getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
const scale = this.getScale(scaleResult || [-0, -0, -0]);
const inverseScale0 = 1 / scale[0];
const inverseScale1 = 1 / scale[1];
const inverseScale2 = 1 / scale[2];
result[0] = this[0] * inverseScale0;
result[1] = this[1] * inverseScale1;
result[2] = this[2] * inverseScale2;
result[3] = this[4] * inverseScale0;
result[4] = this[5] * inverseScale1;
result[5] = this[6] * inverseScale2;
result[6] = this[8] * inverseScale0;
result[7] = this[9] * inverseScale1;
result[8] = this[10] * inverseScale2;
return result;
}
transpose() {
mat4.transpose(this, this);
return this.check();
}
invert() {
mat4.invert(this, this);
return this.check();
}
multiplyLeft(a) {
mat4.multiply(this, a, this);
return this.check();
}
multiplyRight(a) {
mat4.multiply(this, this, a);
return this.check();
}
rotateX(radians) {
mat4.rotateX(this, this, radians);
return this.check();
}
rotateY(radians) {
mat4.rotateY(this, this, radians);
return this.check();
}
rotateZ(radians) {
mat4.rotateZ(this, this, radians);
return this.check();
}
rotateXYZ([rx, ry, rz]) {
return this.rotateX(rx).rotateY(ry).rotateZ(rz);
}
rotateAxis(radians, axis) {
mat4.rotate(this, this, radians, axis);
return this.check();
}
scale(factor) {
if (Array.isArray(factor)) {
mat4.scale(this, this, factor);
} else {
mat4.scale(this, this, [factor, factor, factor]);
}
}, {
key: "transformAsVector",
value: function transformAsVector(vector, result) {
switch (vector.length) {
case 2:
result = (0, _glMatrixExtras.vec2_transformMat4AsVector)(result || [-0, -0], vector, this);
break;
case 3:
result = (0, _glMatrixExtras.vec3_transformMat4AsVector)(result || [-0, -0, -0], vector, this);
break;
return this.check();
}
default:
throw new Error('Illegal vector');
}
translate(vec) {
mat4.translate(this, this, vec);
return this.check();
}
(0, _validators.checkVector)(result, vector.length);
transform(vector, result) {
if (vector.length === 4) {
result = vec4.transformMat4(result || [-0, -0, -0, -0], vector, this);
(0, _validators.checkVector)(result, 4);
return result;
}
}, {
key: "makeRotationX",
value: function makeRotationX(radians) {
return this.identity().rotateX(radians);
return this.transformAsPoint(vector, result);
}
transformAsPoint(vector, result) {
const {
length
} = vector;
switch (length) {
case 2:
result = vec2.transformMat4(result || [-0, -0], vector, this);
break;
case 3:
result = vec3.transformMat4(result || [-0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
}, {
key: "makeTranslation",
value: function makeTranslation(x, y, z) {
return this.identity().translate([x, y, z]);
(0, _validators.checkVector)(result, vector.length);
return result;
}
transformAsVector(vector, result) {
switch (vector.length) {
case 2:
result = (0, _glMatrixExtras.vec2_transformMat4AsVector)(result || [-0, -0], vector, this);
break;
case 3:
result = (0, _glMatrixExtras.vec3_transformMat4AsVector)(result || [-0, -0, -0], vector, this);
break;
default:
throw new Error('Illegal vector');
}
}, {
key: "transformPoint",
value: function transformPoint(vector, result) {
(0, _validators.deprecated)('Matrix4.transformPoint', '3.0');
return this.transformAsPoint(vector, result);
}
}, {
key: "transformVector",
value: function transformVector(vector, result) {
(0, _validators.deprecated)('Matrix4.transformVector', '3.0');
return this.transformAsPoint(vector, result);
}
}, {
key: "transformDirection",
value: function transformDirection(vector, result) {
(0, _validators.deprecated)('Matrix4.transformDirection', '3.0');
return this.transformAsVector(vector, result);
}
}], [{
key: "IDENTITY",
get: function get() {
constants.IDENTITY = constants.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
return constants.IDENTITY;
}
}, {
key: "ZERO",
get: function get() {
constants.ZERO = constants.ZERO || Object.freeze(new Matrix4(ZERO));
return constants.ZERO;
}
}, {
key: "_computeInfinitePerspectiveOffCenter",
value: function _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
var column0Row0 = 2.0 * near / (right - left);
var column1Row1 = 2.0 * near / (top - bottom);
var column2Row0 = (right + left) / (right - left);
var column2Row1 = (top + bottom) / (top - bottom);
var column2Row2 = -1.0;
var column2Row3 = -1.0;
var column3Row2 = -2.0 * near;
result[0] = column0Row0;
result[1] = 0.0;
result[2] = 0.0;
result[3] = 0.0;
result[4] = 0.0;
result[5] = column1Row1;
result[6] = 0.0;
result[7] = 0.0;
result[8] = column2Row0;
result[9] = column2Row1;
result[10] = column2Row2;
result[11] = column2Row3;
result[12] = 0.0;
result[13] = 0.0;
result[14] = column3Row2;
result[15] = 0.0;
return result;
}
}]);
return Matrix4;
}(_matrix.default);
(0, _validators.checkVector)(result, vector.length);
return result;
}
makeRotationX(radians) {
return this.identity().rotateX(radians);
}
makeTranslation(x, y, z) {
return this.identity().translate([x, y, z]);
}
transformPoint(vector, result) {
(0, _validators.deprecated)('Matrix4.transformPoint', '3.0');
return this.transformAsPoint(vector, result);
}
transformVector(vector, result) {
(0, _validators.deprecated)('Matrix4.transformVector', '3.0');
return this.transformAsPoint(vector, result);
}
transformDirection(vector, result) {
(0, _validators.deprecated)('Matrix4.transformDirection', '3.0');
return this.transformAsVector(vector, result);
}
}
exports.default = Matrix4;
//# sourceMappingURL=matrix4.js.map

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

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _matrix = _interopRequireDefault(require("./matrix4"));

@@ -21,24 +17,13 @@

var Pose = function () {
function Pose() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$x = _ref.x,
x = _ref$x === void 0 ? 0 : _ref$x,
_ref$y = _ref.y,
y = _ref$y === void 0 ? 0 : _ref$y,
_ref$z = _ref.z,
z = _ref$z === void 0 ? 0 : _ref$z,
_ref$roll = _ref.roll,
roll = _ref$roll === void 0 ? 0 : _ref$roll,
_ref$pitch = _ref.pitch,
pitch = _ref$pitch === void 0 ? 0 : _ref$pitch,
_ref$yaw = _ref.yaw,
yaw = _ref$yaw === void 0 ? 0 : _ref$yaw,
_ref$position = _ref.position,
position = _ref$position === void 0 ? undefined : _ref$position,
_ref$orientation = _ref.orientation,
orientation = _ref$orientation === void 0 ? undefined : _ref$orientation;
(0, _classCallCheck2.default)(this, Pose);
class Pose {
constructor({
x = 0,
y = 0,
z = 0,
roll = 0,
pitch = 0,
yaw = 0,
position = undefined,
orientation = undefined
} = {}) {
if (Array.isArray(position) && position.length === 3) {

@@ -57,105 +42,96 @@ this.position = new _vector.default(position);

(0, _createClass2.default)(Pose, [{
key: "x",
get: function get() {
return this.position.x;
},
set: function set(value) {
this.position.x = value;
}
}, {
key: "y",
get: function get() {
return this.position.y;
},
set: function set(value) {
this.position.y = value;
}
}, {
key: "z",
get: function get() {
return this.position.z;
},
set: function set(value) {
this.position.z = value;
}
}, {
key: "roll",
get: function get() {
return this.orientation.roll;
},
set: function set(value) {
this.orientation.roll = value;
}
}, {
key: "pitch",
get: function get() {
return this.orientation.pitch;
},
set: function set(value) {
this.orientation.pitch = value;
}
}, {
key: "yaw",
get: function get() {
return this.orientation.yaw;
},
set: function set(value) {
this.orientation.yaw = value;
}
}, {
key: "getPosition",
value: function getPosition() {
return this.position;
}
}, {
key: "getOrientation",
value: function getOrientation() {
return this.orientation;
}
}, {
key: "equals",
value: function equals(pose) {
if (!pose) {
return false;
}
get x() {
return this.position.x;
}
return this.position.equals(pose.position) && this.orientation.equals(pose.orientation);
set x(value) {
this.position.x = value;
}
get y() {
return this.position.y;
}
set y(value) {
this.position.y = value;
}
get z() {
return this.position.z;
}
set z(value) {
this.position.z = value;
}
get roll() {
return this.orientation.roll;
}
set roll(value) {
this.orientation.roll = value;
}
get pitch() {
return this.orientation.pitch;
}
set pitch(value) {
this.orientation.pitch = value;
}
get yaw() {
return this.orientation.yaw;
}
set yaw(value) {
this.orientation.yaw = value;
}
getPosition() {
return this.position;
}
getOrientation() {
return this.orientation;
}
equals(pose) {
if (!pose) {
return false;
}
}, {
key: "exactEquals",
value: function exactEquals(pose) {
if (!pose) {
return false;
}
return this.position.exactEquals(pose.position) && this.orientation.exactEquals(pose.orientation);
return this.position.equals(pose.position) && this.orientation.equals(pose.orientation);
}
exactEquals(pose) {
if (!pose) {
return false;
}
}, {
key: "getTransformationMatrix",
value: function getTransformationMatrix() {
var sr = Math.sin(this.roll);
var sp = Math.sin(this.pitch);
var sw = Math.sin(this.yaw);
var cr = Math.cos(this.roll);
var cp = Math.cos(this.pitch);
var cw = Math.cos(this.yaw);
var matrix = new _matrix.default().setRowMajor(cw * cp, -sw * cr + cw * sp * sr, sw * sr + cw * sp * cr, this.x, sw * cp, cw * cr + sw * sp * sr, -cw * sr + sw * sp * cr, this.y, -sp, cp * sr, cp * cr, this.z, 0, 0, 0, 1);
return matrix;
}
}, {
key: "getTransformationMatrixFromPose",
value: function getTransformationMatrixFromPose(pose) {
return new _matrix.default().multiplyRight(this.getTransformationMatrix()).multiplyRight(pose.getTransformationMatrix().invert());
}
}, {
key: "getTransformationMatrixToPose",
value: function getTransformationMatrixToPose(pose) {
return new _matrix.default().multiplyRight(pose.getTransformationMatrix()).multiplyRight(this.getTransformationMatrix().invert());
}
}]);
return Pose;
}();
return this.position.exactEquals(pose.position) && this.orientation.exactEquals(pose.orientation);
}
getTransformationMatrix() {
const sr = Math.sin(this.roll);
const sp = Math.sin(this.pitch);
const sw = Math.sin(this.yaw);
const cr = Math.cos(this.roll);
const cp = Math.cos(this.pitch);
const cw = Math.cos(this.yaw);
const matrix = new _matrix.default().setRowMajor(cw * cp, -sw * cr + cw * sp * sr, sw * sr + cw * sp * cr, this.x, sw * cp, cw * cr + sw * sp * sr, -cw * sr + sw * sp * cr, this.y, -sp, cp * sr, cp * cr, this.z, 0, 0, 0, 1);
return matrix;
}
getTransformationMatrixFromPose(pose) {
return new _matrix.default().multiplyRight(this.getTransformationMatrix()).multiplyRight(pose.getTransformationMatrix().invert());
}
getTransformationMatrixToPose(pose) {
return new _matrix.default().multiplyRight(pose.getTransformationMatrix()).multiplyRight(this.getTransformationMatrix().invert());
}
}
exports.default = Pose;
//# sourceMappingURL=pose.js.map

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

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

@@ -13,12 +11,2 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _mathArray = _interopRequireDefault(require("./base/math-array"));

@@ -34,285 +22,233 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
const IDENTITY_QUATERNION = [0, 0, 0, 1];
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
class Quaternion extends _mathArray.default {
constructor(x = 0, y = 0, z = 0, w = 1) {
super(-0, -0, -0, -0);
var IDENTITY_QUATERNION = [0, 0, 0, 1];
if (Array.isArray(x) && arguments.length === 1) {
this.copy(x);
} else {
this.set(x, y, z, w);
}
}
var Quaternion = function (_MathArray) {
(0, _inherits2.default)(Quaternion, _MathArray);
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
return this.check();
}
var _super = _createSuper(Quaternion);
set(x, y, z, w) {
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = w;
return this.check();
}
function Quaternion() {
var _this;
fromMatrix3(m) {
quat.fromMat3(this, m);
return this.check();
}
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
(0, _classCallCheck2.default)(this, Quaternion);
_this = _super.call(this, -0, -0, -0, -0);
identity() {
quat.identity(this);
return this.check();
}
if (Array.isArray(x) && arguments.length === 1) {
_this.copy(x);
} else {
_this.set(x, y, z, w);
}
fromAxisRotation(axis, rad) {
quat.setAxisAngle(this, axis, rad);
return this.check();
}
return _this;
setAxisAngle(axis, rad) {
return this.fromAxisRotation(axis, rad);
}
(0, _createClass2.default)(Quaternion, [{
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
return this.check();
}
}, {
key: "set",
value: function set(x, y, z, w) {
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = w;
return this.check();
}
}, {
key: "fromMatrix3",
value: function fromMatrix3(m) {
quat.fromMat3(this, m);
return this.check();
}
}, {
key: "identity",
value: function identity() {
quat.identity(this);
return this.check();
}
}, {
key: "fromAxisRotation",
value: function fromAxisRotation(axis, rad) {
quat.setAxisAngle(this, axis, rad);
return this.check();
}
}, {
key: "setAxisAngle",
value: function setAxisAngle(axis, rad) {
return this.fromAxisRotation(axis, rad);
}
}, {
key: "ELEMENTS",
get: function get() {
return 4;
}
}, {
key: "x",
get: function get() {
return this[0];
},
set: function set(value) {
this[0] = (0, _validators.checkNumber)(value);
}
}, {
key: "y",
get: function get() {
return this[1];
},
set: function set(value) {
this[1] = (0, _validators.checkNumber)(value);
}
}, {
key: "z",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "w",
get: function get() {
return this[3];
},
set: function set(value) {
this[3] = (0, _validators.checkNumber)(value);
}
}, {
key: "len",
value: function len() {
return quat.length(this);
}
}, {
key: "lengthSquared",
value: function lengthSquared() {
return quat.squaredLength(this);
}
}, {
key: "dot",
value: function dot(a, b) {
if (b !== undefined) {
throw new Error('Quaternion.dot only takes one argument');
}
get ELEMENTS() {
return 4;
}
return quat.dot(this, a);
get x() {
return this[0];
}
set x(value) {
this[0] = (0, _validators.checkNumber)(value);
}
get y() {
return this[1];
}
set y(value) {
this[1] = (0, _validators.checkNumber)(value);
}
get z() {
return this[2];
}
set z(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get w() {
return this[3];
}
set w(value) {
this[3] = (0, _validators.checkNumber)(value);
}
len() {
return quat.length(this);
}
lengthSquared() {
return quat.squaredLength(this);
}
dot(a, b) {
if (b !== undefined) {
throw new Error('Quaternion.dot only takes one argument');
}
}, {
key: "rotationTo",
value: function rotationTo(vectorA, vectorB) {
quat.rotationTo(this, vectorA, vectorB);
return this.check();
}
}, {
key: "add",
value: function add(a, b) {
if (b !== undefined) {
throw new Error('Quaternion.add only takes one argument');
}
quat.add(this, this, a);
return this.check();
return quat.dot(this, a);
}
rotationTo(vectorA, vectorB) {
quat.rotationTo(this, vectorA, vectorB);
return this.check();
}
add(a, b) {
if (b !== undefined) {
throw new Error('Quaternion.add only takes one argument');
}
}, {
key: "calculateW",
value: function calculateW() {
quat.calculateW(this, this);
return this.check();
}
}, {
key: "conjugate",
value: function conjugate() {
quat.conjugate(this, this);
return this.check();
}
}, {
key: "invert",
value: function invert() {
quat.invert(this, this);
return this.check();
}
}, {
key: "lerp",
value: function lerp(a, b, t) {
quat.lerp(this, a, b, t);
return this.check();
}
}, {
key: "multiplyRight",
value: function multiplyRight(a, b) {
(0, _assert.default)(!b);
quat.multiply(this, this, a);
return this.check();
}
}, {
key: "multiplyLeft",
value: function multiplyLeft(a, b) {
(0, _assert.default)(!b);
quat.multiply(this, a, this);
return this.check();
}
}, {
key: "normalize",
value: function normalize() {
var length = this.len();
var l = length > 0 ? 1 / length : 0;
this[0] = this[0] * l;
this[1] = this[1] * l;
this[2] = this[2] * l;
this[3] = this[3] * l;
if (length === 0) {
this[3] = 1;
}
quat.add(this, this, a);
return this.check();
}
return this.check();
calculateW() {
quat.calculateW(this, this);
return this.check();
}
conjugate() {
quat.conjugate(this, this);
return this.check();
}
invert() {
quat.invert(this, this);
return this.check();
}
lerp(a, b, t) {
quat.lerp(this, a, b, t);
return this.check();
}
multiplyRight(a, b) {
(0, _assert.default)(!b);
quat.multiply(this, this, a);
return this.check();
}
multiplyLeft(a, b) {
(0, _assert.default)(!b);
quat.multiply(this, a, this);
return this.check();
}
normalize() {
const length = this.len();
const l = length > 0 ? 1 / length : 0;
this[0] = this[0] * l;
this[1] = this[1] * l;
this[2] = this[2] * l;
this[3] = this[3] * l;
if (length === 0) {
this[3] = 1;
}
}, {
key: "rotateX",
value: function rotateX(rad) {
quat.rotateX(this, this, rad);
return this.check();
}
}, {
key: "rotateY",
value: function rotateY(rad) {
quat.rotateY(this, this, rad);
return this.check();
}
}, {
key: "rotateZ",
value: function rotateZ(rad) {
quat.rotateZ(this, this, rad);
return this.check();
}
}, {
key: "scale",
value: function scale(b) {
quat.scale(this, this, b);
return this.check();
}
}, {
key: "slerp",
value: function slerp(start, target, ratio) {
switch (arguments.length) {
case 1:
var _arguments$ = arguments[0];
var _arguments$$start = _arguments$.start;
start = _arguments$$start === void 0 ? IDENTITY_QUATERNION : _arguments$$start;
target = _arguments$.target;
ratio = _arguments$.ratio;
break;
case 2:
var _arguments = Array.prototype.slice.call(arguments);
return this.check();
}
target = _arguments[0];
ratio = _arguments[1];
start = this;
break;
rotateX(rad) {
quat.rotateX(this, this, rad);
return this.check();
}
default:
}
rotateY(rad) {
quat.rotateY(this, this, rad);
return this.check();
}
quat.slerp(this, start, target, ratio);
return this.check();
rotateZ(rad) {
quat.rotateZ(this, this, rad);
return this.check();
}
scale(b) {
quat.scale(this, this, b);
return this.check();
}
slerp(start, target, ratio) {
switch (arguments.length) {
case 1:
({
start = IDENTITY_QUATERNION,
target,
ratio
} = arguments[0]);
break;
case 2:
[target, ratio] = arguments;
start = this;
break;
default:
}
}, {
key: "transformVector4",
value: function transformVector4(vector) {
var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : vector;
vec4.transformQuat(result, vector, this);
return (0, _validators.checkVector)(result, 4);
}
}, {
key: "lengthSq",
value: function lengthSq() {
return this.lengthSquared();
}
}, {
key: "setFromAxisAngle",
value: function setFromAxisAngle(axis, rad) {
return this.setAxisAngle(axis, rad);
}
}, {
key: "premultiply",
value: function premultiply(a, b) {
return this.multiplyLeft(a, b);
}
}, {
key: "multiply",
value: function multiply(a, b) {
return this.multiplyRight(a, b);
}
}]);
return Quaternion;
}(_mathArray.default);
quat.slerp(this, start, target, ratio);
return this.check();
}
transformVector4(vector, result = vector) {
vec4.transformQuat(result, vector, this);
return (0, _validators.checkVector)(result, 4);
}
lengthSq() {
return this.lengthSquared();
}
setFromAxisAngle(axis, rad) {
return this.setAxisAngle(axis, rad);
}
premultiply(a, b) {
return this.multiplyLeft(a, b);
}
multiply(a, b) {
return this.multiplyRight(a, b);
}
}
exports.default = Quaternion;
//# sourceMappingURL=quaternion.js.map

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

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

@@ -13,8 +11,2 @@ value: true

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _common = require("../lib/common");

@@ -26,28 +18,19 @@

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 EPSILON = 0.000001;
var EARTH_RADIUS_METERS = 6.371e6;
const EPSILON = 0.000001;
const EARTH_RADIUS_METERS = 6.371e6;
var SphericalCoordinates = function () {
function SphericalCoordinates() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref$phi = _ref.phi,
phi = _ref$phi === void 0 ? 0 : _ref$phi,
_ref$theta = _ref.theta,
theta = _ref$theta === void 0 ? 0 : _ref$theta,
_ref$radius = _ref.radius,
radius = _ref$radius === void 0 ? 1 : _ref$radius,
_ref$bearing = _ref.bearing,
bearing = _ref$bearing === void 0 ? undefined : _ref$bearing,
_ref$pitch = _ref.pitch,
pitch = _ref$pitch === void 0 ? undefined : _ref$pitch,
_ref$altitude = _ref.altitude,
altitude = _ref$altitude === void 0 ? undefined : _ref$altitude,
_ref$radiusScale = _ref.radiusScale,
radiusScale = _ref$radiusScale === void 0 ? EARTH_RADIUS_METERS : _ref$radiusScale;
(0, _classCallCheck2.default)(this, SphericalCoordinates);
class SphericalCoordinates {
constructor({
phi = 0,
theta = 0,
radius = 1,
bearing = undefined,
pitch = undefined,
altitude = undefined,
radiusScale = EARTH_RADIUS_METERS
} = {}) {
this.phi = phi;

@@ -69,140 +52,116 @@ this.theta = theta;

(0, _createClass2.default)(SphericalCoordinates, [{
key: "toString",
value: function toString() {
return this.formatString(_common.config);
}
}, {
key: "formatString",
value: function formatString(_ref2) {
var _ref2$printTypes = _ref2.printTypes,
printTypes = _ref2$printTypes === void 0 ? false : _ref2$printTypes;
var f = _common.formatValue;
return "".concat(printTypes ? 'Spherical' : '', "[rho:").concat(f(this.radius), ",theta:").concat(f(this.theta), ",phi:").concat(f(this.phi), "]");
}
}, {
key: "equals",
value: function equals(other) {
return (0, _common.equals)(this.radius, other.radius) && (0, _common.equals)(this.theta, other.theta) && (0, _common.equals)(this.phi, other.phi);
}
}, {
key: "exactEquals",
value: function exactEquals(other) {
return this.radius === other.radius && this.theta === other.theta && this.phi === other.phi;
}
}, {
key: "bearing",
get: function get() {
return 180 - (0, _common.degrees)(this.phi);
},
set: function set(v) {
this.phi = Math.PI - (0, _common.radians)(v);
}
}, {
key: "pitch",
get: function get() {
return (0, _common.degrees)(this.theta);
},
set: function set(v) {
this.theta = (0, _common.radians)(v);
}
}, {
key: "longitude",
get: function get() {
return (0, _common.degrees)(this.phi);
}
}, {
key: "latitude",
get: function get() {
return (0, _common.degrees)(this.theta);
}
}, {
key: "lng",
get: function get() {
return (0, _common.degrees)(this.phi);
}
}, {
key: "lat",
get: function get() {
return (0, _common.degrees)(this.theta);
}
}, {
key: "z",
get: function get() {
return (this.radius - 1) * this.radiusScale;
}
}, {
key: "set",
value: function set(radius, phi, theta) {
this.radius = radius;
this.phi = phi;
this.theta = theta;
return this.check();
}
}, {
key: "clone",
value: function clone() {
return new SphericalCoordinates().copy(this);
}
}, {
key: "copy",
value: function copy(other) {
this.radius = other.radius;
this.phi = other.phi;
this.theta = other.theta;
return this.check();
}
}, {
key: "fromLngLatZ",
value: function fromLngLatZ(_ref3) {
var _ref4 = (0, _slicedToArray2.default)(_ref3, 3),
lng = _ref4[0],
lat = _ref4[1],
z = _ref4[2];
toString() {
return this.formatString(_common.config);
}
this.radius = 1 + z / this.radiusScale;
this.phi = (0, _common.radians)(lat);
this.theta = (0, _common.radians)(lng);
}
}, {
key: "fromVector3",
value: function fromVector3(v) {
this.radius = vec3.length(v);
formatString({
printTypes = false
}) {
const f = _common.formatValue;
return "".concat(printTypes ? 'Spherical' : '', "[rho:").concat(f(this.radius), ",theta:").concat(f(this.theta), ",phi:").concat(f(this.phi), "]");
}
if (this.radius > 0) {
this.theta = Math.atan2(v[0], v[1]);
this.phi = Math.acos((0, _common.clamp)(v[2] / this.radius, -1, 1));
}
equals(other) {
return (0, _common.equals)(this.radius, other.radius) && (0, _common.equals)(this.theta, other.theta) && (0, _common.equals)(this.phi, other.phi);
}
return this.check();
exactEquals(other) {
return this.radius === other.radius && this.theta === other.theta && this.phi === other.phi;
}
get bearing() {
return 180 - (0, _common.degrees)(this.phi);
}
set bearing(v) {
this.phi = Math.PI - (0, _common.radians)(v);
}
get pitch() {
return (0, _common.degrees)(this.theta);
}
set pitch(v) {
this.theta = (0, _common.radians)(v);
}
get longitude() {
return (0, _common.degrees)(this.phi);
}
get latitude() {
return (0, _common.degrees)(this.theta);
}
get lng() {
return (0, _common.degrees)(this.phi);
}
get lat() {
return (0, _common.degrees)(this.theta);
}
get z() {
return (this.radius - 1) * this.radiusScale;
}
set(radius, phi, theta) {
this.radius = radius;
this.phi = phi;
this.theta = theta;
return this.check();
}
clone() {
return new SphericalCoordinates().copy(this);
}
copy(other) {
this.radius = other.radius;
this.phi = other.phi;
this.theta = other.theta;
return this.check();
}
fromLngLatZ([lng, lat, z]) {
this.radius = 1 + z / this.radiusScale;
this.phi = (0, _common.radians)(lat);
this.theta = (0, _common.radians)(lng);
}
fromVector3(v) {
this.radius = vec3.length(v);
if (this.radius > 0) {
this.theta = Math.atan2(v[0], v[1]);
this.phi = Math.acos((0, _common.clamp)(v[2] / this.radius, -1, 1));
}
}, {
key: "toVector3",
value: function toVector3() {
return new _vector.default(0, 0, this.radius).rotateX({
radians: this.theta
}).rotateZ({
radians: this.phi
});
}
}, {
key: "makeSafe",
value: function makeSafe() {
this.phi = Math.max(EPSILON, Math.min(Math.PI - EPSILON, this.phi));
return this;
}
}, {
key: "check",
value: function check() {
if (!Number.isFinite(this.phi) || !Number.isFinite(this.theta) || !(this.radius > 0)) {
throw new Error('SphericalCoordinates: some fields set to invalid numbers');
}
return this;
return this.check();
}
toVector3() {
return new _vector.default(0, 0, this.radius).rotateX({
radians: this.theta
}).rotateZ({
radians: this.phi
});
}
makeSafe() {
this.phi = Math.max(EPSILON, Math.min(Math.PI - EPSILON, this.phi));
return this;
}
check() {
if (!Number.isFinite(this.phi) || !Number.isFinite(this.theta) || !(this.radius > 0)) {
throw new Error('SphericalCoordinates: some fields set to invalid numbers');
}
}]);
return SphericalCoordinates;
}();
return this;
}
}
exports.default = SphericalCoordinates;
//# sourceMappingURL=spherical-coordinates.js.map

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

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

@@ -13,12 +11,2 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _vector = _interopRequireDefault(require("./base/vector"));

@@ -34,25 +22,12 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
class Vector2 extends _vector.default {
constructor(x = 0, y = 0) {
super(2);
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Vector2 = function (_Vector) {
(0, _inherits2.default)(Vector2, _Vector);
var _super = _createSuper(Vector2);
function Vector2() {
var _this;
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
(0, _classCallCheck2.default)(this, Vector2);
_this = _super.call(this, 2);
if ((0, _common.isArray)(x) && arguments.length === 1) {
_this.copy(x);
this.copy(x);
} else {

@@ -64,97 +39,80 @@ if (_common.config.debug) {

_this[0] = x;
_this[1] = y;
this[0] = x;
this[1] = y;
}
}
return _this;
set(x, y) {
this[0] = x;
this[1] = y;
return this.check();
}
(0, _createClass2.default)(Vector2, [{
key: "set",
value: function set(x, y) {
this[0] = x;
this[1] = y;
return this.check();
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
return this.check();
}
}, {
key: "fromObject",
value: function fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
return this.check();
}
this[0] = object.x;
this[1] = object.y;
return this.check();
fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
}
}, {
key: "toObject",
value: function toObject(object) {
object.x = this[0];
object.y = this[1];
return object;
}
}, {
key: "ELEMENTS",
get: function get() {
return 2;
}
}, {
key: "horizontalAngle",
value: function horizontalAngle() {
return Math.atan2(this.y, this.x);
}
}, {
key: "verticalAngle",
value: function verticalAngle() {
return Math.atan2(this.x, this.y);
}
}, {
key: "transform",
value: function transform(matrix4) {
return this.transformAsPoint(matrix4);
}
}, {
key: "transformAsPoint",
value: function transformAsPoint(matrix4) {
vec2.transformMat4(this, this, matrix4);
return this.check();
}
}, {
key: "transformAsVector",
value: function transformAsVector(matrix4) {
(0, _glMatrixExtras.vec2_transformMat4AsVector)(this, this, matrix4);
return this.check();
}
}, {
key: "transformByMatrix3",
value: function transformByMatrix3(matrix3) {
vec2.transformMat3(this, this, matrix3);
return this.check();
}
}, {
key: "transformByMatrix2x3",
value: function transformByMatrix2x3(matrix2x3) {
vec2.transformMat2d(this, this, matrix2x3);
return this.check();
}
}, {
key: "transformByMatrix2",
value: function transformByMatrix2(matrix2) {
vec2.transformMat2(this, this, matrix2);
return this.check();
}
}]);
return Vector2;
}(_vector.default);
this[0] = object.x;
this[1] = object.y;
return this.check();
}
toObject(object) {
object.x = this[0];
object.y = this[1];
return object;
}
get ELEMENTS() {
return 2;
}
horizontalAngle() {
return Math.atan2(this.y, this.x);
}
verticalAngle() {
return Math.atan2(this.x, this.y);
}
transform(matrix4) {
return this.transformAsPoint(matrix4);
}
transformAsPoint(matrix4) {
vec2.transformMat4(this, this, matrix4);
return this.check();
}
transformAsVector(matrix4) {
(0, _glMatrixExtras.vec2_transformMat4AsVector)(this, this, matrix4);
return this.check();
}
transformByMatrix3(matrix3) {
vec2.transformMat3(this, this, matrix3);
return this.check();
}
transformByMatrix2x3(matrix2x3) {
vec2.transformMat2d(this, this, matrix2x3);
return this.check();
}
transformByMatrix2(matrix2) {
vec2.transformMat2(this, this, matrix2);
return this.check();
}
}
exports.default = Vector2;
//# sourceMappingURL=vector2.js.map

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

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

@@ -13,12 +11,2 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _vector = _interopRequireDefault(require("./base/vector"));

@@ -34,29 +22,19 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
const ORIGIN = [0, 0, 0];
const constants = {};
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
class Vector3 extends _vector.default {
static get ZERO() {
return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
}
var ORIGIN = [0, 0, 0];
var constants = {};
constructor(x = 0, y = 0, z = 0) {
super(-0, -0, -0);
var Vector3 = function (_Vector) {
(0, _inherits2.default)(Vector3, _Vector);
var _super = _createSuper(Vector3);
function Vector3() {
var _this;
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
(0, _classCallCheck2.default)(this, Vector3);
_this = _super.call(this, -0, -0, -0);
if (arguments.length === 1 && (0, _common.isArray)(x)) {
_this.copy(x);
this.copy(x);
} else {

@@ -69,144 +47,119 @@ if (_common.config.debug) {

_this[0] = x;
_this[1] = y;
_this[2] = z;
}
return _this;
}
(0, _createClass2.default)(Vector3, [{
key: "set",
value: function set(x, y, z) {
this[0] = x;
this[1] = y;
this[2] = z;
return this.check();
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
return this.check();
}
}, {
key: "fromObject",
value: function fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
(0, _validators.checkNumber)(object.z);
}
}
this[0] = object.x;
this[1] = object.y;
this[2] = object.z;
return this.check();
set(x, y, z) {
this[0] = x;
this[1] = y;
this[2] = z;
return this.check();
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
return this.check();
}
fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
(0, _validators.checkNumber)(object.z);
}
}, {
key: "toObject",
value: function toObject(object) {
object.x = this[0];
object.y = this[1];
object.z = this[2];
return object;
}
}, {
key: "ELEMENTS",
get: function get() {
return 3;
}
}, {
key: "z",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "angle",
value: function angle(vector) {
return vec3.angle(this, vector);
}
}, {
key: "cross",
value: function cross(vector) {
vec3.cross(this, this, vector);
return this.check();
}
}, {
key: "rotateX",
value: function rotateX(_ref) {
var radians = _ref.radians,
_ref$origin = _ref.origin,
origin = _ref$origin === void 0 ? ORIGIN : _ref$origin;
vec3.rotateX(this, this, origin, radians);
return this.check();
}
}, {
key: "rotateY",
value: function rotateY(_ref2) {
var radians = _ref2.radians,
_ref2$origin = _ref2.origin,
origin = _ref2$origin === void 0 ? ORIGIN : _ref2$origin;
vec3.rotateY(this, this, origin, radians);
return this.check();
}
}, {
key: "rotateZ",
value: function rotateZ(_ref3) {
var radians = _ref3.radians,
_ref3$origin = _ref3.origin,
origin = _ref3$origin === void 0 ? ORIGIN : _ref3$origin;
vec3.rotateZ(this, this, origin, radians);
return this.check();
}
}, {
key: "transform",
value: function transform(matrix4) {
return this.transformAsPoint(matrix4);
}
}, {
key: "transformAsPoint",
value: function transformAsPoint(matrix4) {
vec3.transformMat4(this, this, matrix4);
return this.check();
}
}, {
key: "transformAsVector",
value: function transformAsVector(matrix4) {
(0, _glMatrixExtras.vec3_transformMat4AsVector)(this, this, matrix4);
return this.check();
}
}, {
key: "transformByMatrix3",
value: function transformByMatrix3(matrix3) {
vec3.transformMat3(this, this, matrix3);
return this.check();
}
}, {
key: "transformByMatrix2",
value: function transformByMatrix2(matrix2) {
(0, _glMatrixExtras.vec3_transformMat2)(this, this, matrix2);
return this.check();
}
}, {
key: "transformByQuaternion",
value: function transformByQuaternion(quaternion) {
vec3.transformQuat(this, this, quaternion);
return this.check();
}
}], [{
key: "ZERO",
get: function get() {
return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
}
}]);
return Vector3;
}(_vector.default);
this[0] = object.x;
this[1] = object.y;
this[2] = object.z;
return this.check();
}
toObject(object) {
object.x = this[0];
object.y = this[1];
object.z = this[2];
return object;
}
get ELEMENTS() {
return 3;
}
get z() {
return this[2];
}
set z(value) {
this[2] = (0, _validators.checkNumber)(value);
}
angle(vector) {
return vec3.angle(this, vector);
}
cross(vector) {
vec3.cross(this, this, vector);
return this.check();
}
rotateX({
radians,
origin = ORIGIN
}) {
vec3.rotateX(this, this, origin, radians);
return this.check();
}
rotateY({
radians,
origin = ORIGIN
}) {
vec3.rotateY(this, this, origin, radians);
return this.check();
}
rotateZ({
radians,
origin = ORIGIN
}) {
vec3.rotateZ(this, this, origin, radians);
return this.check();
}
transform(matrix4) {
return this.transformAsPoint(matrix4);
}
transformAsPoint(matrix4) {
vec3.transformMat4(this, this, matrix4);
return this.check();
}
transformAsVector(matrix4) {
(0, _glMatrixExtras.vec3_transformMat4AsVector)(this, this, matrix4);
return this.check();
}
transformByMatrix3(matrix3) {
vec3.transformMat3(this, this, matrix3);
return this.check();
}
transformByMatrix2(matrix2) {
(0, _glMatrixExtras.vec3_transformMat2)(this, this, matrix2);
return this.check();
}
transformByQuaternion(quaternion) {
vec3.transformQuat(this, this, quaternion);
return this.check();
}
}
exports.default = Vector3;
//# sourceMappingURL=vector3.js.map

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

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

@@ -13,12 +11,2 @@ value: true

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _vector = _interopRequireDefault(require("./base/vector"));

@@ -34,29 +22,18 @@

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; }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
const constants = {};
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
class Vector4 extends _vector.default {
static get ZERO() {
return constants.ZERO = constants.ZERO || Object.freeze(new Vector4(0, 0, 0, 0));
}
var constants = {};
constructor(x = 0, y = 0, z = 0, w = 0) {
super(-0, -0, -0, -0);
var Vector4 = function (_Vector) {
(0, _inherits2.default)(Vector4, _Vector);
var _super = _createSuper(Vector4);
function Vector4() {
var _this;
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
(0, _classCallCheck2.default)(this, Vector4);
_this = _super.call(this, -0, -0, -0, -0);
if ((0, _common.isArray)(x) && arguments.length === 1) {
_this.copy(x);
this.copy(x);
} else {

@@ -70,14 +47,2 @@ if (_common.config.debug) {

_this[0] = x;
_this[1] = y;
_this[2] = z;
_this[3] = w;
}
return _this;
}
(0, _createClass2.default)(Vector4, [{
key: "set",
value: function set(x, y, z, w) {
this[0] = x;

@@ -87,99 +52,92 @@ this[1] = y;

this[3] = w;
return this.check();
}
}, {
key: "copy",
value: function copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
return this.check();
}
}, {
key: "fromObject",
value: function fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
(0, _validators.checkNumber)(object.z);
(0, _validators.checkNumber)(object.w);
}
}
this[0] = object.x;
this[1] = object.y;
this[2] = object.z;
this[3] = object.w;
return this;
set(x, y, z, w) {
this[0] = x;
this[1] = y;
this[2] = z;
this[3] = w;
return this.check();
}
copy(array) {
this[0] = array[0];
this[1] = array[1];
this[2] = array[2];
this[3] = array[3];
return this.check();
}
fromObject(object) {
if (_common.config.debug) {
(0, _validators.checkNumber)(object.x);
(0, _validators.checkNumber)(object.y);
(0, _validators.checkNumber)(object.z);
(0, _validators.checkNumber)(object.w);
}
}, {
key: "toObject",
value: function toObject(object) {
object.x = this[0];
object.y = this[1];
object.z = this[2];
object.w = this[3];
return object;
}
}, {
key: "ELEMENTS",
get: function get() {
return 4;
}
}, {
key: "z",
get: function get() {
return this[2];
},
set: function set(value) {
this[2] = (0, _validators.checkNumber)(value);
}
}, {
key: "w",
get: function get() {
return this[3];
},
set: function set(value) {
this[3] = (0, _validators.checkNumber)(value);
}
}, {
key: "transform",
value: function transform(matrix4) {
vec4.transformMat4(this, this, matrix4);
return this.check();
}
}, {
key: "transformByMatrix3",
value: function transformByMatrix3(matrix3) {
(0, _glMatrixExtras.vec4_transformMat3)(this, this, matrix3);
return this.check();
}
}, {
key: "transformByMatrix2",
value: function transformByMatrix2(matrix2) {
(0, _glMatrixExtras.vec4_transformMat2)(this, this, matrix2);
return this.check();
}
}, {
key: "transformByQuaternion",
value: function transformByQuaternion(quaternion) {
vec4.transformQuat(this, this, quaternion);
return this.check();
}
}, {
key: "applyMatrix4",
value: function applyMatrix4(m) {
m.transform(this, this);
return this;
}
}], [{
key: "ZERO",
get: function get() {
return constants.ZERO = constants.ZERO || Object.freeze(new Vector4(0, 0, 0, 0));
}
}]);
return Vector4;
}(_vector.default);
this[0] = object.x;
this[1] = object.y;
this[2] = object.z;
this[3] = object.w;
return this;
}
toObject(object) {
object.x = this[0];
object.y = this[1];
object.z = this[2];
object.w = this[3];
return object;
}
get ELEMENTS() {
return 4;
}
get z() {
return this[2];
}
set z(value) {
this[2] = (0, _validators.checkNumber)(value);
}
get w() {
return this[3];
}
set w(value) {
this[3] = (0, _validators.checkNumber)(value);
}
transform(matrix4) {
vec4.transformMat4(this, this, matrix4);
return this.check();
}
transformByMatrix3(matrix3) {
(0, _glMatrixExtras.vec4_transformMat3)(this, this, matrix3);
return this.check();
}
transformByMatrix2(matrix2) {
(0, _glMatrixExtras.vec4_transformMat2)(this, this, matrix2);
return this.check();
}
transformByQuaternion(quaternion) {
vec4.transformQuat(this, this, quaternion);
return this.check();
}
applyMatrix4(m) {
m.transform(this, this);
return this;
}
}
exports.default = Vector4;
//# sourceMappingURL=vector4.js.map

@@ -8,215 +8,207 @@ "use strict";

});
Object.defineProperty(exports, "config", {
Object.defineProperty(exports, "Vector2", {
enumerable: true,
get: function get() {
return _common.config;
get: function () {
return _vector.default;
}
});
Object.defineProperty(exports, "configure", {
Object.defineProperty(exports, "Vector3", {
enumerable: true,
get: function get() {
return _common.configure;
get: function () {
return _vector2.default;
}
});
Object.defineProperty(exports, "formatValue", {
Object.defineProperty(exports, "Vector4", {
enumerable: true,
get: function get() {
return _common.formatValue;
get: function () {
return _vector3.default;
}
});
Object.defineProperty(exports, "isArray", {
Object.defineProperty(exports, "Matrix3", {
enumerable: true,
get: function get() {
return _common.isArray;
get: function () {
return _matrix.default;
}
});
Object.defineProperty(exports, "clone", {
Object.defineProperty(exports, "Matrix4", {
enumerable: true,
get: function get() {
return _common.clone;
get: function () {
return _matrix2.default;
}
});
Object.defineProperty(exports, "equals", {
Object.defineProperty(exports, "Quaternion", {
enumerable: true,
get: function get() {
return _common.equals;
get: function () {
return _quaternion.default;
}
});
Object.defineProperty(exports, "exactEquals", {
Object.defineProperty(exports, "SphericalCoordinates", {
enumerable: true,
get: function get() {
return _common.exactEquals;
get: function () {
return _sphericalCoordinates.default;
}
});
Object.defineProperty(exports, "toRadians", {
Object.defineProperty(exports, "_SphericalCoordinates", {
enumerable: true,
get: function get() {
return _common.toRadians;
get: function () {
return _sphericalCoordinates.default;
}
});
Object.defineProperty(exports, "toDegrees", {
Object.defineProperty(exports, "Pose", {
enumerable: true,
get: function get() {
return _common.toDegrees;
get: function () {
return _pose.default;
}
});
Object.defineProperty(exports, "radians", {
Object.defineProperty(exports, "_Pose", {
enumerable: true,
get: function get() {
return _common.radians;
get: function () {
return _pose.default;
}
});
Object.defineProperty(exports, "degrees", {
Object.defineProperty(exports, "Euler", {
enumerable: true,
get: function get() {
return _common.degrees;
get: function () {
return _euler.default;
}
});
Object.defineProperty(exports, "sin", {
Object.defineProperty(exports, "_Euler", {
enumerable: true,
get: function get() {
return _common.sin;
get: function () {
return _euler.default;
}
});
Object.defineProperty(exports, "cos", {
Object.defineProperty(exports, "_MathUtils", {
enumerable: true,
get: function get() {
return _common.cos;
get: function () {
return _mathUtils.default;
}
});
Object.defineProperty(exports, "tan", {
Object.defineProperty(exports, "assert", {
enumerable: true,
get: function get() {
return _common.tan;
get: function () {
return _assert.default;
}
});
Object.defineProperty(exports, "asin", {
Object.defineProperty(exports, "config", {
enumerable: true,
get: function get() {
return _common.asin;
get: function () {
return _common.config;
}
});
Object.defineProperty(exports, "acos", {
Object.defineProperty(exports, "configure", {
enumerable: true,
get: function get() {
return _common.acos;
get: function () {
return _common.configure;
}
});
Object.defineProperty(exports, "atan", {
Object.defineProperty(exports, "formatValue", {
enumerable: true,
get: function get() {
return _common.atan;
get: function () {
return _common.formatValue;
}
});
Object.defineProperty(exports, "clamp", {
Object.defineProperty(exports, "isArray", {
enumerable: true,
get: function get() {
return _common.clamp;
get: function () {
return _common.isArray;
}
});
Object.defineProperty(exports, "lerp", {
Object.defineProperty(exports, "clone", {
enumerable: true,
get: function get() {
return _common.lerp;
get: function () {
return _common.clone;
}
});
Object.defineProperty(exports, "withEpsilon", {
Object.defineProperty(exports, "equals", {
enumerable: true,
get: function get() {
return _common.withEpsilon;
get: function () {
return _common.equals;
}
});
Object.defineProperty(exports, "Vector2", {
Object.defineProperty(exports, "exactEquals", {
enumerable: true,
get: function get() {
return _vector.default;
get: function () {
return _common.exactEquals;
}
});
Object.defineProperty(exports, "Vector3", {
Object.defineProperty(exports, "toRadians", {
enumerable: true,
get: function get() {
return _vector2.default;
get: function () {
return _common.toRadians;
}
});
Object.defineProperty(exports, "Vector4", {
Object.defineProperty(exports, "toDegrees", {
enumerable: true,
get: function get() {
return _vector3.default;
get: function () {
return _common.toDegrees;
}
});
Object.defineProperty(exports, "Matrix3", {
Object.defineProperty(exports, "radians", {
enumerable: true,
get: function get() {
return _matrix.default;
get: function () {
return _common.radians;
}
});
Object.defineProperty(exports, "Matrix4", {
Object.defineProperty(exports, "degrees", {
enumerable: true,
get: function get() {
return _matrix2.default;
get: function () {
return _common.degrees;
}
});
Object.defineProperty(exports, "Quaternion", {
Object.defineProperty(exports, "sin", {
enumerable: true,
get: function get() {
return _quaternion.default;
get: function () {
return _common.sin;
}
});
Object.defineProperty(exports, "checkNumber", {
Object.defineProperty(exports, "cos", {
enumerable: true,
get: function get() {
return _validators.checkNumber;
get: function () {
return _common.cos;
}
});
Object.defineProperty(exports, "_MathUtils", {
Object.defineProperty(exports, "tan", {
enumerable: true,
get: function get() {
return _mathUtils.default;
get: function () {
return _common.tan;
}
});
Object.defineProperty(exports, "SphericalCoordinates", {
Object.defineProperty(exports, "asin", {
enumerable: true,
get: function get() {
return _sphericalCoordinates.default;
get: function () {
return _common.asin;
}
});
Object.defineProperty(exports, "_SphericalCoordinates", {
Object.defineProperty(exports, "acos", {
enumerable: true,
get: function get() {
return _sphericalCoordinates.default;
get: function () {
return _common.acos;
}
});
Object.defineProperty(exports, "Pose", {
Object.defineProperty(exports, "atan", {
enumerable: true,
get: function get() {
return _pose.default;
get: function () {
return _common.atan;
}
});
Object.defineProperty(exports, "_Pose", {
Object.defineProperty(exports, "clamp", {
enumerable: true,
get: function get() {
return _pose.default;
get: function () {
return _common.clamp;
}
});
Object.defineProperty(exports, "Euler", {
Object.defineProperty(exports, "lerp", {
enumerable: true,
get: function get() {
return _euler.default;
get: function () {
return _common.lerp;
}
});
Object.defineProperty(exports, "_Euler", {
Object.defineProperty(exports, "withEpsilon", {
enumerable: true,
get: function get() {
return _euler.default;
get: function () {
return _common.withEpsilon;
}
});
Object.defineProperty(exports, "assert", {
enumerable: true,
get: function get() {
return _assert.default;
}
});
var _common = require("./lib/common");
var _vector = _interopRequireDefault(require("./classes/vector2"));

@@ -234,6 +226,2 @@

var _validators = require("./lib/validators");
var _mathUtils = _interopRequireDefault(require("./lib/math-utils"));
var _sphericalCoordinates = _interopRequireDefault(require("./classes/spherical-coordinates"));

@@ -245,13 +233,7 @@

var _mathUtils = _interopRequireDefault(require("./lib/math-utils"));
var _assert = _interopRequireDefault(require("./lib/assert"));
var globals = {
self: typeof self !== 'undefined' && self,
window: typeof window !== 'undefined' && window,
global: typeof global !== 'undefined' && global
};
var global_ = globals.global || globals.self || globals.window;
global_.mathgl = {
config: _common.config
};
var _common = require("./lib/common");
//# sourceMappingURL=index.js.map

@@ -29,13 +29,7 @@ "use strict";

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _assert = _interopRequireDefault(require("./assert"));
var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
var config = {};
const RADIANS_TO_DEGREES = 1 / Math.PI * 180;
const DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
const config = {};
exports.config = config;

@@ -49,6 +43,4 @@ config.EPSILON = 1e-12;

function configure() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
for (var key in options) {
function configure(options = {}) {
for (const key in options) {
(0, _assert.default)(key in config);

@@ -61,11 +53,5 @@ config[key] = options[key];

function round(value) {
return Math.round(value / config.EPSILON) * config.EPSILON;
}
function formatValue(value) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$precision = _ref.precision,
precision = _ref$precision === void 0 ? config.precision || 4 : _ref$precision;
function formatValue(value, {
precision = config.precision || 4
} = {}) {
value = round(value);

@@ -79,24 +65,6 @@ return "".concat(parseFloat(value.toPrecision(precision)));

function duplicateArray(array) {
return array.clone ? array.clone() : new Array(array.length);
}
function clone(array) {
return array.clone ? array.clone() : (0, _construct2.default)(Array, (0, _toConsumableArray2.default)(array));
return 'clone' in array ? array.clone() : new Array(...array);
}
function map(value, func, result) {
if (isArray(value)) {
result = result || duplicateArray(value);
for (var i = 0; i < result.length && i < value.length; ++i) {
result[i] = func(value[i], i, result);
}
return result;
}
return func(value);
}
function toRadians(degrees) {

@@ -111,53 +79,35 @@ return radians(degrees);

function radians(degrees, result) {
return map(degrees, function (degrees) {
return degrees * DEGREES_TO_RADIANS;
}, result);
return map(degrees, degrees => degrees * DEGREES_TO_RADIANS, result);
}
function degrees(radians, result) {
return map(radians, function (radians) {
return radians * RADIANS_TO_DEGREES;
}, result);
return map(radians, radians => radians * RADIANS_TO_DEGREES, result);
}
function sin(radians) {
return map(radians, function (angle) {
return Math.sin(angle);
});
function sin(radians, result) {
return map(radians, angle => Math.sin(angle), result);
}
function cos(radians) {
return map(radians, function (angle) {
return Math.cos(angle);
});
function cos(radians, result) {
return map(radians, angle => Math.cos(angle), result);
}
function tan(radians) {
return map(radians, function (angle) {
return Math.tan(angle);
});
function tan(radians, result) {
return map(radians, angle => Math.tan(angle));
}
function asin(radians) {
return map(radians, function (angle) {
return Math.asin(angle);
});
return map(radians, angle => Math.asin(angle));
}
function acos(radians) {
return map(radians, function (angle) {
return Math.acos(angle);
});
return map(radians, angle => Math.acos(angle));
}
function atan(radians) {
return map(radians, function (angle) {
return Math.atan(angle);
});
return map(radians, angle => Math.atan(angle));
}
function clamp(value, min, max) {
return map(value, function (value) {
return Math.max(min, Math.min(max, value));
});
return map(value, value => Math.max(min, Math.min(max, value)));
}

@@ -167,5 +117,3 @@

if (isArray(a)) {
return a.map(function (ai, i) {
return lerp(ai, b[i], t);
});
return a.map((ai, i) => lerp(ai, b[i], t));
}

@@ -177,3 +125,3 @@

function equals(a, b, epsilon) {
var oldEpsilon = config.EPSILON;
const oldEpsilon = config.EPSILON;

@@ -194,3 +142,3 @@ if (epsilon) {

for (var i = 0; i < a.length; ++i) {
for (let i = 0; i < a.length; ++i) {
if (!equals(a[i], b[i])) {

@@ -212,4 +160,4 @@ return false;

if (Number.isFinite(a) && Number.isFinite(b)) {
return Math.abs(a - b) <= config.EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
if (typeof a === 'number' && typeof b === 'number') {
return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));
}

@@ -228,3 +176,3 @@

if (a && (0, _typeof2.default)(a) === 'object' && b && (0, _typeof2.default)(b) === 'object') {
if (a && typeof a === 'object' && b && typeof b === 'object') {
if (a.constructor !== b.constructor) {

@@ -244,3 +192,3 @@ return false;

for (var i = 0; i < a.length; ++i) {
for (let i = 0; i < a.length; ++i) {
if (!exactEquals(a[i], b[i])) {

@@ -257,6 +205,6 @@ return false;

function withEpsilon(EPSILON, func) {
var oldPrecision = config.EPSILON;
config.EPSILON = EPSILON;
var value;
function withEpsilon(epsilon, func) {
const oldPrecision = config.EPSILON;
config.EPSILON = epsilon;
let value;

@@ -271,2 +219,25 @@ try {

}
function round(value) {
return Math.round(value / config.EPSILON) * config.EPSILON;
}
function duplicateArray(array) {
return array.clone ? array.clone() : new Array(array.length);
}
function map(value, func, result) {
if (isArray(value)) {
const array = value;
result = result || duplicateArray(array);
for (let i = 0; i < result.length && i < array.length; ++i) {
result[i] = func(value[i], i, result);
}
return result;
}
return func(value);
}
//# sourceMappingURL=common.js.map

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

function vec2_transformMat4AsVector(out, a, m) {
var x = a[0];
var y = a[1];
var w = m[3] * x + m[7] * y || 1.0;
const x = a[0];
const y = a[1];
const w = m[3] * x + m[7] * y || 1.0;
out[0] = (m[0] * x + m[4] * y) / w;

@@ -23,6 +23,6 @@ out[1] = (m[1] * x + m[5] * y) / w;

function vec3_transformMat4AsVector(out, a, m) {
var x = a[0];
var y = a[1];
var z = a[2];
var w = m[3] * x + m[7] * y + m[11] * z || 1.0;
const x = a[0];
const y = a[1];
const z = a[2];
const w = m[3] * x + m[7] * y + m[11] * z || 1.0;
out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;

@@ -35,4 +35,4 @@ out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;

function vec3_transformMat2(out, a, m) {
var x = a[0];
var y = a[1];
const x = a[0];
const y = a[1];
out[0] = m[0] * x + m[2] * y;

@@ -45,4 +45,4 @@ out[1] = m[1] * x + m[3] * y;

function vec4_transformMat2(out, a, m) {
var x = a[0];
var y = a[1];
const x = a[0];
const y = a[1];
out[0] = m[0] * x + m[2] * y;

@@ -56,5 +56,5 @@ out[1] = m[1] * x + m[3] * y;

function vec4_transformMat3(out, a, m) {
var x = a[0];
var y = a[1];
var z = a[2];
const x = a[0];
const y = a[1];
const z = a[2];
out[0] = m[0] * x + m[3] * y + m[6] * z;

@@ -61,0 +61,0 @@ out[1] = m[1] * x + m[4] * y + m[7] * z;

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

for (var i = 0; i < v.length; ++i) {
for (let i = 0; i < v.length; ++i) {
if (!Number.isFinite(v[i])) {

@@ -36,5 +36,3 @@ return false;

function checkVector(v, length) {
var callerName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
function checkVector(v, length, callerName = '') {
if (_common.config.debug && !validateVector(v, length)) {

@@ -47,3 +45,3 @@ throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));

var map = {};
const map = {};

@@ -50,0 +48,0 @@ function deprecated(method, version) {

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

import { config } from './lib/common';
export { default as Vector2 } from './classes/vector2';

@@ -8,18 +7,8 @@ export { default as Vector3 } from './classes/vector3';

export { default as Quaternion } from './classes/quaternion';
export { config, configure, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon } from './lib/common';
export { checkNumber } from './lib/validators';
export { default as _MathUtils } from './lib/math-utils';
export { default as SphericalCoordinates } from './classes/spherical-coordinates';
export { default as Pose } from './classes/pose';
export { default as Euler } from './classes/euler';
export { default as _MathUtils } from './lib/math-utils';
export { default as assert } from './lib/assert';
const globals = {
self: typeof self !== 'undefined' && self,
window: typeof window !== 'undefined' && window,
global: typeof global !== 'undefined' && global
};
const global_ = globals.global || globals.self || globals.window;
global_.mathgl = {
config
};
export { config, configure, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon } from './lib/common';
export { default as _SphericalCoordinates } from './classes/spherical-coordinates';

@@ -26,0 +15,0 @@ export { default as _Pose } from './classes/pose';

import assert from './assert';
const RADIANS_TO_DEGREES = 1 / Math.PI * 180;
const DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
const config = {};
export const config = {};
config.EPSILON = 1e-12;

@@ -11,3 +11,2 @@ config.debug = false;

config.printRowMajor = true;
export { config };
export function configure(options = {}) {

@@ -21,7 +20,2 @@ for (const key in options) {

}
function round(value) {
return Math.round(value / config.EPSILON) * config.EPSILON;
}
export function formatValue(value, {

@@ -36,25 +30,5 @@ precision = config.precision || 4

}
function duplicateArray(array) {
return array.clone ? array.clone() : new Array(array.length);
}
export function clone(array) {
return array.clone ? array.clone() : new Array(...array);
return 'clone' in array ? array.clone() : new Array(...array);
}
function map(value, func, result) {
if (isArray(value)) {
result = result || duplicateArray(value);
for (let i = 0; i < result.length && i < value.length; ++i) {
result[i] = func(value[i], i, result);
}
return result;
}
return func(value);
}
export function toRadians(degrees) {

@@ -72,9 +46,9 @@ return radians(degrees);

}
export function sin(radians) {
return map(radians, angle => Math.sin(angle));
export function sin(radians, result) {
return map(radians, angle => Math.sin(angle), result);
}
export function cos(radians) {
return map(radians, angle => Math.cos(angle));
export function cos(radians, result) {
return map(radians, angle => Math.cos(angle), result);
}
export function tan(radians) {
export function tan(radians, result) {
return map(radians, angle => Math.tan(angle));

@@ -135,4 +109,4 @@ }

if (Number.isFinite(a) && Number.isFinite(b)) {
return Math.abs(a - b) <= config.EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
if (typeof a === 'number' && typeof b === 'number') {
return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));
}

@@ -176,5 +150,5 @@

}
export function withEpsilon(EPSILON, func) {
export function withEpsilon(epsilon, func) {
const oldPrecision = config.EPSILON;
config.EPSILON = EPSILON;
config.EPSILON = epsilon;
let value;

@@ -190,2 +164,25 @@

}
function round(value) {
return Math.round(value / config.EPSILON) * config.EPSILON;
}
function duplicateArray(array) {
return array.clone ? array.clone() : new Array(array.length);
}
function map(value, func, result) {
if (isArray(value)) {
const array = value;
result = result || duplicateArray(array);
for (let i = 0; i < result.length && i < array.length; ++i) {
result[i] = func(value[i], i, result);
}
return result;
}
return func(value);
}
//# sourceMappingURL=common.js.map

@@ -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": "src/index.ts",
"main": "dist/es5/index.js",

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

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

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

/** Base class for vectors and matrices */

@@ -3,0 +2,0 @@ export default abstract class MathArray<DerivedType> extends Array<number> {

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