@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.
- package/LICENSE +51 -0
- package/dist/classes/euler.d.ts +37 -25
- package/dist/classes/euler.d.ts.map +1 -1
- package/dist/classes/euler.js +104 -59
- package/dist/classes/euler.js.map +1 -1
- package/dist/classes/matrix3.d.ts +0 -17
- package/dist/classes/matrix3.d.ts.map +1 -1
- package/dist/classes/matrix3.js +0 -43
- package/dist/classes/matrix3.js.map +1 -1
- package/dist/classes/pose.d.ts.map +1 -1
- package/dist/classes/pose.js +2 -3
- package/dist/classes/pose.js.map +1 -1
- package/dist/gl-matrix/common.d.ts.map +1 -1
- package/dist/gl-matrix/mat3.d.ts +3 -3
- package/dist/gl-matrix/mat3.d.ts.map +1 -1
- package/dist/gl-matrix/mat3.js +1 -1
- package/dist/gl-matrix/mat3.js.map +1 -1
- package/dist/gl-matrix/mat4.d.ts +3 -3
- package/dist/gl-matrix/mat4.d.ts.map +1 -1
- package/dist/gl-matrix/mat4.js +1 -1
- package/dist/gl-matrix/mat4.js.map +1 -1
- package/dist/gl-matrix/quat.d.ts +1 -1
- package/dist/gl-matrix/quat.d.ts.map +1 -1
- package/dist/gl-matrix/quat.js +1 -1
- package/dist/gl-matrix/quat.js.map +1 -1
- package/dist/gl-matrix/vec2.js +1 -1
- package/dist/gl-matrix/vec2.js.map +1 -1
- package/dist/gl-matrix/vec3.d.ts +3 -3
- package/dist/gl-matrix/vec3.d.ts.map +1 -1
- package/dist/gl-matrix/vec3.js +1 -1
- package/dist/gl-matrix/vec3.js.map +1 -1
- package/dist/gl-matrix/vec4.d.ts +3 -3
- package/dist/gl-matrix/vec4.d.ts.map +1 -1
- package/dist/gl-matrix/vec4.js +1 -1
- package/dist/gl-matrix/vec4.js.map +1 -1
- package/dist/index.cjs +194 -186
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/common.js +9 -9
- package/dist/lib/common.js.map +1 -1
- package/dist/lib/validators.js +1 -1
- package/dist/lib/validators.js.map +1 -1
- package/package.json +3 -3
- package/src/classes/euler.ts +116 -65
- package/src/classes/matrix3.ts +0 -49
- package/src/classes/pose.ts +2 -3
- package/src/gl-matrix/mat3.ts +1 -1
- package/src/gl-matrix/mat4.ts +1 -1
- package/src/gl-matrix/quat.ts +1 -1
- package/src/gl-matrix/vec2.ts +1 -1
- package/src/gl-matrix/vec3.ts +1 -1
- package/src/gl-matrix/vec4.ts +1 -1
- package/src/index.ts +4 -0
- package/src/lib/common.ts +9 -9
- package/src/lib/gl-matrix.d.ts +10 -0
- package/src/lib/validators.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type { TypedArray, TypedArrayConstructor, NumericArray, NumberArray, NumberArray2, NumberArray3, NumberArray4, NumberArray6, NumberArray8, NumberArray9, NumberArray12, NumberArray16 } from '@math.gl/types';
|
|
2
2
|
export type { isTypedArray, isNumberArray, isNumericArray } from '@math.gl/types';
|
|
3
|
+
export { MathArray as _MathArray } from "./classes/base/math-array.js";
|
|
4
|
+
export { Matrix as _Matrix } from "./classes/base/matrix.js";
|
|
5
|
+
export { Vector as _Vector } from "./classes/base/vector.js";
|
|
3
6
|
export { Vector2 } from "./classes/vector2.js";
|
|
4
7
|
export { Vector3 } from "./classes/vector3.js";
|
|
5
8
|
export { Vector4 } from "./classes/vector4.js";
|
|
@@ -14,6 +17,7 @@ export type { Matrix4Like } from "./classes/matrix4.js";
|
|
|
14
17
|
export { SphericalCoordinates } from "./classes/spherical-coordinates.js";
|
|
15
18
|
export { Pose } from "./classes/pose.js";
|
|
16
19
|
export { Euler } from "./classes/euler.js";
|
|
20
|
+
export type { EulerRotationOrder } from "./classes/euler.js";
|
|
17
21
|
export * as _MathUtils from "./lib/math-utils.js";
|
|
18
22
|
export { assert } from "./lib/assert.js";
|
|
19
23
|
export { config, configure, safeMod, normalizeAngle, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon } from "./lib/common.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAGhF,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,UAAU,EAAC,gCAA6B;AAEhD,YAAY,EAAC,WAAW,EAAC,6BAA0B;AACnD,YAAY,EAAC,WAAW,EAAC,6BAA0B;AACnD,YAAY,EAAC,WAAW,EAAC,6BAA0B;AACnD,YAAY,EAAC,WAAW,EAAC,6BAA0B;AACnD,YAAY,EAAC,WAAW,EAAC,6BAA0B;AAGnD,OAAO,EAAC,oBAAoB,EAAC,2CAAwC;AACrE,OAAO,EAAC,IAAI,EAAC,0BAAuB;AACpC,OAAO,EAAC,KAAK,EAAC,2BAAwB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,YAA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AK,EACL,IAAI,EACJ,WAAW,EACZ,wBAAqB;AAGtB,OAAO,EAAC,oBAAoB,IAAI,qBAAqB,EAAC,2CAAwC;AAC9F,OAAO,EAAC,IAAI,IAAI,KAAK,EAAC,0BAAuB;AAC7C,OAAO,EAAC,KAAK,IAAI,MAAM,EAAC,2BAAwB;AAEhD,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,kCAAkC;AAClC,OAAO,KAAK,IAAI,4BAAyB;AACzC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// classes
|
|
5
|
+
export { MathArray as _MathArray } from "./classes/base/math-array.js";
|
|
6
|
+
export { Matrix as _Matrix } from "./classes/base/matrix.js";
|
|
7
|
+
export { Vector as _Vector } from "./classes/base/vector.js";
|
|
5
8
|
export { Vector2 } from "./classes/vector2.js";
|
|
6
9
|
export { Vector3 } from "./classes/vector3.js";
|
|
7
10
|
export { Vector4 } from "./classes/vector4.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAoBpC,UAAU;AACV,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C,OAAO,EAAC,OAAO,EAAC,6BAA0B;AAC1C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I,qBAAqB,EAAC,2CAAwC;AAC9F,OAAO,EAAC,IAAI,IAAI,KAAK,EAAC,0BAAuB;AAC7C,OAAO,EAAC,KAAK,IAAI,MAAM,EAAC,2BAAwB;AAEhD,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,kCAAkC;AAClC,OAAO,KAAK,IAAI,4BAAyB;AACzC,4BAA4B;AAC5B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB;AACzC,8BAA8B;AAC9B,OAAO,KAAK,IAAI,4BAAyB"}
|
package/dist/lib/common.js
CHANGED
|
@@ -52,10 +52,10 @@ export function toDegrees(radians) {
|
|
|
52
52
|
return degrees(radians);
|
|
53
53
|
}
|
|
54
54
|
export function radians(degrees, result) {
|
|
55
|
-
return map(degrees,
|
|
55
|
+
return map(degrees, degrees => degrees * DEGREES_TO_RADIANS, result);
|
|
56
56
|
}
|
|
57
57
|
export function degrees(radians, result) {
|
|
58
|
-
return map(radians,
|
|
58
|
+
return map(radians, radians => radians * RADIANS_TO_DEGREES, result);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* The modulo operation that also works for negative dividends.
|
|
@@ -120,45 +120,45 @@ function negativePiToPi(angle) {
|
|
|
120
120
|
* @deprecated
|
|
121
121
|
*/
|
|
122
122
|
export function sin(radians, result) {
|
|
123
|
-
return map(radians,
|
|
123
|
+
return map(radians, angle => Math.sin(angle), result);
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* "GLSL equivalent" of `Math.cos`: Works on single values and vectors
|
|
127
127
|
* @deprecated
|
|
128
128
|
*/
|
|
129
129
|
export function cos(radians, result) {
|
|
130
|
-
return map(radians,
|
|
130
|
+
return map(radians, angle => Math.cos(angle), result);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
* "GLSL equivalent" of `Math.tan`: Works on single values and vectors
|
|
134
134
|
* @deprecated
|
|
135
135
|
*/
|
|
136
136
|
export function tan(radians, result) {
|
|
137
|
-
return map(radians,
|
|
137
|
+
return map(radians, angle => Math.tan(angle), result);
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* "GLSL equivalent" of `Math.asin`: Works on single values and vectors
|
|
141
141
|
* @deprecated
|
|
142
142
|
*/
|
|
143
143
|
export function asin(radians, result) {
|
|
144
|
-
return map(radians,
|
|
144
|
+
return map(radians, angle => Math.asin(angle), result);
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* "GLSL equivalent" of `Math.acos`: Works on single values and vectors
|
|
148
148
|
* @deprecated
|
|
149
149
|
*/
|
|
150
150
|
export function acos(radians, result) {
|
|
151
|
-
return map(radians,
|
|
151
|
+
return map(radians, angle => Math.acos(angle), result);
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* "GLSL equivalent" of `Math.atan`: Works on single values and vectors
|
|
155
155
|
* @deprecated
|
|
156
156
|
*/
|
|
157
157
|
export function atan(radians, result) {
|
|
158
|
-
return map(radians,
|
|
158
|
+
return map(radians, angle => Math.atan(angle), result);
|
|
159
159
|
}
|
|
160
160
|
export function clamp(value, min, max) {
|
|
161
|
-
return map(value,
|
|
161
|
+
return map(value, value => Math.max(min, Math.min(max, value)));
|
|
162
162
|
}
|
|
163
163
|
export function lerp(a, b, t) {
|
|
164
164
|
if (isArray(a)) {
|
package/dist/lib/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/lib/common.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAOpC,OAAO,EAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAC,wBAAqB;AAEnD,MAAM,kBAAkB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AAC/C,MAAM,kBAAkB,GAAG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,CAAC;AAC/F,CAAC;AAED,oEAAoE;AACpE,+CAA+C;AAC/C,SAAS,GAAG,CACV,KAA4B,EAC5B,IAAuE,EACvE,MAAqB;IAErB,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,KAAqB,CAAC;QACpC,MAAM,GAAG,MAAM,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3D,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACzD,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC,KAAe,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/lib/validators.js
CHANGED
|
@@ -30,7 +30,7 @@ const map = {};
|
|
|
30
30
|
export function deprecated(method, version) {
|
|
31
31
|
if (!map[method]) {
|
|
32
32
|
map[method] = true;
|
|
33
|
-
//
|
|
33
|
+
// biome-ignore lint/suspicious/noConsole: deprecations are intentionally reported to users.
|
|
34
34
|
console.warn(`${method} has been removed in version ${version}, see upgrade guide for more information`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/lib/validators.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,MAAM,EAAC,oBAAiB;AAEhC,MAAM,UAAU,cAAc,CAAC,CAAe,EAAE,MAAc;IAC5D,IAAI,CAAC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ED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"version": "4.2.0-alpha.
|
|
9
|
+
"version": "4.2.0-alpha.6",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"webgl",
|
|
12
12
|
"javascript",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"./src/lib/common.js"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@math.gl/types": "4.2.0-alpha.
|
|
48
|
+
"@math.gl/types": "4.2.0-alpha.6"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "b1d477a0afa7033ce6ac837bb4c811b425e99566"
|
|
51
51
|
}
|
package/src/classes/euler.ts
CHANGED
|
@@ -14,8 +14,10 @@ import {checkNumber} from '../lib/validators';
|
|
|
14
14
|
const ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
|
|
15
15
|
const ALMOST_ONE = 0.99999;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/** Order in which Euler rotations are applied. */
|
|
18
|
+
export type EulerRotationOrder = 'zyx' | 'yxz' | 'xzy' | 'zxy' | 'yzx' | 'xyz';
|
|
19
|
+
|
|
20
|
+
enum RotationOrderIndex {
|
|
19
21
|
ZYX = 0,
|
|
20
22
|
YXZ = 1,
|
|
21
23
|
XZY = 2,
|
|
@@ -24,37 +26,65 @@ enum RotationOrder {
|
|
|
24
26
|
XYZ = 5
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
const ROTATION_ORDER_INDICES: Record<EulerRotationOrder, RotationOrderIndex> = {
|
|
30
|
+
zyx: RotationOrderIndex.ZYX,
|
|
31
|
+
yxz: RotationOrderIndex.YXZ,
|
|
32
|
+
xzy: RotationOrderIndex.XZY,
|
|
33
|
+
zxy: RotationOrderIndex.ZXY,
|
|
34
|
+
yzx: RotationOrderIndex.YZX,
|
|
35
|
+
xyz: RotationOrderIndex.XYZ
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const ROTATION_ORDERS = {
|
|
39
|
+
ZYX: 'zyx',
|
|
40
|
+
YXZ: 'yxz',
|
|
41
|
+
XZY: 'xzy',
|
|
42
|
+
ZXY: 'zxy',
|
|
43
|
+
YZX: 'yzx',
|
|
44
|
+
XYZ: 'xyz'
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
27
47
|
export class Euler extends MathArray {
|
|
28
48
|
// Constants
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
/** @deprecated Pass the string `'zyx'` directly. */
|
|
50
|
+
static get ZYX(): EulerRotationOrder {
|
|
51
|
+
return 'zyx';
|
|
31
52
|
}
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
/** @deprecated Pass the string `'yxz'` directly. */
|
|
54
|
+
static get YXZ(): EulerRotationOrder {
|
|
55
|
+
return 'yxz';
|
|
34
56
|
}
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
/** @deprecated Pass the string `'xzy'` directly. */
|
|
58
|
+
static get XZY(): EulerRotationOrder {
|
|
59
|
+
return 'xzy';
|
|
37
60
|
}
|
|
38
|
-
|
|
39
|
-
|
|
61
|
+
/** @deprecated Pass the string `'zxy'` directly. */
|
|
62
|
+
static get ZXY(): EulerRotationOrder {
|
|
63
|
+
return 'zxy';
|
|
40
64
|
}
|
|
41
|
-
|
|
42
|
-
|
|
65
|
+
/** @deprecated Pass the string `'yzx'` directly. */
|
|
66
|
+
static get YZX(): EulerRotationOrder {
|
|
67
|
+
return 'yzx';
|
|
43
68
|
}
|
|
44
|
-
|
|
45
|
-
|
|
69
|
+
/** @deprecated Pass the string `'xyz'` directly. */
|
|
70
|
+
static get XYZ(): EulerRotationOrder {
|
|
71
|
+
return 'xyz';
|
|
46
72
|
}
|
|
47
|
-
|
|
48
|
-
|
|
73
|
+
/** @deprecated Pass the string `'zyx'` directly. */
|
|
74
|
+
static get RollPitchYaw(): EulerRotationOrder {
|
|
75
|
+
return 'zyx';
|
|
49
76
|
}
|
|
50
|
-
|
|
51
|
-
|
|
77
|
+
/** @deprecated Pass the string `'zyx'` directly. */
|
|
78
|
+
static get DefaultOrder(): EulerRotationOrder {
|
|
79
|
+
return 'zyx';
|
|
52
80
|
}
|
|
53
|
-
|
|
54
|
-
|
|
81
|
+
/** @deprecated Pass an {@link EulerRotationOrder} string directly. */
|
|
82
|
+
static get RotationOrders(): typeof ROTATION_ORDERS {
|
|
83
|
+
return ROTATION_ORDERS;
|
|
55
84
|
}
|
|
56
|
-
|
|
57
|
-
|
|
85
|
+
/** @deprecated Euler rotation orders are already represented as strings. */
|
|
86
|
+
static rotationOrder(order: EulerRotationOrder): EulerRotationOrder {
|
|
87
|
+
return order;
|
|
58
88
|
}
|
|
59
89
|
get ELEMENTS(): number {
|
|
60
90
|
return 4;
|
|
@@ -67,7 +97,7 @@ export class Euler extends MathArray {
|
|
|
67
97
|
* @param {Number=} [z]
|
|
68
98
|
* @param {Number=} [order]
|
|
69
99
|
*/
|
|
70
|
-
constructor(x = 0, y = 0, z = 0, order =
|
|
100
|
+
constructor(x = 0, y = 0, z = 0, order: EulerRotationOrder = 'zyx') {
|
|
71
101
|
// PERF NOTE: initialize elements as double precision numbers
|
|
72
102
|
super(-0, -0, -0, -0);
|
|
73
103
|
// eslint-disable-next-line prefer-rest-params
|
|
@@ -93,7 +123,7 @@ export class Euler extends MathArray {
|
|
|
93
123
|
const roll = Math.atan2(t3, t4);
|
|
94
124
|
const pitch = Math.asin(t2);
|
|
95
125
|
const yaw = Math.atan2(t1, t0);
|
|
96
|
-
return this.set(roll, pitch, yaw,
|
|
126
|
+
return this.set(roll, pitch, yaw, 'zyx');
|
|
97
127
|
}
|
|
98
128
|
|
|
99
129
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -111,18 +141,19 @@ export class Euler extends MathArray {
|
|
|
111
141
|
this[0] = array[0];
|
|
112
142
|
this[1] = array[1];
|
|
113
143
|
this[2] = array[2];
|
|
114
|
-
|
|
115
|
-
|
|
144
|
+
if (Number.isFinite(array[3]) && validateOrder(array[3])) {
|
|
145
|
+
this[3] = array[3];
|
|
146
|
+
}
|
|
116
147
|
return this.check();
|
|
117
148
|
}
|
|
118
149
|
|
|
119
150
|
// Sets the three angles, and optionally sets the rotation order
|
|
120
151
|
// If order is not specified, preserves currently set order
|
|
121
|
-
set(x = 0, y = 0, z = 0, order:
|
|
152
|
+
set(x = 0, y = 0, z = 0, order: EulerRotationOrder): this {
|
|
122
153
|
this[0] = x;
|
|
123
154
|
this[1] = y;
|
|
124
155
|
this[2] = z;
|
|
125
|
-
this[3] =
|
|
156
|
+
this[3] = order ? checkOrder(order) : this[3];
|
|
126
157
|
return this.check();
|
|
127
158
|
}
|
|
128
159
|
|
|
@@ -248,16 +279,16 @@ export class Euler extends MathArray {
|
|
|
248
279
|
}
|
|
249
280
|
|
|
250
281
|
// rotation order, in all three angle notations
|
|
251
|
-
get order():
|
|
252
|
-
return this[3];
|
|
282
|
+
get order(): EulerRotationOrder {
|
|
283
|
+
return getOrder(this[3]);
|
|
253
284
|
}
|
|
254
|
-
set order(value:
|
|
285
|
+
set order(value: EulerRotationOrder) {
|
|
255
286
|
this[3] = checkOrder(value);
|
|
256
287
|
}
|
|
257
288
|
|
|
258
289
|
// Constructors
|
|
259
|
-
fromVector3(v: Readonly<NumericArray>, order:
|
|
260
|
-
return this.set(v[0], v[1], v[2],
|
|
290
|
+
fromVector3(v: Readonly<NumericArray>, order: EulerRotationOrder = this.order): this {
|
|
291
|
+
return this.set(v[0], v[1], v[2], order);
|
|
261
292
|
}
|
|
262
293
|
|
|
263
294
|
// TODO - with and without 4th element
|
|
@@ -273,10 +304,10 @@ export class Euler extends MathArray {
|
|
|
273
304
|
|
|
274
305
|
// Common ZYX rotation order
|
|
275
306
|
fromRollPitchYaw(roll: number, pitch: number, yaw: number): this {
|
|
276
|
-
return this.set(roll, pitch, yaw,
|
|
307
|
+
return this.set(roll, pitch, yaw, 'zyx');
|
|
277
308
|
}
|
|
278
309
|
|
|
279
|
-
fromRotationMatrix(m: Readonly<NumericArray>, order:
|
|
310
|
+
fromRotationMatrix(m: Readonly<NumericArray>, order: EulerRotationOrder = 'zyx'): this {
|
|
280
311
|
this._fromRotationMatrix(m, order);
|
|
281
312
|
return this.check();
|
|
282
313
|
}
|
|
@@ -291,18 +322,18 @@ export class Euler extends MathArray {
|
|
|
291
322
|
getQuaternion(): Quaternion {
|
|
292
323
|
const q = new Quaternion();
|
|
293
324
|
switch (this[3]) {
|
|
294
|
-
case
|
|
325
|
+
case RotationOrderIndex.XYZ:
|
|
295
326
|
return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
|
|
296
|
-
case
|
|
297
|
-
return q.rotateY(this[
|
|
298
|
-
case
|
|
299
|
-
return q.rotateZ(this[
|
|
300
|
-
case
|
|
301
|
-
return q.rotateZ(this[
|
|
302
|
-
case
|
|
303
|
-
return q.rotateY(this[
|
|
304
|
-
case
|
|
305
|
-
return q.rotateX(this[0]).rotateZ(this[
|
|
327
|
+
case RotationOrderIndex.YXZ:
|
|
328
|
+
return q.rotateY(this[1]).rotateX(this[0]).rotateZ(this[2]);
|
|
329
|
+
case RotationOrderIndex.ZXY:
|
|
330
|
+
return q.rotateZ(this[2]).rotateX(this[0]).rotateY(this[1]);
|
|
331
|
+
case RotationOrderIndex.ZYX:
|
|
332
|
+
return q.rotateZ(this[2]).rotateY(this[1]).rotateX(this[0]);
|
|
333
|
+
case RotationOrderIndex.YZX:
|
|
334
|
+
return q.rotateY(this[1]).rotateZ(this[2]).rotateX(this[0]);
|
|
335
|
+
case RotationOrderIndex.XZY:
|
|
336
|
+
return q.rotateX(this[0]).rotateZ(this[2]).rotateY(this[1]);
|
|
306
337
|
default:
|
|
307
338
|
throw new Error(ERR_UNKNOWN_ORDER);
|
|
308
339
|
}
|
|
@@ -316,7 +347,7 @@ export class Euler extends MathArray {
|
|
|
316
347
|
// const q = new Quaternion().setFromEuler(this);
|
|
317
348
|
// return this.setFromQuaternion(q, newOrder);
|
|
318
349
|
/* eslint-disable complexity, max-statements, one-var */
|
|
319
|
-
_fromRotationMatrix(m: Readonly<NumericArray>, order =
|
|
350
|
+
_fromRotationMatrix(m: Readonly<NumericArray>, order: EulerRotationOrder = 'zyx'): this {
|
|
320
351
|
// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
|
|
321
352
|
const m11 = m[0],
|
|
322
353
|
m12 = m[4],
|
|
@@ -327,9 +358,9 @@ export class Euler extends MathArray {
|
|
|
327
358
|
const m31 = m[2],
|
|
328
359
|
m32 = m[6],
|
|
329
360
|
m33 = m[10];
|
|
330
|
-
|
|
331
|
-
switch (
|
|
332
|
-
case
|
|
361
|
+
const orderIndex = order ? checkOrder(order) : this[3];
|
|
362
|
+
switch (orderIndex) {
|
|
363
|
+
case RotationOrderIndex.XYZ:
|
|
333
364
|
this[1] = Math.asin(clamp(m13, -1, 1));
|
|
334
365
|
if (Math.abs(m13) < ALMOST_ONE) {
|
|
335
366
|
this[0] = Math.atan2(-m23, m33);
|
|
@@ -339,7 +370,7 @@ export class Euler extends MathArray {
|
|
|
339
370
|
this[2] = 0;
|
|
340
371
|
}
|
|
341
372
|
break;
|
|
342
|
-
case
|
|
373
|
+
case RotationOrderIndex.YXZ:
|
|
343
374
|
this[0] = Math.asin(-clamp(m23, -1, 1));
|
|
344
375
|
if (Math.abs(m23) < ALMOST_ONE) {
|
|
345
376
|
this[1] = Math.atan2(m13, m33);
|
|
@@ -349,7 +380,7 @@ export class Euler extends MathArray {
|
|
|
349
380
|
this[2] = 0;
|
|
350
381
|
}
|
|
351
382
|
break;
|
|
352
|
-
case
|
|
383
|
+
case RotationOrderIndex.ZXY:
|
|
353
384
|
this[0] = Math.asin(clamp(m32, -1, 1));
|
|
354
385
|
if (Math.abs(m32) < ALMOST_ONE) {
|
|
355
386
|
this[1] = Math.atan2(-m31, m33);
|
|
@@ -359,7 +390,7 @@ export class Euler extends MathArray {
|
|
|
359
390
|
this[2] = Math.atan2(m21, m11);
|
|
360
391
|
}
|
|
361
392
|
break;
|
|
362
|
-
case
|
|
393
|
+
case RotationOrderIndex.ZYX:
|
|
363
394
|
this[1] = Math.asin(-clamp(m31, -1, 1));
|
|
364
395
|
if (Math.abs(m31) < ALMOST_ONE) {
|
|
365
396
|
this[0] = Math.atan2(m32, m33);
|
|
@@ -369,7 +400,7 @@ export class Euler extends MathArray {
|
|
|
369
400
|
this[2] = Math.atan2(-m12, m22);
|
|
370
401
|
}
|
|
371
402
|
break;
|
|
372
|
-
case
|
|
403
|
+
case RotationOrderIndex.YZX:
|
|
373
404
|
this[2] = Math.asin(clamp(m21, -1, 1));
|
|
374
405
|
if (Math.abs(m21) < ALMOST_ONE) {
|
|
375
406
|
this[0] = Math.atan2(-m23, m22);
|
|
@@ -379,7 +410,7 @@ export class Euler extends MathArray {
|
|
|
379
410
|
this[1] = Math.atan2(m13, m33);
|
|
380
411
|
}
|
|
381
412
|
break;
|
|
382
|
-
case
|
|
413
|
+
case RotationOrderIndex.XZY:
|
|
383
414
|
this[2] = Math.asin(-clamp(m12, -1, 1));
|
|
384
415
|
if (Math.abs(m12) < ALMOST_ONE) {
|
|
385
416
|
this[0] = Math.atan2(m32, m22);
|
|
@@ -392,7 +423,7 @@ export class Euler extends MathArray {
|
|
|
392
423
|
default:
|
|
393
424
|
throw new Error(ERR_UNKNOWN_ORDER);
|
|
394
425
|
}
|
|
395
|
-
this[3] =
|
|
426
|
+
this[3] = orderIndex;
|
|
396
427
|
return this;
|
|
397
428
|
}
|
|
398
429
|
|
|
@@ -408,7 +439,7 @@ export class Euler extends MathArray {
|
|
|
408
439
|
const d = Math.sin(y);
|
|
409
440
|
const f = Math.sin(z);
|
|
410
441
|
switch (this[3]) {
|
|
411
|
-
case
|
|
442
|
+
case RotationOrderIndex.XYZ: {
|
|
412
443
|
const ae = a * e,
|
|
413
444
|
af = a * f,
|
|
414
445
|
be = b * e,
|
|
@@ -424,7 +455,7 @@ export class Euler extends MathArray {
|
|
|
424
455
|
te[10] = a * c;
|
|
425
456
|
break;
|
|
426
457
|
}
|
|
427
|
-
case
|
|
458
|
+
case RotationOrderIndex.YXZ: {
|
|
428
459
|
const ce = c * e,
|
|
429
460
|
cf = c * f,
|
|
430
461
|
de = d * e,
|
|
@@ -440,7 +471,7 @@ export class Euler extends MathArray {
|
|
|
440
471
|
te[10] = a * c;
|
|
441
472
|
break;
|
|
442
473
|
}
|
|
443
|
-
case
|
|
474
|
+
case RotationOrderIndex.ZXY: {
|
|
444
475
|
const ce = c * e,
|
|
445
476
|
cf = c * f,
|
|
446
477
|
de = d * e,
|
|
@@ -456,7 +487,7 @@ export class Euler extends MathArray {
|
|
|
456
487
|
te[10] = a * c;
|
|
457
488
|
break;
|
|
458
489
|
}
|
|
459
|
-
case
|
|
490
|
+
case RotationOrderIndex.ZYX: {
|
|
460
491
|
const ae = a * e,
|
|
461
492
|
af = a * f,
|
|
462
493
|
be = b * e,
|
|
@@ -472,7 +503,7 @@ export class Euler extends MathArray {
|
|
|
472
503
|
te[10] = a * c;
|
|
473
504
|
break;
|
|
474
505
|
}
|
|
475
|
-
case
|
|
506
|
+
case RotationOrderIndex.YZX: {
|
|
476
507
|
const ac = a * c,
|
|
477
508
|
ad = a * d,
|
|
478
509
|
bc = b * c,
|
|
@@ -488,7 +519,7 @@ export class Euler extends MathArray {
|
|
|
488
519
|
te[10] = ac - bd * f;
|
|
489
520
|
break;
|
|
490
521
|
}
|
|
491
|
-
case
|
|
522
|
+
case RotationOrderIndex.XZY: {
|
|
492
523
|
const ac = a * c,
|
|
493
524
|
ad = a * d,
|
|
494
525
|
bc = b * c,
|
|
@@ -541,9 +572,29 @@ function validateOrder(value: number): boolean {
|
|
|
541
572
|
return value >= 0 && value < 6;
|
|
542
573
|
}
|
|
543
574
|
|
|
544
|
-
function checkOrder(value:
|
|
545
|
-
|
|
575
|
+
function checkOrder(value: EulerRotationOrder): RotationOrderIndex {
|
|
576
|
+
const order = ROTATION_ORDER_INDICES[value];
|
|
577
|
+
if (order === undefined) {
|
|
546
578
|
throw new Error(ERR_UNKNOWN_ORDER);
|
|
547
579
|
}
|
|
548
|
-
return
|
|
580
|
+
return order;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function getOrder(value: number): EulerRotationOrder {
|
|
584
|
+
switch (value) {
|
|
585
|
+
case RotationOrderIndex.ZYX:
|
|
586
|
+
return 'zyx';
|
|
587
|
+
case RotationOrderIndex.YXZ:
|
|
588
|
+
return 'yxz';
|
|
589
|
+
case RotationOrderIndex.XZY:
|
|
590
|
+
return 'xzy';
|
|
591
|
+
case RotationOrderIndex.ZXY:
|
|
592
|
+
return 'zxy';
|
|
593
|
+
case RotationOrderIndex.YZX:
|
|
594
|
+
return 'yzx';
|
|
595
|
+
case RotationOrderIndex.XYZ:
|
|
596
|
+
return 'xyz';
|
|
597
|
+
default:
|
|
598
|
+
throw new Error(ERR_UNKNOWN_ORDER);
|
|
599
|
+
}
|
|
549
600
|
}
|
package/src/classes/matrix3.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import {NumericArray, NumericArray9} from '@math.gl/types';
|
|
7
7
|
import {Matrix} from './base/matrix';
|
|
8
|
-
import {Vector3} from './vector3';
|
|
9
8
|
import {checkVector} from '../lib/validators';
|
|
10
9
|
|
|
11
10
|
import {vec4_transformMat3} from '../lib/gl-matrix-extras';
|
|
@@ -203,54 +202,6 @@ export class Matrix3 extends Matrix {
|
|
|
203
202
|
return this.check();
|
|
204
203
|
}
|
|
205
204
|
|
|
206
|
-
/**
|
|
207
|
-
* Computes the product of this matrix and a column vector.
|
|
208
|
-
*
|
|
209
|
-
* @param {Vector3} cartesian The column.
|
|
210
|
-
* @param {Vector3} result The object onto which to store the result.
|
|
211
|
-
* @returns {Vector3} The modified result parameter.
|
|
212
|
-
*/
|
|
213
|
-
multiplyByVector(cartesian: Vector3, result?: Vector3): Vector3 {
|
|
214
|
-
if (!result) result = new Vector3();
|
|
215
|
-
|
|
216
|
-
const vX = cartesian.x;
|
|
217
|
-
const vY = cartesian.y;
|
|
218
|
-
const vZ = cartesian.z;
|
|
219
|
-
|
|
220
|
-
const x = this[0] * vX + this[3] * vY + this[6] * vZ;
|
|
221
|
-
const y = this[1] * vX + this[4] * vY + this[7] * vZ;
|
|
222
|
-
const z = this[2] * vX + this[5] * vY + this[8] * vZ;
|
|
223
|
-
|
|
224
|
-
result.x = x;
|
|
225
|
-
result.y = y;
|
|
226
|
-
result.z = z;
|
|
227
|
-
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Computes the product of this matrix times a (non-uniform) scale, as if the scale were a scale matrix.
|
|
233
|
-
*
|
|
234
|
-
* @param {Vector3} scale The non-uniform scale on the right-hand side.
|
|
235
|
-
* @param {Matrix3} result The object onto which to store the result.
|
|
236
|
-
* @returns {Matrix3} The modified result parameter.
|
|
237
|
-
*/
|
|
238
|
-
multiplyByScale(scale: Vector3, result?: Matrix3): Matrix3 {
|
|
239
|
-
if (!result) result = new Matrix3();
|
|
240
|
-
|
|
241
|
-
result[0] = this[0] * scale.x;
|
|
242
|
-
result[1] = this[1] * scale.x;
|
|
243
|
-
result[2] = this[2] * scale.x;
|
|
244
|
-
result[3] = this[3] * scale.y;
|
|
245
|
-
result[4] = this[4] * scale.y;
|
|
246
|
-
result[5] = this[5] * scale.y;
|
|
247
|
-
result[6] = this[6] * scale.z;
|
|
248
|
-
result[7] = this[7] * scale.z;
|
|
249
|
-
result[8] = this[8] * scale.z;
|
|
250
|
-
|
|
251
|
-
return result;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
205
|
rotate(radians: number): this {
|
|
255
206
|
mat3_rotate(this, this, radians);
|
|
256
207
|
return this.check();
|
package/src/classes/pose.ts
CHANGED
|
@@ -39,10 +39,9 @@ export class Pose {
|
|
|
39
39
|
this.position = new Vector3(x, y, z);
|
|
40
40
|
}
|
|
41
41
|
if (Array.isArray(orientation) && orientation.length === 4) {
|
|
42
|
-
|
|
43
|
-
this.orientation = new Euler(orientation, orientation[3]);
|
|
42
|
+
this.orientation = new Euler().fromArray(orientation);
|
|
44
43
|
} else {
|
|
45
|
-
this.orientation = new Euler(roll, pitch, yaw,
|
|
44
|
+
this.orientation = new Euler(roll, pitch, yaw, 'zyx');
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
package/src/gl-matrix/mat3.ts
CHANGED
package/src/gl-matrix/mat4.ts
CHANGED