@math.gl/core 4.1.0-alpha.9 → 4.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/matrix3.d.ts +17 -0
- package/dist/classes/matrix3.d.ts.map +1 -1
- package/dist/classes/matrix3.js +43 -0
- package/dist/classes/matrix3.js.map +1 -1
- package/dist/gl-matrix/wip/mat2.d.ts.map +1 -1
- package/dist/gl-matrix/wip/mat2d.d.ts.map +1 -1
- package/dist/index.cjs +540 -56
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/common.d.ts +16 -0
- package/dist/lib/common.d.ts.map +1 -1
- package/dist/lib/common.js +59 -0
- package/dist/lib/common.js.map +1 -1
- package/dist/lib/math-utils.d.ts +1 -0
- package/dist/lib/math-utils.d.ts.map +1 -1
- package/dist/lib/math-utils.js +1 -0
- package/dist/lib/math-utils.js.map +1 -1
- package/package.json +3 -3
- package/src/classes/matrix3.ts +49 -0
- package/src/index.ts +2 -0
- package/src/lib/common.ts +67 -0
- package/src/lib/math-utils.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -49,8 +49,10 @@ __export(dist_exports, {
|
|
|
49
49
|
lerp: () => lerp,
|
|
50
50
|
mat3: () => mat3_exports,
|
|
51
51
|
mat4: () => mat4_exports,
|
|
52
|
+
normalizeAngle: () => normalizeAngle,
|
|
52
53
|
quat: () => quat_exports,
|
|
53
54
|
radians: () => radians,
|
|
55
|
+
safeMod: () => safeMod,
|
|
54
56
|
sin: () => sin,
|
|
55
57
|
tan: () => tan,
|
|
56
58
|
toDegrees: () => toDegrees,
|
|
@@ -62,6 +64,61 @@ __export(dist_exports, {
|
|
|
62
64
|
});
|
|
63
65
|
module.exports = __toCommonJS(dist_exports);
|
|
64
66
|
|
|
67
|
+
// dist/lib/math-utils.js
|
|
68
|
+
var math_utils_exports = {};
|
|
69
|
+
__export(math_utils_exports, {
|
|
70
|
+
EPSILON1: () => EPSILON1,
|
|
71
|
+
EPSILON10: () => EPSILON10,
|
|
72
|
+
EPSILON11: () => EPSILON11,
|
|
73
|
+
EPSILON12: () => EPSILON12,
|
|
74
|
+
EPSILON13: () => EPSILON13,
|
|
75
|
+
EPSILON14: () => EPSILON14,
|
|
76
|
+
EPSILON15: () => EPSILON15,
|
|
77
|
+
EPSILON16: () => EPSILON16,
|
|
78
|
+
EPSILON17: () => EPSILON17,
|
|
79
|
+
EPSILON18: () => EPSILON18,
|
|
80
|
+
EPSILON19: () => EPSILON19,
|
|
81
|
+
EPSILON2: () => EPSILON2,
|
|
82
|
+
EPSILON20: () => EPSILON20,
|
|
83
|
+
EPSILON3: () => EPSILON3,
|
|
84
|
+
EPSILON4: () => EPSILON4,
|
|
85
|
+
EPSILON5: () => EPSILON5,
|
|
86
|
+
EPSILON6: () => EPSILON6,
|
|
87
|
+
EPSILON7: () => EPSILON7,
|
|
88
|
+
EPSILON8: () => EPSILON8,
|
|
89
|
+
EPSILON9: () => EPSILON9,
|
|
90
|
+
PI: () => PI,
|
|
91
|
+
PI_OVER_FOUR: () => PI_OVER_FOUR,
|
|
92
|
+
PI_OVER_SIX: () => PI_OVER_SIX,
|
|
93
|
+
PI_OVER_TWO: () => PI_OVER_TWO,
|
|
94
|
+
TWO_PI: () => TWO_PI
|
|
95
|
+
});
|
|
96
|
+
var EPSILON1 = 0.1;
|
|
97
|
+
var EPSILON2 = 0.01;
|
|
98
|
+
var EPSILON3 = 1e-3;
|
|
99
|
+
var EPSILON4 = 1e-4;
|
|
100
|
+
var EPSILON5 = 1e-5;
|
|
101
|
+
var EPSILON6 = 1e-6;
|
|
102
|
+
var EPSILON7 = 1e-7;
|
|
103
|
+
var EPSILON8 = 1e-8;
|
|
104
|
+
var EPSILON9 = 1e-9;
|
|
105
|
+
var EPSILON10 = 1e-10;
|
|
106
|
+
var EPSILON11 = 1e-11;
|
|
107
|
+
var EPSILON12 = 1e-12;
|
|
108
|
+
var EPSILON13 = 1e-13;
|
|
109
|
+
var EPSILON14 = 1e-14;
|
|
110
|
+
var EPSILON15 = 1e-15;
|
|
111
|
+
var EPSILON16 = 1e-16;
|
|
112
|
+
var EPSILON17 = 1e-17;
|
|
113
|
+
var EPSILON18 = 1e-18;
|
|
114
|
+
var EPSILON19 = 1e-19;
|
|
115
|
+
var EPSILON20 = 1e-20;
|
|
116
|
+
var PI_OVER_TWO = Math.PI / 2;
|
|
117
|
+
var PI_OVER_FOUR = Math.PI / 4;
|
|
118
|
+
var PI_OVER_SIX = Math.PI / 6;
|
|
119
|
+
var PI = Math.PI;
|
|
120
|
+
var TWO_PI = Math.PI * 2;
|
|
121
|
+
|
|
65
122
|
// dist/lib/common.js
|
|
66
123
|
var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
|
|
67
124
|
var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
|
|
@@ -102,6 +159,38 @@ function radians(degrees2, result) {
|
|
|
102
159
|
function degrees(radians2, result) {
|
|
103
160
|
return map(radians2, (radians3) => radians3 * RADIANS_TO_DEGREES, result);
|
|
104
161
|
}
|
|
162
|
+
function safeMod(m, n) {
|
|
163
|
+
if (Math.sign(m) === Math.sign(n) && Math.abs(m) < Math.abs(n)) {
|
|
164
|
+
return m;
|
|
165
|
+
}
|
|
166
|
+
return (m % n + n) % n;
|
|
167
|
+
}
|
|
168
|
+
function normalizeAngle(angle3, range) {
|
|
169
|
+
switch (range) {
|
|
170
|
+
case "negative-pi-to-pi":
|
|
171
|
+
return negativePiToPi(angle3);
|
|
172
|
+
case "zero-to-two-pi":
|
|
173
|
+
return zeroToTwoPi(angle3);
|
|
174
|
+
default:
|
|
175
|
+
return angle3;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function zeroToTwoPi(angle3) {
|
|
179
|
+
if (angle3 >= 0 && angle3 <= TWO_PI) {
|
|
180
|
+
return angle3;
|
|
181
|
+
}
|
|
182
|
+
const remainder = safeMod(angle3, TWO_PI);
|
|
183
|
+
if (Math.abs(remainder) < EPSILON14 && Math.abs(angle3) > EPSILON14) {
|
|
184
|
+
return TWO_PI;
|
|
185
|
+
}
|
|
186
|
+
return remainder;
|
|
187
|
+
}
|
|
188
|
+
function negativePiToPi(angle3) {
|
|
189
|
+
if (angle3 >= -PI && angle3 <= PI) {
|
|
190
|
+
return angle3;
|
|
191
|
+
}
|
|
192
|
+
return zeroToTwoPi(angle3 + PI) - PI;
|
|
193
|
+
}
|
|
105
194
|
function sin(radians2, result) {
|
|
106
195
|
return map(radians2, (angle3) => Math.sin(angle3), result);
|
|
107
196
|
}
|
|
@@ -220,6 +309,11 @@ function map(value, func, result) {
|
|
|
220
309
|
|
|
221
310
|
// dist/classes/base/math-array.js
|
|
222
311
|
var MathArray = class extends Array {
|
|
312
|
+
// Common methods
|
|
313
|
+
/**
|
|
314
|
+
* Clone the current object
|
|
315
|
+
* @returns a new copy of this object
|
|
316
|
+
*/
|
|
223
317
|
clone() {
|
|
224
318
|
return new this.constructor().copy(this);
|
|
225
319
|
}
|
|
@@ -239,7 +333,10 @@ var MathArray = class extends Array {
|
|
|
239
333
|
return targetObject;
|
|
240
334
|
}
|
|
241
335
|
from(arrayOrObject) {
|
|
242
|
-
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) :
|
|
336
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
|
|
337
|
+
// @ts-ignore
|
|
338
|
+
this.fromObject(arrayOrObject)
|
|
339
|
+
);
|
|
243
340
|
}
|
|
244
341
|
to(arrayOrObject) {
|
|
245
342
|
if (arrayOrObject === this) {
|
|
@@ -250,12 +347,14 @@ var MathArray = class extends Array {
|
|
|
250
347
|
toTarget(target) {
|
|
251
348
|
return target ? this.to(target) : this;
|
|
252
349
|
}
|
|
350
|
+
/** @deprecated */
|
|
253
351
|
toFloat32Array() {
|
|
254
352
|
return new Float32Array(this);
|
|
255
353
|
}
|
|
256
354
|
toString() {
|
|
257
355
|
return this.formatString(config);
|
|
258
356
|
}
|
|
357
|
+
/** Formats string according to options */
|
|
259
358
|
formatString(opts) {
|
|
260
359
|
let string = "";
|
|
261
360
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -285,6 +384,8 @@ var MathArray = class extends Array {
|
|
|
285
384
|
}
|
|
286
385
|
return true;
|
|
287
386
|
}
|
|
387
|
+
// Modifiers
|
|
388
|
+
/** Negates all values in this object */
|
|
288
389
|
negate() {
|
|
289
390
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
290
391
|
this[i] = -this[i];
|
|
@@ -302,12 +403,14 @@ var MathArray = class extends Array {
|
|
|
302
403
|
}
|
|
303
404
|
return this.check();
|
|
304
405
|
}
|
|
406
|
+
/** Minimal */
|
|
305
407
|
min(vector) {
|
|
306
408
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
307
409
|
this[i] = Math.min(vector[i], this[i]);
|
|
308
410
|
}
|
|
309
411
|
return this.check();
|
|
310
412
|
}
|
|
413
|
+
/** Maximal */
|
|
311
414
|
max(vector) {
|
|
312
415
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
313
416
|
this[i] = Math.max(vector[i], this[i]);
|
|
@@ -348,18 +451,25 @@ var MathArray = class extends Array {
|
|
|
348
451
|
}
|
|
349
452
|
return this.check();
|
|
350
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* Multiplies all elements by `scale`
|
|
456
|
+
* Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
|
|
457
|
+
*/
|
|
351
458
|
multiplyByScalar(scalar) {
|
|
352
459
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
353
460
|
this[i] *= scalar;
|
|
354
461
|
}
|
|
355
462
|
return this.check();
|
|
356
463
|
}
|
|
464
|
+
// Debug checks
|
|
465
|
+
/** Throws an error if array length is incorrect or contains illegal values */
|
|
357
466
|
check() {
|
|
358
467
|
if (config.debug && !this.validate()) {
|
|
359
468
|
throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
|
|
360
469
|
}
|
|
361
470
|
return this;
|
|
362
471
|
}
|
|
472
|
+
/** Returns false if the array length is incorrect or contains illegal values */
|
|
363
473
|
validate() {
|
|
364
474
|
let valid = this.length === this.ELEMENTS;
|
|
365
475
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -367,39 +477,48 @@ var MathArray = class extends Array {
|
|
|
367
477
|
}
|
|
368
478
|
return valid;
|
|
369
479
|
}
|
|
480
|
+
// three.js compatibility
|
|
481
|
+
/** @deprecated */
|
|
370
482
|
sub(a) {
|
|
371
483
|
return this.subtract(a);
|
|
372
484
|
}
|
|
485
|
+
/** @deprecated */
|
|
373
486
|
setScalar(a) {
|
|
374
487
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
375
488
|
this[i] = a;
|
|
376
489
|
}
|
|
377
490
|
return this.check();
|
|
378
491
|
}
|
|
492
|
+
/** @deprecated */
|
|
379
493
|
addScalar(a) {
|
|
380
494
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
381
495
|
this[i] += a;
|
|
382
496
|
}
|
|
383
497
|
return this.check();
|
|
384
498
|
}
|
|
499
|
+
/** @deprecated */
|
|
385
500
|
subScalar(a) {
|
|
386
501
|
return this.addScalar(-a);
|
|
387
502
|
}
|
|
503
|
+
/** @deprecated */
|
|
388
504
|
multiplyScalar(scalar) {
|
|
389
505
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
390
506
|
this[i] *= scalar;
|
|
391
507
|
}
|
|
392
508
|
return this.check();
|
|
393
509
|
}
|
|
510
|
+
/** @deprecated */
|
|
394
511
|
divideScalar(a) {
|
|
395
512
|
return this.multiplyByScalar(1 / a);
|
|
396
513
|
}
|
|
514
|
+
/** @deprecated */
|
|
397
515
|
clampScalar(min4, max4) {
|
|
398
516
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
399
517
|
this[i] = Math.min(Math.max(this[i], min4), max4);
|
|
400
518
|
}
|
|
401
519
|
return this.check();
|
|
402
520
|
}
|
|
521
|
+
/** @deprecated */
|
|
403
522
|
get elements() {
|
|
404
523
|
return this;
|
|
405
524
|
}
|
|
@@ -439,6 +558,7 @@ function assert(condition, message) {
|
|
|
439
558
|
|
|
440
559
|
// dist/classes/base/vector.js
|
|
441
560
|
var Vector = class extends MathArray {
|
|
561
|
+
// ACCESSORS
|
|
442
562
|
get x() {
|
|
443
563
|
return this[0];
|
|
444
564
|
}
|
|
@@ -451,12 +571,24 @@ var Vector = class extends MathArray {
|
|
|
451
571
|
set y(value) {
|
|
452
572
|
this[1] = checkNumber(value);
|
|
453
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
576
|
+
*
|
|
577
|
+
* @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
|
|
578
|
+
* Instead we provide `len` and `magnitude`
|
|
579
|
+
*/
|
|
454
580
|
len() {
|
|
455
581
|
return Math.sqrt(this.lengthSquared());
|
|
456
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
585
|
+
*/
|
|
457
586
|
magnitude() {
|
|
458
587
|
return this.len();
|
|
459
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
591
|
+
*/
|
|
460
592
|
lengthSquared() {
|
|
461
593
|
let length5 = 0;
|
|
462
594
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -464,6 +596,9 @@ var Vector = class extends MathArray {
|
|
|
464
596
|
}
|
|
465
597
|
return length5;
|
|
466
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
601
|
+
*/
|
|
467
602
|
magnitudeSquared() {
|
|
468
603
|
return this.lengthSquared();
|
|
469
604
|
}
|
|
@@ -485,6 +620,7 @@ var Vector = class extends MathArray {
|
|
|
485
620
|
}
|
|
486
621
|
return checkNumber(product);
|
|
487
622
|
}
|
|
623
|
+
// MODIFIERS
|
|
488
624
|
normalize() {
|
|
489
625
|
const length5 = this.magnitude();
|
|
490
626
|
if (length5 !== 0) {
|
|
@@ -510,6 +646,7 @@ var Vector = class extends MathArray {
|
|
|
510
646
|
}
|
|
511
647
|
return this.check();
|
|
512
648
|
}
|
|
649
|
+
// THREE.js compatibility
|
|
513
650
|
lengthSq() {
|
|
514
651
|
return this.lengthSquared();
|
|
515
652
|
}
|
|
@@ -900,6 +1037,7 @@ function vec4_transformMat3(out, a, m) {
|
|
|
900
1037
|
|
|
901
1038
|
// dist/classes/vector2.js
|
|
902
1039
|
var Vector2 = class extends Vector {
|
|
1040
|
+
// Creates a new, empty vec2
|
|
903
1041
|
constructor(x = 0, y = 0) {
|
|
904
1042
|
super(2);
|
|
905
1043
|
if (isArray(x) && arguments.length === 1) {
|
|
@@ -937,22 +1075,47 @@ var Vector2 = class extends Vector {
|
|
|
937
1075
|
object.y = this[1];
|
|
938
1076
|
return object;
|
|
939
1077
|
}
|
|
1078
|
+
// Getters/setters
|
|
940
1079
|
get ELEMENTS() {
|
|
941
1080
|
return 2;
|
|
942
1081
|
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Returns angle from x axis
|
|
1084
|
+
* @returns
|
|
1085
|
+
*/
|
|
943
1086
|
horizontalAngle() {
|
|
944
1087
|
return Math.atan2(this.y, this.x);
|
|
945
1088
|
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns angle from y axis
|
|
1091
|
+
* @returns
|
|
1092
|
+
*/
|
|
946
1093
|
verticalAngle() {
|
|
947
1094
|
return Math.atan2(this.x, this.y);
|
|
948
1095
|
}
|
|
1096
|
+
// Transforms
|
|
1097
|
+
/**
|
|
1098
|
+
* Transforms as point
|
|
1099
|
+
* @param matrix4
|
|
1100
|
+
* @returns
|
|
1101
|
+
*/
|
|
949
1102
|
transform(matrix4) {
|
|
950
1103
|
return this.transformAsPoint(matrix4);
|
|
951
1104
|
}
|
|
1105
|
+
/**
|
|
1106
|
+
* transforms as point (4th component is implicitly 1)
|
|
1107
|
+
* @param matrix4
|
|
1108
|
+
* @returns
|
|
1109
|
+
*/
|
|
952
1110
|
transformAsPoint(matrix4) {
|
|
953
1111
|
transformMat4(this, this, matrix4);
|
|
954
1112
|
return this.check();
|
|
955
1113
|
}
|
|
1114
|
+
/**
|
|
1115
|
+
* transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
|
|
1116
|
+
* @param matrix4
|
|
1117
|
+
* @returns
|
|
1118
|
+
*/
|
|
956
1119
|
transformAsVector(matrix4) {
|
|
957
1120
|
vec2_transformMat4AsVector(this, this, matrix4);
|
|
958
1121
|
return this.check();
|
|
@@ -1409,6 +1572,12 @@ var Vector3 = class extends Vector {
|
|
|
1409
1572
|
}
|
|
1410
1573
|
return ZERO;
|
|
1411
1574
|
}
|
|
1575
|
+
/**
|
|
1576
|
+
* @class
|
|
1577
|
+
* @param x
|
|
1578
|
+
* @param y
|
|
1579
|
+
* @param z
|
|
1580
|
+
*/
|
|
1412
1581
|
constructor(x = 0, y = 0, z = 0) {
|
|
1413
1582
|
super(-0, -0, -0);
|
|
1414
1583
|
if (arguments.length === 1 && isArray(x)) {
|
|
@@ -1453,6 +1622,7 @@ var Vector3 = class extends Vector {
|
|
|
1453
1622
|
object.z = this[2];
|
|
1454
1623
|
return object;
|
|
1455
1624
|
}
|
|
1625
|
+
// Getters/setters
|
|
1456
1626
|
get ELEMENTS() {
|
|
1457
1627
|
return 3;
|
|
1458
1628
|
}
|
|
@@ -1462,9 +1632,11 @@ var Vector3 = class extends Vector {
|
|
|
1462
1632
|
set z(value) {
|
|
1463
1633
|
this[2] = checkNumber(value);
|
|
1464
1634
|
}
|
|
1635
|
+
// ACCESSORS
|
|
1465
1636
|
angle(vector) {
|
|
1466
1637
|
return angle2(this, vector);
|
|
1467
1638
|
}
|
|
1639
|
+
// MODIFIERS
|
|
1468
1640
|
cross(vector) {
|
|
1469
1641
|
cross2(this, this, vector);
|
|
1470
1642
|
return this.check();
|
|
@@ -1481,13 +1653,17 @@ var Vector3 = class extends Vector {
|
|
|
1481
1653
|
rotateZ(this, this, origin, radians2);
|
|
1482
1654
|
return this.check();
|
|
1483
1655
|
}
|
|
1656
|
+
// Transforms
|
|
1657
|
+
// transforms as point (4th component is implicitly 1)
|
|
1484
1658
|
transform(matrix4) {
|
|
1485
1659
|
return this.transformAsPoint(matrix4);
|
|
1486
1660
|
}
|
|
1661
|
+
// transforms as point (4th component is implicitly 1)
|
|
1487
1662
|
transformAsPoint(matrix4) {
|
|
1488
1663
|
transformMat42(this, this, matrix4);
|
|
1489
1664
|
return this.check();
|
|
1490
1665
|
}
|
|
1666
|
+
// transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
|
|
1491
1667
|
transformAsVector(matrix4) {
|
|
1492
1668
|
vec3_transformMat4AsVector(this, this, matrix4);
|
|
1493
1669
|
return this.check();
|
|
@@ -1567,6 +1743,8 @@ var Vector4 = class extends Vector {
|
|
|
1567
1743
|
object.w = this[3];
|
|
1568
1744
|
return object;
|
|
1569
1745
|
}
|
|
1746
|
+
// Getters/setters
|
|
1747
|
+
/* eslint-disable no-multi-spaces, brace-style, no-return-assign */
|
|
1570
1748
|
get ELEMENTS() {
|
|
1571
1749
|
return 4;
|
|
1572
1750
|
}
|
|
@@ -1598,6 +1776,7 @@ var Vector4 = class extends Vector {
|
|
|
1598
1776
|
transformQuat(this, this, quaternion);
|
|
1599
1777
|
return this.check();
|
|
1600
1778
|
}
|
|
1779
|
+
// three.js compatibility
|
|
1601
1780
|
applyMatrix4(m) {
|
|
1602
1781
|
m.transform(this, this);
|
|
1603
1782
|
return this;
|
|
@@ -1606,6 +1785,16 @@ var Vector4 = class extends Vector {
|
|
|
1606
1785
|
|
|
1607
1786
|
// dist/classes/base/matrix.js
|
|
1608
1787
|
var Matrix = class extends MathArray {
|
|
1788
|
+
// fromObject(object) {
|
|
1789
|
+
// const array = object.elements;
|
|
1790
|
+
// return this.fromRowMajor(array);
|
|
1791
|
+
// }
|
|
1792
|
+
// toObject(object) {
|
|
1793
|
+
// const array = object.elements;
|
|
1794
|
+
// this.toRowMajor(array);
|
|
1795
|
+
// return object;
|
|
1796
|
+
// }
|
|
1797
|
+
// TODO better override formatString?
|
|
1609
1798
|
toString() {
|
|
1610
1799
|
let string = "[";
|
|
1611
1800
|
if (config.printRowMajor) {
|
|
@@ -1627,9 +1816,11 @@ var Matrix = class extends MathArray {
|
|
|
1627
1816
|
getElementIndex(row, col) {
|
|
1628
1817
|
return col * this.RANK + row;
|
|
1629
1818
|
}
|
|
1819
|
+
// By default assumes row major indices
|
|
1630
1820
|
getElement(row, col) {
|
|
1631
1821
|
return this[col * this.RANK + row];
|
|
1632
1822
|
}
|
|
1823
|
+
// By default assumes row major indices
|
|
1633
1824
|
setElement(row, col, value) {
|
|
1634
1825
|
this[col * this.RANK + row] = checkNumber(value);
|
|
1635
1826
|
return this;
|
|
@@ -2219,16 +2410,30 @@ var Matrix3 = class extends Matrix {
|
|
|
2219
2410
|
this[8] = array[8];
|
|
2220
2411
|
return this.check();
|
|
2221
2412
|
}
|
|
2413
|
+
// Constructors
|
|
2222
2414
|
identity() {
|
|
2223
2415
|
return this.copy(IDENTITY_MATRIX);
|
|
2224
2416
|
}
|
|
2417
|
+
/**
|
|
2418
|
+
*
|
|
2419
|
+
* @param object
|
|
2420
|
+
* @returns self
|
|
2421
|
+
*/
|
|
2422
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2225
2423
|
fromObject(object) {
|
|
2226
2424
|
return this.check();
|
|
2227
2425
|
}
|
|
2426
|
+
/** Calculates a 3x3 matrix from the given quaternion
|
|
2427
|
+
* q quat Quaternion to create matrix from
|
|
2428
|
+
*/
|
|
2228
2429
|
fromQuaternion(q) {
|
|
2229
2430
|
fromQuat(this, q);
|
|
2230
2431
|
return this.check();
|
|
2231
2432
|
}
|
|
2433
|
+
/**
|
|
2434
|
+
* accepts column major order, stores in column major order
|
|
2435
|
+
*/
|
|
2436
|
+
// eslint-disable-next-line max-params
|
|
2232
2437
|
set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
|
|
2233
2438
|
this[0] = m00;
|
|
2234
2439
|
this[1] = m10;
|
|
@@ -2241,6 +2446,10 @@ var Matrix3 = class extends Matrix {
|
|
|
2241
2446
|
this[8] = m22;
|
|
2242
2447
|
return this.check();
|
|
2243
2448
|
}
|
|
2449
|
+
/**
|
|
2450
|
+
* accepts row major order, stores as column major
|
|
2451
|
+
*/
|
|
2452
|
+
// eslint-disable-next-line max-params
|
|
2244
2453
|
setRowMajor(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
|
2245
2454
|
this[0] = m00;
|
|
2246
2455
|
this[1] = m10;
|
|
@@ -2253,17 +2462,21 @@ var Matrix3 = class extends Matrix {
|
|
|
2253
2462
|
this[8] = m22;
|
|
2254
2463
|
return this.check();
|
|
2255
2464
|
}
|
|
2465
|
+
// Accessors
|
|
2256
2466
|
determinant() {
|
|
2257
2467
|
return determinant(this);
|
|
2258
2468
|
}
|
|
2469
|
+
// Modifiers
|
|
2259
2470
|
transpose() {
|
|
2260
2471
|
transpose(this, this);
|
|
2261
2472
|
return this.check();
|
|
2262
2473
|
}
|
|
2474
|
+
/** Invert a matrix. Note that this can fail if the matrix is not invertible */
|
|
2263
2475
|
invert() {
|
|
2264
2476
|
invert(this, this);
|
|
2265
2477
|
return this.check();
|
|
2266
2478
|
}
|
|
2479
|
+
// Operations
|
|
2267
2480
|
multiplyLeft(a) {
|
|
2268
2481
|
multiply3(this, a, this);
|
|
2269
2482
|
return this.check();
|
|
@@ -2272,6 +2485,48 @@ var Matrix3 = class extends Matrix {
|
|
|
2272
2485
|
multiply3(this, this, a);
|
|
2273
2486
|
return this.check();
|
|
2274
2487
|
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Computes the product of this matrix and a column vector.
|
|
2490
|
+
*
|
|
2491
|
+
* @param {Vector3} cartesian The column.
|
|
2492
|
+
* @param {Vector3} result The object onto which to store the result.
|
|
2493
|
+
* @returns {Vector3} The modified result parameter.
|
|
2494
|
+
*/
|
|
2495
|
+
multiplyByVector(cartesian, result) {
|
|
2496
|
+
if (!result)
|
|
2497
|
+
result = new Vector3();
|
|
2498
|
+
const vX = cartesian.x;
|
|
2499
|
+
const vY = cartesian.y;
|
|
2500
|
+
const vZ = cartesian.z;
|
|
2501
|
+
const x = this[0] * vX + this[3] * vY + this[6] * vZ;
|
|
2502
|
+
const y = this[1] * vX + this[4] * vY + this[7] * vZ;
|
|
2503
|
+
const z = this[2] * vX + this[5] * vY + this[8] * vZ;
|
|
2504
|
+
result.x = x;
|
|
2505
|
+
result.y = y;
|
|
2506
|
+
result.z = z;
|
|
2507
|
+
return result;
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Computes the product of this matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
|
2511
|
+
*
|
|
2512
|
+
* @param {Vector3} scale The non-uniform scale on the right-hand side.
|
|
2513
|
+
* @param {Matrix3} result The object onto which to store the result.
|
|
2514
|
+
* @returns {Matrix3} The modified result parameter.
|
|
2515
|
+
*/
|
|
2516
|
+
multiplyByScale(scale7, result) {
|
|
2517
|
+
if (!result)
|
|
2518
|
+
result = new Matrix3();
|
|
2519
|
+
result[0] = this[0] * scale7.x;
|
|
2520
|
+
result[1] = this[1] * scale7.x;
|
|
2521
|
+
result[2] = this[2] * scale7.x;
|
|
2522
|
+
result[3] = this[3] * scale7.y;
|
|
2523
|
+
result[4] = this[4] * scale7.y;
|
|
2524
|
+
result[5] = this[5] * scale7.y;
|
|
2525
|
+
result[6] = this[6] * scale7.z;
|
|
2526
|
+
result[7] = this[7] * scale7.z;
|
|
2527
|
+
result[8] = this[8] * scale7.z;
|
|
2528
|
+
return result;
|
|
2529
|
+
}
|
|
2275
2530
|
rotate(radians2) {
|
|
2276
2531
|
rotate2(this, this, radians2);
|
|
2277
2532
|
return this.check();
|
|
@@ -2288,6 +2543,7 @@ var Matrix3 = class extends Matrix {
|
|
|
2288
2543
|
translate(this, this, vec);
|
|
2289
2544
|
return this.check();
|
|
2290
2545
|
}
|
|
2546
|
+
// Transforms
|
|
2291
2547
|
transform(vector, result) {
|
|
2292
2548
|
let out;
|
|
2293
2549
|
switch (vector.length) {
|
|
@@ -2306,12 +2562,15 @@ var Matrix3 = class extends Matrix {
|
|
|
2306
2562
|
checkVector(out, vector.length);
|
|
2307
2563
|
return out;
|
|
2308
2564
|
}
|
|
2565
|
+
/** @deprecated */
|
|
2309
2566
|
transformVector(vector, result) {
|
|
2310
2567
|
return this.transform(vector, result);
|
|
2311
2568
|
}
|
|
2569
|
+
/** @deprecated */
|
|
2312
2570
|
transformVector2(vector, result) {
|
|
2313
2571
|
return this.transform(vector, result);
|
|
2314
2572
|
}
|
|
2573
|
+
/** @deprecated */
|
|
2315
2574
|
transformVector3(vector, result) {
|
|
2316
2575
|
return this.transform(vector, result);
|
|
2317
2576
|
}
|
|
@@ -4238,6 +4497,7 @@ var Matrix4 = class extends Matrix {
|
|
|
4238
4497
|
this[15] = array[15];
|
|
4239
4498
|
return this.check();
|
|
4240
4499
|
}
|
|
4500
|
+
// eslint-disable-next-line max-params
|
|
4241
4501
|
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
|
|
4242
4502
|
this[0] = m00;
|
|
4243
4503
|
this[1] = m10;
|
|
@@ -4257,6 +4517,8 @@ var Matrix4 = class extends Matrix {
|
|
|
4257
4517
|
this[15] = m33;
|
|
4258
4518
|
return this.check();
|
|
4259
4519
|
}
|
|
4520
|
+
// accepts row major order, stores as column major
|
|
4521
|
+
// eslint-disable-next-line max-params
|
|
4260
4522
|
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
|
|
4261
4523
|
this[0] = m00;
|
|
4262
4524
|
this[1] = m10;
|
|
@@ -4295,16 +4557,39 @@ var Matrix4 = class extends Matrix {
|
|
|
4295
4557
|
result[15] = this[15];
|
|
4296
4558
|
return result;
|
|
4297
4559
|
}
|
|
4560
|
+
// Constructors
|
|
4561
|
+
/** Set to identity matrix */
|
|
4298
4562
|
identity() {
|
|
4299
4563
|
return this.copy(IDENTITY_MATRIX2);
|
|
4300
4564
|
}
|
|
4565
|
+
/**
|
|
4566
|
+
*
|
|
4567
|
+
* @param object
|
|
4568
|
+
* @returns self
|
|
4569
|
+
*/
|
|
4570
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4301
4571
|
fromObject(object) {
|
|
4302
4572
|
return this.check();
|
|
4303
4573
|
}
|
|
4574
|
+
/**
|
|
4575
|
+
* Calculates a 4x4 matrix from the given quaternion
|
|
4576
|
+
* @param quaternion Quaternion to create matrix from
|
|
4577
|
+
* @returns self
|
|
4578
|
+
*/
|
|
4304
4579
|
fromQuaternion(quaternion) {
|
|
4305
4580
|
fromQuat3(this, quaternion);
|
|
4306
4581
|
return this.check();
|
|
4307
4582
|
}
|
|
4583
|
+
/**
|
|
4584
|
+
* Generates a frustum matrix with the given bounds
|
|
4585
|
+
* @param view.left - Left bound of the frustum
|
|
4586
|
+
* @param view.right - Right bound of the frustum
|
|
4587
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
4588
|
+
* @param view.top - Top bound of the frustum
|
|
4589
|
+
* @param view.near - Near bound of the frustum
|
|
4590
|
+
* @param view.far - Far bound of the frustum. Can be set to Infinity.
|
|
4591
|
+
* @returns self
|
|
4592
|
+
*/
|
|
4308
4593
|
frustum(view) {
|
|
4309
4594
|
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4310
4595
|
if (far === Infinity) {
|
|
@@ -4314,16 +4599,45 @@ var Matrix4 = class extends Matrix {
|
|
|
4314
4599
|
}
|
|
4315
4600
|
return this.check();
|
|
4316
4601
|
}
|
|
4602
|
+
/**
|
|
4603
|
+
* Generates a look-at matrix with the given eye position, focal point,
|
|
4604
|
+
* and up axis
|
|
4605
|
+
* @param view.eye - (vector) Position of the viewer
|
|
4606
|
+
* @param view.center - (vector) Point the viewer is looking at
|
|
4607
|
+
* @param view.up - (vector) Up axis
|
|
4608
|
+
* @returns self
|
|
4609
|
+
*/
|
|
4317
4610
|
lookAt(view) {
|
|
4318
4611
|
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
4319
4612
|
lookAt(this, eye, center, up);
|
|
4320
4613
|
return this.check();
|
|
4321
4614
|
}
|
|
4615
|
+
/**
|
|
4616
|
+
* Generates a orthogonal projection matrix with the given bounds
|
|
4617
|
+
* from "traditional" view space parameters
|
|
4618
|
+
* @param view.left - Left bound of the frustum
|
|
4619
|
+
* @param view.right number Right bound of the frustum
|
|
4620
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
4621
|
+
* @param view.top number Top bound of the frustum
|
|
4622
|
+
* @param view.near - Near bound of the frustum
|
|
4623
|
+
* @param view.far number Far bound of the frustum
|
|
4624
|
+
* @returns self
|
|
4625
|
+
*/
|
|
4322
4626
|
ortho(view) {
|
|
4323
4627
|
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4324
4628
|
ortho(this, left, right, bottom, top, near, far);
|
|
4325
4629
|
return this.check();
|
|
4326
4630
|
}
|
|
4631
|
+
/**
|
|
4632
|
+
* Generates an orthogonal projection matrix with the same parameters
|
|
4633
|
+
* as a perspective matrix (plus focalDistance)
|
|
4634
|
+
* @param view.fovy Vertical field of view in radians
|
|
4635
|
+
* @param view.aspect Aspect ratio. Typically viewport width / viewport height
|
|
4636
|
+
* @param view.focalDistance Distance in the view frustum used for extent calculations
|
|
4637
|
+
* @param view.near Near bound of the frustum
|
|
4638
|
+
* @param view.far Far bound of the frustum
|
|
4639
|
+
* @returns self
|
|
4640
|
+
*/
|
|
4327
4641
|
orthographic(view) {
|
|
4328
4642
|
const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4329
4643
|
checkRadians(fovy);
|
|
@@ -4339,27 +4653,53 @@ var Matrix4 = class extends Matrix {
|
|
|
4339
4653
|
far
|
|
4340
4654
|
});
|
|
4341
4655
|
}
|
|
4656
|
+
/**
|
|
4657
|
+
* Generates a perspective projection matrix with the given bounds
|
|
4658
|
+
* @param view.fovy Vertical field of view in radians
|
|
4659
|
+
* @param view.aspect Aspect ratio. typically viewport width/height
|
|
4660
|
+
* @param view.near Near bound of the frustum
|
|
4661
|
+
* @param view.far Far bound of the frustum
|
|
4662
|
+
* @returns self
|
|
4663
|
+
*/
|
|
4342
4664
|
perspective(view) {
|
|
4343
4665
|
const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
|
|
4344
4666
|
checkRadians(fovy);
|
|
4345
4667
|
perspective(this, fovy, aspect, near, far);
|
|
4346
4668
|
return this.check();
|
|
4347
4669
|
}
|
|
4670
|
+
// Accessors
|
|
4348
4671
|
determinant() {
|
|
4349
4672
|
return determinant2(this);
|
|
4350
4673
|
}
|
|
4674
|
+
/**
|
|
4675
|
+
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
4676
|
+
* The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
|
|
4677
|
+
* @param result
|
|
4678
|
+
* @returns self
|
|
4679
|
+
*/
|
|
4351
4680
|
getScale(result = [-0, -0, -0]) {
|
|
4352
4681
|
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
|
|
4353
4682
|
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
|
|
4354
4683
|
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
|
|
4355
4684
|
return result;
|
|
4356
4685
|
}
|
|
4686
|
+
/**
|
|
4687
|
+
* Gets the translation portion, assuming the matrix is a affine transformation matrix.
|
|
4688
|
+
* @param result
|
|
4689
|
+
* @returns self
|
|
4690
|
+
*/
|
|
4357
4691
|
getTranslation(result = [-0, -0, -0]) {
|
|
4358
4692
|
result[0] = this[12];
|
|
4359
4693
|
result[1] = this[13];
|
|
4360
4694
|
result[2] = this[14];
|
|
4361
4695
|
return result;
|
|
4362
4696
|
}
|
|
4697
|
+
/**
|
|
4698
|
+
* Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
|
|
4699
|
+
* @param result
|
|
4700
|
+
* @param scaleResult
|
|
4701
|
+
* @returns self
|
|
4702
|
+
*/
|
|
4363
4703
|
getRotation(result, scaleResult) {
|
|
4364
4704
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4365
4705
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -4385,6 +4725,12 @@ var Matrix4 = class extends Matrix {
|
|
|
4385
4725
|
result[15] = 1;
|
|
4386
4726
|
return result;
|
|
4387
4727
|
}
|
|
4728
|
+
/**
|
|
4729
|
+
*
|
|
4730
|
+
* @param result
|
|
4731
|
+
* @param scaleResult
|
|
4732
|
+
* @returns self
|
|
4733
|
+
*/
|
|
4388
4734
|
getRotationMatrix3(result, scaleResult) {
|
|
4389
4735
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4390
4736
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -4403,6 +4749,7 @@ var Matrix4 = class extends Matrix {
|
|
|
4403
4749
|
result[8] = this[10] * inverseScale2;
|
|
4404
4750
|
return result;
|
|
4405
4751
|
}
|
|
4752
|
+
// Modifiers
|
|
4406
4753
|
transpose() {
|
|
4407
4754
|
transpose2(this, this);
|
|
4408
4755
|
return this.check();
|
|
@@ -4411,6 +4758,7 @@ var Matrix4 = class extends Matrix {
|
|
|
4411
4758
|
invert2(this, this);
|
|
4412
4759
|
return this.check();
|
|
4413
4760
|
}
|
|
4761
|
+
// Operations
|
|
4414
4762
|
multiplyLeft(a) {
|
|
4415
4763
|
multiply4(this, a, this);
|
|
4416
4764
|
return this.check();
|
|
@@ -4419,33 +4767,68 @@ var Matrix4 = class extends Matrix {
|
|
|
4419
4767
|
multiply4(this, this, a);
|
|
4420
4768
|
return this.check();
|
|
4421
4769
|
}
|
|
4770
|
+
// Rotates a matrix by the given angle around the X axis
|
|
4422
4771
|
rotateX(radians2) {
|
|
4423
4772
|
rotateX2(this, this, radians2);
|
|
4424
4773
|
return this.check();
|
|
4425
4774
|
}
|
|
4775
|
+
// Rotates a matrix by the given angle around the Y axis.
|
|
4426
4776
|
rotateY(radians2) {
|
|
4427
4777
|
rotateY2(this, this, radians2);
|
|
4428
4778
|
return this.check();
|
|
4429
4779
|
}
|
|
4780
|
+
/**
|
|
4781
|
+
* Rotates a matrix by the given angle around the Z axis.
|
|
4782
|
+
* @param radians
|
|
4783
|
+
* @returns self
|
|
4784
|
+
*/
|
|
4430
4785
|
rotateZ(radians2) {
|
|
4431
4786
|
rotateZ2(this, this, radians2);
|
|
4432
4787
|
return this.check();
|
|
4433
4788
|
}
|
|
4789
|
+
/**
|
|
4790
|
+
*
|
|
4791
|
+
* @param param0
|
|
4792
|
+
* @returns self
|
|
4793
|
+
*/
|
|
4434
4794
|
rotateXYZ(angleXYZ) {
|
|
4435
4795
|
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
4436
4796
|
}
|
|
4797
|
+
/**
|
|
4798
|
+
*
|
|
4799
|
+
* @param radians
|
|
4800
|
+
* @param axis
|
|
4801
|
+
* @returns self
|
|
4802
|
+
*/
|
|
4437
4803
|
rotateAxis(radians2, axis) {
|
|
4438
4804
|
rotate3(this, this, radians2, axis);
|
|
4439
4805
|
return this.check();
|
|
4440
4806
|
}
|
|
4807
|
+
/**
|
|
4808
|
+
*
|
|
4809
|
+
* @param factor
|
|
4810
|
+
* @returns self
|
|
4811
|
+
*/
|
|
4441
4812
|
scale(factor) {
|
|
4442
4813
|
scale4(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
4443
4814
|
return this.check();
|
|
4444
4815
|
}
|
|
4816
|
+
/**
|
|
4817
|
+
*
|
|
4818
|
+
* @param vec
|
|
4819
|
+
* @returns self
|
|
4820
|
+
*/
|
|
4445
4821
|
translate(vector) {
|
|
4446
4822
|
translate2(this, this, vector);
|
|
4447
4823
|
return this.check();
|
|
4448
4824
|
}
|
|
4825
|
+
// Transforms
|
|
4826
|
+
/**
|
|
4827
|
+
* Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
|
|
4828
|
+
* @param vector
|
|
4829
|
+
* @param result
|
|
4830
|
+
* @returns self
|
|
4831
|
+
*/
|
|
4449
4832
|
transform(vector, result) {
|
|
4450
4833
|
if (vector.length === 4) {
|
|
4451
4834
|
result = transformMat43(result || [-0, -0, -0, -0], vector, this);
|
|
@@ -4454,6 +4837,12 @@ var Matrix4 = class extends Matrix {
|
|
|
4454
4837
|
}
|
|
4455
4838
|
return this.transformAsPoint(vector, result);
|
|
4456
4839
|
}
|
|
4840
|
+
/**
|
|
4841
|
+
* Transforms any 2 or 3 element array as point (w implicitly 1)
|
|
4842
|
+
* @param vector
|
|
4843
|
+
* @param result
|
|
4844
|
+
* @returns self
|
|
4845
|
+
*/
|
|
4457
4846
|
transformAsPoint(vector, result) {
|
|
4458
4847
|
const { length: length5 } = vector;
|
|
4459
4848
|
let out;
|
|
@@ -4470,6 +4859,12 @@ var Matrix4 = class extends Matrix {
|
|
|
4470
4859
|
checkVector(out, vector.length);
|
|
4471
4860
|
return out;
|
|
4472
4861
|
}
|
|
4862
|
+
/**
|
|
4863
|
+
* Transforms any 2 or 3 element array as vector (w implicitly 0)
|
|
4864
|
+
* @param vector
|
|
4865
|
+
* @param result
|
|
4866
|
+
* @returns self
|
|
4867
|
+
*/
|
|
4473
4868
|
transformAsVector(vector, result) {
|
|
4474
4869
|
let out;
|
|
4475
4870
|
switch (vector.length) {
|
|
@@ -4485,15 +4880,19 @@ var Matrix4 = class extends Matrix {
|
|
|
4485
4880
|
checkVector(out, vector.length);
|
|
4486
4881
|
return out;
|
|
4487
4882
|
}
|
|
4883
|
+
/** @deprecated */
|
|
4488
4884
|
transformPoint(vector, result) {
|
|
4489
4885
|
return this.transformAsPoint(vector, result);
|
|
4490
4886
|
}
|
|
4887
|
+
/** @deprecated */
|
|
4491
4888
|
transformVector(vector, result) {
|
|
4492
4889
|
return this.transformAsPoint(vector, result);
|
|
4493
4890
|
}
|
|
4891
|
+
/** @deprecated */
|
|
4494
4892
|
transformDirection(vector, result) {
|
|
4495
4893
|
return this.transformAsVector(vector, result);
|
|
4496
4894
|
}
|
|
4895
|
+
// three.js math API compatibility
|
|
4497
4896
|
makeRotationX(radians2) {
|
|
4498
4897
|
return this.identity().rotateX(radians2);
|
|
4499
4898
|
}
|
|
@@ -4925,6 +5324,13 @@ var Quaternion = class extends MathArray {
|
|
|
4925
5324
|
this[3] = object.w;
|
|
4926
5325
|
return this.check();
|
|
4927
5326
|
}
|
|
5327
|
+
/**
|
|
5328
|
+
* Creates a quaternion from the given 3x3 rotation matrix.
|
|
5329
|
+
* NOTE: The resultant quaternion is not normalized, so you should
|
|
5330
|
+
* be sure to renormalize the quaternion yourself where necessary.
|
|
5331
|
+
* @param m
|
|
5332
|
+
* @returns
|
|
5333
|
+
*/
|
|
4928
5334
|
fromMatrix3(m) {
|
|
4929
5335
|
fromMat3(this, m);
|
|
4930
5336
|
return this.check();
|
|
@@ -4933,13 +5339,21 @@ var Quaternion = class extends MathArray {
|
|
|
4933
5339
|
setAxisAngle(this, axis, rad);
|
|
4934
5340
|
return this.check();
|
|
4935
5341
|
}
|
|
5342
|
+
/** Set a quat to the identity quaternion */
|
|
4936
5343
|
identity() {
|
|
4937
5344
|
identity3(this);
|
|
4938
5345
|
return this.check();
|
|
4939
5346
|
}
|
|
5347
|
+
// Set the components of a quat to the given values
|
|
5348
|
+
// set(i, j, k, l) {
|
|
5349
|
+
// quat_set(this, i, j, k, l);
|
|
5350
|
+
// return this.check();
|
|
5351
|
+
// }
|
|
5352
|
+
// Sets a quat from the given angle and rotation axis, then returns it.
|
|
4940
5353
|
setAxisAngle(axis, rad) {
|
|
4941
5354
|
return this.fromAxisRotation(axis, rad);
|
|
4942
5355
|
}
|
|
5356
|
+
// Getters/setters
|
|
4943
5357
|
get ELEMENTS() {
|
|
4944
5358
|
return 4;
|
|
4945
5359
|
}
|
|
@@ -4967,35 +5381,72 @@ var Quaternion = class extends MathArray {
|
|
|
4967
5381
|
set w(value) {
|
|
4968
5382
|
this[3] = checkNumber(value);
|
|
4969
5383
|
}
|
|
5384
|
+
// Calculates the length of a quat
|
|
4970
5385
|
len() {
|
|
4971
5386
|
return length4(this);
|
|
4972
5387
|
}
|
|
5388
|
+
// Calculates the squared length of a quat
|
|
4973
5389
|
lengthSquared() {
|
|
4974
5390
|
return squaredLength4(this);
|
|
4975
5391
|
}
|
|
5392
|
+
// Calculates the dot product of two quat's
|
|
5393
|
+
// @return {Number}
|
|
4976
5394
|
dot(a) {
|
|
4977
5395
|
return dot4(this, a);
|
|
4978
5396
|
}
|
|
5397
|
+
// Gets the rotation axis and angle for a given quaternion.
|
|
5398
|
+
// If a quaternion is created with setAxisAngle, this method will
|
|
5399
|
+
// return the same values as providied in the original parameter
|
|
5400
|
+
// list OR functionally equivalent values.
|
|
5401
|
+
// Example: The quaternion formed by axis [0, 0, 1] and angle -90
|
|
5402
|
+
// is the same as the quaternion formed by [0, 0, 1] and 270.
|
|
5403
|
+
// This method favors the latter.
|
|
5404
|
+
// @return {{[x,y,z], Number}}
|
|
5405
|
+
// getAxisAngle() {
|
|
5406
|
+
// const axis = [];
|
|
5407
|
+
// // const angle = quat_getAxisAngle(axis, this);
|
|
5408
|
+
// return {axis, angle};
|
|
5409
|
+
// }
|
|
5410
|
+
// MODIFIERS
|
|
5411
|
+
// Sets a quaternion to represent the shortest rotation from one vector
|
|
5412
|
+
// to another. Both vectors are assumed to be unit length.
|
|
4979
5413
|
rotationTo(vectorA, vectorB) {
|
|
4980
5414
|
rotationTo(this, vectorA, vectorB);
|
|
4981
5415
|
return this.check();
|
|
4982
5416
|
}
|
|
5417
|
+
// Sets the specified quaternion with values corresponding to the given axes.
|
|
5418
|
+
// Each axis is a vec3 and is expected to be unit length and perpendicular
|
|
5419
|
+
// to all other specified axes.
|
|
5420
|
+
// setAxes() {
|
|
5421
|
+
// Number
|
|
5422
|
+
// }
|
|
5423
|
+
// Performs a spherical linear interpolation with two control points
|
|
5424
|
+
// sqlerp() {
|
|
5425
|
+
// Number;
|
|
5426
|
+
// }
|
|
5427
|
+
// Adds two quat's
|
|
4983
5428
|
add(a) {
|
|
4984
5429
|
add6(this, this, a);
|
|
4985
5430
|
return this.check();
|
|
4986
5431
|
}
|
|
5432
|
+
// Calculates the W component of a quat from the X, Y, and Z components.
|
|
5433
|
+
// Any existing W component will be ignored.
|
|
4987
5434
|
calculateW() {
|
|
4988
5435
|
calculateW(this, this);
|
|
4989
5436
|
return this.check();
|
|
4990
5437
|
}
|
|
5438
|
+
// Calculates the conjugate of a quat If the quaternion is normalized,
|
|
5439
|
+
// this function is faster than quat_invert and produces the same result.
|
|
4991
5440
|
conjugate() {
|
|
4992
5441
|
conjugate(this, this);
|
|
4993
5442
|
return this.check();
|
|
4994
5443
|
}
|
|
5444
|
+
// Calculates the inverse of a quat
|
|
4995
5445
|
invert() {
|
|
4996
5446
|
invert3(this, this);
|
|
4997
5447
|
return this.check();
|
|
4998
5448
|
}
|
|
5449
|
+
// Performs a linear interpolation between two quat's
|
|
4999
5450
|
lerp(a, b, t) {
|
|
5000
5451
|
if (t === void 0) {
|
|
5001
5452
|
return this.lerp(this, a, b);
|
|
@@ -5003,6 +5454,7 @@ var Quaternion = class extends MathArray {
|
|
|
5003
5454
|
lerp5(this, a, b, t);
|
|
5004
5455
|
return this.check();
|
|
5005
5456
|
}
|
|
5457
|
+
// Multiplies two quat's
|
|
5006
5458
|
multiplyRight(a) {
|
|
5007
5459
|
multiply6(this, this, a);
|
|
5008
5460
|
return this.check();
|
|
@@ -5011,6 +5463,7 @@ var Quaternion = class extends MathArray {
|
|
|
5011
5463
|
multiply6(this, a, this);
|
|
5012
5464
|
return this.check();
|
|
5013
5465
|
}
|
|
5466
|
+
// Normalize a quat
|
|
5014
5467
|
normalize() {
|
|
5015
5468
|
const length5 = this.len();
|
|
5016
5469
|
const l = length5 > 0 ? 1 / length5 : 0;
|
|
@@ -5023,22 +5476,27 @@ var Quaternion = class extends MathArray {
|
|
|
5023
5476
|
}
|
|
5024
5477
|
return this.check();
|
|
5025
5478
|
}
|
|
5479
|
+
// Rotates a quaternion by the given angle about the X axis
|
|
5026
5480
|
rotateX(rad) {
|
|
5027
5481
|
rotateX3(this, this, rad);
|
|
5028
5482
|
return this.check();
|
|
5029
5483
|
}
|
|
5484
|
+
// Rotates a quaternion by the given angle about the Y axis
|
|
5030
5485
|
rotateY(rad) {
|
|
5031
5486
|
rotateY3(this, this, rad);
|
|
5032
5487
|
return this.check();
|
|
5033
5488
|
}
|
|
5489
|
+
// Rotates a quaternion by the given angle about the Z axis
|
|
5034
5490
|
rotateZ(rad) {
|
|
5035
5491
|
rotateZ3(this, this, rad);
|
|
5036
5492
|
return this.check();
|
|
5037
5493
|
}
|
|
5494
|
+
// Scales a quat by a scalar number
|
|
5038
5495
|
scale(b) {
|
|
5039
5496
|
scale6(this, this, b);
|
|
5040
5497
|
return this.check();
|
|
5041
5498
|
}
|
|
5499
|
+
// Performs a spherical linear interpolation between two quat
|
|
5042
5500
|
slerp(arg0, arg1, arg2) {
|
|
5043
5501
|
let start;
|
|
5044
5502
|
let target;
|
|
@@ -5068,6 +5526,7 @@ var Quaternion = class extends MathArray {
|
|
|
5068
5526
|
transformQuat2(result, vector, this);
|
|
5069
5527
|
return checkVector(result, 4);
|
|
5070
5528
|
}
|
|
5529
|
+
// THREE.js Math API compatibility
|
|
5071
5530
|
lengthSq() {
|
|
5072
5531
|
return this.lengthSquared();
|
|
5073
5532
|
}
|
|
@@ -5083,9 +5542,30 @@ var Quaternion = class extends MathArray {
|
|
|
5083
5542
|
};
|
|
5084
5543
|
|
|
5085
5544
|
// dist/classes/spherical-coordinates.js
|
|
5086
|
-
var
|
|
5545
|
+
var EPSILON21 = 1e-6;
|
|
5087
5546
|
var EARTH_RADIUS_METERS = 6371e3;
|
|
5088
5547
|
var SphericalCoordinates = class {
|
|
5548
|
+
// bearing: number;
|
|
5549
|
+
// pitch: number;
|
|
5550
|
+
// altitude: number;
|
|
5551
|
+
// lnglatZ coordinates
|
|
5552
|
+
// longitude: number;
|
|
5553
|
+
// latitude: number;
|
|
5554
|
+
// lng: number;
|
|
5555
|
+
// lat: number;
|
|
5556
|
+
// z: number;
|
|
5557
|
+
/**
|
|
5558
|
+
* Creates a new SphericalCoordinates object
|
|
5559
|
+
* @param options
|
|
5560
|
+
* @param [options.phi] =0 - rotation around X (latitude)
|
|
5561
|
+
* @param [options.theta] =0 - rotation around Y (longitude)
|
|
5562
|
+
* @param [options.radius] =1 - Distance from center
|
|
5563
|
+
* @param [options.bearing]
|
|
5564
|
+
* @param [options.pitch]
|
|
5565
|
+
* @param [options.altitude]
|
|
5566
|
+
* @param [options.radiusScale] =1
|
|
5567
|
+
*/
|
|
5568
|
+
// eslint-disable-next-line complexity
|
|
5089
5569
|
constructor({ phi = 0, theta = 0, radius = 1, bearing, pitch, altitude, radiusScale = EARTH_RADIUS_METERS } = {}) {
|
|
5090
5570
|
this.phi = phi;
|
|
5091
5571
|
this.theta = theta;
|
|
@@ -5112,6 +5592,8 @@ var SphericalCoordinates = class {
|
|
|
5112
5592
|
exactEquals(other) {
|
|
5113
5593
|
return this.radius === other.radius && this.theta === other.theta && this.phi === other.phi;
|
|
5114
5594
|
}
|
|
5595
|
+
/* eslint-disable brace-style */
|
|
5596
|
+
// Cartographic (bearing 0 north, pitch 0 look from above)
|
|
5115
5597
|
get bearing() {
|
|
5116
5598
|
return 180 - degrees(this.phi);
|
|
5117
5599
|
}
|
|
@@ -5124,6 +5606,10 @@ var SphericalCoordinates = class {
|
|
|
5124
5606
|
set pitch(v) {
|
|
5125
5607
|
this.theta = radians(v);
|
|
5126
5608
|
}
|
|
5609
|
+
// get pitch() { return 90 - degrees(this.phi); }
|
|
5610
|
+
// set pitch(v) { this.phi = radians(v) + Math.PI / 2; }
|
|
5611
|
+
// get altitude() { return this.radius - 1; } // relative altitude
|
|
5612
|
+
// lnglatZ coordinates
|
|
5127
5613
|
get longitude() {
|
|
5128
5614
|
return degrees(this.phi);
|
|
5129
5615
|
}
|
|
@@ -5139,6 +5625,7 @@ var SphericalCoordinates = class {
|
|
|
5139
5625
|
get z() {
|
|
5140
5626
|
return (this.radius - 1) * this.radiusScale;
|
|
5141
5627
|
}
|
|
5628
|
+
/* eslint-enable brace-style */
|
|
5142
5629
|
set(radius, phi, theta) {
|
|
5143
5630
|
this.radius = radius;
|
|
5144
5631
|
this.phi = phi;
|
|
@@ -5171,8 +5658,9 @@ var SphericalCoordinates = class {
|
|
|
5171
5658
|
toVector3() {
|
|
5172
5659
|
return new Vector3(0, 0, this.radius).rotateX({ radians: this.theta }).rotateZ({ radians: this.phi });
|
|
5173
5660
|
}
|
|
5661
|
+
// restrict phi to be betwee EPS and PI-EPS
|
|
5174
5662
|
makeSafe() {
|
|
5175
|
-
this.phi = Math.max(
|
|
5663
|
+
this.phi = Math.max(EPSILON21, Math.min(Math.PI - EPSILON21, this.phi));
|
|
5176
5664
|
return this;
|
|
5177
5665
|
}
|
|
5178
5666
|
check() {
|
|
@@ -5196,6 +5684,7 @@ var RotationOrder;
|
|
|
5196
5684
|
RotationOrder2[RotationOrder2["XYZ"] = 5] = "XYZ";
|
|
5197
5685
|
})(RotationOrder || (RotationOrder = {}));
|
|
5198
5686
|
var Euler = class extends MathArray {
|
|
5687
|
+
// Constants
|
|
5199
5688
|
static get ZYX() {
|
|
5200
5689
|
return RotationOrder.ZYX;
|
|
5201
5690
|
}
|
|
@@ -5229,6 +5718,13 @@ var Euler = class extends MathArray {
|
|
|
5229
5718
|
get ELEMENTS() {
|
|
5230
5719
|
return 4;
|
|
5231
5720
|
}
|
|
5721
|
+
/**
|
|
5722
|
+
* @class
|
|
5723
|
+
* @param {Number | Number[]} x
|
|
5724
|
+
* @param {Number=} [y]
|
|
5725
|
+
* @param {Number=} [z]
|
|
5726
|
+
* @param {Number=} [order]
|
|
5727
|
+
*/
|
|
5232
5728
|
constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
|
|
5233
5729
|
super(-0, -0, -0, -0);
|
|
5234
5730
|
if (arguments.length > 0 && Array.isArray(arguments[0])) {
|
|
@@ -5252,9 +5748,15 @@ var Euler = class extends MathArray {
|
|
|
5252
5748
|
const yaw = Math.atan2(t1, t0);
|
|
5253
5749
|
return this.set(roll, pitch, yaw, Euler.RollPitchYaw);
|
|
5254
5750
|
}
|
|
5751
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5255
5752
|
fromObject(object) {
|
|
5256
5753
|
throw new Error("not implemented");
|
|
5257
5754
|
}
|
|
5755
|
+
// fromQuaternion(q, order) {
|
|
5756
|
+
// this._fromRotationMat[-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
5757
|
+
// return this.check();
|
|
5758
|
+
// }
|
|
5759
|
+
// If copied array does contain fourth element, preserves currently set order
|
|
5258
5760
|
copy(array) {
|
|
5259
5761
|
this[0] = array[0];
|
|
5260
5762
|
this[1] = array[1];
|
|
@@ -5262,6 +5764,8 @@ var Euler = class extends MathArray {
|
|
|
5262
5764
|
this[3] = Number.isFinite(array[3]) || this.order;
|
|
5263
5765
|
return this.check();
|
|
5264
5766
|
}
|
|
5767
|
+
// Sets the three angles, and optionally sets the rotation order
|
|
5768
|
+
// If order is not specified, preserves currently set order
|
|
5265
5769
|
set(x = 0, y = 0, z = 0, order) {
|
|
5266
5770
|
this[0] = x;
|
|
5267
5771
|
this[1] = y;
|
|
@@ -5272,12 +5776,14 @@ var Euler = class extends MathArray {
|
|
|
5272
5776
|
validate() {
|
|
5273
5777
|
return validateOrder(this[3]) && Number.isFinite(this[0]) && Number.isFinite(this[1]) && Number.isFinite(this[2]);
|
|
5274
5778
|
}
|
|
5779
|
+
// Does not copy the orientation element
|
|
5275
5780
|
toArray(array = [], offset = 0) {
|
|
5276
5781
|
array[offset] = this[0];
|
|
5277
5782
|
array[offset + 1] = this[1];
|
|
5278
5783
|
array[offset + 2] = this[2];
|
|
5279
5784
|
return array;
|
|
5280
5785
|
}
|
|
5786
|
+
// Copies the orientation element
|
|
5281
5787
|
toArray4(array = [], offset = 0) {
|
|
5282
5788
|
array[offset] = this[0];
|
|
5283
5789
|
array[offset + 1] = this[1];
|
|
@@ -5291,6 +5797,8 @@ var Euler = class extends MathArray {
|
|
|
5291
5797
|
result[2] = this[2];
|
|
5292
5798
|
return result;
|
|
5293
5799
|
}
|
|
5800
|
+
/* eslint-disable no-multi-spaces, brace-style, no-return-assign */
|
|
5801
|
+
// x, y, z angle notation (note: only corresponds to axis in XYZ orientation)
|
|
5294
5802
|
get x() {
|
|
5295
5803
|
return this[0];
|
|
5296
5804
|
}
|
|
@@ -5309,6 +5817,7 @@ var Euler = class extends MathArray {
|
|
|
5309
5817
|
set z(value) {
|
|
5310
5818
|
this[2] = checkNumber(value);
|
|
5311
5819
|
}
|
|
5820
|
+
// alpha, beta, gamma angle notation
|
|
5312
5821
|
get alpha() {
|
|
5313
5822
|
return this[0];
|
|
5314
5823
|
}
|
|
@@ -5327,6 +5836,7 @@ var Euler = class extends MathArray {
|
|
|
5327
5836
|
set gamma(value) {
|
|
5328
5837
|
this[2] = checkNumber(value);
|
|
5329
5838
|
}
|
|
5839
|
+
// phi, theta, psi angle notation
|
|
5330
5840
|
get phi() {
|
|
5331
5841
|
return this[0];
|
|
5332
5842
|
}
|
|
@@ -5345,6 +5855,7 @@ var Euler = class extends MathArray {
|
|
|
5345
5855
|
set psi(value) {
|
|
5346
5856
|
this[2] = checkNumber(value);
|
|
5347
5857
|
}
|
|
5858
|
+
// roll, pitch, yaw angle notation
|
|
5348
5859
|
get roll() {
|
|
5349
5860
|
return this[0];
|
|
5350
5861
|
}
|
|
@@ -5363,15 +5874,18 @@ var Euler = class extends MathArray {
|
|
|
5363
5874
|
set yaw(value) {
|
|
5364
5875
|
this[2] = checkNumber(value);
|
|
5365
5876
|
}
|
|
5877
|
+
// rotation order, in all three angle notations
|
|
5366
5878
|
get order() {
|
|
5367
5879
|
return this[3];
|
|
5368
5880
|
}
|
|
5369
5881
|
set order(value) {
|
|
5370
5882
|
this[3] = checkOrder(value);
|
|
5371
5883
|
}
|
|
5884
|
+
// Constructors
|
|
5372
5885
|
fromVector3(v, order) {
|
|
5373
5886
|
return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
|
|
5374
5887
|
}
|
|
5888
|
+
// TODO - with and without 4th element
|
|
5375
5889
|
fromArray(array, offset = 0) {
|
|
5376
5890
|
this[0] = array[0 + offset];
|
|
5377
5891
|
this[1] = array[1 + offset];
|
|
@@ -5381,6 +5895,7 @@ var Euler = class extends MathArray {
|
|
|
5381
5895
|
}
|
|
5382
5896
|
return this.check();
|
|
5383
5897
|
}
|
|
5898
|
+
// Common ZYX rotation order
|
|
5384
5899
|
fromRollPitchYaw(roll, pitch, yaw) {
|
|
5385
5900
|
return this.set(roll, pitch, yaw, RotationOrder.ZYX);
|
|
5386
5901
|
}
|
|
@@ -5388,9 +5903,11 @@ var Euler = class extends MathArray {
|
|
|
5388
5903
|
this._fromRotationMatrix(m, order);
|
|
5389
5904
|
return this.check();
|
|
5390
5905
|
}
|
|
5906
|
+
// ACCESSORS
|
|
5391
5907
|
getRotationMatrix(m) {
|
|
5392
5908
|
return this._getRotationMatrix(m);
|
|
5393
5909
|
}
|
|
5910
|
+
// TODO - move to Quaternion
|
|
5394
5911
|
getQuaternion() {
|
|
5395
5912
|
const q = new Quaternion();
|
|
5396
5913
|
switch (this[3]) {
|
|
@@ -5410,6 +5927,14 @@ var Euler = class extends MathArray {
|
|
|
5410
5927
|
throw new Error(ERR_UNKNOWN_ORDER);
|
|
5411
5928
|
}
|
|
5412
5929
|
}
|
|
5930
|
+
// INTERNAL METHODS
|
|
5931
|
+
// Conversion from Euler to rotation matrix and from matrix to Euler
|
|
5932
|
+
// Adapted from three.js under MIT license
|
|
5933
|
+
// // WARNING: this discards revolution information -bhouston
|
|
5934
|
+
// reorder(newOrder) {
|
|
5935
|
+
// const q = new Quaternion().setFromEuler(this);
|
|
5936
|
+
// return this.setFromQuaternion(q, newOrder);
|
|
5937
|
+
/* eslint-disable complexity, max-statements, one-var */
|
|
5413
5938
|
_fromRotationMatrix(m, order = Euler.DefaultOrder) {
|
|
5414
5939
|
const m11 = m[0], m12 = m[4], m13 = m[8];
|
|
5415
5940
|
const m21 = m[1], m22 = m[5], m23 = m[9];
|
|
@@ -5683,17 +6208,29 @@ var Pose = class {
|
|
|
5683
6208
|
const cw = Math.cos(this.yaw);
|
|
5684
6209
|
return new Matrix4().setRowMajor(
|
|
5685
6210
|
cw * cp,
|
|
6211
|
+
// 0,0
|
|
5686
6212
|
-sw * cr + cw * sp * sr,
|
|
6213
|
+
// 0,1
|
|
5687
6214
|
sw * sr + cw * sp * cr,
|
|
6215
|
+
// 0,2
|
|
5688
6216
|
this.x,
|
|
6217
|
+
// 0,3
|
|
5689
6218
|
sw * cp,
|
|
6219
|
+
// 1,0
|
|
5690
6220
|
cw * cr + sw * sp * sr,
|
|
6221
|
+
// 1,1
|
|
5691
6222
|
-cw * sr + sw * sp * cr,
|
|
6223
|
+
// 1,2
|
|
5692
6224
|
this.y,
|
|
6225
|
+
// 1,3
|
|
5693
6226
|
-sp,
|
|
6227
|
+
// 2,0
|
|
5694
6228
|
cp * sr,
|
|
6229
|
+
// 2,1
|
|
5695
6230
|
cp * cr,
|
|
6231
|
+
// 2,2
|
|
5696
6232
|
this.z,
|
|
6233
|
+
// 2,3
|
|
5697
6234
|
0,
|
|
5698
6235
|
0,
|
|
5699
6236
|
0,
|
|
@@ -5707,57 +6244,4 @@ var Pose = class {
|
|
|
5707
6244
|
return new Matrix4().multiplyRight(pose.getTransformationMatrix()).multiplyRight(this.getTransformationMatrix().invert());
|
|
5708
6245
|
}
|
|
5709
6246
|
};
|
|
5710
|
-
|
|
5711
|
-
// dist/lib/math-utils.js
|
|
5712
|
-
var math_utils_exports = {};
|
|
5713
|
-
__export(math_utils_exports, {
|
|
5714
|
-
EPSILON1: () => EPSILON1,
|
|
5715
|
-
EPSILON10: () => EPSILON10,
|
|
5716
|
-
EPSILON11: () => EPSILON11,
|
|
5717
|
-
EPSILON12: () => EPSILON12,
|
|
5718
|
-
EPSILON13: () => EPSILON13,
|
|
5719
|
-
EPSILON14: () => EPSILON14,
|
|
5720
|
-
EPSILON15: () => EPSILON15,
|
|
5721
|
-
EPSILON16: () => EPSILON16,
|
|
5722
|
-
EPSILON17: () => EPSILON17,
|
|
5723
|
-
EPSILON18: () => EPSILON18,
|
|
5724
|
-
EPSILON19: () => EPSILON19,
|
|
5725
|
-
EPSILON2: () => EPSILON22,
|
|
5726
|
-
EPSILON20: () => EPSILON20,
|
|
5727
|
-
EPSILON3: () => EPSILON3,
|
|
5728
|
-
EPSILON4: () => EPSILON4,
|
|
5729
|
-
EPSILON5: () => EPSILON5,
|
|
5730
|
-
EPSILON6: () => EPSILON6,
|
|
5731
|
-
EPSILON7: () => EPSILON7,
|
|
5732
|
-
EPSILON8: () => EPSILON8,
|
|
5733
|
-
EPSILON9: () => EPSILON9,
|
|
5734
|
-
PI_OVER_FOUR: () => PI_OVER_FOUR,
|
|
5735
|
-
PI_OVER_SIX: () => PI_OVER_SIX,
|
|
5736
|
-
PI_OVER_TWO: () => PI_OVER_TWO,
|
|
5737
|
-
TWO_PI: () => TWO_PI
|
|
5738
|
-
});
|
|
5739
|
-
var EPSILON1 = 0.1;
|
|
5740
|
-
var EPSILON22 = 0.01;
|
|
5741
|
-
var EPSILON3 = 1e-3;
|
|
5742
|
-
var EPSILON4 = 1e-4;
|
|
5743
|
-
var EPSILON5 = 1e-5;
|
|
5744
|
-
var EPSILON6 = 1e-6;
|
|
5745
|
-
var EPSILON7 = 1e-7;
|
|
5746
|
-
var EPSILON8 = 1e-8;
|
|
5747
|
-
var EPSILON9 = 1e-9;
|
|
5748
|
-
var EPSILON10 = 1e-10;
|
|
5749
|
-
var EPSILON11 = 1e-11;
|
|
5750
|
-
var EPSILON12 = 1e-12;
|
|
5751
|
-
var EPSILON13 = 1e-13;
|
|
5752
|
-
var EPSILON14 = 1e-14;
|
|
5753
|
-
var EPSILON15 = 1e-15;
|
|
5754
|
-
var EPSILON16 = 1e-16;
|
|
5755
|
-
var EPSILON17 = 1e-17;
|
|
5756
|
-
var EPSILON18 = 1e-18;
|
|
5757
|
-
var EPSILON19 = 1e-19;
|
|
5758
|
-
var EPSILON20 = 1e-20;
|
|
5759
|
-
var PI_OVER_TWO = Math.PI / 2;
|
|
5760
|
-
var PI_OVER_FOUR = Math.PI / 4;
|
|
5761
|
-
var PI_OVER_SIX = Math.PI / 6;
|
|
5762
|
-
var TWO_PI = Math.PI * 2;
|
|
5763
6247
|
//# sourceMappingURL=index.cjs.map
|