@math.gl/core 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/base/math-array.d.ts +1 -2
- package/dist/classes/base/math-array.js +220 -266
- package/dist/classes/base/matrix.d.ts +1 -2
- package/dist/classes/base/matrix.js +52 -53
- package/dist/classes/base/vector.d.ts +1 -2
- package/dist/classes/base/vector.js +121 -135
- package/dist/classes/euler.d.ts +2 -3
- package/dist/classes/euler.js +462 -533
- package/dist/classes/matrix3.d.ts +2 -3
- package/dist/classes/matrix3.js +185 -190
- package/dist/classes/matrix4.d.ts +1 -2
- package/dist/classes/matrix4.js +516 -452
- package/dist/classes/pose.d.ts +4 -5
- package/dist/classes/pose.js +104 -119
- package/dist/classes/quaternion.d.ts +1 -2
- package/dist/classes/quaternion.js +257 -233
- package/dist/classes/spherical-coordinates.d.ts +3 -4
- package/dist/classes/spherical-coordinates.js +138 -147
- package/dist/classes/vector2.d.ts +1 -2
- package/dist/classes/vector2.js +101 -85
- package/dist/classes/vector3.d.ts +1 -2
- package/dist/classes/vector3.js +125 -136
- package/dist/classes/vector4.d.ts +2 -3
- package/dist/classes/vector4.js +106 -114
- package/dist/gl-matrix/common.d.ts +0 -1
- package/dist/gl-matrix/common.js +38 -6
- package/dist/gl-matrix/mat3.d.ts +0 -1
- package/dist/gl-matrix/mat3.js +699 -425
- package/dist/gl-matrix/mat4.d.ts +0 -1
- package/dist/gl-matrix/mat4.js +1879 -1339
- package/dist/gl-matrix/quat.d.ts +0 -1
- package/dist/gl-matrix/quat.js +655 -257
- package/dist/gl-matrix/vec2.d.ts +0 -1
- package/dist/gl-matrix/vec2.js +529 -212
- package/dist/gl-matrix/vec3.d.ts +0 -1
- package/dist/gl-matrix/vec3.js +703 -335
- package/dist/gl-matrix/vec4.d.ts +0 -1
- package/dist/gl-matrix/vec4.js +579 -293
- package/dist/gl-matrix/wip/index.d.ts +3 -4
- package/dist/gl-matrix/wip/index.js +2 -1
- package/dist/gl-matrix/wip/mat2.d.ts +0 -1
- package/dist/gl-matrix/wip/mat2.js +333 -157
- package/dist/gl-matrix/wip/mat2d.d.ts +0 -1
- package/dist/gl-matrix/wip/mat2d.js +377 -202
- package/dist/gl-matrix/wip/quat2.d.ts +0 -1
- package/dist/gl-matrix/wip/quat2.js +647 -409
- package/dist/index.cjs +60 -100
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +21 -22
- package/dist/index.js +23 -16
- package/dist/lib/assert.d.ts +0 -1
- package/dist/lib/assert.js +3 -4
- package/dist/lib/common.d.ts +2 -3
- package/dist/lib/common.js +163 -134
- package/dist/lib/gl-matrix-extras.d.ts +0 -1
- package/dist/lib/gl-matrix-extras.js +39 -36
- package/dist/lib/math-utils.d.ts +0 -1
- package/dist/lib/math-utils.js +2 -1
- package/dist/lib/validators.d.ts +0 -1
- package/dist/lib/validators.js +22 -25
- package/package.json +5 -6
- package/src/classes/matrix3.ts +1 -1
- package/dist/classes/base/math-array.d.ts.map +0 -1
- package/dist/classes/base/math-array.js.map +0 -1
- package/dist/classes/base/matrix.d.ts.map +0 -1
- package/dist/classes/base/matrix.js.map +0 -1
- package/dist/classes/base/vector.d.ts.map +0 -1
- package/dist/classes/base/vector.js.map +0 -1
- package/dist/classes/euler.d.ts.map +0 -1
- package/dist/classes/euler.js.map +0 -1
- package/dist/classes/matrix3.d.ts.map +0 -1
- package/dist/classes/matrix3.js.map +0 -1
- package/dist/classes/matrix4.d.ts.map +0 -1
- package/dist/classes/matrix4.js.map +0 -1
- package/dist/classes/pose.d.ts.map +0 -1
- package/dist/classes/pose.js.map +0 -1
- package/dist/classes/quaternion.d.ts.map +0 -1
- package/dist/classes/quaternion.js.map +0 -1
- package/dist/classes/spherical-coordinates.d.ts.map +0 -1
- package/dist/classes/spherical-coordinates.js.map +0 -1
- package/dist/classes/vector2.d.ts.map +0 -1
- package/dist/classes/vector2.js.map +0 -1
- package/dist/classes/vector3.d.ts.map +0 -1
- package/dist/classes/vector3.js.map +0 -1
- package/dist/classes/vector4.d.ts.map +0 -1
- package/dist/classes/vector4.js.map +0 -1
- package/dist/gl-matrix/common.d.ts.map +0 -1
- package/dist/gl-matrix/common.js.map +0 -1
- package/dist/gl-matrix/mat3.d.ts.map +0 -1
- package/dist/gl-matrix/mat3.js.map +0 -1
- package/dist/gl-matrix/mat4.d.ts.map +0 -1
- package/dist/gl-matrix/mat4.js.map +0 -1
- package/dist/gl-matrix/quat.d.ts.map +0 -1
- package/dist/gl-matrix/quat.js.map +0 -1
- package/dist/gl-matrix/vec2.d.ts.map +0 -1
- package/dist/gl-matrix/vec2.js.map +0 -1
- package/dist/gl-matrix/vec3.d.ts.map +0 -1
- package/dist/gl-matrix/vec3.js.map +0 -1
- package/dist/gl-matrix/vec4.d.ts.map +0 -1
- package/dist/gl-matrix/vec4.js.map +0 -1
- package/dist/gl-matrix/wip/index.d.ts.map +0 -1
- package/dist/gl-matrix/wip/index.js.map +0 -1
- package/dist/gl-matrix/wip/mat2.d.ts.map +0 -1
- package/dist/gl-matrix/wip/mat2.js.map +0 -1
- package/dist/gl-matrix/wip/mat2d.d.ts.map +0 -1
- package/dist/gl-matrix/wip/mat2d.js.map +0 -1
- package/dist/gl-matrix/wip/quat2.d.ts.map +0 -1
- package/dist/gl-matrix/wip/quat2.js.map +0 -1
- package/dist/gl-matrix/wip/types.d.js +0 -2
- package/dist/gl-matrix/wip/types.d.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/assert.d.ts.map +0 -1
- package/dist/lib/assert.js.map +0 -1
- package/dist/lib/common.d.ts.map +0 -1
- package/dist/lib/common.js.map +0 -1
- package/dist/lib/gl-matrix-extras.d.ts.map +0 -1
- package/dist/lib/gl-matrix-extras.js.map +0 -1
- package/dist/lib/gl-matrix.d.js +0 -2
- package/dist/lib/gl-matrix.d.js.map +0 -1
- package/dist/lib/math-utils.d.ts.map +0 -1
- package/dist/lib/math-utils.js.map +0 -1
- package/dist/lib/validators.d.ts.map +0 -1
- package/dist/lib/validators.js.map +0 -1
|
@@ -1,240 +1,264 @@
|
|
|
1
1
|
import { MathArray } from "./base/math-array.js";
|
|
2
2
|
import { checkNumber, checkVector } from "../lib/validators.js";
|
|
3
3
|
import { Vector4 } from "./vector4.js";
|
|
4
|
-
|
|
4
|
+
// @ts-ignore gl-matrix types...
|
|
5
|
+
import { fromMat3 as quat_fromMat3, setAxisAngle as quat_setAxisAngle, identity as quat_identity, length as quat_length, squaredLength as quat_squaredLength, dot as quat_dot,
|
|
6
|
+
// getAxisAngle as quat_getAxisAngle,
|
|
7
|
+
rotationTo as quat_rotationTo, add as quat_add, calculateW as quat_calculateW, conjugate as quat_conjugate, invert as quat_invert, lerp as quat_lerp, multiply as quat_multiply, rotateX as quat_rotateX, rotateY as quat_rotateY, rotateZ as quat_rotateZ, scale as quat_scale, slerp as quat_slerp } from "../gl-matrix/quat.js";
|
|
8
|
+
// @ts-ignore gl-matrix types...
|
|
5
9
|
import { transformQuat as vec4_transformQuat } from "../gl-matrix/vec4.js";
|
|
6
10
|
const IDENTITY_QUATERNION = [0, 0, 0, 1];
|
|
7
11
|
export class Quaternion extends MathArray {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
12
|
+
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
13
|
+
// PERF NOTE: initialize elements as double precision numbers
|
|
14
|
+
super(-0, -0, -0, -0);
|
|
15
|
+
// eslint-disable-next-line prefer-rest-params
|
|
16
|
+
if (Array.isArray(x) && arguments.length === 1) {
|
|
17
|
+
this.copy(x);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.set(x, y, z, w);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
copy(array) {
|
|
24
|
+
this[0] = array[0];
|
|
25
|
+
this[1] = array[1];
|
|
26
|
+
this[2] = array[2];
|
|
27
|
+
this[3] = array[3];
|
|
28
|
+
return this.check();
|
|
29
|
+
}
|
|
30
|
+
set(x, y, z, w) {
|
|
31
|
+
this[0] = x;
|
|
32
|
+
this[1] = y;
|
|
33
|
+
this[2] = z;
|
|
34
|
+
this[3] = w;
|
|
35
|
+
return this.check();
|
|
36
|
+
}
|
|
37
|
+
fromObject(object) {
|
|
38
|
+
this[0] = object.x;
|
|
39
|
+
this[1] = object.y;
|
|
40
|
+
this[2] = object.z;
|
|
41
|
+
this[3] = object.w;
|
|
42
|
+
return this.check();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a quaternion from the given 3x3 rotation matrix.
|
|
46
|
+
* NOTE: The resultant quaternion is not normalized, so you should
|
|
47
|
+
* be sure to renormalize the quaternion yourself where necessary.
|
|
48
|
+
* @param m
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
fromMatrix3(m) {
|
|
52
|
+
quat_fromMat3(this, m);
|
|
53
|
+
return this.check();
|
|
54
|
+
}
|
|
55
|
+
fromAxisRotation(axis, rad) {
|
|
56
|
+
quat_setAxisAngle(this, axis, rad);
|
|
57
|
+
return this.check();
|
|
58
|
+
}
|
|
59
|
+
/** Set a quat to the identity quaternion */
|
|
60
|
+
identity() {
|
|
61
|
+
quat_identity(this);
|
|
62
|
+
return this.check();
|
|
63
|
+
}
|
|
64
|
+
// Set the components of a quat to the given values
|
|
65
|
+
// set(i, j, k, l) {
|
|
66
|
+
// quat_set(this, i, j, k, l);
|
|
67
|
+
// return this.check();
|
|
68
|
+
// }
|
|
69
|
+
// Sets a quat from the given angle and rotation axis, then returns it.
|
|
70
|
+
setAxisAngle(axis, rad) {
|
|
71
|
+
return this.fromAxisRotation(axis, rad);
|
|
72
|
+
}
|
|
73
|
+
// Getters/setters
|
|
74
|
+
get ELEMENTS() {
|
|
75
|
+
return 4;
|
|
76
|
+
}
|
|
77
|
+
get x() {
|
|
78
|
+
return this[0];
|
|
79
|
+
}
|
|
80
|
+
set x(value) {
|
|
81
|
+
this[0] = checkNumber(value);
|
|
82
|
+
}
|
|
83
|
+
get y() {
|
|
84
|
+
return this[1];
|
|
85
|
+
}
|
|
86
|
+
set y(value) {
|
|
87
|
+
this[1] = checkNumber(value);
|
|
88
|
+
}
|
|
89
|
+
get z() {
|
|
90
|
+
return this[2];
|
|
91
|
+
}
|
|
92
|
+
set z(value) {
|
|
93
|
+
this[2] = checkNumber(value);
|
|
94
|
+
}
|
|
95
|
+
get w() {
|
|
96
|
+
return this[3];
|
|
97
|
+
}
|
|
98
|
+
set w(value) {
|
|
99
|
+
this[3] = checkNumber(value);
|
|
100
|
+
}
|
|
101
|
+
// Calculates the length of a quat
|
|
102
|
+
len() {
|
|
103
|
+
return quat_length(this);
|
|
104
|
+
}
|
|
105
|
+
// Calculates the squared length of a quat
|
|
106
|
+
lengthSquared() {
|
|
107
|
+
return quat_squaredLength(this);
|
|
108
|
+
}
|
|
109
|
+
// Calculates the dot product of two quat's
|
|
110
|
+
// @return {Number}
|
|
111
|
+
dot(a) {
|
|
112
|
+
return quat_dot(this, a);
|
|
113
|
+
}
|
|
114
|
+
// Gets the rotation axis and angle for a given quaternion.
|
|
115
|
+
// If a quaternion is created with setAxisAngle, this method will
|
|
116
|
+
// return the same values as providied in the original parameter
|
|
117
|
+
// list OR functionally equivalent values.
|
|
118
|
+
// Example: The quaternion formed by axis [0, 0, 1] and angle -90
|
|
119
|
+
// is the same as the quaternion formed by [0, 0, 1] and 270.
|
|
120
|
+
// This method favors the latter.
|
|
121
|
+
// @return {{[x,y,z], Number}}
|
|
122
|
+
// getAxisAngle() {
|
|
123
|
+
// const axis = [];
|
|
124
|
+
// // const angle = quat_getAxisAngle(axis, this);
|
|
125
|
+
// return {axis, angle};
|
|
126
|
+
// }
|
|
127
|
+
// MODIFIERS
|
|
128
|
+
// Sets a quaternion to represent the shortest rotation from one vector
|
|
129
|
+
// to another. Both vectors are assumed to be unit length.
|
|
130
|
+
rotationTo(vectorA, vectorB) {
|
|
131
|
+
quat_rotationTo(this, vectorA, vectorB);
|
|
132
|
+
return this.check();
|
|
133
|
+
}
|
|
134
|
+
// Sets the specified quaternion with values corresponding to the given axes.
|
|
135
|
+
// Each axis is a vec3 and is expected to be unit length and perpendicular
|
|
136
|
+
// to all other specified axes.
|
|
137
|
+
// setAxes() {
|
|
138
|
+
// Number
|
|
139
|
+
// }
|
|
140
|
+
// Performs a spherical linear interpolation with two control points
|
|
141
|
+
// sqlerp() {
|
|
142
|
+
// Number;
|
|
143
|
+
// }
|
|
144
|
+
// Adds two quat's
|
|
145
|
+
add(a) {
|
|
146
|
+
quat_add(this, this, a);
|
|
147
|
+
return this.check();
|
|
148
|
+
}
|
|
149
|
+
// Calculates the W component of a quat from the X, Y, and Z components.
|
|
150
|
+
// Any existing W component will be ignored.
|
|
151
|
+
calculateW() {
|
|
152
|
+
quat_calculateW(this, this);
|
|
153
|
+
return this.check();
|
|
154
|
+
}
|
|
155
|
+
// Calculates the conjugate of a quat If the quaternion is normalized,
|
|
156
|
+
// this function is faster than quat_invert and produces the same result.
|
|
157
|
+
conjugate() {
|
|
158
|
+
quat_conjugate(this, this);
|
|
159
|
+
return this.check();
|
|
160
|
+
}
|
|
161
|
+
// Calculates the inverse of a quat
|
|
162
|
+
invert() {
|
|
163
|
+
quat_invert(this, this);
|
|
164
|
+
return this.check();
|
|
165
|
+
}
|
|
166
|
+
// Performs a linear interpolation between two quat's
|
|
167
|
+
lerp(a, b, t) {
|
|
168
|
+
if (t === undefined) {
|
|
169
|
+
return this.lerp(this, a, b);
|
|
170
|
+
}
|
|
171
|
+
quat_lerp(this, a, b, t);
|
|
172
|
+
return this.check();
|
|
173
|
+
}
|
|
174
|
+
// Multiplies two quat's
|
|
175
|
+
multiplyRight(a) {
|
|
176
|
+
quat_multiply(this, this, a);
|
|
177
|
+
return this.check();
|
|
178
|
+
}
|
|
179
|
+
multiplyLeft(a) {
|
|
180
|
+
quat_multiply(this, a, this);
|
|
181
|
+
return this.check();
|
|
182
|
+
}
|
|
183
|
+
// Normalize a quat
|
|
184
|
+
normalize() {
|
|
185
|
+
// Handle 0 case
|
|
186
|
+
const length = this.len();
|
|
187
|
+
const l = length > 0 ? 1 / length : 0;
|
|
188
|
+
this[0] = this[0] * l;
|
|
189
|
+
this[1] = this[1] * l;
|
|
190
|
+
this[2] = this[2] * l;
|
|
191
|
+
this[3] = this[3] * l;
|
|
192
|
+
// Set to [0, 0, 0, 1] if length is 0
|
|
193
|
+
if (length === 0) {
|
|
194
|
+
this[3] = 1;
|
|
195
|
+
}
|
|
196
|
+
return this.check();
|
|
197
|
+
}
|
|
198
|
+
// Rotates a quaternion by the given angle about the X axis
|
|
199
|
+
rotateX(rad) {
|
|
200
|
+
quat_rotateX(this, this, rad);
|
|
201
|
+
return this.check();
|
|
202
|
+
}
|
|
203
|
+
// Rotates a quaternion by the given angle about the Y axis
|
|
204
|
+
rotateY(rad) {
|
|
205
|
+
quat_rotateY(this, this, rad);
|
|
206
|
+
return this.check();
|
|
207
|
+
}
|
|
208
|
+
// Rotates a quaternion by the given angle about the Z axis
|
|
209
|
+
rotateZ(rad) {
|
|
210
|
+
quat_rotateZ(this, this, rad);
|
|
211
|
+
return this.check();
|
|
212
|
+
}
|
|
213
|
+
// Scales a quat by a scalar number
|
|
214
|
+
scale(b) {
|
|
215
|
+
quat_scale(this, this, b);
|
|
216
|
+
return this.check();
|
|
217
|
+
}
|
|
218
|
+
// Performs a spherical linear interpolation between two quat
|
|
219
|
+
slerp(arg0, arg1, arg2) {
|
|
220
|
+
let start;
|
|
221
|
+
let target;
|
|
222
|
+
let ratio;
|
|
223
|
+
// eslint-disable-next-line prefer-rest-params
|
|
224
|
+
switch (arguments.length) {
|
|
225
|
+
case 1: // Deprecated signature ({start, target, ratio})
|
|
226
|
+
// eslint-disable-next-line prefer-rest-params
|
|
227
|
+
({
|
|
228
|
+
start = IDENTITY_QUATERNION,
|
|
229
|
+
target,
|
|
230
|
+
ratio
|
|
231
|
+
} = arg0);
|
|
232
|
+
break;
|
|
233
|
+
case 2: // THREE.js compatibility signature (target, ration)
|
|
234
|
+
start = this; // eslint-disable-line
|
|
235
|
+
target = arg0;
|
|
236
|
+
ratio = arg1;
|
|
237
|
+
break;
|
|
238
|
+
default:
|
|
239
|
+
// Default signature: (start, target, ratio)
|
|
240
|
+
start = arg0;
|
|
241
|
+
target = arg1;
|
|
242
|
+
ratio = arg2;
|
|
243
|
+
}
|
|
244
|
+
quat_slerp(this, start, target, ratio);
|
|
245
|
+
return this.check();
|
|
246
|
+
}
|
|
247
|
+
transformVector4(vector, result = new Vector4()) {
|
|
248
|
+
vec4_transformQuat(result, vector, this);
|
|
249
|
+
return checkVector(result, 4);
|
|
250
|
+
}
|
|
251
|
+
// THREE.js Math API compatibility
|
|
252
|
+
lengthSq() {
|
|
253
|
+
return this.lengthSquared();
|
|
254
|
+
}
|
|
255
|
+
setFromAxisAngle(axis, rad) {
|
|
256
|
+
return this.setAxisAngle(axis, rad);
|
|
257
|
+
}
|
|
258
|
+
premultiply(a) {
|
|
259
|
+
return this.multiplyLeft(a);
|
|
260
|
+
}
|
|
261
|
+
multiply(a) {
|
|
262
|
+
return this.multiplyRight(a);
|
|
263
|
+
}
|
|
239
264
|
}
|
|
240
|
-
//# sourceMappingURL=quaternion.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NumericArray } from '@math.gl/types';
|
|
2
|
-
import { Vector3 } from
|
|
3
|
-
|
|
2
|
+
import { Vector3 } from "./vector3.js";
|
|
3
|
+
type SphericalCoordinatesOptions = {
|
|
4
4
|
phi?: number;
|
|
5
5
|
theta?: number;
|
|
6
6
|
radius?: number;
|
|
@@ -9,7 +9,7 @@ declare type SphericalCoordinatesOptions = {
|
|
|
9
9
|
altitude?: number;
|
|
10
10
|
radiusScale?: number;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
type FormatOptions = {
|
|
13
13
|
printTypes?: boolean;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
@@ -57,4 +57,3 @@ export declare class SphericalCoordinates {
|
|
|
57
57
|
check(): this;
|
|
58
58
|
}
|
|
59
59
|
export {};
|
|
60
|
-
//# sourceMappingURL=spherical-coordinates.d.ts.map
|