@math.gl/core 3.6.3 → 4.0.0-alpha.2

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 (210) hide show
  1. package/dist/classes/base/math-array.d.ts +5 -4
  2. package/dist/classes/base/math-array.d.ts.map +1 -1
  3. package/dist/{esm/classes → classes}/base/math-array.js +8 -3
  4. package/dist/classes/base/math-array.js.map +1 -0
  5. package/dist/classes/base/matrix.d.ts +2 -2
  6. package/dist/classes/base/matrix.d.ts.map +1 -1
  7. package/dist/{esm/classes → classes}/base/matrix.js +4 -4
  8. package/dist/classes/base/matrix.js.map +1 -0
  9. package/dist/classes/base/vector.d.ts +2 -2
  10. package/dist/classes/base/vector.d.ts.map +1 -1
  11. package/dist/{esm/classes → classes}/base/vector.js +4 -4
  12. package/dist/classes/base/vector.js.map +1 -0
  13. package/dist/classes/euler.d.ts +4 -4
  14. package/dist/classes/euler.d.ts.map +1 -1
  15. package/dist/{esm/classes → classes}/euler.js +6 -6
  16. package/dist/classes/euler.js.map +1 -0
  17. package/dist/classes/matrix3.d.ts +5 -2
  18. package/dist/classes/matrix3.d.ts.map +1 -1
  19. package/dist/{esm/classes → classes}/matrix3.js +20 -20
  20. package/dist/classes/matrix3.js.map +1 -0
  21. package/dist/classes/matrix4.d.ts +2 -2
  22. package/dist/classes/matrix4.d.ts.map +1 -1
  23. package/dist/{esm/classes → classes}/matrix4.js +27 -27
  24. package/dist/classes/matrix4.js.map +1 -0
  25. package/dist/classes/pose.d.ts +4 -4
  26. package/dist/classes/pose.d.ts.map +1 -1
  27. package/dist/{esm/classes → classes}/pose.js +4 -4
  28. package/dist/classes/pose.js.map +1 -0
  29. package/dist/classes/quaternion.d.ts +2 -2
  30. package/dist/classes/quaternion.d.ts.map +1 -1
  31. package/dist/{esm/classes → classes}/quaternion.js +26 -26
  32. package/dist/classes/quaternion.js.map +1 -0
  33. package/dist/classes/spherical-coordinates.d.ts +2 -2
  34. package/dist/classes/spherical-coordinates.d.ts.map +1 -1
  35. package/dist/{esm/classes → classes}/spherical-coordinates.js +5 -5
  36. package/dist/classes/spherical-coordinates.js.map +1 -0
  37. package/dist/classes/vector2.d.ts +2 -2
  38. package/dist/classes/vector2.d.ts.map +1 -1
  39. package/dist/{esm/classes → classes}/vector2.js +10 -10
  40. package/dist/classes/vector2.js.map +1 -0
  41. package/dist/classes/vector3.d.ts +2 -2
  42. package/dist/classes/vector3.d.ts.map +1 -1
  43. package/dist/{esm/classes → classes}/vector3.js +14 -14
  44. package/dist/classes/vector3.js.map +1 -0
  45. package/dist/classes/vector4.d.ts +3 -3
  46. package/dist/classes/vector4.d.ts.map +1 -1
  47. package/dist/{esm/classes → classes}/vector4.js +8 -8
  48. package/dist/classes/vector4.js.map +1 -0
  49. package/dist/gl-matrix/common.d.ts +38 -0
  50. package/dist/gl-matrix/common.d.ts.map +1 -0
  51. package/dist/gl-matrix/common.js +19 -0
  52. package/dist/gl-matrix/common.js.map +1 -0
  53. package/dist/gl-matrix/mat3.d.ts +295 -0
  54. package/dist/gl-matrix/mat3.d.ts.map +1 -0
  55. package/dist/gl-matrix/mat3.js +489 -0
  56. package/dist/gl-matrix/mat3.js.map +1 -0
  57. package/dist/gl-matrix/mat4.d.ts +577 -0
  58. package/dist/gl-matrix/mat4.d.ts.map +1 -0
  59. package/dist/gl-matrix/mat4.js +1455 -0
  60. package/dist/gl-matrix/mat4.js.map +1 -0
  61. package/dist/gl-matrix/quat.d.ts +357 -0
  62. package/dist/gl-matrix/quat.d.ts.map +1 -0
  63. package/dist/gl-matrix/quat.js +315 -0
  64. package/dist/gl-matrix/quat.js.map +1 -0
  65. package/dist/gl-matrix/vec2.d.ts +373 -0
  66. package/dist/gl-matrix/vec2.d.ts.map +1 -0
  67. package/dist/gl-matrix/vec2.js +257 -0
  68. package/dist/gl-matrix/vec2.js.map +1 -0
  69. package/dist/gl-matrix/vec3.d.ts +416 -0
  70. package/dist/gl-matrix/vec3.d.ts.map +1 -0
  71. package/dist/gl-matrix/vec3.js +384 -0
  72. package/dist/gl-matrix/vec3.js.map +1 -0
  73. package/dist/gl-matrix/vec4.d.ts +340 -0
  74. package/dist/gl-matrix/vec4.d.ts.map +1 -0
  75. package/dist/gl-matrix/vec4.js +334 -0
  76. package/dist/gl-matrix/vec4.js.map +1 -0
  77. package/dist/gl-matrix/wip/index.d.ts +5 -0
  78. package/dist/gl-matrix/wip/index.d.ts.map +1 -0
  79. package/dist/gl-matrix/wip/index.js +12 -0
  80. package/dist/gl-matrix/wip/index.js.map +1 -0
  81. package/dist/gl-matrix/wip/mat2.d.ts +229 -0
  82. package/dist/gl-matrix/wip/mat2.d.ts.map +1 -0
  83. package/dist/gl-matrix/wip/mat2.js +208 -0
  84. package/dist/gl-matrix/wip/mat2.js.map +1 -0
  85. package/dist/gl-matrix/wip/mat2d.d.ts +244 -0
  86. package/dist/gl-matrix/wip/mat2d.d.ts.map +1 -0
  87. package/dist/gl-matrix/wip/mat2d.js +251 -0
  88. package/dist/gl-matrix/wip/mat2d.js.map +1 -0
  89. package/dist/gl-matrix/wip/quat2.d.ts +352 -0
  90. package/dist/gl-matrix/wip/quat2.d.ts.map +1 -0
  91. package/dist/gl-matrix/wip/quat2.js +482 -0
  92. package/dist/gl-matrix/wip/quat2.js.map +1 -0
  93. package/dist/gl-matrix/wip/types.d.js +2 -0
  94. package/dist/{esm/lib/gl-matrix.d.js.map → gl-matrix/wip/types.d.js.map} +1 -1
  95. package/dist/index.cjs +3788 -0
  96. package/dist/index.d.ts +15 -14
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +17 -0
  99. package/dist/index.js.map +1 -0
  100. package/dist/lib/assert.d.ts +1 -1
  101. package/dist/lib/assert.d.ts.map +1 -1
  102. package/dist/lib/assert.js +6 -0
  103. package/dist/lib/assert.js.map +1 -0
  104. package/dist/lib/common.d.ts +10 -5
  105. package/dist/lib/common.d.ts.map +1 -1
  106. package/dist/{esm/lib → lib}/common.js +11 -9
  107. package/dist/lib/common.js.map +1 -0
  108. package/dist/lib/gl-matrix-extras.js.map +1 -0
  109. package/dist/lib/math-utils.d.ts +24 -27
  110. package/dist/lib/math-utils.d.ts.map +1 -1
  111. package/dist/lib/math-utils.js +25 -0
  112. package/dist/lib/math-utils.js.map +1 -0
  113. package/dist/lib/validators.d.ts +1 -1
  114. package/dist/lib/validators.d.ts.map +1 -1
  115. package/dist/{esm/lib → lib}/validators.js +2 -2
  116. package/dist/lib/validators.js.map +1 -0
  117. package/package.json +6 -6
  118. package/src/classes/base/math-array.ts +16 -8
  119. package/src/classes/base/matrix.ts +7 -4
  120. package/src/classes/base/vector.ts +4 -4
  121. package/src/classes/euler.ts +9 -8
  122. package/src/classes/matrix3.ts +37 -24
  123. package/src/classes/matrix4.ts +48 -29
  124. package/src/classes/pose.ts +4 -4
  125. package/src/classes/quaternion.ts +54 -32
  126. package/src/classes/spherical-coordinates.ts +5 -4
  127. package/src/classes/vector2.ts +13 -9
  128. package/src/classes/vector3.ts +26 -12
  129. package/src/classes/vector4.ts +14 -10
  130. package/src/gl-matrix/common.js +58 -0
  131. package/src/gl-matrix/mat3.js +842 -0
  132. package/src/gl-matrix/mat4.js +2169 -0
  133. package/src/gl-matrix/quat.ts +789 -0
  134. package/src/gl-matrix/vec2.js +629 -0
  135. package/src/gl-matrix/vec3.js +827 -0
  136. package/src/gl-matrix/vec4.js +675 -0
  137. package/src/gl-matrix/wip/index.js +15 -0
  138. package/src/gl-matrix/wip/mat2.js +442 -0
  139. package/src/gl-matrix/wip/mat2d.js +505 -0
  140. package/src/gl-matrix/wip/quat2.ts +886 -0
  141. package/src/gl-matrix/wip/types.d.ts +93 -0
  142. package/src/index.ts +16 -14
  143. package/src/lib/assert.ts +1 -1
  144. package/src/lib/common.ts +31 -19
  145. package/src/lib/math-utils.ts +24 -26
  146. package/src/lib/validators.ts +3 -3
  147. package/dist/es5/classes/base/math-array.js +0 -348
  148. package/dist/es5/classes/base/math-array.js.map +0 -1
  149. package/dist/es5/classes/base/matrix.js +0 -108
  150. package/dist/es5/classes/base/matrix.js.map +0 -1
  151. package/dist/es5/classes/base/vector.js +0 -210
  152. package/dist/es5/classes/base/vector.js.map +0 -1
  153. package/dist/es5/classes/euler.js +0 -654
  154. package/dist/es5/classes/euler.js.map +0 -1
  155. package/dist/es5/classes/matrix3.js +0 -284
  156. package/dist/es5/classes/matrix3.js.map +0 -1
  157. package/dist/es5/classes/matrix4.js +0 -574
  158. package/dist/es5/classes/matrix4.js.map +0 -1
  159. package/dist/es5/classes/pose.js +0 -159
  160. package/dist/es5/classes/pose.js.map +0 -1
  161. package/dist/es5/classes/quaternion.js +0 -323
  162. package/dist/es5/classes/quaternion.js.map +0 -1
  163. package/dist/es5/classes/spherical-coordinates.js +0 -208
  164. package/dist/es5/classes/spherical-coordinates.js.map +0 -1
  165. package/dist/es5/classes/vector2.js +0 -156
  166. package/dist/es5/classes/vector2.js.map +0 -1
  167. package/dist/es5/classes/vector3.js +0 -213
  168. package/dist/es5/classes/vector3.js.map +0 -1
  169. package/dist/es5/classes/vector4.js +0 -185
  170. package/dist/es5/classes/vector4.js.map +0 -1
  171. package/dist/es5/docs/README.md +0 -0
  172. package/dist/es5/index.js +0 -236
  173. package/dist/es5/index.js.map +0 -1
  174. package/dist/es5/lib/assert.js +0 -13
  175. package/dist/es5/lib/assert.js.map +0 -1
  176. package/dist/es5/lib/common.js +0 -255
  177. package/dist/es5/lib/common.js.map +0 -1
  178. package/dist/es5/lib/gl-matrix-extras.js +0 -61
  179. package/dist/es5/lib/gl-matrix-extras.js.map +0 -1
  180. package/dist/es5/lib/gl-matrix.d.js +0 -2
  181. package/dist/es5/lib/math-utils.js +0 -34
  182. package/dist/es5/lib/math-utils.js.map +0 -1
  183. package/dist/es5/lib/validators.js +0 -53
  184. package/dist/es5/lib/validators.js.map +0 -1
  185. package/dist/esm/classes/base/math-array.js.map +0 -1
  186. package/dist/esm/classes/base/matrix.js.map +0 -1
  187. package/dist/esm/classes/base/vector.js.map +0 -1
  188. package/dist/esm/classes/euler.js.map +0 -1
  189. package/dist/esm/classes/matrix3.js.map +0 -1
  190. package/dist/esm/classes/matrix4.js.map +0 -1
  191. package/dist/esm/classes/pose.js.map +0 -1
  192. package/dist/esm/classes/quaternion.js.map +0 -1
  193. package/dist/esm/classes/spherical-coordinates.js.map +0 -1
  194. package/dist/esm/classes/vector2.js.map +0 -1
  195. package/dist/esm/classes/vector3.js.map +0 -1
  196. package/dist/esm/classes/vector4.js.map +0 -1
  197. package/dist/esm/docs/README.md +0 -0
  198. package/dist/esm/index.js +0 -16
  199. package/dist/esm/index.js.map +0 -1
  200. package/dist/esm/lib/assert.js +0 -6
  201. package/dist/esm/lib/assert.js.map +0 -1
  202. package/dist/esm/lib/common.js.map +0 -1
  203. package/dist/esm/lib/gl-matrix-extras.js.map +0 -1
  204. package/dist/esm/lib/math-utils.js +0 -27
  205. package/dist/esm/lib/math-utils.js.map +0 -1
  206. package/dist/esm/lib/validators.js.map +0 -1
  207. package/src/docs/README.md +0 -0
  208. /package/dist/{esm/lib → lib}/gl-matrix-extras.js +0 -0
  209. /package/dist/{esm/lib → lib}/gl-matrix.d.js +0 -0
  210. /package/dist/{es5/lib → lib}/gl-matrix.d.js.map +0 -0
package/dist/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  export type { TypedArray, NumericArray } from '@math.gl/types';
2
- export { default as Vector2 } from './classes/vector2';
3
- export { default as Vector3 } from './classes/vector3';
4
- export { default as Vector4 } from './classes/vector4';
5
- export { default as Matrix3 } from './classes/matrix3';
6
- export { default as Matrix4 } from './classes/matrix4';
7
- export { default as Quaternion } from './classes/quaternion';
8
- export { default as SphericalCoordinates } from './classes/spherical-coordinates';
9
- export { default as Pose } from './classes/pose';
10
- export { default as Euler } from './classes/euler';
11
- export { default as _MathUtils } from './lib/math-utils';
12
- export { default as assert } from './lib/assert';
2
+ export type { isTypedArray, isNumericArray } from '@math.gl/types';
3
+ export { Vector2 } from './classes/vector2';
4
+ export { Vector3 } from './classes/vector3';
5
+ export { Vector4 } from './classes/vector4';
6
+ export { Matrix3 } from './classes/matrix3';
7
+ export { Matrix4 } from './classes/matrix4';
8
+ export { Quaternion } from './classes/quaternion';
9
+ export { SphericalCoordinates } from './classes/spherical-coordinates';
10
+ export { Pose } from './classes/pose';
11
+ export { Euler } from './classes/euler';
12
+ export * as _MathUtils from './lib/math-utils';
13
+ export { assert } from './lib/assert';
13
14
  export { config, configure, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon } from './lib/common';
14
- export { default as _SphericalCoordinates } from './classes/spherical-coordinates';
15
- export { default as _Pose } from './classes/pose';
16
- export { default as _Euler } from './classes/euler';
15
+ export { SphericalCoordinates as _SphericalCoordinates } from './classes/spherical-coordinates';
16
+ export { Pose as _Pose } from './classes/pose';
17
+ export { Euler as _Euler } from './classes/euler';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG7D,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAC,OAAO,IAAI,IAAI,EAAC,MAAM,gBAAgB,CAAC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AM,gBAAgB,CAAC;AACpC,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAEL,MAAM,EACN,SAAS,EACT,WAAW,EACX,OAAO,EACP,KAAK,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,SAAS,EAET,OAAO,EACP,OAAO,EACP,GAAG,EACH,GAAG,EACH,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,WAAW,EACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAC,oBAAoB,IAAI,qBAAqB,EAAC,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAC,IAAI,IAAI,KAAK,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,KAAK,IAAI,MAAM,EAAC,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export { Vector2 } from "./classes/vector2.js";
2
+ export { Vector3 } from "./classes/vector3.js";
3
+ export { Vector4 } from "./classes/vector4.js";
4
+ export { Matrix3 } from "./classes/matrix3.js";
5
+ export { Matrix4 } from "./classes/matrix4.js";
6
+ export { Quaternion } from "./classes/quaternion.js";
7
+ export { SphericalCoordinates } from "./classes/spherical-coordinates.js";
8
+ export { Pose } from "./classes/pose.js";
9
+ export { Euler } from "./classes/euler.js";
10
+ import * as _MathUtils from "./lib/math-utils.js";
11
+ export { _MathUtils };
12
+ export { assert } from "./lib/assert.js";
13
+ export { config, configure, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon } from "./lib/common.js";
14
+ export { SphericalCoordinates as _SphericalCoordinates } from "./classes/spherical-coordinates.js";
15
+ export { Pose as _Pose } from "./classes/pose.js";
16
+ export { Euler as _Euler } from "./classes/euler.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Vector2","Vector3","Vector4","Matrix3","Matrix4","Quaternion","SphericalCoordinates","Pose","Euler","assert","config","configure","formatValue","isArray","clone","equals","exactEquals","toRadians","toDegrees","radians","degrees","sin","cos","tan","asin","acos","atan","clamp","lerp","withEpsilon","_SphericalCoordinates","_Pose","_Euler"],"mappings":"SAQQA,O;SACAC,O;SACAC,O;SACAC,O;SACAC,O;SACAC,U;SAGAC,oB;SACAC,I;SACAC,K;;;SAKAC,M;SAINC,M,EACAC,S,EACAC,W,EACAC,O,EACAC,K,EACAC,M,EACAC,W,EACAC,S,EACAC,S,EAEAC,O,EACAC,O,EACAC,G,EACAC,G,EACAC,G,EACAC,I,EACAC,I,EACAC,I,EACAC,K,EACAC,I,EACAC,W;SAIMvB,oBAAoB,IAAIwB,qB;SACxBvB,IAAI,IAAIwB,K;SACRvB,KAAK,IAAIwB,M","sourcesContent":["// luma.gl, MIT license\n\n// types\nexport type {TypedArray, NumericArray} from '@math.gl/types';\n\nexport type {isTypedArray, isNumericArray} from '@math.gl/types';\n\n// classes\nexport {Vector2} from './classes/vector2';\nexport {Vector3} from './classes/vector3';\nexport {Vector4} from './classes/vector4';\nexport {Matrix3} from './classes/matrix3';\nexport {Matrix4} from './classes/matrix4';\nexport {Quaternion} from './classes/quaternion';\n\n// experimental\nexport {SphericalCoordinates} from './classes/spherical-coordinates';\nexport {Pose} from './classes/pose';\nexport {Euler} from './classes/euler';\n\nexport * as _MathUtils from './lib/math-utils';\n\n// lib\nexport {assert} from './lib/assert';\n\nexport {\n // math.gl global utility methods\n config,\n configure,\n formatValue,\n isArray,\n clone,\n equals,\n exactEquals,\n toRadians,\n toDegrees,\n // math.gl \"GLSL\"-style functions\n radians,\n degrees,\n sin,\n cos,\n tan,\n asin,\n acos,\n atan,\n clamp,\n lerp,\n withEpsilon\n} from './lib/common';\n\n// DEPRECATED\nexport {SphericalCoordinates as _SphericalCoordinates} from './classes/spherical-coordinates';\nexport {Pose as _Pose} from './classes/pose';\nexport {Euler as _Euler} from './classes/euler';\n"],"file":"index.js"}
@@ -1,2 +1,2 @@
1
- export default function assert(condition: unknown, message?: string): void;
1
+ export declare function assert(condition: unknown, message?: string): void;
2
2
  //# sourceMappingURL=assert.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/lib/assert.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAIzE"}
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/lib/assert.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAIjE"}
@@ -0,0 +1,6 @@
1
+ export function assert(condition, message) {
2
+ if (!condition) {
3
+ throw new Error("math.gl assertion ".concat(message));
4
+ }
5
+ }
6
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/assert.ts"],"names":["assert","condition","message","Error"],"mappings":"AAAA,OAAO,SAASA,MAAT,CAAgBC,SAAhB,EAAoCC,OAApC,EAA4D;AACjE,MAAI,CAACD,SAAL,EAAgB;AACd,UAAM,IAAIE,KAAJ,6BAA+BD,OAA/B,EAAN;AACD;AACF","sourcesContent":["export function assert(condition: unknown, message?: string): void {\n if (!condition) {\n throw new Error(`math.gl assertion ${message}`);\n }\n}\n"],"file":"assert.js"}
@@ -1,5 +1,5 @@
1
- import { NumericArray } from '@math.gl/types';
2
- import type MathArray from '../classes/base/math-array';
1
+ import type { NumericArray } from '@math.gl/types';
2
+ import type { MathArray } from '../classes/base/math-array';
3
3
  export declare type ConfigurationOptions = {
4
4
  EPSILON: number;
5
5
  debug?: boolean;
@@ -9,8 +9,13 @@ export declare type ConfigurationOptions = {
9
9
  printRowMajor?: boolean;
10
10
  _cartographicRadians?: boolean;
11
11
  };
12
- export declare const config: ConfigurationOptions;
13
- export declare function configure(options?: Partial<ConfigurationOptions>): ConfigurationOptions;
12
+ declare global {
13
+ var mathgl: {
14
+ config: Required<ConfigurationOptions>;
15
+ };
16
+ }
17
+ export declare const config: Required<ConfigurationOptions>;
18
+ export declare function configure(options: Partial<ConfigurationOptions>): ConfigurationOptions;
14
19
  /**
15
20
  * Formats a value into a string
16
21
  * @param value
@@ -23,8 +28,8 @@ export declare function formatValue(value: number, { precision }?: {
23
28
  /**
24
29
  * Check if value is an "array"
25
30
  * Returns `true` if value is either an array or a typed array
26
- *
27
31
  * Note: returns `false` for `ArrayBuffer` and `DataView` instances
32
+ * @note isTypedArray and isNumericArray are often more useful in TypeScript
28
33
  */
29
34
  export declare function isArray(value: unknown): boolean;
30
35
  export declare function clone(array: NumericArray | MathArray): NumericArray;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAMF,eAAO,MAAM,MAAM,EAAE,oBAOpB,CAAC;AAEF,wBAAgB,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,oBAAoB,CAOvF;AAED;;;;;GAKG;AACH,wBAAgB,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AAG,MAAM,CAAC;AACvE,wBAAgB,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;AAUnF;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;AAC9D,wBAAgB,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;AAehF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAkChE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAwBnD;AAID,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAUhE"}
@@ -1,20 +1,21 @@
1
- import assert from './assert';
2
1
  const RADIANS_TO_DEGREES = 1 / Math.PI * 180;
3
2
  const DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
4
- export const config = {
3
+ const DEFAULT_CONFIG = {
5
4
  EPSILON: 1e-12,
6
5
  debug: false,
7
6
  precision: 4,
8
7
  printTypes: false,
9
8
  printDegrees: false,
10
- printRowMajor: true
9
+ printRowMajor: true,
10
+ _cartographicRadians: false
11
11
  };
12
- export function configure(options) {
13
- for (const key in options) {
14
- assert(key in config);
15
- config[key] = options[key];
12
+ globalThis.mathgl = globalThis.mathgl || {
13
+ config: { ...DEFAULT_CONFIG
16
14
  }
17
-
15
+ };
16
+ export const config = globalThis.mathgl.config;
17
+ export function configure(options) {
18
+ Object.assign(config, options);
18
19
  return config;
19
20
  }
20
21
  export function formatValue(value, {
@@ -171,7 +172,8 @@ function map(value, func, result) {
171
172
  result = result || duplicateArray(array);
172
173
 
173
174
  for (let i = 0; i < result.length && i < array.length; ++i) {
174
- result[i] = func(value[i], i, result);
175
+ const val = typeof value === 'number' ? value : value[i];
176
+ result[i] = func(val, i, result);
175
177
  }
176
178
 
177
179
  return result;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/common.ts"],"names":["RADIANS_TO_DEGREES","Math","PI","DEGREES_TO_RADIANS","DEFAULT_CONFIG","EPSILON","debug","precision","printTypes","printDegrees","printRowMajor","_cartographicRadians","globalThis","mathgl","config","configure","options","Object","assign","formatValue","value","round","parseFloat","toPrecision","isArray","Array","ArrayBuffer","isView","DataView","clone","array","slice","toRadians","degrees","radians","toDegrees","result","map","sin","angle","cos","tan","asin","acos","atan","clamp","min","max","lerp","a","b","t","ai","i","equals","epsilon","oldEpsilon","length","abs","exactEquals","constructor","withEpsilon","func","oldPrecision","duplicateArray","val"],"mappings":"AAMA,MAAMA,kBAAkB,GAAI,IAAIC,IAAI,CAACC,EAAV,GAAgB,GAA3C;AACA,MAAMC,kBAAkB,GAAI,IAAI,GAAL,GAAYF,IAAI,CAACC,EAA5C;AAYA,MAAME,cAA8C,GAAG;AACrDC,EAAAA,OAAO,EAAE,KAD4C;AAErDC,EAAAA,KAAK,EAAE,KAF8C;AAGrDC,EAAAA,SAAS,EAAE,CAH0C;AAIrDC,EAAAA,UAAU,EAAE,KAJyC;AAKrDC,EAAAA,YAAY,EAAE,KALuC;AAMrDC,EAAAA,aAAa,EAAE,IANsC;AAOrDC,EAAAA,oBAAoB,EAAE;AAP+B,CAAvD;AAoBAC,UAAU,CAACC,MAAX,GAAoBD,UAAU,CAACC,MAAX,IAAqB;AAACC,EAAAA,MAAM,EAAE,EAAC,GAAGV;AAAJ;AAAT,CAAzC;AAEA,OAAO,MAAMU,MAAM,GAAGF,UAAU,CAACC,MAAX,CAAkBC,MAAjC;AAEP,OAAO,SAASC,SAAT,CAAmBC,OAAnB,EAAi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CAAD,CAAN,GAAYS,IAAI,CAACG,GAAD,EAAMZ,CAAN,EAASjB,MAAT,CAAhB;AACD;;AACD,WAAOA,MAAP;AACD;;AACD,SAAO0B,IAAI,CAAC1C,KAAD,CAAX;AACD","sourcesContent":["// math.gl, MIT license\n\nimport type {NumericArray} from '@math.gl/types';\n\nimport type {MathArray} from '../classes/base/math-array';\n\nconst RADIANS_TO_DEGREES = (1 / Math.PI) * 180;\nconst DEGREES_TO_RADIANS = (1 / 180) * Math.PI;\n\nexport type ConfigurationOptions = {\n EPSILON: number;\n debug?: boolean;\n precision: number;\n printTypes?: boolean;\n printDegrees?: boolean;\n printRowMajor?: boolean;\n _cartographicRadians?: boolean;\n};\n\nconst DEFAULT_CONFIG: Required<ConfigurationOptions> = {\n EPSILON: 1e-12,\n debug: false,\n precision: 4,\n printTypes: false,\n printDegrees: false,\n printRowMajor: true,\n _cartographicRadians: false\n};\n\n// We use a global field to store the config\ndeclare global {\n // eslint-disable-next-line no-var\n var mathgl: {\n config: Required<ConfigurationOptions>;\n };\n}\n\n// Configuration is truly global as of v3.6 to ensure single config even if multiple copies of math.gl\n// Multiple copies of config can be quite tricky to debug...\nglobalThis.mathgl = globalThis.mathgl || {config: {...DEFAULT_CONFIG}};\n\nexport const config = globalThis.mathgl.config;\n\nexport function configure(options: Partial<ConfigurationOptions>): ConfigurationOptions {\n // Only copy existing keys\n Object.assign(config, options);\n return config;\n}\n\n/**\n * Formats a value into a string\n * @param value\n * @param param1\n * @returns\n */\nexport function formatValue(\n value: number,\n {precision = config.precision}: {precision?: number} = {}\n): string {\n value = round(value);\n // get rid of trailing zeros\n return `${parseFloat(value.toPrecision(precision))}`;\n}\n\n/**\n * Check if value is an \"array\"\n * Returns `true` if value is either an array or a typed array\n * Note: returns `false` for `ArrayBuffer` and `DataView` instances\n * @note isTypedArray and isNumericArray are often more useful in TypeScript\n */\nexport function isArray(value: unknown): boolean {\n return Array.isArray(value) || (ArrayBuffer.isView(value) && !(value instanceof DataView));\n}\n\nexport function clone(array: NumericArray | MathArray): NumericArray {\n return 'clone' in array ? array.clone() : array.slice();\n}\n\nexport function toRadians(degrees: number): number;\nexport function toRadians(degrees: NumericArray): NumericArray;\n\nexport function toRadians(degrees: number | NumericArray): number | NumericArray {\n return radians(degrees as NumericArray);\n}\n\nexport function toDegrees(degrees: number): number;\nexport function toDegrees(degrees: NumericArray): NumericArray;\n\nexport function toDegrees(radians: number | NumericArray): number | NumericArray {\n return degrees(radians as NumericArray);\n}\n\n// GLSL math function equivalents - Works on both single values and vectors\n\n/**\n * \"GLSL equivalent\" radians: Works on single values and vectors\n */\nexport function radians(degrees: number): number;\nexport function radians(degrees: NumericArray, result?: NumericArray): NumericArray;\n\nexport function radians(\n degrees: number | NumericArray,\n result?: NumericArray\n): number | NumericArray {\n return map(degrees, (degrees) => degrees * DEGREES_TO_RADIANS, result);\n}\n\n/**\n * \"GLSL equivalent\" degrees: Works on single values and vectors\n */\nexport function degrees(radians: number): number;\nexport function degrees(radians: NumericArray, result?: NumericArray): NumericArray;\n\nexport function degrees(\n radians: number | NumericArray,\n result?: NumericArray\n): number | NumericArray {\n return map(radians, (radians) => radians * RADIANS_TO_DEGREES, result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.sin`: Works on single values and vectors\n * @deprecated\n */\nexport function sin(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.sin(angle), result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.cos`: Works on single values and vectors\n * @deprecated\n */\nexport function cos(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.cos(angle), result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.tan`: Works on single values and vectors\n * @deprecated\n */\nexport function tan(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.tan(angle), result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.asin`: Works on single values and vectors\n * @deprecated\n */\nexport function asin(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.asin(angle), result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.acos`: Works on single values and vectors\n * @deprecated\n */\nexport function acos(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.acos(angle), result);\n}\n\n/**\n * \"GLSL equivalent\" of `Math.atan`: Works on single values and vectors\n * @deprecated\n */\nexport function atan(radians: number | NumericArray, result?: NumericArray): number | NumericArray {\n return map(radians, (angle) => Math.atan(angle), result);\n}\n\n/**\n * GLSL style value clamping: Works on single values and vectors\n */\nexport function clamp(value: number, min: number, max: number): number;\nexport function clamp(value: NumericArray, min: number, max: number): NumericArray;\n\nexport function clamp(\n value: number | NumericArray,\n min: number,\n max: number\n): number | NumericArray {\n return map(value, (value) => Math.max(min, Math.min(max, value)));\n}\n\n/**\n * Interpolate between two numbers or two arrays\n */\nexport function lerp(a: number, b: number, t: number): number;\nexport function lerp(a: NumericArray, b: NumericArray, t: number): NumericArray;\n\nexport function lerp(\n a: number | NumericArray,\n b: number | NumericArray,\n t: number\n): number | NumericArray {\n if (isArray(a)) {\n return (a as NumericArray).map((ai: number, i: number) => lerp(ai, (b as NumericArray)[i], t));\n }\n return t * (b as number) + (1 - t) * (a as number);\n}\n\n/* eslint-disable */\n\n/**\n * Compares any two math objects, using `equals` method if available.\n * @param a\n * @param b\n * @param epsilon\n * @returns\n */\nexport function equals(a: any, b: any, epsilon?: number): boolean {\n const oldEpsilon = config.EPSILON;\n if (epsilon) {\n config.EPSILON = epsilon;\n }\n try {\n if (a === b) {\n return true;\n }\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n // eslint-disable-next-line max-depth\n if (!equals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n if (a && a.equals) {\n return a.equals(b);\n }\n if (b && b.equals) {\n return b.equals(a);\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));\n }\n return false;\n } finally {\n config.EPSILON = oldEpsilon;\n }\n}\n\nexport function exactEquals(a: any, b: any): boolean {\n if (a === b) {\n return true;\n }\n if (a && typeof a === 'object' && b && typeof b === 'object') {\n if (a.constructor !== b.constructor) {\n return false;\n }\n if (a.exactEquals) {\n return a.exactEquals(b);\n }\n }\n if (isArray(a) && isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; ++i) {\n if (!exactEquals(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n\n/* eslint-enable */\n\nexport function withEpsilon<T>(epsilon: number, func: () => T): T {\n const oldPrecision = config.EPSILON;\n config.EPSILON = epsilon;\n let value: T;\n try {\n value = func();\n } finally {\n config.EPSILON = oldPrecision;\n }\n return value;\n}\n\n// HELPERS\n\nfunction round(value: number): number {\n return Math.round(value / config.EPSILON) * config.EPSILON;\n}\n\n// If the array has a clone function, calls it, otherwise returns a copy\nfunction duplicateArray(array: NumericArray): NumericArray {\n // @ts-expect-error We check for math.gl class methods\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n return array.clone ? (array.clone() as NumericArray) : (new Array(array.length) as number[]);\n}\n\n// If the argument value is an array, applies the func element wise,\n// otherwise applies func to the argument value\nfunction map(\n value: number | NumericArray,\n func: (x: number, index?: number, result?: NumericArray) => number,\n result?: NumericArray\n): number | NumericArray {\n if (isArray(value)) {\n const array = value as NumericArray;\n result = result || duplicateArray(array);\n for (let i = 0; i < result.length && i < array.length; ++i) {\n const val = typeof value === 'number' ? value : value[i];\n result[i] = func(val, i, result);\n }\n return result;\n }\n return func(value as number);\n}\n"],"file":"common.js"}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/gl-matrix-extras.ts"],"names":["vec2_transformMat4AsVector","out","a","m","x","y","w","vec3_transformMat4AsVector","z","vec3_transformMat2","vec4_transformMat2","vec4_transformMat3"],"mappings":"AAIA,OAAO,SAASA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AAP,GAAWD,CAAC,CAAC,CAAD,CAAD,GAAOE,CAA3B;AACAJ,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASC,CAAC,CAAC,CAAD,CAAV;AACAD,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASC,CAAC,CAAC,CAAD,CAAV;AACA,SAAOD,GAAP;AACD;AAED,OAAO,SAASU,kBAAT,CACLV,GADK,EAELC,CAFK,EAGLC,CAHK,EAIF;AACH,QAAMC,CAAC,GAAGF,CAAC,CAAC,CAAD,CAAX;AACA,QAAMG,CAAC,GAAGH,CAAC,CAAC,CAAD,CAAX;AACA,QAAMM,CAAC,GAAGN,CAAC,CAAC,CAAD,CAAX;AACAD,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASE,CAAC,CAAC,CAAD,CAAD,GAAOC,CAAP,GAAWD,CAAC,CAAC,CAAD,CAAD,GAAOE,CAAlB,GAAsBF,CAAC,CAAC,CAAD,CAAD,GAAOK,CAAtC;AACAP,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASE,CAAC,CAAC,CAAD,CAAD,GAAOC,CAAP,GAAWD,CAAC,CAAC,CAAD,CAAD,GAAOE,CAAlB,GAAsBF,CAAC,CAAC,CAAD,CAAD,GAAOK,CAAtC;AACAP,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASE,CAAC,CAAC,CAAD,CAAD,GAAOC,CAAP,GAAWD,CAAC,CAAC,CAAD,CAAD,GAAOE,CAAlB,GAAsBF,CAAC,CAAC,CAAD,CAAD,GAAOK,CAAtC;AACAP,EAAAA,GAAG,CAAC,CAAD,CAAH,GAASC,CAAC,CAAC,CAAD,CAAV;AACA,SAAOD,GAAP;AACD","sourcesContent":["/* eslint-disable camelcase */\nimport {NumericArray} from '@math.gl/types';\n// vec2 additions\n\nexport function vec2_transformMat4AsVector<T extends NumericArray>(\n out: T,\n a: Readonly<NumericArray>,\n m: Readonly<NumericArray>\n): T {\n const x = a[0];\n const y = a[1];\n const w = m[3] * x + m[7] * y || 1.0;\n out[0] = (m[0] * x + m[4] * y) / w;\n out[1] = (m[1] * x + m[5] * y) / w;\n return out;\n}\n\n// vec3 additions\n\n// Transform as vector, only uses 3x3 minor matrix\nexport function vec3_transformMat4AsVector<T extends NumericArray>(\n out: T,\n a: Readonly<NumericArray>,\n m: Readonly<NumericArray>\n): T {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n const w = m[3] * x + m[7] * y + m[11] * z || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;\n return out;\n}\n\nexport function vec3_transformMat2<T extends NumericArray>(\n out: T,\n a: Readonly<NumericArray>,\n m: Readonly<NumericArray>\n): T {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n out[2] = a[2];\n return out;\n}\n\n// vec4 additions\n\nexport function vec4_transformMat2<T extends NumericArray>(\n out: T,\n a: Readonly<NumericArray>,\n m: Readonly<NumericArray>\n): T {\n const x = a[0];\n const y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n\nexport function vec4_transformMat3<T extends NumericArray>(\n out: T,\n a: Readonly<NumericArray>,\n m: Readonly<NumericArray>\n): T {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = m[0] * x + m[3] * y + m[6] * z;\n out[1] = m[1] * x + m[4] * y + m[7] * z;\n out[2] = m[2] * x + m[5] * y + m[8] * z;\n out[3] = a[3];\n return out;\n}\n"],"file":"gl-matrix-extras.js"}
@@ -1,28 +1,25 @@
1
- declare const _default: {
2
- EPSILON1: number;
3
- EPSILON2: number;
4
- EPSILON3: number;
5
- EPSILON4: number;
6
- EPSILON5: number;
7
- EPSILON6: number;
8
- EPSILON7: number;
9
- EPSILON8: number;
10
- EPSILON9: number;
11
- EPSILON10: number;
12
- EPSILON11: number;
13
- EPSILON12: number;
14
- EPSILON13: number;
15
- EPSILON14: number;
16
- EPSILON15: number;
17
- EPSILON16: number;
18
- EPSILON17: number;
19
- EPSILON18: number;
20
- EPSILON19: number;
21
- EPSILON20: number;
22
- PI_OVER_TWO: number;
23
- PI_OVER_FOUR: number;
24
- PI_OVER_SIX: number;
25
- TWO_PI: number;
26
- };
27
- export default _default;
1
+ export declare const EPSILON1 = 0.1;
2
+ export declare const EPSILON2 = 0.01;
3
+ export declare const EPSILON3 = 0.001;
4
+ export declare const EPSILON4 = 0.0001;
5
+ export declare const EPSILON5 = 0.00001;
6
+ export declare const EPSILON6 = 0.000001;
7
+ export declare const EPSILON7 = 1e-7;
8
+ export declare const EPSILON8 = 1e-8;
9
+ export declare const EPSILON9 = 1e-9;
10
+ export declare const EPSILON10 = 1e-10;
11
+ export declare const EPSILON11 = 1e-11;
12
+ export declare const EPSILON12 = 1e-12;
13
+ export declare const EPSILON13 = 1e-13;
14
+ export declare const EPSILON14 = 1e-14;
15
+ export declare const EPSILON15 = 1e-15;
16
+ export declare const EPSILON16 = 1e-16;
17
+ export declare const EPSILON17 = 1e-17;
18
+ export declare const EPSILON18 = 1e-18;
19
+ export declare const EPSILON19 = 1e-19;
20
+ export declare const EPSILON20 = 1e-20;
21
+ export declare const PI_OVER_TWO: number;
22
+ export declare const PI_OVER_FOUR: number;
23
+ export declare const PI_OVER_SIX: number;
24
+ export declare const TWO_PI: number;
28
25
  //# sourceMappingURL=math-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"math-utils.d.ts","sourceRoot":"","sources":["../../src/lib/math-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBA2BE"}
1
+ {"version":3,"file":"math-utils.d.ts","sourceRoot":"","sources":["../../src/lib/math-utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,MAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,QAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,SAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,UAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,WAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,QAAQ,OAAO,CAAC;AAC7B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAC/B,eAAO,MAAM,SAAS,QAAQ,CAAC;AAE/B,eAAO,MAAM,WAAW,QAAc,CAAC;AACvC,eAAO,MAAM,YAAY,QAAc,CAAC;AACxC,eAAO,MAAM,WAAW,QAAc,CAAC;AAEvC,eAAO,MAAM,MAAM,QAAc,CAAC"}
@@ -0,0 +1,25 @@
1
+ export const EPSILON1 = 1e-1;
2
+ export const EPSILON2 = 1e-2;
3
+ export const EPSILON3 = 1e-3;
4
+ export const EPSILON4 = 1e-4;
5
+ export const EPSILON5 = 1e-5;
6
+ export const EPSILON6 = 1e-6;
7
+ export const EPSILON7 = 1e-7;
8
+ export const EPSILON8 = 1e-8;
9
+ export const EPSILON9 = 1e-9;
10
+ export const EPSILON10 = 1e-10;
11
+ export const EPSILON11 = 1e-11;
12
+ export const EPSILON12 = 1e-12;
13
+ export const EPSILON13 = 1e-13;
14
+ export const EPSILON14 = 1e-14;
15
+ export const EPSILON15 = 1e-15;
16
+ export const EPSILON16 = 1e-16;
17
+ export const EPSILON17 = 1e-17;
18
+ export const EPSILON18 = 1e-18;
19
+ export const EPSILON19 = 1e-19;
20
+ export const EPSILON20 = 1e-20;
21
+ export const PI_OVER_TWO = Math.PI / 2;
22
+ export const PI_OVER_FOUR = Math.PI / 4;
23
+ export const PI_OVER_SIX = Math.PI / 6;
24
+ export const TWO_PI = Math.PI * 2;
25
+ //# sourceMappingURL=math-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/math-utils.ts"],"names":["EPSILON1","EPSILON2","EPSILON3","EPSILON4","EPSILON5","EPSILON6","EPSILON7","EPSILON8","EPSILON9","EPSILON10","EPSILON11","EPSILON12","EPSILON13","EPSILON14","EPSILON15","EPSILON16","EPSILON17","EPSILON18","EPSILON19","EPSILON20","PI_OVER_TWO","Math","PI","PI_OVER_FOUR","PI_OVER_SIX","TWO_PI"],"mappings":"AAEA,OAAO,MAAMA,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,QAAQ,GAAG,IAAjB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AACP,OAAO,MAAMC,SAAS,GAAG,KAAlB;AAEP,OAAO,MAAMC,WAAW,GAAGC,IAAI,CAACC,EAAL,GAAU,CAA9B;AACP,OAAO,MAAMC,YAAY,GAAGF,IAAI,CAACC,EAAL,GAAU,CAA/B;AACP,OAAO,MAAME,WAAW,GAAGH,IAAI,CAACC,EAAL,GAAU,CAA9B;AAEP,OAAO,MAAMG,MAAM,GAAGJ,IAAI,CAACC,EAAL,GAAU,CAAzB","sourcesContent":["// NOTE: Added to make Cesium-derived test cases work\n// TODO: Determine if/how to keep\nexport const EPSILON1 = 1e-1;\nexport const EPSILON2 = 1e-2;\nexport const EPSILON3 = 1e-3;\nexport const EPSILON4 = 1e-4;\nexport const EPSILON5 = 1e-5;\nexport const EPSILON6 = 1e-6;\nexport const EPSILON7 = 1e-7;\nexport const EPSILON8 = 1e-8;\nexport const EPSILON9 = 1e-9;\nexport const EPSILON10 = 1e-10;\nexport const EPSILON11 = 1e-11;\nexport const EPSILON12 = 1e-12;\nexport const EPSILON13 = 1e-13;\nexport const EPSILON14 = 1e-14;\nexport const EPSILON15 = 1e-15;\nexport const EPSILON16 = 1e-16;\nexport const EPSILON17 = 1e-17;\nexport const EPSILON18 = 1e-18;\nexport const EPSILON19 = 1e-19;\nexport const EPSILON20 = 1e-20;\n\nexport const PI_OVER_TWO = Math.PI / 2;\nexport const PI_OVER_FOUR = Math.PI / 4;\nexport const PI_OVER_SIX = Math.PI / 6;\n\nexport const TWO_PI = Math.PI * 2;\n"],"file":"math-utils.js"}
@@ -1,6 +1,6 @@
1
1
  import { NumberArray } from '@math.gl/types';
2
2
  export declare function validateVector(v: NumberArray, length: number): boolean;
3
- export declare function checkNumber(value: any): number;
3
+ export declare function checkNumber(value: unknown): number;
4
4
  export declare function checkVector<T extends NumberArray>(v: T, length: number, callerName?: string): T;
5
5
  export declare function deprecated(method: string, version: string): void;
6
6
  //# sourceMappingURL=validators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/lib/validators.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAWtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAK9C;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/C,CAAC,EAAE,CAAC,EACJ,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAW,GACtB,CAAC,CAKH;AAID,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQhE"}
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/lib/validators.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAWtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKlD;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/C,CAAC,EAAE,CAAC,EACJ,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAW,GACtB,CAAC,CAKH;AAID,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQhE"}
@@ -1,4 +1,4 @@
1
- import { config } from './common';
1
+ import { config } from "./common.js";
2
2
  export function validateVector(v, length) {
3
3
  if (v.length !== length) {
4
4
  return false;
@@ -14,7 +14,7 @@ export function validateVector(v, length) {
14
14
  }
15
15
  export function checkNumber(value) {
16
16
  if (!Number.isFinite(value)) {
17
- throw new Error("Invalid number ".concat(value));
17
+ throw new Error("Invalid number ".concat(JSON.stringify(value)));
18
18
  }
19
19
 
20
20
  return value;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/validators.ts"],"names":["config","validateVector","v","length","i","Number","isFinite","checkNumber","value","Error","JSON","stringify","checkVector","callerName","debug","map","deprecated","method","version","console","warn"],"mappings":"SAoBQA,M;AAER,OAAO,SAASC,cAAT,CAAwBC,CAAxB,EAAwCC,MAAxC,EAAiE;AACtE,MAAID,CAAC,CAACC,MAAF,KAAaA,MAAjB,EAAyB;AACvB,WAAO,KAAP;AACD;;AAED,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,CAAC,CAACC,MAAtB,EAA8B,EAAEC,CAAhC,EAAmC;AACjC,QAAI,CAACC,MAAM,CAACC,QAAP,CAAgBJ,CAAC,CAACE,CAAD,CAAjB,CAAL,EAA4B;AAC1B,aAAO,KAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD;AAED,OAAO,SAASG,WAAT,CAAqBC,KAArB,EAA6C;AAClD,MAAI,CAACH,MAAM,CAACC,QAAP,CAAgBE,KAAhB,CAAL,EAA6B;AAC3B,UAAM,IAAIC,KAAJ,0BAA4BC,IAAI,CAACC,SAAL,CAAeH,KAAf,CAA5B,EAAN;AACD;;AACD,SAAOA,KAAP;AACD;AAED,OAAO,SAASI,WAAT,CACLV,CADK,EAELC,MAFK,EAGLU,UAAkB,GAAG,EAHhB,EAIF;AACH,MAAIb,MAAM,CAACc,KAAP,IAAgB,CAACb,cAAc,CAACC,CAAD,EAAIC,MAAJ,CAAnC,EAAgD;AAC9C,UAAM,IAAIM,KAAJ,oBAAsBI,UAAtB,0CAAN;AACD;;AACD,SAAOX,CAAP;AACD;AAED,MAAMa,GAA4B,GAAG,EAArC;AAEA,OAAO,SAASC,UAAT,CAAoBC,MAApB,EAAoCC,OAApC,EAA2D;AAChE,MAAI,CAACH,GAAG,CAACE,MAAD,CAAR,EAAkB;AAChBF,IAAAA,GAAG,CAACE,MAAD,CAAH,GAAc,IAAd;AAEAE,IAAAA,OAAO,CAACC,IAAR,WACKH,MADL,0CAC2CC,OAD3C;AAGD;AACF","sourcesContent":["// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport {NumberArray} from '@math.gl/types';\nimport {config} from './common';\n\nexport function validateVector(v: NumberArray, length: number): boolean {\n if (v.length !== length) {\n return false;\n }\n // Could be arguments \"array\" (v.every not availasble)\n for (let i = 0; i < v.length; ++i) {\n if (!Number.isFinite(v[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport function checkNumber(value: unknown): number {\n if (!Number.isFinite(value)) {\n throw new Error(`Invalid number ${JSON.stringify(value)}`);\n }\n return value as number;\n}\n\nexport function checkVector<T extends NumberArray>(\n v: T,\n length: number,\n callerName: string = ''\n): T {\n if (config.debug && !validateVector(v, length)) {\n throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);\n }\n return v;\n}\n\nconst map: Record<string, boolean> = {};\n\nexport function deprecated(method: string, version: string): void {\n if (!map[method]) {\n map[method] = true;\n // eslint-disable-next-line\n console.warn(\n `${method} has been removed in version ${version}, see upgrade guide for more information`\n );\n }\n}\n"],"file":"validators.js"}
package/package.json CHANGED
@@ -2,10 +2,11 @@
2
2
  "name": "@math.gl/core",
3
3
  "description": "Array-based 3D Math Classes optimized for WebGL applications",
4
4
  "license": "MIT",
5
+ "type": "module",
5
6
  "publishConfig": {
6
7
  "access": "public"
7
8
  },
8
- "version": "3.6.3",
9
+ "version": "4.0.0-alpha.2",
9
10
  "keywords": [
10
11
  "webgl",
11
12
  "javascript",
@@ -27,8 +28,8 @@
27
28
  "url": "https://github.com/uber-web/math.gl.git"
28
29
  },
29
30
  "types": "dist/index.d.ts",
30
- "main": "dist/es5/index.js",
31
- "module": "dist/esm/index.js",
31
+ "main": "dist/index.cjs",
32
+ "module": "dist/index.js",
32
33
  "files": [
33
34
  "dist",
34
35
  "src"
@@ -38,8 +39,7 @@
38
39
  ],
39
40
  "dependencies": {
40
41
  "@babel/runtime": "^7.12.0",
41
- "@math.gl/types": "3.6.3",
42
- "gl-matrix": "^3.4.0"
42
+ "@math.gl/types": "4.0.0-alpha.2"
43
43
  },
44
- "gitHead": "0efab394df9babad7ed93027c1003f30528b2090"
44
+ "gitHead": "2e693639e3cf898fee8e323c93efdd07be7c2ca7"
45
45
  }
@@ -3,13 +3,13 @@ import {NumericArray} from '@math.gl/types';
3
3
  import {ConfigurationOptions, config, formatValue, equals, isArray} from '../../lib/common';
4
4
 
5
5
  /** Base class for vectors and matrices */
6
- export default abstract class MathArray extends Array<number> {
6
+ export abstract class MathArray extends Array<number> {
7
7
  /** Number of elements (values) in this array */
8
8
  abstract get ELEMENTS(): number;
9
9
 
10
10
  abstract copy(vector: Readonly<NumericArray>): this;
11
11
 
12
- abstract fromObject(object: object): this;
12
+ abstract fromObject(object: Record<string, unknown>): this;
13
13
 
14
14
  // Common methods
15
15
 
@@ -39,14 +39,21 @@ export default abstract class MathArray extends Array<number> {
39
39
  return targetArray;
40
40
  }
41
41
 
42
- from(arrayOrObject: Readonly<NumericArray> | object): this {
43
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
42
+ toObject(targetObject: Record<string, unknown>): Record<string, unknown> {
43
+ return targetObject;
44
44
  }
45
45
 
46
- to<T extends NumericArray | object>(arrayOrObject: T): T {
46
+ from(arrayOrObject: Readonly<NumericArray> | Record<string, unknown>): this {
47
+ return Array.isArray(arrayOrObject)
48
+ ? this.copy(arrayOrObject)
49
+ : // @ts-ignore
50
+ this.fromObject(arrayOrObject);
51
+ }
52
+
53
+ to<T extends NumericArray | Record<string, unknown>>(arrayOrObject: T): T {
47
54
  // @ts-ignore
48
55
  if (arrayOrObject === this) {
49
- return this;
56
+ return this as T;
50
57
  }
51
58
  // @ts-expect-error TS2339: Property 'toObject' does not exist on type 'MathArray'.
52
59
  return isArray(arrayOrObject) ? this.toArray(arrayOrObject) : this.toObject(arrayOrObject);
@@ -61,7 +68,7 @@ export default abstract class MathArray extends Array<number> {
61
68
  return new Float32Array(this);
62
69
  }
63
70
 
64
- toString(): string {
71
+ override toString(): string {
65
72
  return this.formatString(config);
66
73
  }
67
74
 
@@ -118,7 +125,8 @@ export default abstract class MathArray extends Array<number> {
118
125
  }
119
126
  for (let i = 0; i < this.ELEMENTS; ++i) {
120
127
  const ai = a[i];
121
- this[i] = ai + t * (b[i] - ai);
128
+ const endValue = typeof b === 'number' ? b : b[i];
129
+ this[i] = ai + t * (endValue - ai);
122
130
  }
123
131
  return this.check();
124
132
  }
@@ -1,12 +1,12 @@
1
1
  // Copyright (c) 2017 Uber Technologies, Inc.
2
2
  // MIT License
3
3
  import {NumericArray} from '@math.gl/types';
4
- import MathArray from './math-array';
4
+ import {MathArray} from './math-array';
5
5
  import {checkNumber} from '../../lib/validators';
6
6
  import {config} from '../../lib/common';
7
7
 
8
8
  /** Base class for matrices */
9
- export default abstract class Matrix extends MathArray {
9
+ export abstract class Matrix extends MathArray {
10
10
  abstract get RANK(): number;
11
11
 
12
12
  // fromObject(object) {
@@ -20,7 +20,7 @@ export default abstract class Matrix extends MathArray {
20
20
  // }
21
21
 
22
22
  // TODO better override formatString?
23
- toString(): string {
23
+ override toString(): string {
24
24
  let string = '[';
25
25
  if (config.printRowMajor) {
26
26
  string += 'row-major:';
@@ -56,7 +56,10 @@ export default abstract class Matrix extends MathArray {
56
56
  getColumn<NumArrayT>(columnIndex: number, result: NumArrayT): NumArrayT;
57
57
  getColumn(columnIndex: number): number[];
58
58
 
59
- getColumn(columnIndex: number, result: number[] = new Array(this.RANK).fill(-0)): number[] {
59
+ getColumn(
60
+ columnIndex: number,
61
+ result: number[] = new Array<number>(this.RANK).fill(-0)
62
+ ): number[] {
60
63
  const firstIndex = columnIndex * this.RANK;
61
64
  for (let i = 0; i < this.RANK; ++i) {
62
65
  result[i] = this[firstIndex + i];
@@ -1,12 +1,12 @@
1
1
  // Copyright (c) 2017 Uber Technologies, Inc.
2
2
  // MIT License
3
3
  import {NumericArray} from '@math.gl/types';
4
- import MathArray from './math-array';
4
+ import {MathArray} from './math-array';
5
5
  import {checkNumber} from '../../lib/validators';
6
- import assert from '../../lib/assert';
6
+ import {assert} from '../../lib/assert';
7
7
 
8
8
  /** Base class for vectors with at least 2 elements */
9
- export default abstract class Vector extends MathArray {
9
+ export abstract class Vector extends MathArray {
10
10
  // ACCESSORS
11
11
 
12
12
  get x(): number {
@@ -148,6 +148,6 @@ export default abstract class Vector extends MathArray {
148
148
 
149
149
  addScaledVector(a: Readonly<NumericArray>, b: number): this {
150
150
  // @ts-expect-error error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
151
- return this.add(new this.constructor(a).multiplyScalar(b));
151
+ return this.add((new this.constructor(a) as this).multiplyScalar(b));
152
152
  }
153
153
  }
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) 2017 Uber Technologies, Inc.
2
2
  // MIT License
3
- import MathArray from './base/math-array';
4
- import Quaternion from './quaternion';
3
+ import {MathArray} from './base/math-array';
4
+ import {Quaternion} from './quaternion';
5
5
  import {NumericArray} from '@math.gl/types';
6
6
 
7
7
  import {clamp} from '../lib/common';
@@ -20,7 +20,7 @@ enum RotationOrder {
20
20
  XYZ = 5
21
21
  }
22
22
 
23
- export default class Euler extends MathArray {
23
+ export class Euler extends MathArray {
24
24
  // Constants
25
25
  static get ZYX(): RotationOrder {
26
26
  return RotationOrder.ZYX;
@@ -92,7 +92,8 @@ export default class Euler extends MathArray {
92
92
  return this.set(roll, pitch, yaw, Euler.RollPitchYaw);
93
93
  }
94
94
 
95
- fromObject(object: object): this {
95
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
96
+ fromObject(object: Record<string, unknown>): this {
96
97
  throw new Error('not implemented');
97
98
  // return this.set(object.x, object.y, object.z, object.order);
98
99
  }
@@ -121,7 +122,7 @@ export default class Euler extends MathArray {
121
122
  return this.check();
122
123
  }
123
124
 
124
- validate(): boolean {
125
+ override validate(): boolean {
125
126
  return (
126
127
  validateOrder(this[3]) &&
127
128
  Number.isFinite(this[0]) &&
@@ -131,7 +132,7 @@ export default class Euler extends MathArray {
131
132
  }
132
133
 
133
134
  // Does not copy the orientation element
134
- toArray(array: NumericArray = [], offset: number = 0): NumericArray {
135
+ override toArray(array: NumericArray = [], offset: number = 0): NumericArray {
135
136
  array[offset] = this[0];
136
137
  array[offset + 1] = this[1];
137
138
  array[offset + 2] = this[2];
@@ -256,7 +257,7 @@ export default class Euler extends MathArray {
256
257
  }
257
258
 
258
259
  // TODO - with and without 4th element
259
- fromArray(array: Readonly<NumericArray>, offset: number = 0): this {
260
+ override fromArray(array: Readonly<NumericArray>, offset: number = 0): this {
260
261
  this[0] = array[0 + offset];
261
262
  this[1] = array[1 + offset];
262
263
  this[2] = array[2 + offset];
@@ -285,7 +286,7 @@ export default class Euler extends MathArray {
285
286
  // TODO - move to Quaternion
286
287
  getQuaternion(): Quaternion {
287
288
  const q = new Quaternion();
288
- switch (this[4]) {
289
+ switch (this[3]) {
289
290
  case RotationOrder.XYZ:
290
291
  return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
291
292
  case RotationOrder.YXZ: