@math.gl/core 4.2.0-alpha.3 → 4.2.0-alpha.6

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.
Files changed (59) hide show
  1. package/LICENSE +51 -0
  2. package/dist/classes/euler.d.ts +37 -25
  3. package/dist/classes/euler.d.ts.map +1 -1
  4. package/dist/classes/euler.js +104 -59
  5. package/dist/classes/euler.js.map +1 -1
  6. package/dist/classes/matrix3.d.ts +0 -17
  7. package/dist/classes/matrix3.d.ts.map +1 -1
  8. package/dist/classes/matrix3.js +0 -43
  9. package/dist/classes/matrix3.js.map +1 -1
  10. package/dist/classes/pose.d.ts.map +1 -1
  11. package/dist/classes/pose.js +2 -3
  12. package/dist/classes/pose.js.map +1 -1
  13. package/dist/gl-matrix/common.d.ts.map +1 -1
  14. package/dist/gl-matrix/mat3.d.ts +3 -3
  15. package/dist/gl-matrix/mat3.d.ts.map +1 -1
  16. package/dist/gl-matrix/mat3.js +1 -1
  17. package/dist/gl-matrix/mat3.js.map +1 -1
  18. package/dist/gl-matrix/mat4.d.ts +3 -3
  19. package/dist/gl-matrix/mat4.d.ts.map +1 -1
  20. package/dist/gl-matrix/mat4.js +1 -1
  21. package/dist/gl-matrix/mat4.js.map +1 -1
  22. package/dist/gl-matrix/quat.d.ts +1 -1
  23. package/dist/gl-matrix/quat.d.ts.map +1 -1
  24. package/dist/gl-matrix/quat.js +1 -1
  25. package/dist/gl-matrix/quat.js.map +1 -1
  26. package/dist/gl-matrix/vec2.js +1 -1
  27. package/dist/gl-matrix/vec2.js.map +1 -1
  28. package/dist/gl-matrix/vec3.d.ts +3 -3
  29. package/dist/gl-matrix/vec3.d.ts.map +1 -1
  30. package/dist/gl-matrix/vec3.js +1 -1
  31. package/dist/gl-matrix/vec3.js.map +1 -1
  32. package/dist/gl-matrix/vec4.d.ts +3 -3
  33. package/dist/gl-matrix/vec4.d.ts.map +1 -1
  34. package/dist/gl-matrix/vec4.js +1 -1
  35. package/dist/gl-matrix/vec4.js.map +1 -1
  36. package/dist/index.cjs +194 -186
  37. package/dist/index.cjs.map +3 -4
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +3 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/lib/common.js +9 -9
  43. package/dist/lib/common.js.map +1 -1
  44. package/dist/lib/validators.js +1 -1
  45. package/dist/lib/validators.js.map +1 -1
  46. package/package.json +3 -3
  47. package/src/classes/euler.ts +116 -65
  48. package/src/classes/matrix3.ts +0 -49
  49. package/src/classes/pose.ts +2 -3
  50. package/src/gl-matrix/mat3.ts +1 -1
  51. package/src/gl-matrix/mat4.ts +1 -1
  52. package/src/gl-matrix/quat.ts +1 -1
  53. package/src/gl-matrix/vec2.ts +1 -1
  54. package/src/gl-matrix/vec3.ts +1 -1
  55. package/src/gl-matrix/vec4.ts +1 -1
  56. package/src/index.ts +4 -0
  57. package/src/lib/common.ts +9 -9
  58. package/src/lib/gl-matrix.d.ts +10 -0
  59. package/src/lib/validators.ts +1 -1
package/dist/index.cjs CHANGED
@@ -17,8 +17,8 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
19
  // dist/index.js
20
- var dist_exports = {};
21
- __export(dist_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
22
  Euler: () => Euler,
23
23
  Matrix3: () => Matrix3,
24
24
  Matrix4: () => Matrix4,
@@ -29,9 +29,12 @@ __export(dist_exports, {
29
29
  Vector3: () => Vector3,
30
30
  Vector4: () => Vector4,
31
31
  _Euler: () => Euler,
32
+ _MathArray: () => MathArray,
32
33
  _MathUtils: () => math_utils_exports,
34
+ _Matrix: () => Matrix,
33
35
  _Pose: () => Pose,
34
36
  _SphericalCoordinates: () => SphericalCoordinates,
37
+ _Vector: () => Vector,
35
38
  acos: () => acos,
36
39
  asin: () => asin,
37
40
  assert: () => assert,
@@ -62,7 +65,7 @@ __export(dist_exports, {
62
65
  vec4: () => vec4_exports,
63
66
  withEpsilon: () => withEpsilon
64
67
  });
65
- module.exports = __toCommonJS(dist_exports);
68
+ module.exports = __toCommonJS(index_exports);
66
69
 
67
70
  // dist/lib/math-utils.js
68
71
  var math_utils_exports = {};
@@ -549,6 +552,64 @@ function checkVector(v, length5, callerName = "") {
549
552
  return v;
550
553
  }
551
554
 
555
+ // dist/classes/base/matrix.js
556
+ var Matrix = class extends MathArray {
557
+ // fromObject(object) {
558
+ // const array = object.elements;
559
+ // return this.fromRowMajor(array);
560
+ // }
561
+ // toObject(object) {
562
+ // const array = object.elements;
563
+ // this.toRowMajor(array);
564
+ // return object;
565
+ // }
566
+ // TODO better override formatString?
567
+ toString() {
568
+ let string = "[";
569
+ if (config.printRowMajor) {
570
+ string += "row-major:";
571
+ for (let row = 0; row < this.RANK; ++row) {
572
+ for (let col = 0; col < this.RANK; ++col) {
573
+ string += ` ${this[col * this.RANK + row]}`;
574
+ }
575
+ }
576
+ } else {
577
+ string += "column-major:";
578
+ for (let i = 0; i < this.ELEMENTS; ++i) {
579
+ string += ` ${this[i]}`;
580
+ }
581
+ }
582
+ string += "]";
583
+ return string;
584
+ }
585
+ getElementIndex(row, col) {
586
+ return col * this.RANK + row;
587
+ }
588
+ // By default assumes row major indices
589
+ getElement(row, col) {
590
+ return this[col * this.RANK + row];
591
+ }
592
+ // By default assumes row major indices
593
+ setElement(row, col, value) {
594
+ this[col * this.RANK + row] = checkNumber(value);
595
+ return this;
596
+ }
597
+ getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
598
+ const firstIndex = columnIndex * this.RANK;
599
+ for (let i = 0; i < this.RANK; ++i) {
600
+ result[i] = this[firstIndex + i];
601
+ }
602
+ return result;
603
+ }
604
+ setColumn(columnIndex, columnVector) {
605
+ const firstIndex = columnIndex * this.RANK;
606
+ for (let i = 0; i < this.RANK; ++i) {
607
+ this[firstIndex + i] = columnVector[i];
608
+ }
609
+ return this;
610
+ }
611
+ };
612
+
552
613
  // dist/lib/assert.js
553
614
  function assert(condition, message) {
554
615
  if (!condition) {
@@ -743,7 +804,7 @@ var degree = Math.PI / 180;
743
804
  // dist/gl-matrix/vec2.js
744
805
  function create() {
745
806
  const out = new ARRAY_TYPE(2);
746
- if (ARRAY_TYPE != Float32Array) {
807
+ if (ARRAY_TYPE !== Float32Array) {
747
808
  out[0] = 0;
748
809
  out[1] = 0;
749
810
  }
@@ -961,7 +1022,7 @@ var div = divide;
961
1022
  var dist = distance;
962
1023
  var sqrDist = squaredDistance;
963
1024
  var sqrLen = squaredLength;
964
- var forEach = function() {
1025
+ var forEach = (function() {
965
1026
  const vec = create();
966
1027
  return function(a, stride, offset, count, fn, arg) {
967
1028
  let i;
@@ -986,7 +1047,7 @@ var forEach = function() {
986
1047
  }
987
1048
  return a;
988
1049
  };
989
- }();
1050
+ })();
990
1051
 
991
1052
  // dist/lib/gl-matrix-extras.js
992
1053
  function vec2_transformMat4AsVector(out, a, m) {
@@ -1189,7 +1250,7 @@ __export(vec3_exports, {
1189
1250
  });
1190
1251
  function create2() {
1191
1252
  const out = new ARRAY_TYPE(3);
1192
- if (ARRAY_TYPE != Float32Array) {
1253
+ if (ARRAY_TYPE !== Float32Array) {
1193
1254
  out[0] = 0;
1194
1255
  out[1] = 0;
1195
1256
  out[2] = 0;
@@ -1532,7 +1593,7 @@ var dist2 = distance2;
1532
1593
  var sqrDist2 = squaredDistance2;
1533
1594
  var len2 = length2;
1534
1595
  var sqrLen2 = squaredLength2;
1535
- var forEach2 = function() {
1596
+ var forEach2 = (function() {
1536
1597
  const vec = create2();
1537
1598
  return function(a, stride, offset, count, fn, arg) {
1538
1599
  let i;
@@ -1559,15 +1620,15 @@ var forEach2 = function() {
1559
1620
  }
1560
1621
  return a;
1561
1622
  };
1562
- }();
1623
+ })();
1563
1624
 
1564
1625
  // dist/classes/vector3.js
1565
1626
  var ORIGIN = [0, 0, 0];
1566
1627
  var ZERO;
1567
- var Vector3 = class extends Vector {
1628
+ var Vector3 = class _Vector3 extends Vector {
1568
1629
  static get ZERO() {
1569
1630
  if (!ZERO) {
1570
- ZERO = new Vector3(0, 0, 0);
1631
+ ZERO = new _Vector3(0, 0, 0);
1571
1632
  Object.freeze(ZERO);
1572
1633
  }
1573
1634
  return ZERO;
@@ -1684,10 +1745,10 @@ var Vector3 = class extends Vector {
1684
1745
 
1685
1746
  // dist/classes/vector4.js
1686
1747
  var ZERO2;
1687
- var Vector4 = class extends Vector {
1748
+ var Vector4 = class _Vector4 extends Vector {
1688
1749
  static get ZERO() {
1689
1750
  if (!ZERO2) {
1690
- ZERO2 = new Vector4(0, 0, 0, 0);
1751
+ ZERO2 = new _Vector4(0, 0, 0, 0);
1691
1752
  Object.freeze(ZERO2);
1692
1753
  }
1693
1754
  return ZERO2;
@@ -1783,64 +1844,6 @@ var Vector4 = class extends Vector {
1783
1844
  }
1784
1845
  };
1785
1846
 
1786
- // dist/classes/base/matrix.js
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?
1798
- toString() {
1799
- let string = "[";
1800
- if (config.printRowMajor) {
1801
- string += "row-major:";
1802
- for (let row = 0; row < this.RANK; ++row) {
1803
- for (let col = 0; col < this.RANK; ++col) {
1804
- string += ` ${this[col * this.RANK + row]}`;
1805
- }
1806
- }
1807
- } else {
1808
- string += "column-major:";
1809
- for (let i = 0; i < this.ELEMENTS; ++i) {
1810
- string += ` ${this[i]}`;
1811
- }
1812
- }
1813
- string += "]";
1814
- return string;
1815
- }
1816
- getElementIndex(row, col) {
1817
- return col * this.RANK + row;
1818
- }
1819
- // By default assumes row major indices
1820
- getElement(row, col) {
1821
- return this[col * this.RANK + row];
1822
- }
1823
- // By default assumes row major indices
1824
- setElement(row, col, value) {
1825
- this[col * this.RANK + row] = checkNumber(value);
1826
- return this;
1827
- }
1828
- getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
1829
- const firstIndex = columnIndex * this.RANK;
1830
- for (let i = 0; i < this.RANK; ++i) {
1831
- result[i] = this[firstIndex + i];
1832
- }
1833
- return result;
1834
- }
1835
- setColumn(columnIndex, columnVector) {
1836
- const firstIndex = columnIndex * this.RANK;
1837
- for (let i = 0; i < this.RANK; ++i) {
1838
- this[firstIndex + i] = columnVector[i];
1839
- }
1840
- return this;
1841
- }
1842
- };
1843
-
1844
1847
  // dist/gl-matrix/mat3.js
1845
1848
  var mat3_exports = {};
1846
1849
  __export(mat3_exports, {
@@ -1879,7 +1882,7 @@ __export(mat3_exports, {
1879
1882
  });
1880
1883
  function create3() {
1881
1884
  const out = new ARRAY_TYPE(9);
1882
- if (ARRAY_TYPE != Float32Array) {
1885
+ if (ARRAY_TYPE !== Float32Array) {
1883
1886
  out[1] = 0;
1884
1887
  out[2] = 0;
1885
1888
  out[3] = 0;
@@ -2485,48 +2488,6 @@ var Matrix3 = class extends Matrix {
2485
2488
  multiply3(this, this, a);
2486
2489
  return this.check();
2487
2490
  }
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
- }
2530
2491
  rotate(radians2) {
2531
2492
  rotate2(this, this, radians2);
2532
2493
  return this.check();
@@ -2650,7 +2611,7 @@ __export(mat4_exports, {
2650
2611
  });
2651
2612
  function create4() {
2652
2613
  const out = new ARRAY_TYPE(16);
2653
- if (ARRAY_TYPE != Float32Array) {
2614
+ if (ARRAY_TYPE !== Float32Array) {
2654
2615
  out[1] = 0;
2655
2616
  out[2] = 0;
2656
2617
  out[3] = 0;
@@ -4110,7 +4071,7 @@ __export(vec4_exports, {
4110
4071
  });
4111
4072
  function create5() {
4112
4073
  const out = new ARRAY_TYPE(4);
4113
- if (ARRAY_TYPE != Float32Array) {
4074
+ if (ARRAY_TYPE !== Float32Array) {
4114
4075
  out[0] = 0;
4115
4076
  out[1] = 0;
4116
4077
  out[2] = 0;
@@ -4398,7 +4359,7 @@ var dist3 = distance3;
4398
4359
  var sqrDist3 = squaredDistance3;
4399
4360
  var len3 = length3;
4400
4361
  var sqrLen3 = squaredLength3;
4401
- var forEach3 = function() {
4362
+ var forEach3 = (function() {
4402
4363
  const vec = create5();
4403
4364
  return function(a, stride, offset, count, fn, arg) {
4404
4365
  let i;
@@ -4427,7 +4388,7 @@ var forEach3 = function() {
4427
4388
  }
4428
4389
  return a;
4429
4390
  };
4430
- }();
4391
+ })();
4431
4392
 
4432
4393
  // dist/classes/matrix4.js
4433
4394
  var INDICES2;
@@ -4991,7 +4952,7 @@ __export(quat_exports, {
4991
4952
  });
4992
4953
  function create6() {
4993
4954
  const out = new ARRAY_TYPE(4);
4994
- if (ARRAY_TYPE != Float32Array) {
4955
+ if (ARRAY_TYPE !== Float32Array) {
4995
4956
  out[0] = 0;
4996
4957
  out[1] = 0;
4997
4958
  out[2] = 0;
@@ -5238,7 +5199,7 @@ var exactEquals7 = exactEquals6;
5238
5199
  function equals7(a, b) {
5239
5200
  return Math.abs(dot3(a, b)) >= 1 - EPSILON;
5240
5201
  }
5241
- var rotationTo = function() {
5202
+ var rotationTo = (function() {
5242
5203
  const tmpvec3 = create2();
5243
5204
  const xUnitVec3 = fromValues2(1, 0, 0);
5244
5205
  const yUnitVec3 = fromValues2(0, 1, 0);
@@ -5265,8 +5226,8 @@ var rotationTo = function() {
5265
5226
  out[3] = 1 + dot5;
5266
5227
  return normalize4(out, out);
5267
5228
  };
5268
- }();
5269
- var sqlerp = function() {
5229
+ })();
5230
+ var sqlerp = (function() {
5270
5231
  const temp1 = create6();
5271
5232
  const temp2 = create6();
5272
5233
  return function(out, a, b, c, d, t) {
@@ -5275,8 +5236,8 @@ var sqlerp = function() {
5275
5236
  slerp2(out, temp1, temp2, 2 * t * (1 - t));
5276
5237
  return out;
5277
5238
  };
5278
- }();
5279
- var setAxes = function() {
5239
+ })();
5240
+ var setAxes = (function() {
5280
5241
  const matr = create3();
5281
5242
  return function(out, view, right, up) {
5282
5243
  matr[0] = right[0];
@@ -5290,7 +5251,7 @@ var setAxes = function() {
5290
5251
  matr[8] = -view[2];
5291
5252
  return normalize4(out, fromMat3(out, matr));
5292
5253
  };
5293
- }();
5254
+ })();
5294
5255
 
5295
5256
  // dist/classes/quaternion.js
5296
5257
  var IDENTITY_QUATERNION = [0, 0, 0, 1];
@@ -5544,7 +5505,7 @@ var Quaternion = class extends MathArray {
5544
5505
  // dist/classes/spherical-coordinates.js
5545
5506
  var EPSILON21 = 1e-6;
5546
5507
  var EARTH_RADIUS_METERS = 6371e3;
5547
- var SphericalCoordinates = class {
5508
+ var SphericalCoordinates = class _SphericalCoordinates {
5548
5509
  // bearing: number;
5549
5510
  // pitch: number;
5550
5511
  // altitude: number;
@@ -5633,7 +5594,7 @@ var SphericalCoordinates = class {
5633
5594
  return this.check();
5634
5595
  }
5635
5596
  clone() {
5636
- return new SphericalCoordinates().copy(this);
5597
+ return new _SphericalCoordinates().copy(this);
5637
5598
  }
5638
5599
  copy(other) {
5639
5600
  this.radius = other.radius;
@@ -5674,46 +5635,72 @@ var SphericalCoordinates = class {
5674
5635
  // dist/classes/euler.js
5675
5636
  var ERR_UNKNOWN_ORDER = "Unknown Euler angle order";
5676
5637
  var ALMOST_ONE = 0.99999;
5677
- var RotationOrder;
5678
- (function(RotationOrder2) {
5679
- RotationOrder2[RotationOrder2["ZYX"] = 0] = "ZYX";
5680
- RotationOrder2[RotationOrder2["YXZ"] = 1] = "YXZ";
5681
- RotationOrder2[RotationOrder2["XZY"] = 2] = "XZY";
5682
- RotationOrder2[RotationOrder2["ZXY"] = 3] = "ZXY";
5683
- RotationOrder2[RotationOrder2["YZX"] = 4] = "YZX";
5684
- RotationOrder2[RotationOrder2["XYZ"] = 5] = "XYZ";
5685
- })(RotationOrder || (RotationOrder = {}));
5638
+ var RotationOrderIndex;
5639
+ (function(RotationOrderIndex2) {
5640
+ RotationOrderIndex2[RotationOrderIndex2["ZYX"] = 0] = "ZYX";
5641
+ RotationOrderIndex2[RotationOrderIndex2["YXZ"] = 1] = "YXZ";
5642
+ RotationOrderIndex2[RotationOrderIndex2["XZY"] = 2] = "XZY";
5643
+ RotationOrderIndex2[RotationOrderIndex2["ZXY"] = 3] = "ZXY";
5644
+ RotationOrderIndex2[RotationOrderIndex2["YZX"] = 4] = "YZX";
5645
+ RotationOrderIndex2[RotationOrderIndex2["XYZ"] = 5] = "XYZ";
5646
+ })(RotationOrderIndex || (RotationOrderIndex = {}));
5647
+ var ROTATION_ORDER_INDICES = {
5648
+ zyx: RotationOrderIndex.ZYX,
5649
+ yxz: RotationOrderIndex.YXZ,
5650
+ xzy: RotationOrderIndex.XZY,
5651
+ zxy: RotationOrderIndex.ZXY,
5652
+ yzx: RotationOrderIndex.YZX,
5653
+ xyz: RotationOrderIndex.XYZ
5654
+ };
5655
+ var ROTATION_ORDERS = {
5656
+ ZYX: "zyx",
5657
+ YXZ: "yxz",
5658
+ XZY: "xzy",
5659
+ ZXY: "zxy",
5660
+ YZX: "yzx",
5661
+ XYZ: "xyz"
5662
+ };
5686
5663
  var Euler = class extends MathArray {
5687
5664
  // Constants
5665
+ /** @deprecated Pass the string `'zyx'` directly. */
5688
5666
  static get ZYX() {
5689
- return RotationOrder.ZYX;
5667
+ return "zyx";
5690
5668
  }
5669
+ /** @deprecated Pass the string `'yxz'` directly. */
5691
5670
  static get YXZ() {
5692
- return RotationOrder.YXZ;
5671
+ return "yxz";
5693
5672
  }
5673
+ /** @deprecated Pass the string `'xzy'` directly. */
5694
5674
  static get XZY() {
5695
- return RotationOrder.XZY;
5675
+ return "xzy";
5696
5676
  }
5677
+ /** @deprecated Pass the string `'zxy'` directly. */
5697
5678
  static get ZXY() {
5698
- return RotationOrder.ZXY;
5679
+ return "zxy";
5699
5680
  }
5681
+ /** @deprecated Pass the string `'yzx'` directly. */
5700
5682
  static get YZX() {
5701
- return RotationOrder.YZX;
5683
+ return "yzx";
5702
5684
  }
5685
+ /** @deprecated Pass the string `'xyz'` directly. */
5703
5686
  static get XYZ() {
5704
- return RotationOrder.XYZ;
5687
+ return "xyz";
5705
5688
  }
5689
+ /** @deprecated Pass the string `'zyx'` directly. */
5706
5690
  static get RollPitchYaw() {
5707
- return RotationOrder.ZYX;
5691
+ return "zyx";
5708
5692
  }
5693
+ /** @deprecated Pass the string `'zyx'` directly. */
5709
5694
  static get DefaultOrder() {
5710
- return RotationOrder.ZYX;
5695
+ return "zyx";
5711
5696
  }
5697
+ /** @deprecated Pass an {@link EulerRotationOrder} string directly. */
5712
5698
  static get RotationOrders() {
5713
- return RotationOrder;
5699
+ return ROTATION_ORDERS;
5714
5700
  }
5701
+ /** @deprecated Euler rotation orders are already represented as strings. */
5715
5702
  static rotationOrder(order) {
5716
- return RotationOrder[order];
5703
+ return order;
5717
5704
  }
5718
5705
  get ELEMENTS() {
5719
5706
  return 4;
@@ -5725,7 +5712,7 @@ var Euler = class extends MathArray {
5725
5712
  * @param {Number=} [z]
5726
5713
  * @param {Number=} [order]
5727
5714
  */
5728
- constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
5715
+ constructor(x = 0, y = 0, z = 0, order = "zyx") {
5729
5716
  super(-0, -0, -0, -0);
5730
5717
  if (arguments.length > 0 && Array.isArray(arguments[0])) {
5731
5718
  this.fromVector3(...arguments);
@@ -5746,7 +5733,7 @@ var Euler = class extends MathArray {
5746
5733
  const roll = Math.atan2(t3, t4);
5747
5734
  const pitch = Math.asin(t2);
5748
5735
  const yaw = Math.atan2(t1, t0);
5749
- return this.set(roll, pitch, yaw, Euler.RollPitchYaw);
5736
+ return this.set(roll, pitch, yaw, "zyx");
5750
5737
  }
5751
5738
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
5752
5739
  fromObject(object) {
@@ -5761,7 +5748,9 @@ var Euler = class extends MathArray {
5761
5748
  this[0] = array[0];
5762
5749
  this[1] = array[1];
5763
5750
  this[2] = array[2];
5764
- this[3] = Number.isFinite(array[3]) || this.order;
5751
+ if (Number.isFinite(array[3]) && validateOrder(array[3])) {
5752
+ this[3] = array[3];
5753
+ }
5765
5754
  return this.check();
5766
5755
  }
5767
5756
  // Sets the three angles, and optionally sets the rotation order
@@ -5770,7 +5759,7 @@ var Euler = class extends MathArray {
5770
5759
  this[0] = x;
5771
5760
  this[1] = y;
5772
5761
  this[2] = z;
5773
- this[3] = Number.isFinite(order) ? order : this[3];
5762
+ this[3] = order ? checkOrder(order) : this[3];
5774
5763
  return this.check();
5775
5764
  }
5776
5765
  validate() {
@@ -5876,14 +5865,14 @@ var Euler = class extends MathArray {
5876
5865
  }
5877
5866
  // rotation order, in all three angle notations
5878
5867
  get order() {
5879
- return this[3];
5868
+ return getOrder(this[3]);
5880
5869
  }
5881
5870
  set order(value) {
5882
5871
  this[3] = checkOrder(value);
5883
5872
  }
5884
5873
  // Constructors
5885
- fromVector3(v, order) {
5886
- return this.set(v[0], v[1], v[2], Number.isFinite(order) ? order : this[3]);
5874
+ fromVector3(v, order = this.order) {
5875
+ return this.set(v[0], v[1], v[2], order);
5887
5876
  }
5888
5877
  // TODO - with and without 4th element
5889
5878
  fromArray(array, offset = 0) {
@@ -5897,9 +5886,9 @@ var Euler = class extends MathArray {
5897
5886
  }
5898
5887
  // Common ZYX rotation order
5899
5888
  fromRollPitchYaw(roll, pitch, yaw) {
5900
- return this.set(roll, pitch, yaw, RotationOrder.ZYX);
5889
+ return this.set(roll, pitch, yaw, "zyx");
5901
5890
  }
5902
- fromRotationMatrix(m, order = Euler.DefaultOrder) {
5891
+ fromRotationMatrix(m, order = "zyx") {
5903
5892
  this._fromRotationMatrix(m, order);
5904
5893
  return this.check();
5905
5894
  }
@@ -5911,18 +5900,18 @@ var Euler = class extends MathArray {
5911
5900
  getQuaternion() {
5912
5901
  const q = new Quaternion();
5913
5902
  switch (this[3]) {
5914
- case RotationOrder.XYZ:
5903
+ case RotationOrderIndex.XYZ:
5915
5904
  return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
5916
- case RotationOrder.YXZ:
5917
- return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);
5918
- case RotationOrder.ZXY:
5919
- return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);
5920
- case RotationOrder.ZYX:
5921
- return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);
5922
- case RotationOrder.YZX:
5923
- return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);
5924
- case RotationOrder.XZY:
5925
- return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);
5905
+ case RotationOrderIndex.YXZ:
5906
+ return q.rotateY(this[1]).rotateX(this[0]).rotateZ(this[2]);
5907
+ case RotationOrderIndex.ZXY:
5908
+ return q.rotateZ(this[2]).rotateX(this[0]).rotateY(this[1]);
5909
+ case RotationOrderIndex.ZYX:
5910
+ return q.rotateZ(this[2]).rotateY(this[1]).rotateX(this[0]);
5911
+ case RotationOrderIndex.YZX:
5912
+ return q.rotateY(this[1]).rotateZ(this[2]).rotateX(this[0]);
5913
+ case RotationOrderIndex.XZY:
5914
+ return q.rotateX(this[0]).rotateZ(this[2]).rotateY(this[1]);
5926
5915
  default:
5927
5916
  throw new Error(ERR_UNKNOWN_ORDER);
5928
5917
  }
@@ -5935,13 +5924,13 @@ var Euler = class extends MathArray {
5935
5924
  // const q = new Quaternion().setFromEuler(this);
5936
5925
  // return this.setFromQuaternion(q, newOrder);
5937
5926
  /* eslint-disable complexity, max-statements, one-var */
5938
- _fromRotationMatrix(m, order = Euler.DefaultOrder) {
5927
+ _fromRotationMatrix(m, order = "zyx") {
5939
5928
  const m11 = m[0], m12 = m[4], m13 = m[8];
5940
5929
  const m21 = m[1], m22 = m[5], m23 = m[9];
5941
5930
  const m31 = m[2], m32 = m[6], m33 = m[10];
5942
- order = order || this[3];
5943
- switch (order) {
5944
- case Euler.XYZ:
5931
+ const orderIndex = order ? checkOrder(order) : this[3];
5932
+ switch (orderIndex) {
5933
+ case RotationOrderIndex.XYZ:
5945
5934
  this[1] = Math.asin(clamp(m13, -1, 1));
5946
5935
  if (Math.abs(m13) < ALMOST_ONE) {
5947
5936
  this[0] = Math.atan2(-m23, m33);
@@ -5951,7 +5940,7 @@ var Euler = class extends MathArray {
5951
5940
  this[2] = 0;
5952
5941
  }
5953
5942
  break;
5954
- case Euler.YXZ:
5943
+ case RotationOrderIndex.YXZ:
5955
5944
  this[0] = Math.asin(-clamp(m23, -1, 1));
5956
5945
  if (Math.abs(m23) < ALMOST_ONE) {
5957
5946
  this[1] = Math.atan2(m13, m33);
@@ -5961,7 +5950,7 @@ var Euler = class extends MathArray {
5961
5950
  this[2] = 0;
5962
5951
  }
5963
5952
  break;
5964
- case Euler.ZXY:
5953
+ case RotationOrderIndex.ZXY:
5965
5954
  this[0] = Math.asin(clamp(m32, -1, 1));
5966
5955
  if (Math.abs(m32) < ALMOST_ONE) {
5967
5956
  this[1] = Math.atan2(-m31, m33);
@@ -5971,7 +5960,7 @@ var Euler = class extends MathArray {
5971
5960
  this[2] = Math.atan2(m21, m11);
5972
5961
  }
5973
5962
  break;
5974
- case Euler.ZYX:
5963
+ case RotationOrderIndex.ZYX:
5975
5964
  this[1] = Math.asin(-clamp(m31, -1, 1));
5976
5965
  if (Math.abs(m31) < ALMOST_ONE) {
5977
5966
  this[0] = Math.atan2(m32, m33);
@@ -5981,7 +5970,7 @@ var Euler = class extends MathArray {
5981
5970
  this[2] = Math.atan2(-m12, m22);
5982
5971
  }
5983
5972
  break;
5984
- case Euler.YZX:
5973
+ case RotationOrderIndex.YZX:
5985
5974
  this[2] = Math.asin(clamp(m21, -1, 1));
5986
5975
  if (Math.abs(m21) < ALMOST_ONE) {
5987
5976
  this[0] = Math.atan2(-m23, m22);
@@ -5991,7 +5980,7 @@ var Euler = class extends MathArray {
5991
5980
  this[1] = Math.atan2(m13, m33);
5992
5981
  }
5993
5982
  break;
5994
- case Euler.XZY:
5983
+ case RotationOrderIndex.XZY:
5995
5984
  this[2] = Math.asin(-clamp(m12, -1, 1));
5996
5985
  if (Math.abs(m12) < ALMOST_ONE) {
5997
5986
  this[0] = Math.atan2(m32, m22);
@@ -6004,7 +5993,7 @@ var Euler = class extends MathArray {
6004
5993
  default:
6005
5994
  throw new Error(ERR_UNKNOWN_ORDER);
6006
5995
  }
6007
- this[3] = order;
5996
+ this[3] = orderIndex;
6008
5997
  return this;
6009
5998
  }
6010
5999
  _getRotationMatrix(result) {
@@ -6017,7 +6006,7 @@ var Euler = class extends MathArray {
6017
6006
  const d = Math.sin(y);
6018
6007
  const f = Math.sin(z);
6019
6008
  switch (this[3]) {
6020
- case Euler.XYZ: {
6009
+ case RotationOrderIndex.XYZ: {
6021
6010
  const ae = a * e, af = a * f, be = b * e, bf = b * f;
6022
6011
  te[0] = c * e;
6023
6012
  te[4] = -c * f;
@@ -6030,7 +6019,7 @@ var Euler = class extends MathArray {
6030
6019
  te[10] = a * c;
6031
6020
  break;
6032
6021
  }
6033
- case Euler.YXZ: {
6022
+ case RotationOrderIndex.YXZ: {
6034
6023
  const ce = c * e, cf = c * f, de = d * e, df = d * f;
6035
6024
  te[0] = ce + df * b;
6036
6025
  te[4] = de * b - cf;
@@ -6043,7 +6032,7 @@ var Euler = class extends MathArray {
6043
6032
  te[10] = a * c;
6044
6033
  break;
6045
6034
  }
6046
- case Euler.ZXY: {
6035
+ case RotationOrderIndex.ZXY: {
6047
6036
  const ce = c * e, cf = c * f, de = d * e, df = d * f;
6048
6037
  te[0] = ce - df * b;
6049
6038
  te[4] = -a * f;
@@ -6056,7 +6045,7 @@ var Euler = class extends MathArray {
6056
6045
  te[10] = a * c;
6057
6046
  break;
6058
6047
  }
6059
- case Euler.ZYX: {
6048
+ case RotationOrderIndex.ZYX: {
6060
6049
  const ae = a * e, af = a * f, be = b * e, bf = b * f;
6061
6050
  te[0] = c * e;
6062
6051
  te[4] = be * d - af;
@@ -6069,7 +6058,7 @@ var Euler = class extends MathArray {
6069
6058
  te[10] = a * c;
6070
6059
  break;
6071
6060
  }
6072
- case Euler.YZX: {
6061
+ case RotationOrderIndex.YZX: {
6073
6062
  const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
6074
6063
  te[0] = c * e;
6075
6064
  te[4] = bd - ac * f;
@@ -6082,7 +6071,7 @@ var Euler = class extends MathArray {
6082
6071
  te[10] = ac - bd * f;
6083
6072
  break;
6084
6073
  }
6085
- case Euler.XZY: {
6074
+ case RotationOrderIndex.XZY: {
6086
6075
  const ac = a * c, ad = a * d, bc = b * c, bd = b * d;
6087
6076
  te[0] = c * e;
6088
6077
  te[4] = -f;
@@ -6125,10 +6114,29 @@ function validateOrder(value) {
6125
6114
  return value >= 0 && value < 6;
6126
6115
  }
6127
6116
  function checkOrder(value) {
6128
- if (value < 0 && value >= 6) {
6117
+ const order = ROTATION_ORDER_INDICES[value];
6118
+ if (order === void 0) {
6129
6119
  throw new Error(ERR_UNKNOWN_ORDER);
6130
6120
  }
6131
- return value;
6121
+ return order;
6122
+ }
6123
+ function getOrder(value) {
6124
+ switch (value) {
6125
+ case RotationOrderIndex.ZYX:
6126
+ return "zyx";
6127
+ case RotationOrderIndex.YXZ:
6128
+ return "yxz";
6129
+ case RotationOrderIndex.XZY:
6130
+ return "xzy";
6131
+ case RotationOrderIndex.ZXY:
6132
+ return "zxy";
6133
+ case RotationOrderIndex.YZX:
6134
+ return "yzx";
6135
+ case RotationOrderIndex.XYZ:
6136
+ return "xyz";
6137
+ default:
6138
+ throw new Error(ERR_UNKNOWN_ORDER);
6139
+ }
6132
6140
  }
6133
6141
 
6134
6142
  // dist/classes/pose.js
@@ -6140,9 +6148,9 @@ var Pose = class {
6140
6148
  this.position = new Vector3(x, y, z);
6141
6149
  }
6142
6150
  if (Array.isArray(orientation) && orientation.length === 4) {
6143
- this.orientation = new Euler(orientation, orientation[3]);
6151
+ this.orientation = new Euler().fromArray(orientation);
6144
6152
  } else {
6145
- this.orientation = new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
6153
+ this.orientation = new Euler(roll, pitch, yaw, "zyx");
6146
6154
  }
6147
6155
  }
6148
6156
  get x() {