@ohif/app 3.14.0-beta.97 → 3.14.0-beta.99
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/{1645.bundle.a98b9ca6.js → 1645.bundle.1a466b16.js} +600 -600
- package/dist/{1788.bundle.3f1349d2.js → 1788.bundle.962951f9.js} +26 -26
- package/dist/{1793.bundle.27458a55.js → 1793.bundle.30f89e46.js} +5 -3
- package/dist/{1862.bundle.79bfe469.js → 1862.bundle.3ae388c3.js} +2 -2
- package/dist/204.bundle.bc44c201.js +101 -0
- package/dist/204.bundle.css +52 -0
- package/dist/{2748.bundle.eaa94e2e.js → 2103.bundle.1cf348e8.js} +1 -1771
- package/dist/{2478.bundle.fc6ab30b.js → 2478.bundle.68ff1b2d.js} +2 -2
- package/dist/{2717.bundle.d5f58443.js → 2717.bundle.4318f1ee.js} +45 -43
- package/dist/{5989.bundle.f484884a.js → 287.bundle.ee60c370.js} +4570 -832
- package/dist/{2894.bundle.d612efb2.js → 2894.bundle.30c0af5b.js} +20 -14
- package/dist/{2991.bundle.f94892fb.js → 2991.bundle.77642eee.js} +101 -97
- package/dist/{3004.bundle.51919fdc.js → 3004.bundle.5568149a.js} +39 -38
- package/dist/{3255.bundle.13e205ac.js → 3255.bundle.3272671f.js} +29 -27
- package/dist/{3366.bundle.62baeeec.js → 3366.bundle.d9e78e25.js} +57 -53
- package/dist/{3468.bundle.f5dc5e44.js → 3468.bundle.666f2441.js} +37 -27
- package/dist/{347.bundle.397bb252.js → 347.bundle.1323658e.js} +44 -44
- package/dist/{3622.bundle.f4cf2d16.js → 3622.bundle.edb42b96.js} +56 -54
- package/dist/{3723.bundle.eab70100.js → 3723.bundle.43ff1971.js} +1 -1
- package/dist/{3771.bundle.aba09bd7.js → 3771.bundle.a5754f97.js} +8 -8
- package/dist/{4449.bundle.aaa4ab92.js → 4487.bundle.fa0375a4.js} +853 -95
- package/dist/{4606.bundle.a3485206.js → 4606.bundle.6c297e2a.js} +9 -7
- package/dist/{4998.bundle.3aedb48d.js → 4998.bundle.25b8cbfe.js} +5 -3
- package/dist/{5076.bundle.95c07142.js → 5076.bundle.2a14756f.js} +66 -66
- package/dist/{5143.bundle.04f54c00.js → 5143.bundle.53156bb0.js} +358 -226
- package/dist/{5154.bundle.2f460017.js → 5154.bundle.ccd02dd7.js} +5 -3
- package/dist/{5320.bundle.9b05cebb.js → 5320.bundle.c17eb4a7.js} +678 -546
- package/dist/{6212.bundle.e505e123.js → 6212.bundle.c4856be7.js} +48 -46
- package/dist/{6253.bundle.9b473339.js → 6253.bundle.596ce463.js} +1225 -1145
- package/dist/{1153.bundle.51d39e80.js → 6314.bundle.5aadfe48.js} +199 -420
- package/dist/{641.bundle.4627a8e1.js → 641.bundle.8e45751e.js} +89 -89
- package/dist/{6481.bundle.d2fca485.js → 6481.bundle.85093e70.js} +29 -23
- package/dist/{6507.bundle.d52f5e81.js → 6507.bundle.bbcdd01e.js} +76 -76
- package/dist/{6722.bundle.d09a8aad.js → 6722.bundle.3e9a4ef6.js} +4 -4
- package/dist/{6956.bundle.c82fd790.js → 6956.bundle.dc0e8660.js} +33 -33
- package/dist/{7526.bundle.0685dfeb.js → 7526.bundle.3460c3ca.js} +55 -53
- package/dist/{7604.bundle.9eb317c8.js → 7604.bundle.f1eeded4.js} +2 -2
- package/dist/{8312.bundle.2cb75b58.js → 8312.bundle.d67b6f4e.js} +652 -687
- package/dist/{6847.bundle.b2adb444.js → 8729.bundle.e17fe9b2.js} +87 -845
- package/dist/{8788.bundle.4bb4c65b.js → 8788.bundle.83ddf642.js} +21 -20
- package/dist/{8868.bundle.4c357767.js → 8868.bundle.8f3653b3.js} +31 -31
- package/dist/{8923.bundle.9aca06c4.js → 8923.bundle.8b682e96.js} +148 -148
- package/dist/{899.bundle.9a033d16.js → 899.bundle.4e1aee7f.js} +73 -203
- package/dist/{9187.bundle.8f72b4fe.js → 9187.bundle.407afa07.js} +112 -110
- package/dist/9385.bundle.fb0bbf4a.js +1888 -0
- package/dist/{9481.bundle.ccb81f53.js → 9481.bundle.d045ae3a.js} +8 -6
- package/dist/{9517.bundle.1ae74db3.js → 9517.bundle.3e2896ef.js} +31 -17
- package/dist/{9620.bundle.d1dc0be1.js → 9620.bundle.b4cc392c.js} +63 -61
- package/dist/{9841.bundle.0f40f02b.js → 9841.bundle.4f2c401a.js} +93 -91
- package/dist/{9886.bundle.cabb4a24.js → 9886.bundle.b00d5d78.js} +4 -4
- package/dist/{8037.bundle.30a187f7.js → 9889.bundle.bf312047.js} +7743 -1098
- package/dist/{9948.bundle.1172ebca.js → 9948.bundle.fecf81f8.js} +5 -5
- package/dist/{app.bundle.12bfd0b7.js → app.bundle.bb359653.js} +1953 -1245
- package/dist/{compute.bundle.0ed1fe87.js → compute.bundle.9267d449.js} +13 -12
- package/dist/{histogram-worker.bundle.58e60d7c.js → histogram-worker.bundle.29bcdbf6.js} +6 -5
- package/dist/index.html +1 -1
- package/dist/{interpolation.bundle.5a53d112.js → interpolation.bundle.ee9998a4.js} +8 -7
- package/dist/{lib-router.bundle.a5ac870a.js → lib-router.bundle.2a887bc7.js} +334 -201
- package/dist/{polySeg.bundle.b4089601.js → polySeg.bundle.a55f8eee.js} +12 -12
- package/dist/sw.js +11 -1
- package/package.json +14 -19
- package/dist/1566.bundle.d58db206.js +0 -3610
|
@@ -0,0 +1,1888 @@
|
|
|
1
|
+
(globalThis["rspackChunk_ohif_app"] ||= []).push([[9385], {
|
|
2
|
+
38792(module) {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// do not edit .js files directly - edit src/index.jst
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module.exports = function equal(a, b) {
|
|
11
|
+
if (a === b) return true;
|
|
12
|
+
|
|
13
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
14
|
+
if (a.constructor !== b.constructor) return false;
|
|
15
|
+
|
|
16
|
+
var length, i, keys;
|
|
17
|
+
if (Array.isArray(a)) {
|
|
18
|
+
length = a.length;
|
|
19
|
+
if (length != b.length) return false;
|
|
20
|
+
for (i = length; i-- !== 0;)
|
|
21
|
+
if (!equal(a[i], b[i])) return false;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
28
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
29
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
30
|
+
|
|
31
|
+
keys = Object.keys(a);
|
|
32
|
+
length = keys.length;
|
|
33
|
+
if (length !== Object.keys(b).length) return false;
|
|
34
|
+
|
|
35
|
+
for (i = length; i-- !== 0;)
|
|
36
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
37
|
+
|
|
38
|
+
for (i = length; i-- !== 0;) {
|
|
39
|
+
var key = keys[i];
|
|
40
|
+
|
|
41
|
+
if (!equal(a[key], b[key])) return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// true if both NaN, false otherwise
|
|
48
|
+
return a!==a && b!==b;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
},
|
|
53
|
+
21589(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
54
|
+
"use strict";
|
|
55
|
+
/* import */ var _common_js__rspack_import_0 = __webpack_require__(23172);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 2x2 Matrix
|
|
59
|
+
* @module mat2
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new identity mat2
|
|
64
|
+
*
|
|
65
|
+
* @returns {mat2} a new 2x2 matrix
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
function create() {
|
|
69
|
+
var out = new glMatrix.ARRAY_TYPE(4);
|
|
70
|
+
|
|
71
|
+
if (glMatrix.ARRAY_TYPE != Float32Array) {
|
|
72
|
+
out[1] = 0;
|
|
73
|
+
out[2] = 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
out[0] = 1;
|
|
77
|
+
out[3] = 1;
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new mat2 initialized with values from an existing matrix
|
|
82
|
+
*
|
|
83
|
+
* @param {ReadonlyMat2} a matrix to clone
|
|
84
|
+
* @returns {mat2} a new 2x2 matrix
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
function clone(a) {
|
|
88
|
+
var out = new glMatrix.ARRAY_TYPE(4);
|
|
89
|
+
out[0] = a[0];
|
|
90
|
+
out[1] = a[1];
|
|
91
|
+
out[2] = a[2];
|
|
92
|
+
out[3] = a[3];
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Copy the values from one mat2 to another
|
|
97
|
+
*
|
|
98
|
+
* @param {mat2} out the receiving matrix
|
|
99
|
+
* @param {ReadonlyMat2} a the source matrix
|
|
100
|
+
* @returns {mat2} out
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
function copy(out, a) {
|
|
104
|
+
out[0] = a[0];
|
|
105
|
+
out[1] = a[1];
|
|
106
|
+
out[2] = a[2];
|
|
107
|
+
out[3] = a[3];
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Set a mat2 to the identity matrix
|
|
112
|
+
*
|
|
113
|
+
* @param {mat2} out the receiving matrix
|
|
114
|
+
* @returns {mat2} out
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
function identity(out) {
|
|
118
|
+
out[0] = 1;
|
|
119
|
+
out[1] = 0;
|
|
120
|
+
out[2] = 0;
|
|
121
|
+
out[3] = 1;
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create a new mat2 with the given values
|
|
126
|
+
*
|
|
127
|
+
* @param {Number} m00 Component in column 0, row 0 position (index 0)
|
|
128
|
+
* @param {Number} m01 Component in column 0, row 1 position (index 1)
|
|
129
|
+
* @param {Number} m10 Component in column 1, row 0 position (index 2)
|
|
130
|
+
* @param {Number} m11 Component in column 1, row 1 position (index 3)
|
|
131
|
+
* @returns {mat2} out A new 2x2 matrix
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
function fromValues(m00, m01, m10, m11) {
|
|
135
|
+
var out = new glMatrix.ARRAY_TYPE(4);
|
|
136
|
+
out[0] = m00;
|
|
137
|
+
out[1] = m01;
|
|
138
|
+
out[2] = m10;
|
|
139
|
+
out[3] = m11;
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Set the components of a mat2 to the given values
|
|
144
|
+
*
|
|
145
|
+
* @param {mat2} out the receiving matrix
|
|
146
|
+
* @param {Number} m00 Component in column 0, row 0 position (index 0)
|
|
147
|
+
* @param {Number} m01 Component in column 0, row 1 position (index 1)
|
|
148
|
+
* @param {Number} m10 Component in column 1, row 0 position (index 2)
|
|
149
|
+
* @param {Number} m11 Component in column 1, row 1 position (index 3)
|
|
150
|
+
* @returns {mat2} out
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
function set(out, m00, m01, m10, m11) {
|
|
154
|
+
out[0] = m00;
|
|
155
|
+
out[1] = m01;
|
|
156
|
+
out[2] = m10;
|
|
157
|
+
out[3] = m11;
|
|
158
|
+
return out;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Transpose the values of a mat2
|
|
162
|
+
*
|
|
163
|
+
* @param {mat2} out the receiving matrix
|
|
164
|
+
* @param {ReadonlyMat2} a the source matrix
|
|
165
|
+
* @returns {mat2} out
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
function transpose(out, a) {
|
|
169
|
+
// If we are transposing ourselves we can skip a few steps but have to cache
|
|
170
|
+
// some values
|
|
171
|
+
if (out === a) {
|
|
172
|
+
var a1 = a[1];
|
|
173
|
+
out[1] = a[2];
|
|
174
|
+
out[2] = a1;
|
|
175
|
+
} else {
|
|
176
|
+
out[0] = a[0];
|
|
177
|
+
out[1] = a[2];
|
|
178
|
+
out[2] = a[1];
|
|
179
|
+
out[3] = a[3];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Inverts a mat2
|
|
186
|
+
*
|
|
187
|
+
* @param {mat2} out the receiving matrix
|
|
188
|
+
* @param {ReadonlyMat2} a the source matrix
|
|
189
|
+
* @returns {mat2} out
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
function invert(out, a) {
|
|
193
|
+
var a0 = a[0],
|
|
194
|
+
a1 = a[1],
|
|
195
|
+
a2 = a[2],
|
|
196
|
+
a3 = a[3]; // Calculate the determinant
|
|
197
|
+
|
|
198
|
+
var det = a0 * a3 - a2 * a1;
|
|
199
|
+
|
|
200
|
+
if (!det) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
det = 1.0 / det;
|
|
205
|
+
out[0] = a3 * det;
|
|
206
|
+
out[1] = -a1 * det;
|
|
207
|
+
out[2] = -a2 * det;
|
|
208
|
+
out[3] = a0 * det;
|
|
209
|
+
return out;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Calculates the adjugate of a mat2
|
|
213
|
+
*
|
|
214
|
+
* @param {mat2} out the receiving matrix
|
|
215
|
+
* @param {ReadonlyMat2} a the source matrix
|
|
216
|
+
* @returns {mat2} out
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
function adjoint(out, a) {
|
|
220
|
+
// Caching this value is nessecary if out == a
|
|
221
|
+
var a0 = a[0];
|
|
222
|
+
out[0] = a[3];
|
|
223
|
+
out[1] = -a[1];
|
|
224
|
+
out[2] = -a[2];
|
|
225
|
+
out[3] = a0;
|
|
226
|
+
return out;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Calculates the determinant of a mat2
|
|
230
|
+
*
|
|
231
|
+
* @param {ReadonlyMat2} a the source matrix
|
|
232
|
+
* @returns {Number} determinant of a
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
function determinant(a) {
|
|
236
|
+
return a[0] * a[3] - a[2] * a[1];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Multiplies two mat2's
|
|
240
|
+
*
|
|
241
|
+
* @param {mat2} out the receiving matrix
|
|
242
|
+
* @param {ReadonlyMat2} a the first operand
|
|
243
|
+
* @param {ReadonlyMat2} b the second operand
|
|
244
|
+
* @returns {mat2} out
|
|
245
|
+
*/
|
|
246
|
+
|
|
247
|
+
function multiply(out, a, b) {
|
|
248
|
+
var a0 = a[0],
|
|
249
|
+
a1 = a[1],
|
|
250
|
+
a2 = a[2],
|
|
251
|
+
a3 = a[3];
|
|
252
|
+
var b0 = b[0],
|
|
253
|
+
b1 = b[1],
|
|
254
|
+
b2 = b[2],
|
|
255
|
+
b3 = b[3];
|
|
256
|
+
out[0] = a0 * b0 + a2 * b1;
|
|
257
|
+
out[1] = a1 * b0 + a3 * b1;
|
|
258
|
+
out[2] = a0 * b2 + a2 * b3;
|
|
259
|
+
out[3] = a1 * b2 + a3 * b3;
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Rotates a mat2 by the given angle
|
|
264
|
+
*
|
|
265
|
+
* @param {mat2} out the receiving matrix
|
|
266
|
+
* @param {ReadonlyMat2} a the matrix to rotate
|
|
267
|
+
* @param {Number} rad the angle to rotate the matrix by
|
|
268
|
+
* @returns {mat2} out
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
function rotate(out, a, rad) {
|
|
272
|
+
var a0 = a[0],
|
|
273
|
+
a1 = a[1],
|
|
274
|
+
a2 = a[2],
|
|
275
|
+
a3 = a[3];
|
|
276
|
+
var s = Math.sin(rad);
|
|
277
|
+
var c = Math.cos(rad);
|
|
278
|
+
out[0] = a0 * c + a2 * s;
|
|
279
|
+
out[1] = a1 * c + a3 * s;
|
|
280
|
+
out[2] = a0 * -s + a2 * c;
|
|
281
|
+
out[3] = a1 * -s + a3 * c;
|
|
282
|
+
return out;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Scales the mat2 by the dimensions in the given vec2
|
|
286
|
+
*
|
|
287
|
+
* @param {mat2} out the receiving matrix
|
|
288
|
+
* @param {ReadonlyMat2} a the matrix to rotate
|
|
289
|
+
* @param {ReadonlyVec2} v the vec2 to scale the matrix by
|
|
290
|
+
* @returns {mat2} out
|
|
291
|
+
**/
|
|
292
|
+
|
|
293
|
+
function scale(out, a, v) {
|
|
294
|
+
var a0 = a[0],
|
|
295
|
+
a1 = a[1],
|
|
296
|
+
a2 = a[2],
|
|
297
|
+
a3 = a[3];
|
|
298
|
+
var v0 = v[0],
|
|
299
|
+
v1 = v[1];
|
|
300
|
+
out[0] = a0 * v0;
|
|
301
|
+
out[1] = a1 * v0;
|
|
302
|
+
out[2] = a2 * v1;
|
|
303
|
+
out[3] = a3 * v1;
|
|
304
|
+
return out;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Creates a matrix from a given angle
|
|
308
|
+
* This is equivalent to (but much faster than):
|
|
309
|
+
*
|
|
310
|
+
* mat2.identity(dest);
|
|
311
|
+
* mat2.rotate(dest, dest, rad);
|
|
312
|
+
*
|
|
313
|
+
* @param {mat2} out mat2 receiving operation result
|
|
314
|
+
* @param {Number} rad the angle to rotate the matrix by
|
|
315
|
+
* @returns {mat2} out
|
|
316
|
+
*/
|
|
317
|
+
|
|
318
|
+
function fromRotation(out, rad) {
|
|
319
|
+
var s = Math.sin(rad);
|
|
320
|
+
var c = Math.cos(rad);
|
|
321
|
+
out[0] = c;
|
|
322
|
+
out[1] = s;
|
|
323
|
+
out[2] = -s;
|
|
324
|
+
out[3] = c;
|
|
325
|
+
return out;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Creates a matrix from a vector scaling
|
|
329
|
+
* This is equivalent to (but much faster than):
|
|
330
|
+
*
|
|
331
|
+
* mat2.identity(dest);
|
|
332
|
+
* mat2.scale(dest, dest, vec);
|
|
333
|
+
*
|
|
334
|
+
* @param {mat2} out mat2 receiving operation result
|
|
335
|
+
* @param {ReadonlyVec2} v Scaling vector
|
|
336
|
+
* @returns {mat2} out
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
function fromScaling(out, v) {
|
|
340
|
+
out[0] = v[0];
|
|
341
|
+
out[1] = 0;
|
|
342
|
+
out[2] = 0;
|
|
343
|
+
out[3] = v[1];
|
|
344
|
+
return out;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Returns a string representation of a mat2
|
|
348
|
+
*
|
|
349
|
+
* @param {ReadonlyMat2} a matrix to represent as a string
|
|
350
|
+
* @returns {String} string representation of the matrix
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
function str(a) {
|
|
354
|
+
return "mat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")";
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Returns Frobenius norm of a mat2
|
|
358
|
+
*
|
|
359
|
+
* @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of
|
|
360
|
+
* @returns {Number} Frobenius norm
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
function frob(a) {
|
|
364
|
+
return Math.hypot(a[0], a[1], a[2], a[3]);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
|
|
368
|
+
* @param {ReadonlyMat2} L the lower triangular matrix
|
|
369
|
+
* @param {ReadonlyMat2} D the diagonal matrix
|
|
370
|
+
* @param {ReadonlyMat2} U the upper triangular matrix
|
|
371
|
+
* @param {ReadonlyMat2} a the input matrix to factorize
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
function LDU(L, D, U, a) {
|
|
375
|
+
L[2] = a[2] / a[0];
|
|
376
|
+
U[0] = a[0];
|
|
377
|
+
U[1] = a[1];
|
|
378
|
+
U[3] = a[3] - L[2] * U[1];
|
|
379
|
+
return [L, D, U];
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Adds two mat2's
|
|
383
|
+
*
|
|
384
|
+
* @param {mat2} out the receiving matrix
|
|
385
|
+
* @param {ReadonlyMat2} a the first operand
|
|
386
|
+
* @param {ReadonlyMat2} b the second operand
|
|
387
|
+
* @returns {mat2} out
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
function add(out, a, b) {
|
|
391
|
+
out[0] = a[0] + b[0];
|
|
392
|
+
out[1] = a[1] + b[1];
|
|
393
|
+
out[2] = a[2] + b[2];
|
|
394
|
+
out[3] = a[3] + b[3];
|
|
395
|
+
return out;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Subtracts matrix b from matrix a
|
|
399
|
+
*
|
|
400
|
+
* @param {mat2} out the receiving matrix
|
|
401
|
+
* @param {ReadonlyMat2} a the first operand
|
|
402
|
+
* @param {ReadonlyMat2} b the second operand
|
|
403
|
+
* @returns {mat2} out
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
function subtract(out, a, b) {
|
|
407
|
+
out[0] = a[0] - b[0];
|
|
408
|
+
out[1] = a[1] - b[1];
|
|
409
|
+
out[2] = a[2] - b[2];
|
|
410
|
+
out[3] = a[3] - b[3];
|
|
411
|
+
return out;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
|
|
415
|
+
*
|
|
416
|
+
* @param {ReadonlyMat2} a The first matrix.
|
|
417
|
+
* @param {ReadonlyMat2} b The second matrix.
|
|
418
|
+
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
function exactEquals(a, b) {
|
|
422
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Returns whether or not the matrices have approximately the same elements in the same position.
|
|
426
|
+
*
|
|
427
|
+
* @param {ReadonlyMat2} a The first matrix.
|
|
428
|
+
* @param {ReadonlyMat2} b The second matrix.
|
|
429
|
+
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
430
|
+
*/
|
|
431
|
+
|
|
432
|
+
function equals(a, b) {
|
|
433
|
+
var a0 = a[0],
|
|
434
|
+
a1 = a[1],
|
|
435
|
+
a2 = a[2],
|
|
436
|
+
a3 = a[3];
|
|
437
|
+
var b0 = b[0],
|
|
438
|
+
b1 = b[1],
|
|
439
|
+
b2 = b[2],
|
|
440
|
+
b3 = b[3];
|
|
441
|
+
return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Multiply each element of the matrix by a scalar.
|
|
445
|
+
*
|
|
446
|
+
* @param {mat2} out the receiving matrix
|
|
447
|
+
* @param {ReadonlyMat2} a the matrix to scale
|
|
448
|
+
* @param {Number} b amount to scale the matrix's elements by
|
|
449
|
+
* @returns {mat2} out
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
function multiplyScalar(out, a, b) {
|
|
453
|
+
out[0] = a[0] * b;
|
|
454
|
+
out[1] = a[1] * b;
|
|
455
|
+
out[2] = a[2] * b;
|
|
456
|
+
out[3] = a[3] * b;
|
|
457
|
+
return out;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Adds two mat2's after multiplying each element of the second operand by a scalar value.
|
|
461
|
+
*
|
|
462
|
+
* @param {mat2} out the receiving vector
|
|
463
|
+
* @param {ReadonlyMat2} a the first operand
|
|
464
|
+
* @param {ReadonlyMat2} b the second operand
|
|
465
|
+
* @param {Number} scale the amount to scale b's elements by before adding
|
|
466
|
+
* @returns {mat2} out
|
|
467
|
+
*/
|
|
468
|
+
|
|
469
|
+
function multiplyScalarAndAdd(out, a, b, scale) {
|
|
470
|
+
out[0] = a[0] + b[0] * scale;
|
|
471
|
+
out[1] = a[1] + b[1] * scale;
|
|
472
|
+
out[2] = a[2] + b[2] * scale;
|
|
473
|
+
out[3] = a[3] + b[3] * scale;
|
|
474
|
+
return out;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Alias for {@link mat2.multiply}
|
|
478
|
+
* @function
|
|
479
|
+
*/
|
|
480
|
+
|
|
481
|
+
var mul = (/* unused pure expression or super */ null && (multiply));
|
|
482
|
+
/**
|
|
483
|
+
* Alias for {@link mat2.subtract}
|
|
484
|
+
* @function
|
|
485
|
+
*/
|
|
486
|
+
|
|
487
|
+
var sub = (/* unused pure expression or super */ null && (subtract));
|
|
488
|
+
|
|
489
|
+
},
|
|
490
|
+
46245(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
491
|
+
"use strict";
|
|
492
|
+
/* import */ var _common_js__rspack_import_0 = __webpack_require__(23172);
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* 2x3 Matrix
|
|
496
|
+
* @module mat2d
|
|
497
|
+
* @description
|
|
498
|
+
* A mat2d contains six elements defined as:
|
|
499
|
+
* <pre>
|
|
500
|
+
* [a, b,
|
|
501
|
+
* c, d,
|
|
502
|
+
* tx, ty]
|
|
503
|
+
* </pre>
|
|
504
|
+
* This is a short form for the 3x3 matrix:
|
|
505
|
+
* <pre>
|
|
506
|
+
* [a, b, 0,
|
|
507
|
+
* c, d, 0,
|
|
508
|
+
* tx, ty, 1]
|
|
509
|
+
* </pre>
|
|
510
|
+
* The last column is ignored so the array is shorter and operations are faster.
|
|
511
|
+
*/
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Creates a new identity mat2d
|
|
515
|
+
*
|
|
516
|
+
* @returns {mat2d} a new 2x3 matrix
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
function create() {
|
|
520
|
+
var out = new glMatrix.ARRAY_TYPE(6);
|
|
521
|
+
|
|
522
|
+
if (glMatrix.ARRAY_TYPE != Float32Array) {
|
|
523
|
+
out[1] = 0;
|
|
524
|
+
out[2] = 0;
|
|
525
|
+
out[4] = 0;
|
|
526
|
+
out[5] = 0;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
out[0] = 1;
|
|
530
|
+
out[3] = 1;
|
|
531
|
+
return out;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Creates a new mat2d initialized with values from an existing matrix
|
|
535
|
+
*
|
|
536
|
+
* @param {ReadonlyMat2d} a matrix to clone
|
|
537
|
+
* @returns {mat2d} a new 2x3 matrix
|
|
538
|
+
*/
|
|
539
|
+
|
|
540
|
+
function clone(a) {
|
|
541
|
+
var out = new glMatrix.ARRAY_TYPE(6);
|
|
542
|
+
out[0] = a[0];
|
|
543
|
+
out[1] = a[1];
|
|
544
|
+
out[2] = a[2];
|
|
545
|
+
out[3] = a[3];
|
|
546
|
+
out[4] = a[4];
|
|
547
|
+
out[5] = a[5];
|
|
548
|
+
return out;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Copy the values from one mat2d to another
|
|
552
|
+
*
|
|
553
|
+
* @param {mat2d} out the receiving matrix
|
|
554
|
+
* @param {ReadonlyMat2d} a the source matrix
|
|
555
|
+
* @returns {mat2d} out
|
|
556
|
+
*/
|
|
557
|
+
|
|
558
|
+
function copy(out, a) {
|
|
559
|
+
out[0] = a[0];
|
|
560
|
+
out[1] = a[1];
|
|
561
|
+
out[2] = a[2];
|
|
562
|
+
out[3] = a[3];
|
|
563
|
+
out[4] = a[4];
|
|
564
|
+
out[5] = a[5];
|
|
565
|
+
return out;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Set a mat2d to the identity matrix
|
|
569
|
+
*
|
|
570
|
+
* @param {mat2d} out the receiving matrix
|
|
571
|
+
* @returns {mat2d} out
|
|
572
|
+
*/
|
|
573
|
+
|
|
574
|
+
function identity(out) {
|
|
575
|
+
out[0] = 1;
|
|
576
|
+
out[1] = 0;
|
|
577
|
+
out[2] = 0;
|
|
578
|
+
out[3] = 1;
|
|
579
|
+
out[4] = 0;
|
|
580
|
+
out[5] = 0;
|
|
581
|
+
return out;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Create a new mat2d with the given values
|
|
585
|
+
*
|
|
586
|
+
* @param {Number} a Component A (index 0)
|
|
587
|
+
* @param {Number} b Component B (index 1)
|
|
588
|
+
* @param {Number} c Component C (index 2)
|
|
589
|
+
* @param {Number} d Component D (index 3)
|
|
590
|
+
* @param {Number} tx Component TX (index 4)
|
|
591
|
+
* @param {Number} ty Component TY (index 5)
|
|
592
|
+
* @returns {mat2d} A new mat2d
|
|
593
|
+
*/
|
|
594
|
+
|
|
595
|
+
function fromValues(a, b, c, d, tx, ty) {
|
|
596
|
+
var out = new glMatrix.ARRAY_TYPE(6);
|
|
597
|
+
out[0] = a;
|
|
598
|
+
out[1] = b;
|
|
599
|
+
out[2] = c;
|
|
600
|
+
out[3] = d;
|
|
601
|
+
out[4] = tx;
|
|
602
|
+
out[5] = ty;
|
|
603
|
+
return out;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Set the components of a mat2d to the given values
|
|
607
|
+
*
|
|
608
|
+
* @param {mat2d} out the receiving matrix
|
|
609
|
+
* @param {Number} a Component A (index 0)
|
|
610
|
+
* @param {Number} b Component B (index 1)
|
|
611
|
+
* @param {Number} c Component C (index 2)
|
|
612
|
+
* @param {Number} d Component D (index 3)
|
|
613
|
+
* @param {Number} tx Component TX (index 4)
|
|
614
|
+
* @param {Number} ty Component TY (index 5)
|
|
615
|
+
* @returns {mat2d} out
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
function set(out, a, b, c, d, tx, ty) {
|
|
619
|
+
out[0] = a;
|
|
620
|
+
out[1] = b;
|
|
621
|
+
out[2] = c;
|
|
622
|
+
out[3] = d;
|
|
623
|
+
out[4] = tx;
|
|
624
|
+
out[5] = ty;
|
|
625
|
+
return out;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Inverts a mat2d
|
|
629
|
+
*
|
|
630
|
+
* @param {mat2d} out the receiving matrix
|
|
631
|
+
* @param {ReadonlyMat2d} a the source matrix
|
|
632
|
+
* @returns {mat2d} out
|
|
633
|
+
*/
|
|
634
|
+
|
|
635
|
+
function invert(out, a) {
|
|
636
|
+
var aa = a[0],
|
|
637
|
+
ab = a[1],
|
|
638
|
+
ac = a[2],
|
|
639
|
+
ad = a[3];
|
|
640
|
+
var atx = a[4],
|
|
641
|
+
aty = a[5];
|
|
642
|
+
var det = aa * ad - ab * ac;
|
|
643
|
+
|
|
644
|
+
if (!det) {
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
det = 1.0 / det;
|
|
649
|
+
out[0] = ad * det;
|
|
650
|
+
out[1] = -ab * det;
|
|
651
|
+
out[2] = -ac * det;
|
|
652
|
+
out[3] = aa * det;
|
|
653
|
+
out[4] = (ac * aty - ad * atx) * det;
|
|
654
|
+
out[5] = (ab * atx - aa * aty) * det;
|
|
655
|
+
return out;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Calculates the determinant of a mat2d
|
|
659
|
+
*
|
|
660
|
+
* @param {ReadonlyMat2d} a the source matrix
|
|
661
|
+
* @returns {Number} determinant of a
|
|
662
|
+
*/
|
|
663
|
+
|
|
664
|
+
function determinant(a) {
|
|
665
|
+
return a[0] * a[3] - a[1] * a[2];
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Multiplies two mat2d's
|
|
669
|
+
*
|
|
670
|
+
* @param {mat2d} out the receiving matrix
|
|
671
|
+
* @param {ReadonlyMat2d} a the first operand
|
|
672
|
+
* @param {ReadonlyMat2d} b the second operand
|
|
673
|
+
* @returns {mat2d} out
|
|
674
|
+
*/
|
|
675
|
+
|
|
676
|
+
function multiply(out, a, b) {
|
|
677
|
+
var a0 = a[0],
|
|
678
|
+
a1 = a[1],
|
|
679
|
+
a2 = a[2],
|
|
680
|
+
a3 = a[3],
|
|
681
|
+
a4 = a[4],
|
|
682
|
+
a5 = a[5];
|
|
683
|
+
var b0 = b[0],
|
|
684
|
+
b1 = b[1],
|
|
685
|
+
b2 = b[2],
|
|
686
|
+
b3 = b[3],
|
|
687
|
+
b4 = b[4],
|
|
688
|
+
b5 = b[5];
|
|
689
|
+
out[0] = a0 * b0 + a2 * b1;
|
|
690
|
+
out[1] = a1 * b0 + a3 * b1;
|
|
691
|
+
out[2] = a0 * b2 + a2 * b3;
|
|
692
|
+
out[3] = a1 * b2 + a3 * b3;
|
|
693
|
+
out[4] = a0 * b4 + a2 * b5 + a4;
|
|
694
|
+
out[5] = a1 * b4 + a3 * b5 + a5;
|
|
695
|
+
return out;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Rotates a mat2d by the given angle
|
|
699
|
+
*
|
|
700
|
+
* @param {mat2d} out the receiving matrix
|
|
701
|
+
* @param {ReadonlyMat2d} a the matrix to rotate
|
|
702
|
+
* @param {Number} rad the angle to rotate the matrix by
|
|
703
|
+
* @returns {mat2d} out
|
|
704
|
+
*/
|
|
705
|
+
|
|
706
|
+
function rotate(out, a, rad) {
|
|
707
|
+
var a0 = a[0],
|
|
708
|
+
a1 = a[1],
|
|
709
|
+
a2 = a[2],
|
|
710
|
+
a3 = a[3],
|
|
711
|
+
a4 = a[4],
|
|
712
|
+
a5 = a[5];
|
|
713
|
+
var s = Math.sin(rad);
|
|
714
|
+
var c = Math.cos(rad);
|
|
715
|
+
out[0] = a0 * c + a2 * s;
|
|
716
|
+
out[1] = a1 * c + a3 * s;
|
|
717
|
+
out[2] = a0 * -s + a2 * c;
|
|
718
|
+
out[3] = a1 * -s + a3 * c;
|
|
719
|
+
out[4] = a4;
|
|
720
|
+
out[5] = a5;
|
|
721
|
+
return out;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Scales the mat2d by the dimensions in the given vec2
|
|
725
|
+
*
|
|
726
|
+
* @param {mat2d} out the receiving matrix
|
|
727
|
+
* @param {ReadonlyMat2d} a the matrix to translate
|
|
728
|
+
* @param {ReadonlyVec2} v the vec2 to scale the matrix by
|
|
729
|
+
* @returns {mat2d} out
|
|
730
|
+
**/
|
|
731
|
+
|
|
732
|
+
function scale(out, a, v) {
|
|
733
|
+
var a0 = a[0],
|
|
734
|
+
a1 = a[1],
|
|
735
|
+
a2 = a[2],
|
|
736
|
+
a3 = a[3],
|
|
737
|
+
a4 = a[4],
|
|
738
|
+
a5 = a[5];
|
|
739
|
+
var v0 = v[0],
|
|
740
|
+
v1 = v[1];
|
|
741
|
+
out[0] = a0 * v0;
|
|
742
|
+
out[1] = a1 * v0;
|
|
743
|
+
out[2] = a2 * v1;
|
|
744
|
+
out[3] = a3 * v1;
|
|
745
|
+
out[4] = a4;
|
|
746
|
+
out[5] = a5;
|
|
747
|
+
return out;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Translates the mat2d by the dimensions in the given vec2
|
|
751
|
+
*
|
|
752
|
+
* @param {mat2d} out the receiving matrix
|
|
753
|
+
* @param {ReadonlyMat2d} a the matrix to translate
|
|
754
|
+
* @param {ReadonlyVec2} v the vec2 to translate the matrix by
|
|
755
|
+
* @returns {mat2d} out
|
|
756
|
+
**/
|
|
757
|
+
|
|
758
|
+
function translate(out, a, v) {
|
|
759
|
+
var a0 = a[0],
|
|
760
|
+
a1 = a[1],
|
|
761
|
+
a2 = a[2],
|
|
762
|
+
a3 = a[3],
|
|
763
|
+
a4 = a[4],
|
|
764
|
+
a5 = a[5];
|
|
765
|
+
var v0 = v[0],
|
|
766
|
+
v1 = v[1];
|
|
767
|
+
out[0] = a0;
|
|
768
|
+
out[1] = a1;
|
|
769
|
+
out[2] = a2;
|
|
770
|
+
out[3] = a3;
|
|
771
|
+
out[4] = a0 * v0 + a2 * v1 + a4;
|
|
772
|
+
out[5] = a1 * v0 + a3 * v1 + a5;
|
|
773
|
+
return out;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Creates a matrix from a given angle
|
|
777
|
+
* This is equivalent to (but much faster than):
|
|
778
|
+
*
|
|
779
|
+
* mat2d.identity(dest);
|
|
780
|
+
* mat2d.rotate(dest, dest, rad);
|
|
781
|
+
*
|
|
782
|
+
* @param {mat2d} out mat2d receiving operation result
|
|
783
|
+
* @param {Number} rad the angle to rotate the matrix by
|
|
784
|
+
* @returns {mat2d} out
|
|
785
|
+
*/
|
|
786
|
+
|
|
787
|
+
function fromRotation(out, rad) {
|
|
788
|
+
var s = Math.sin(rad),
|
|
789
|
+
c = Math.cos(rad);
|
|
790
|
+
out[0] = c;
|
|
791
|
+
out[1] = s;
|
|
792
|
+
out[2] = -s;
|
|
793
|
+
out[3] = c;
|
|
794
|
+
out[4] = 0;
|
|
795
|
+
out[5] = 0;
|
|
796
|
+
return out;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* Creates a matrix from a vector scaling
|
|
800
|
+
* This is equivalent to (but much faster than):
|
|
801
|
+
*
|
|
802
|
+
* mat2d.identity(dest);
|
|
803
|
+
* mat2d.scale(dest, dest, vec);
|
|
804
|
+
*
|
|
805
|
+
* @param {mat2d} out mat2d receiving operation result
|
|
806
|
+
* @param {ReadonlyVec2} v Scaling vector
|
|
807
|
+
* @returns {mat2d} out
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
function fromScaling(out, v) {
|
|
811
|
+
out[0] = v[0];
|
|
812
|
+
out[1] = 0;
|
|
813
|
+
out[2] = 0;
|
|
814
|
+
out[3] = v[1];
|
|
815
|
+
out[4] = 0;
|
|
816
|
+
out[5] = 0;
|
|
817
|
+
return out;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Creates a matrix from a vector translation
|
|
821
|
+
* This is equivalent to (but much faster than):
|
|
822
|
+
*
|
|
823
|
+
* mat2d.identity(dest);
|
|
824
|
+
* mat2d.translate(dest, dest, vec);
|
|
825
|
+
*
|
|
826
|
+
* @param {mat2d} out mat2d receiving operation result
|
|
827
|
+
* @param {ReadonlyVec2} v Translation vector
|
|
828
|
+
* @returns {mat2d} out
|
|
829
|
+
*/
|
|
830
|
+
|
|
831
|
+
function fromTranslation(out, v) {
|
|
832
|
+
out[0] = 1;
|
|
833
|
+
out[1] = 0;
|
|
834
|
+
out[2] = 0;
|
|
835
|
+
out[3] = 1;
|
|
836
|
+
out[4] = v[0];
|
|
837
|
+
out[5] = v[1];
|
|
838
|
+
return out;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Returns a string representation of a mat2d
|
|
842
|
+
*
|
|
843
|
+
* @param {ReadonlyMat2d} a matrix to represent as a string
|
|
844
|
+
* @returns {String} string representation of the matrix
|
|
845
|
+
*/
|
|
846
|
+
|
|
847
|
+
function str(a) {
|
|
848
|
+
return "mat2d(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")";
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Returns Frobenius norm of a mat2d
|
|
852
|
+
*
|
|
853
|
+
* @param {ReadonlyMat2d} a the matrix to calculate Frobenius norm of
|
|
854
|
+
* @returns {Number} Frobenius norm
|
|
855
|
+
*/
|
|
856
|
+
|
|
857
|
+
function frob(a) {
|
|
858
|
+
return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], 1);
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Adds two mat2d's
|
|
862
|
+
*
|
|
863
|
+
* @param {mat2d} out the receiving matrix
|
|
864
|
+
* @param {ReadonlyMat2d} a the first operand
|
|
865
|
+
* @param {ReadonlyMat2d} b the second operand
|
|
866
|
+
* @returns {mat2d} out
|
|
867
|
+
*/
|
|
868
|
+
|
|
869
|
+
function add(out, a, b) {
|
|
870
|
+
out[0] = a[0] + b[0];
|
|
871
|
+
out[1] = a[1] + b[1];
|
|
872
|
+
out[2] = a[2] + b[2];
|
|
873
|
+
out[3] = a[3] + b[3];
|
|
874
|
+
out[4] = a[4] + b[4];
|
|
875
|
+
out[5] = a[5] + b[5];
|
|
876
|
+
return out;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Subtracts matrix b from matrix a
|
|
880
|
+
*
|
|
881
|
+
* @param {mat2d} out the receiving matrix
|
|
882
|
+
* @param {ReadonlyMat2d} a the first operand
|
|
883
|
+
* @param {ReadonlyMat2d} b the second operand
|
|
884
|
+
* @returns {mat2d} out
|
|
885
|
+
*/
|
|
886
|
+
|
|
887
|
+
function subtract(out, a, b) {
|
|
888
|
+
out[0] = a[0] - b[0];
|
|
889
|
+
out[1] = a[1] - b[1];
|
|
890
|
+
out[2] = a[2] - b[2];
|
|
891
|
+
out[3] = a[3] - b[3];
|
|
892
|
+
out[4] = a[4] - b[4];
|
|
893
|
+
out[5] = a[5] - b[5];
|
|
894
|
+
return out;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Multiply each element of the matrix by a scalar.
|
|
898
|
+
*
|
|
899
|
+
* @param {mat2d} out the receiving matrix
|
|
900
|
+
* @param {ReadonlyMat2d} a the matrix to scale
|
|
901
|
+
* @param {Number} b amount to scale the matrix's elements by
|
|
902
|
+
* @returns {mat2d} out
|
|
903
|
+
*/
|
|
904
|
+
|
|
905
|
+
function multiplyScalar(out, a, b) {
|
|
906
|
+
out[0] = a[0] * b;
|
|
907
|
+
out[1] = a[1] * b;
|
|
908
|
+
out[2] = a[2] * b;
|
|
909
|
+
out[3] = a[3] * b;
|
|
910
|
+
out[4] = a[4] * b;
|
|
911
|
+
out[5] = a[5] * b;
|
|
912
|
+
return out;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Adds two mat2d's after multiplying each element of the second operand by a scalar value.
|
|
916
|
+
*
|
|
917
|
+
* @param {mat2d} out the receiving vector
|
|
918
|
+
* @param {ReadonlyMat2d} a the first operand
|
|
919
|
+
* @param {ReadonlyMat2d} b the second operand
|
|
920
|
+
* @param {Number} scale the amount to scale b's elements by before adding
|
|
921
|
+
* @returns {mat2d} out
|
|
922
|
+
*/
|
|
923
|
+
|
|
924
|
+
function multiplyScalarAndAdd(out, a, b, scale) {
|
|
925
|
+
out[0] = a[0] + b[0] * scale;
|
|
926
|
+
out[1] = a[1] + b[1] * scale;
|
|
927
|
+
out[2] = a[2] + b[2] * scale;
|
|
928
|
+
out[3] = a[3] + b[3] * scale;
|
|
929
|
+
out[4] = a[4] + b[4] * scale;
|
|
930
|
+
out[5] = a[5] + b[5] * scale;
|
|
931
|
+
return out;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
|
|
935
|
+
*
|
|
936
|
+
* @param {ReadonlyMat2d} a The first matrix.
|
|
937
|
+
* @param {ReadonlyMat2d} b The second matrix.
|
|
938
|
+
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
939
|
+
*/
|
|
940
|
+
|
|
941
|
+
function exactEquals(a, b) {
|
|
942
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5];
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Returns whether or not the matrices have approximately the same elements in the same position.
|
|
946
|
+
*
|
|
947
|
+
* @param {ReadonlyMat2d} a The first matrix.
|
|
948
|
+
* @param {ReadonlyMat2d} b The second matrix.
|
|
949
|
+
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
950
|
+
*/
|
|
951
|
+
|
|
952
|
+
function equals(a, b) {
|
|
953
|
+
var a0 = a[0],
|
|
954
|
+
a1 = a[1],
|
|
955
|
+
a2 = a[2],
|
|
956
|
+
a3 = a[3],
|
|
957
|
+
a4 = a[4],
|
|
958
|
+
a5 = a[5];
|
|
959
|
+
var b0 = b[0],
|
|
960
|
+
b1 = b[1],
|
|
961
|
+
b2 = b[2],
|
|
962
|
+
b3 = b[3],
|
|
963
|
+
b4 = b[4],
|
|
964
|
+
b5 = b[5];
|
|
965
|
+
return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5));
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Alias for {@link mat2d.multiply}
|
|
969
|
+
* @function
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
var mul = (/* unused pure expression or super */ null && (multiply));
|
|
973
|
+
/**
|
|
974
|
+
* Alias for {@link mat2d.subtract}
|
|
975
|
+
* @function
|
|
976
|
+
*/
|
|
977
|
+
|
|
978
|
+
var sub = (/* unused pure expression or super */ null && (subtract));
|
|
979
|
+
|
|
980
|
+
},
|
|
981
|
+
8470(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
982
|
+
"use strict";
|
|
983
|
+
/* import */ var _common_js__rspack_import_0 = __webpack_require__(23172);
|
|
984
|
+
/* import */ var _quat_js__rspack_import_1 = __webpack_require__(6462);
|
|
985
|
+
/* import */ var _mat4_js__rspack_import_2 = __webpack_require__(39095);
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Dual Quaternion<br>
|
|
991
|
+
* Format: [real, dual]<br>
|
|
992
|
+
* Quaternion format: XYZW<br>
|
|
993
|
+
* Make sure to have normalized dual quaternions, otherwise the functions may not work as intended.<br>
|
|
994
|
+
* @module quat2
|
|
995
|
+
*/
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Creates a new identity dual quat
|
|
999
|
+
*
|
|
1000
|
+
* @returns {quat2} a new dual quaternion [real -> rotation, dual -> translation]
|
|
1001
|
+
*/
|
|
1002
|
+
|
|
1003
|
+
function create() {
|
|
1004
|
+
var dq = new glMatrix.ARRAY_TYPE(8);
|
|
1005
|
+
|
|
1006
|
+
if (glMatrix.ARRAY_TYPE != Float32Array) {
|
|
1007
|
+
dq[0] = 0;
|
|
1008
|
+
dq[1] = 0;
|
|
1009
|
+
dq[2] = 0;
|
|
1010
|
+
dq[4] = 0;
|
|
1011
|
+
dq[5] = 0;
|
|
1012
|
+
dq[6] = 0;
|
|
1013
|
+
dq[7] = 0;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
dq[3] = 1;
|
|
1017
|
+
return dq;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Creates a new quat initialized with values from an existing quaternion
|
|
1021
|
+
*
|
|
1022
|
+
* @param {ReadonlyQuat2} a dual quaternion to clone
|
|
1023
|
+
* @returns {quat2} new dual quaternion
|
|
1024
|
+
* @function
|
|
1025
|
+
*/
|
|
1026
|
+
|
|
1027
|
+
function clone(a) {
|
|
1028
|
+
var dq = new glMatrix.ARRAY_TYPE(8);
|
|
1029
|
+
dq[0] = a[0];
|
|
1030
|
+
dq[1] = a[1];
|
|
1031
|
+
dq[2] = a[2];
|
|
1032
|
+
dq[3] = a[3];
|
|
1033
|
+
dq[4] = a[4];
|
|
1034
|
+
dq[5] = a[5];
|
|
1035
|
+
dq[6] = a[6];
|
|
1036
|
+
dq[7] = a[7];
|
|
1037
|
+
return dq;
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Creates a new dual quat initialized with the given values
|
|
1041
|
+
*
|
|
1042
|
+
* @param {Number} x1 X component
|
|
1043
|
+
* @param {Number} y1 Y component
|
|
1044
|
+
* @param {Number} z1 Z component
|
|
1045
|
+
* @param {Number} w1 W component
|
|
1046
|
+
* @param {Number} x2 X component
|
|
1047
|
+
* @param {Number} y2 Y component
|
|
1048
|
+
* @param {Number} z2 Z component
|
|
1049
|
+
* @param {Number} w2 W component
|
|
1050
|
+
* @returns {quat2} new dual quaternion
|
|
1051
|
+
* @function
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
1054
|
+
function fromValues(x1, y1, z1, w1, x2, y2, z2, w2) {
|
|
1055
|
+
var dq = new glMatrix.ARRAY_TYPE(8);
|
|
1056
|
+
dq[0] = x1;
|
|
1057
|
+
dq[1] = y1;
|
|
1058
|
+
dq[2] = z1;
|
|
1059
|
+
dq[3] = w1;
|
|
1060
|
+
dq[4] = x2;
|
|
1061
|
+
dq[5] = y2;
|
|
1062
|
+
dq[6] = z2;
|
|
1063
|
+
dq[7] = w2;
|
|
1064
|
+
return dq;
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Creates a new dual quat from the given values (quat and translation)
|
|
1068
|
+
*
|
|
1069
|
+
* @param {Number} x1 X component
|
|
1070
|
+
* @param {Number} y1 Y component
|
|
1071
|
+
* @param {Number} z1 Z component
|
|
1072
|
+
* @param {Number} w1 W component
|
|
1073
|
+
* @param {Number} x2 X component (translation)
|
|
1074
|
+
* @param {Number} y2 Y component (translation)
|
|
1075
|
+
* @param {Number} z2 Z component (translation)
|
|
1076
|
+
* @returns {quat2} new dual quaternion
|
|
1077
|
+
* @function
|
|
1078
|
+
*/
|
|
1079
|
+
|
|
1080
|
+
function fromRotationTranslationValues(x1, y1, z1, w1, x2, y2, z2) {
|
|
1081
|
+
var dq = new glMatrix.ARRAY_TYPE(8);
|
|
1082
|
+
dq[0] = x1;
|
|
1083
|
+
dq[1] = y1;
|
|
1084
|
+
dq[2] = z1;
|
|
1085
|
+
dq[3] = w1;
|
|
1086
|
+
var ax = x2 * 0.5,
|
|
1087
|
+
ay = y2 * 0.5,
|
|
1088
|
+
az = z2 * 0.5;
|
|
1089
|
+
dq[4] = ax * w1 + ay * z1 - az * y1;
|
|
1090
|
+
dq[5] = ay * w1 + az * x1 - ax * z1;
|
|
1091
|
+
dq[6] = az * w1 + ax * y1 - ay * x1;
|
|
1092
|
+
dq[7] = -ax * x1 - ay * y1 - az * z1;
|
|
1093
|
+
return dq;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Creates a dual quat from a quaternion and a translation
|
|
1097
|
+
*
|
|
1098
|
+
* @param {ReadonlyQuat2} dual quaternion receiving operation result
|
|
1099
|
+
* @param {ReadonlyQuat} q a normalized quaternion
|
|
1100
|
+
* @param {ReadonlyVec3} t tranlation vector
|
|
1101
|
+
* @returns {quat2} dual quaternion receiving operation result
|
|
1102
|
+
* @function
|
|
1103
|
+
*/
|
|
1104
|
+
|
|
1105
|
+
function fromRotationTranslation(out, q, t) {
|
|
1106
|
+
var ax = t[0] * 0.5,
|
|
1107
|
+
ay = t[1] * 0.5,
|
|
1108
|
+
az = t[2] * 0.5,
|
|
1109
|
+
bx = q[0],
|
|
1110
|
+
by = q[1],
|
|
1111
|
+
bz = q[2],
|
|
1112
|
+
bw = q[3];
|
|
1113
|
+
out[0] = bx;
|
|
1114
|
+
out[1] = by;
|
|
1115
|
+
out[2] = bz;
|
|
1116
|
+
out[3] = bw;
|
|
1117
|
+
out[4] = ax * bw + ay * bz - az * by;
|
|
1118
|
+
out[5] = ay * bw + az * bx - ax * bz;
|
|
1119
|
+
out[6] = az * bw + ax * by - ay * bx;
|
|
1120
|
+
out[7] = -ax * bx - ay * by - az * bz;
|
|
1121
|
+
return out;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Creates a dual quat from a translation
|
|
1125
|
+
*
|
|
1126
|
+
* @param {ReadonlyQuat2} dual quaternion receiving operation result
|
|
1127
|
+
* @param {ReadonlyVec3} t translation vector
|
|
1128
|
+
* @returns {quat2} dual quaternion receiving operation result
|
|
1129
|
+
* @function
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1132
|
+
function fromTranslation(out, t) {
|
|
1133
|
+
out[0] = 0;
|
|
1134
|
+
out[1] = 0;
|
|
1135
|
+
out[2] = 0;
|
|
1136
|
+
out[3] = 1;
|
|
1137
|
+
out[4] = t[0] * 0.5;
|
|
1138
|
+
out[5] = t[1] * 0.5;
|
|
1139
|
+
out[6] = t[2] * 0.5;
|
|
1140
|
+
out[7] = 0;
|
|
1141
|
+
return out;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Creates a dual quat from a quaternion
|
|
1145
|
+
*
|
|
1146
|
+
* @param {ReadonlyQuat2} dual quaternion receiving operation result
|
|
1147
|
+
* @param {ReadonlyQuat} q the quaternion
|
|
1148
|
+
* @returns {quat2} dual quaternion receiving operation result
|
|
1149
|
+
* @function
|
|
1150
|
+
*/
|
|
1151
|
+
|
|
1152
|
+
function fromRotation(out, q) {
|
|
1153
|
+
out[0] = q[0];
|
|
1154
|
+
out[1] = q[1];
|
|
1155
|
+
out[2] = q[2];
|
|
1156
|
+
out[3] = q[3];
|
|
1157
|
+
out[4] = 0;
|
|
1158
|
+
out[5] = 0;
|
|
1159
|
+
out[6] = 0;
|
|
1160
|
+
out[7] = 0;
|
|
1161
|
+
return out;
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Creates a new dual quat from a matrix (4x4)
|
|
1165
|
+
*
|
|
1166
|
+
* @param {quat2} out the dual quaternion
|
|
1167
|
+
* @param {ReadonlyMat4} a the matrix
|
|
1168
|
+
* @returns {quat2} dual quat receiving operation result
|
|
1169
|
+
* @function
|
|
1170
|
+
*/
|
|
1171
|
+
|
|
1172
|
+
function fromMat4(out, a) {
|
|
1173
|
+
//TODO Optimize this
|
|
1174
|
+
var outer = quat.create();
|
|
1175
|
+
mat4.getRotation(outer, a);
|
|
1176
|
+
var t = new glMatrix.ARRAY_TYPE(3);
|
|
1177
|
+
mat4.getTranslation(t, a);
|
|
1178
|
+
fromRotationTranslation(out, outer, t);
|
|
1179
|
+
return out;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Copy the values from one dual quat to another
|
|
1183
|
+
*
|
|
1184
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1185
|
+
* @param {ReadonlyQuat2} a the source dual quaternion
|
|
1186
|
+
* @returns {quat2} out
|
|
1187
|
+
* @function
|
|
1188
|
+
*/
|
|
1189
|
+
|
|
1190
|
+
function copy(out, a) {
|
|
1191
|
+
out[0] = a[0];
|
|
1192
|
+
out[1] = a[1];
|
|
1193
|
+
out[2] = a[2];
|
|
1194
|
+
out[3] = a[3];
|
|
1195
|
+
out[4] = a[4];
|
|
1196
|
+
out[5] = a[5];
|
|
1197
|
+
out[6] = a[6];
|
|
1198
|
+
out[7] = a[7];
|
|
1199
|
+
return out;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Set a dual quat to the identity dual quaternion
|
|
1203
|
+
*
|
|
1204
|
+
* @param {quat2} out the receiving quaternion
|
|
1205
|
+
* @returns {quat2} out
|
|
1206
|
+
*/
|
|
1207
|
+
|
|
1208
|
+
function identity(out) {
|
|
1209
|
+
out[0] = 0;
|
|
1210
|
+
out[1] = 0;
|
|
1211
|
+
out[2] = 0;
|
|
1212
|
+
out[3] = 1;
|
|
1213
|
+
out[4] = 0;
|
|
1214
|
+
out[5] = 0;
|
|
1215
|
+
out[6] = 0;
|
|
1216
|
+
out[7] = 0;
|
|
1217
|
+
return out;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Set the components of a dual quat to the given values
|
|
1221
|
+
*
|
|
1222
|
+
* @param {quat2} out the receiving quaternion
|
|
1223
|
+
* @param {Number} x1 X component
|
|
1224
|
+
* @param {Number} y1 Y component
|
|
1225
|
+
* @param {Number} z1 Z component
|
|
1226
|
+
* @param {Number} w1 W component
|
|
1227
|
+
* @param {Number} x2 X component
|
|
1228
|
+
* @param {Number} y2 Y component
|
|
1229
|
+
* @param {Number} z2 Z component
|
|
1230
|
+
* @param {Number} w2 W component
|
|
1231
|
+
* @returns {quat2} out
|
|
1232
|
+
* @function
|
|
1233
|
+
*/
|
|
1234
|
+
|
|
1235
|
+
function set(out, x1, y1, z1, w1, x2, y2, z2, w2) {
|
|
1236
|
+
out[0] = x1;
|
|
1237
|
+
out[1] = y1;
|
|
1238
|
+
out[2] = z1;
|
|
1239
|
+
out[3] = w1;
|
|
1240
|
+
out[4] = x2;
|
|
1241
|
+
out[5] = y2;
|
|
1242
|
+
out[6] = z2;
|
|
1243
|
+
out[7] = w2;
|
|
1244
|
+
return out;
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Gets the real part of a dual quat
|
|
1248
|
+
* @param {quat} out real part
|
|
1249
|
+
* @param {ReadonlyQuat2} a Dual Quaternion
|
|
1250
|
+
* @return {quat} real part
|
|
1251
|
+
*/
|
|
1252
|
+
|
|
1253
|
+
var getReal = _quat_js__rspack_import_1.copy;
|
|
1254
|
+
/**
|
|
1255
|
+
* Gets the dual part of a dual quat
|
|
1256
|
+
* @param {quat} out dual part
|
|
1257
|
+
* @param {ReadonlyQuat2} a Dual Quaternion
|
|
1258
|
+
* @return {quat} dual part
|
|
1259
|
+
*/
|
|
1260
|
+
|
|
1261
|
+
function getDual(out, a) {
|
|
1262
|
+
out[0] = a[4];
|
|
1263
|
+
out[1] = a[5];
|
|
1264
|
+
out[2] = a[6];
|
|
1265
|
+
out[3] = a[7];
|
|
1266
|
+
return out;
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Set the real component of a dual quat to the given quaternion
|
|
1270
|
+
*
|
|
1271
|
+
* @param {quat2} out the receiving quaternion
|
|
1272
|
+
* @param {ReadonlyQuat} q a quaternion representing the real part
|
|
1273
|
+
* @returns {quat2} out
|
|
1274
|
+
* @function
|
|
1275
|
+
*/
|
|
1276
|
+
|
|
1277
|
+
var setReal = _quat_js__rspack_import_1.copy;
|
|
1278
|
+
/**
|
|
1279
|
+
* Set the dual component of a dual quat to the given quaternion
|
|
1280
|
+
*
|
|
1281
|
+
* @param {quat2} out the receiving quaternion
|
|
1282
|
+
* @param {ReadonlyQuat} q a quaternion representing the dual part
|
|
1283
|
+
* @returns {quat2} out
|
|
1284
|
+
* @function
|
|
1285
|
+
*/
|
|
1286
|
+
|
|
1287
|
+
function setDual(out, q) {
|
|
1288
|
+
out[4] = q[0];
|
|
1289
|
+
out[5] = q[1];
|
|
1290
|
+
out[6] = q[2];
|
|
1291
|
+
out[7] = q[3];
|
|
1292
|
+
return out;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Gets the translation of a normalized dual quat
|
|
1296
|
+
* @param {vec3} out translation
|
|
1297
|
+
* @param {ReadonlyQuat2} a Dual Quaternion to be decomposed
|
|
1298
|
+
* @return {vec3} translation
|
|
1299
|
+
*/
|
|
1300
|
+
|
|
1301
|
+
function getTranslation(out, a) {
|
|
1302
|
+
var ax = a[4],
|
|
1303
|
+
ay = a[5],
|
|
1304
|
+
az = a[6],
|
|
1305
|
+
aw = a[7],
|
|
1306
|
+
bx = -a[0],
|
|
1307
|
+
by = -a[1],
|
|
1308
|
+
bz = -a[2],
|
|
1309
|
+
bw = a[3];
|
|
1310
|
+
out[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;
|
|
1311
|
+
out[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;
|
|
1312
|
+
out[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;
|
|
1313
|
+
return out;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Translates a dual quat by the given vector
|
|
1317
|
+
*
|
|
1318
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1319
|
+
* @param {ReadonlyQuat2} a the dual quaternion to translate
|
|
1320
|
+
* @param {ReadonlyVec3} v vector to translate by
|
|
1321
|
+
* @returns {quat2} out
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
function translate(out, a, v) {
|
|
1325
|
+
var ax1 = a[0],
|
|
1326
|
+
ay1 = a[1],
|
|
1327
|
+
az1 = a[2],
|
|
1328
|
+
aw1 = a[3],
|
|
1329
|
+
bx1 = v[0] * 0.5,
|
|
1330
|
+
by1 = v[1] * 0.5,
|
|
1331
|
+
bz1 = v[2] * 0.5,
|
|
1332
|
+
ax2 = a[4],
|
|
1333
|
+
ay2 = a[5],
|
|
1334
|
+
az2 = a[6],
|
|
1335
|
+
aw2 = a[7];
|
|
1336
|
+
out[0] = ax1;
|
|
1337
|
+
out[1] = ay1;
|
|
1338
|
+
out[2] = az1;
|
|
1339
|
+
out[3] = aw1;
|
|
1340
|
+
out[4] = aw1 * bx1 + ay1 * bz1 - az1 * by1 + ax2;
|
|
1341
|
+
out[5] = aw1 * by1 + az1 * bx1 - ax1 * bz1 + ay2;
|
|
1342
|
+
out[6] = aw1 * bz1 + ax1 * by1 - ay1 * bx1 + az2;
|
|
1343
|
+
out[7] = -ax1 * bx1 - ay1 * by1 - az1 * bz1 + aw2;
|
|
1344
|
+
return out;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Rotates a dual quat around the X axis
|
|
1348
|
+
*
|
|
1349
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1350
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1351
|
+
* @param {number} rad how far should the rotation be
|
|
1352
|
+
* @returns {quat2} out
|
|
1353
|
+
*/
|
|
1354
|
+
|
|
1355
|
+
function rotateX(out, a, rad) {
|
|
1356
|
+
var bx = -a[0],
|
|
1357
|
+
by = -a[1],
|
|
1358
|
+
bz = -a[2],
|
|
1359
|
+
bw = a[3],
|
|
1360
|
+
ax = a[4],
|
|
1361
|
+
ay = a[5],
|
|
1362
|
+
az = a[6],
|
|
1363
|
+
aw = a[7],
|
|
1364
|
+
ax1 = ax * bw + aw * bx + ay * bz - az * by,
|
|
1365
|
+
ay1 = ay * bw + aw * by + az * bx - ax * bz,
|
|
1366
|
+
az1 = az * bw + aw * bz + ax * by - ay * bx,
|
|
1367
|
+
aw1 = aw * bw - ax * bx - ay * by - az * bz;
|
|
1368
|
+
quat.rotateX(out, a, rad);
|
|
1369
|
+
bx = out[0];
|
|
1370
|
+
by = out[1];
|
|
1371
|
+
bz = out[2];
|
|
1372
|
+
bw = out[3];
|
|
1373
|
+
out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
|
|
1374
|
+
out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
|
|
1375
|
+
out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
|
|
1376
|
+
out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
|
|
1377
|
+
return out;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Rotates a dual quat around the Y axis
|
|
1381
|
+
*
|
|
1382
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1383
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1384
|
+
* @param {number} rad how far should the rotation be
|
|
1385
|
+
* @returns {quat2} out
|
|
1386
|
+
*/
|
|
1387
|
+
|
|
1388
|
+
function rotateY(out, a, rad) {
|
|
1389
|
+
var bx = -a[0],
|
|
1390
|
+
by = -a[1],
|
|
1391
|
+
bz = -a[2],
|
|
1392
|
+
bw = a[3],
|
|
1393
|
+
ax = a[4],
|
|
1394
|
+
ay = a[5],
|
|
1395
|
+
az = a[6],
|
|
1396
|
+
aw = a[7],
|
|
1397
|
+
ax1 = ax * bw + aw * bx + ay * bz - az * by,
|
|
1398
|
+
ay1 = ay * bw + aw * by + az * bx - ax * bz,
|
|
1399
|
+
az1 = az * bw + aw * bz + ax * by - ay * bx,
|
|
1400
|
+
aw1 = aw * bw - ax * bx - ay * by - az * bz;
|
|
1401
|
+
quat.rotateY(out, a, rad);
|
|
1402
|
+
bx = out[0];
|
|
1403
|
+
by = out[1];
|
|
1404
|
+
bz = out[2];
|
|
1405
|
+
bw = out[3];
|
|
1406
|
+
out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
|
|
1407
|
+
out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
|
|
1408
|
+
out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
|
|
1409
|
+
out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
|
|
1410
|
+
return out;
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Rotates a dual quat around the Z axis
|
|
1414
|
+
*
|
|
1415
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1416
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1417
|
+
* @param {number} rad how far should the rotation be
|
|
1418
|
+
* @returns {quat2} out
|
|
1419
|
+
*/
|
|
1420
|
+
|
|
1421
|
+
function rotateZ(out, a, rad) {
|
|
1422
|
+
var bx = -a[0],
|
|
1423
|
+
by = -a[1],
|
|
1424
|
+
bz = -a[2],
|
|
1425
|
+
bw = a[3],
|
|
1426
|
+
ax = a[4],
|
|
1427
|
+
ay = a[5],
|
|
1428
|
+
az = a[6],
|
|
1429
|
+
aw = a[7],
|
|
1430
|
+
ax1 = ax * bw + aw * bx + ay * bz - az * by,
|
|
1431
|
+
ay1 = ay * bw + aw * by + az * bx - ax * bz,
|
|
1432
|
+
az1 = az * bw + aw * bz + ax * by - ay * bx,
|
|
1433
|
+
aw1 = aw * bw - ax * bx - ay * by - az * bz;
|
|
1434
|
+
quat.rotateZ(out, a, rad);
|
|
1435
|
+
bx = out[0];
|
|
1436
|
+
by = out[1];
|
|
1437
|
+
bz = out[2];
|
|
1438
|
+
bw = out[3];
|
|
1439
|
+
out[4] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
|
|
1440
|
+
out[5] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
|
|
1441
|
+
out[6] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
|
|
1442
|
+
out[7] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
|
|
1443
|
+
return out;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Rotates a dual quat by a given quaternion (a * q)
|
|
1447
|
+
*
|
|
1448
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1449
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1450
|
+
* @param {ReadonlyQuat} q quaternion to rotate by
|
|
1451
|
+
* @returns {quat2} out
|
|
1452
|
+
*/
|
|
1453
|
+
|
|
1454
|
+
function rotateByQuatAppend(out, a, q) {
|
|
1455
|
+
var qx = q[0],
|
|
1456
|
+
qy = q[1],
|
|
1457
|
+
qz = q[2],
|
|
1458
|
+
qw = q[3],
|
|
1459
|
+
ax = a[0],
|
|
1460
|
+
ay = a[1],
|
|
1461
|
+
az = a[2],
|
|
1462
|
+
aw = a[3];
|
|
1463
|
+
out[0] = ax * qw + aw * qx + ay * qz - az * qy;
|
|
1464
|
+
out[1] = ay * qw + aw * qy + az * qx - ax * qz;
|
|
1465
|
+
out[2] = az * qw + aw * qz + ax * qy - ay * qx;
|
|
1466
|
+
out[3] = aw * qw - ax * qx - ay * qy - az * qz;
|
|
1467
|
+
ax = a[4];
|
|
1468
|
+
ay = a[5];
|
|
1469
|
+
az = a[6];
|
|
1470
|
+
aw = a[7];
|
|
1471
|
+
out[4] = ax * qw + aw * qx + ay * qz - az * qy;
|
|
1472
|
+
out[5] = ay * qw + aw * qy + az * qx - ax * qz;
|
|
1473
|
+
out[6] = az * qw + aw * qz + ax * qy - ay * qx;
|
|
1474
|
+
out[7] = aw * qw - ax * qx - ay * qy - az * qz;
|
|
1475
|
+
return out;
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Rotates a dual quat by a given quaternion (q * a)
|
|
1479
|
+
*
|
|
1480
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1481
|
+
* @param {ReadonlyQuat} q quaternion to rotate by
|
|
1482
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1483
|
+
* @returns {quat2} out
|
|
1484
|
+
*/
|
|
1485
|
+
|
|
1486
|
+
function rotateByQuatPrepend(out, q, a) {
|
|
1487
|
+
var qx = q[0],
|
|
1488
|
+
qy = q[1],
|
|
1489
|
+
qz = q[2],
|
|
1490
|
+
qw = q[3],
|
|
1491
|
+
bx = a[0],
|
|
1492
|
+
by = a[1],
|
|
1493
|
+
bz = a[2],
|
|
1494
|
+
bw = a[3];
|
|
1495
|
+
out[0] = qx * bw + qw * bx + qy * bz - qz * by;
|
|
1496
|
+
out[1] = qy * bw + qw * by + qz * bx - qx * bz;
|
|
1497
|
+
out[2] = qz * bw + qw * bz + qx * by - qy * bx;
|
|
1498
|
+
out[3] = qw * bw - qx * bx - qy * by - qz * bz;
|
|
1499
|
+
bx = a[4];
|
|
1500
|
+
by = a[5];
|
|
1501
|
+
bz = a[6];
|
|
1502
|
+
bw = a[7];
|
|
1503
|
+
out[4] = qx * bw + qw * bx + qy * bz - qz * by;
|
|
1504
|
+
out[5] = qy * bw + qw * by + qz * bx - qx * bz;
|
|
1505
|
+
out[6] = qz * bw + qw * bz + qx * by - qy * bx;
|
|
1506
|
+
out[7] = qw * bw - qx * bx - qy * by - qz * bz;
|
|
1507
|
+
return out;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Rotates a dual quat around a given axis. Does the normalisation automatically
|
|
1511
|
+
*
|
|
1512
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1513
|
+
* @param {ReadonlyQuat2} a the dual quaternion to rotate
|
|
1514
|
+
* @param {ReadonlyVec3} axis the axis to rotate around
|
|
1515
|
+
* @param {Number} rad how far the rotation should be
|
|
1516
|
+
* @returns {quat2} out
|
|
1517
|
+
*/
|
|
1518
|
+
|
|
1519
|
+
function rotateAroundAxis(out, a, axis, rad) {
|
|
1520
|
+
//Special case for rad = 0
|
|
1521
|
+
if (Math.abs(rad) < glMatrix.EPSILON) {
|
|
1522
|
+
return copy(out, a);
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
var axisLength = Math.hypot(axis[0], axis[1], axis[2]);
|
|
1526
|
+
rad = rad * 0.5;
|
|
1527
|
+
var s = Math.sin(rad);
|
|
1528
|
+
var bx = s * axis[0] / axisLength;
|
|
1529
|
+
var by = s * axis[1] / axisLength;
|
|
1530
|
+
var bz = s * axis[2] / axisLength;
|
|
1531
|
+
var bw = Math.cos(rad);
|
|
1532
|
+
var ax1 = a[0],
|
|
1533
|
+
ay1 = a[1],
|
|
1534
|
+
az1 = a[2],
|
|
1535
|
+
aw1 = a[3];
|
|
1536
|
+
out[0] = ax1 * bw + aw1 * bx + ay1 * bz - az1 * by;
|
|
1537
|
+
out[1] = ay1 * bw + aw1 * by + az1 * bx - ax1 * bz;
|
|
1538
|
+
out[2] = az1 * bw + aw1 * bz + ax1 * by - ay1 * bx;
|
|
1539
|
+
out[3] = aw1 * bw - ax1 * bx - ay1 * by - az1 * bz;
|
|
1540
|
+
var ax = a[4],
|
|
1541
|
+
ay = a[5],
|
|
1542
|
+
az = a[6],
|
|
1543
|
+
aw = a[7];
|
|
1544
|
+
out[4] = ax * bw + aw * bx + ay * bz - az * by;
|
|
1545
|
+
out[5] = ay * bw + aw * by + az * bx - ax * bz;
|
|
1546
|
+
out[6] = az * bw + aw * bz + ax * by - ay * bx;
|
|
1547
|
+
out[7] = aw * bw - ax * bx - ay * by - az * bz;
|
|
1548
|
+
return out;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Adds two dual quat's
|
|
1552
|
+
*
|
|
1553
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1554
|
+
* @param {ReadonlyQuat2} a the first operand
|
|
1555
|
+
* @param {ReadonlyQuat2} b the second operand
|
|
1556
|
+
* @returns {quat2} out
|
|
1557
|
+
* @function
|
|
1558
|
+
*/
|
|
1559
|
+
|
|
1560
|
+
function add(out, a, b) {
|
|
1561
|
+
out[0] = a[0] + b[0];
|
|
1562
|
+
out[1] = a[1] + b[1];
|
|
1563
|
+
out[2] = a[2] + b[2];
|
|
1564
|
+
out[3] = a[3] + b[3];
|
|
1565
|
+
out[4] = a[4] + b[4];
|
|
1566
|
+
out[5] = a[5] + b[5];
|
|
1567
|
+
out[6] = a[6] + b[6];
|
|
1568
|
+
out[7] = a[7] + b[7];
|
|
1569
|
+
return out;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Multiplies two dual quat's
|
|
1573
|
+
*
|
|
1574
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1575
|
+
* @param {ReadonlyQuat2} a the first operand
|
|
1576
|
+
* @param {ReadonlyQuat2} b the second operand
|
|
1577
|
+
* @returns {quat2} out
|
|
1578
|
+
*/
|
|
1579
|
+
|
|
1580
|
+
function multiply(out, a, b) {
|
|
1581
|
+
var ax0 = a[0],
|
|
1582
|
+
ay0 = a[1],
|
|
1583
|
+
az0 = a[2],
|
|
1584
|
+
aw0 = a[3],
|
|
1585
|
+
bx1 = b[4],
|
|
1586
|
+
by1 = b[5],
|
|
1587
|
+
bz1 = b[6],
|
|
1588
|
+
bw1 = b[7],
|
|
1589
|
+
ax1 = a[4],
|
|
1590
|
+
ay1 = a[5],
|
|
1591
|
+
az1 = a[6],
|
|
1592
|
+
aw1 = a[7],
|
|
1593
|
+
bx0 = b[0],
|
|
1594
|
+
by0 = b[1],
|
|
1595
|
+
bz0 = b[2],
|
|
1596
|
+
bw0 = b[3];
|
|
1597
|
+
out[0] = ax0 * bw0 + aw0 * bx0 + ay0 * bz0 - az0 * by0;
|
|
1598
|
+
out[1] = ay0 * bw0 + aw0 * by0 + az0 * bx0 - ax0 * bz0;
|
|
1599
|
+
out[2] = az0 * bw0 + aw0 * bz0 + ax0 * by0 - ay0 * bx0;
|
|
1600
|
+
out[3] = aw0 * bw0 - ax0 * bx0 - ay0 * by0 - az0 * bz0;
|
|
1601
|
+
out[4] = ax0 * bw1 + aw0 * bx1 + ay0 * bz1 - az0 * by1 + ax1 * bw0 + aw1 * bx0 + ay1 * bz0 - az1 * by0;
|
|
1602
|
+
out[5] = ay0 * bw1 + aw0 * by1 + az0 * bx1 - ax0 * bz1 + ay1 * bw0 + aw1 * by0 + az1 * bx0 - ax1 * bz0;
|
|
1603
|
+
out[6] = az0 * bw1 + aw0 * bz1 + ax0 * by1 - ay0 * bx1 + az1 * bw0 + aw1 * bz0 + ax1 * by0 - ay1 * bx0;
|
|
1604
|
+
out[7] = aw0 * bw1 - ax0 * bx1 - ay0 * by1 - az0 * bz1 + aw1 * bw0 - ax1 * bx0 - ay1 * by0 - az1 * bz0;
|
|
1605
|
+
return out;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Alias for {@link quat2.multiply}
|
|
1609
|
+
* @function
|
|
1610
|
+
*/
|
|
1611
|
+
|
|
1612
|
+
var mul = (/* unused pure expression or super */ null && (multiply));
|
|
1613
|
+
/**
|
|
1614
|
+
* Scales a dual quat by a scalar number
|
|
1615
|
+
*
|
|
1616
|
+
* @param {quat2} out the receiving dual quat
|
|
1617
|
+
* @param {ReadonlyQuat2} a the dual quat to scale
|
|
1618
|
+
* @param {Number} b amount to scale the dual quat by
|
|
1619
|
+
* @returns {quat2} out
|
|
1620
|
+
* @function
|
|
1621
|
+
*/
|
|
1622
|
+
|
|
1623
|
+
function scale(out, a, b) {
|
|
1624
|
+
out[0] = a[0] * b;
|
|
1625
|
+
out[1] = a[1] * b;
|
|
1626
|
+
out[2] = a[2] * b;
|
|
1627
|
+
out[3] = a[3] * b;
|
|
1628
|
+
out[4] = a[4] * b;
|
|
1629
|
+
out[5] = a[5] * b;
|
|
1630
|
+
out[6] = a[6] * b;
|
|
1631
|
+
out[7] = a[7] * b;
|
|
1632
|
+
return out;
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Calculates the dot product of two dual quat's (The dot product of the real parts)
|
|
1636
|
+
*
|
|
1637
|
+
* @param {ReadonlyQuat2} a the first operand
|
|
1638
|
+
* @param {ReadonlyQuat2} b the second operand
|
|
1639
|
+
* @returns {Number} dot product of a and b
|
|
1640
|
+
* @function
|
|
1641
|
+
*/
|
|
1642
|
+
|
|
1643
|
+
var dot = _quat_js__rspack_import_1.dot;
|
|
1644
|
+
/**
|
|
1645
|
+
* Performs a linear interpolation between two dual quats's
|
|
1646
|
+
* NOTE: The resulting dual quaternions won't always be normalized (The error is most noticeable when t = 0.5)
|
|
1647
|
+
*
|
|
1648
|
+
* @param {quat2} out the receiving dual quat
|
|
1649
|
+
* @param {ReadonlyQuat2} a the first operand
|
|
1650
|
+
* @param {ReadonlyQuat2} b the second operand
|
|
1651
|
+
* @param {Number} t interpolation amount, in the range [0-1], between the two inputs
|
|
1652
|
+
* @returns {quat2} out
|
|
1653
|
+
*/
|
|
1654
|
+
|
|
1655
|
+
function lerp(out, a, b, t) {
|
|
1656
|
+
var mt = 1 - t;
|
|
1657
|
+
if (dot(a, b) < 0) t = -t;
|
|
1658
|
+
out[0] = a[0] * mt + b[0] * t;
|
|
1659
|
+
out[1] = a[1] * mt + b[1] * t;
|
|
1660
|
+
out[2] = a[2] * mt + b[2] * t;
|
|
1661
|
+
out[3] = a[3] * mt + b[3] * t;
|
|
1662
|
+
out[4] = a[4] * mt + b[4] * t;
|
|
1663
|
+
out[5] = a[5] * mt + b[5] * t;
|
|
1664
|
+
out[6] = a[6] * mt + b[6] * t;
|
|
1665
|
+
out[7] = a[7] * mt + b[7] * t;
|
|
1666
|
+
return out;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Calculates the inverse of a dual quat. If they are normalized, conjugate is cheaper
|
|
1670
|
+
*
|
|
1671
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1672
|
+
* @param {ReadonlyQuat2} a dual quat to calculate inverse of
|
|
1673
|
+
* @returns {quat2} out
|
|
1674
|
+
*/
|
|
1675
|
+
|
|
1676
|
+
function invert(out, a) {
|
|
1677
|
+
var sqlen = squaredLength(a);
|
|
1678
|
+
out[0] = -a[0] / sqlen;
|
|
1679
|
+
out[1] = -a[1] / sqlen;
|
|
1680
|
+
out[2] = -a[2] / sqlen;
|
|
1681
|
+
out[3] = a[3] / sqlen;
|
|
1682
|
+
out[4] = -a[4] / sqlen;
|
|
1683
|
+
out[5] = -a[5] / sqlen;
|
|
1684
|
+
out[6] = -a[6] / sqlen;
|
|
1685
|
+
out[7] = a[7] / sqlen;
|
|
1686
|
+
return out;
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Calculates the conjugate of a dual quat
|
|
1690
|
+
* If the dual quaternion is normalized, this function is faster than quat2.inverse and produces the same result.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {quat2} out the receiving quaternion
|
|
1693
|
+
* @param {ReadonlyQuat2} a quat to calculate conjugate of
|
|
1694
|
+
* @returns {quat2} out
|
|
1695
|
+
*/
|
|
1696
|
+
|
|
1697
|
+
function conjugate(out, a) {
|
|
1698
|
+
out[0] = -a[0];
|
|
1699
|
+
out[1] = -a[1];
|
|
1700
|
+
out[2] = -a[2];
|
|
1701
|
+
out[3] = a[3];
|
|
1702
|
+
out[4] = -a[4];
|
|
1703
|
+
out[5] = -a[5];
|
|
1704
|
+
out[6] = -a[6];
|
|
1705
|
+
out[7] = a[7];
|
|
1706
|
+
return out;
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Calculates the length of a dual quat
|
|
1710
|
+
*
|
|
1711
|
+
* @param {ReadonlyQuat2} a dual quat to calculate length of
|
|
1712
|
+
* @returns {Number} length of a
|
|
1713
|
+
* @function
|
|
1714
|
+
*/
|
|
1715
|
+
|
|
1716
|
+
var length = _quat_js__rspack_import_1.length;
|
|
1717
|
+
/**
|
|
1718
|
+
* Alias for {@link quat2.length}
|
|
1719
|
+
* @function
|
|
1720
|
+
*/
|
|
1721
|
+
|
|
1722
|
+
var len = (/* unused pure expression or super */ null && (length));
|
|
1723
|
+
/**
|
|
1724
|
+
* Calculates the squared length of a dual quat
|
|
1725
|
+
*
|
|
1726
|
+
* @param {ReadonlyQuat2} a dual quat to calculate squared length of
|
|
1727
|
+
* @returns {Number} squared length of a
|
|
1728
|
+
* @function
|
|
1729
|
+
*/
|
|
1730
|
+
|
|
1731
|
+
var squaredLength = _quat_js__rspack_import_1.squaredLength;
|
|
1732
|
+
/**
|
|
1733
|
+
* Alias for {@link quat2.squaredLength}
|
|
1734
|
+
* @function
|
|
1735
|
+
*/
|
|
1736
|
+
|
|
1737
|
+
var sqrLen = (/* unused pure expression or super */ null && (squaredLength));
|
|
1738
|
+
/**
|
|
1739
|
+
* Normalize a dual quat
|
|
1740
|
+
*
|
|
1741
|
+
* @param {quat2} out the receiving dual quaternion
|
|
1742
|
+
* @param {ReadonlyQuat2} a dual quaternion to normalize
|
|
1743
|
+
* @returns {quat2} out
|
|
1744
|
+
* @function
|
|
1745
|
+
*/
|
|
1746
|
+
|
|
1747
|
+
function normalize(out, a) {
|
|
1748
|
+
var magnitude = squaredLength(a);
|
|
1749
|
+
|
|
1750
|
+
if (magnitude > 0) {
|
|
1751
|
+
magnitude = Math.sqrt(magnitude);
|
|
1752
|
+
var a0 = a[0] / magnitude;
|
|
1753
|
+
var a1 = a[1] / magnitude;
|
|
1754
|
+
var a2 = a[2] / magnitude;
|
|
1755
|
+
var a3 = a[3] / magnitude;
|
|
1756
|
+
var b0 = a[4];
|
|
1757
|
+
var b1 = a[5];
|
|
1758
|
+
var b2 = a[6];
|
|
1759
|
+
var b3 = a[7];
|
|
1760
|
+
var a_dot_b = a0 * b0 + a1 * b1 + a2 * b2 + a3 * b3;
|
|
1761
|
+
out[0] = a0;
|
|
1762
|
+
out[1] = a1;
|
|
1763
|
+
out[2] = a2;
|
|
1764
|
+
out[3] = a3;
|
|
1765
|
+
out[4] = (b0 - a0 * a_dot_b) / magnitude;
|
|
1766
|
+
out[5] = (b1 - a1 * a_dot_b) / magnitude;
|
|
1767
|
+
out[6] = (b2 - a2 * a_dot_b) / magnitude;
|
|
1768
|
+
out[7] = (b3 - a3 * a_dot_b) / magnitude;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
return out;
|
|
1772
|
+
}
|
|
1773
|
+
/**
|
|
1774
|
+
* Returns a string representation of a dual quatenion
|
|
1775
|
+
*
|
|
1776
|
+
* @param {ReadonlyQuat2} a dual quaternion to represent as a string
|
|
1777
|
+
* @returns {String} string representation of the dual quat
|
|
1778
|
+
*/
|
|
1779
|
+
|
|
1780
|
+
function str(a) {
|
|
1781
|
+
return "quat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ")";
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Returns whether or not the dual quaternions have exactly the same elements in the same position (when compared with ===)
|
|
1785
|
+
*
|
|
1786
|
+
* @param {ReadonlyQuat2} a the first dual quaternion.
|
|
1787
|
+
* @param {ReadonlyQuat2} b the second dual quaternion.
|
|
1788
|
+
* @returns {Boolean} true if the dual quaternions are equal, false otherwise.
|
|
1789
|
+
*/
|
|
1790
|
+
|
|
1791
|
+
function exactEquals(a, b) {
|
|
1792
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7];
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Returns whether or not the dual quaternions have approximately the same elements in the same position.
|
|
1796
|
+
*
|
|
1797
|
+
* @param {ReadonlyQuat2} a the first dual quat.
|
|
1798
|
+
* @param {ReadonlyQuat2} b the second dual quat.
|
|
1799
|
+
* @returns {Boolean} true if the dual quats are equal, false otherwise.
|
|
1800
|
+
*/
|
|
1801
|
+
|
|
1802
|
+
function equals(a, b) {
|
|
1803
|
+
var a0 = a[0],
|
|
1804
|
+
a1 = a[1],
|
|
1805
|
+
a2 = a[2],
|
|
1806
|
+
a3 = a[3],
|
|
1807
|
+
a4 = a[4],
|
|
1808
|
+
a5 = a[5],
|
|
1809
|
+
a6 = a[6],
|
|
1810
|
+
a7 = a[7];
|
|
1811
|
+
var b0 = b[0],
|
|
1812
|
+
b1 = b[1],
|
|
1813
|
+
b2 = b[2],
|
|
1814
|
+
b3 = b[3],
|
|
1815
|
+
b4 = b[4],
|
|
1816
|
+
b5 = b[5],
|
|
1817
|
+
b6 = b[6],
|
|
1818
|
+
b7 = b[7];
|
|
1819
|
+
return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7));
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
},
|
|
1823
|
+
92464(module, __unused_rspack_exports, __webpack_require__) {
|
|
1824
|
+
// A library of seedable RNGs implemented in Javascript.
|
|
1825
|
+
//
|
|
1826
|
+
// Usage:
|
|
1827
|
+
//
|
|
1828
|
+
// var seedrandom = require('seedrandom');
|
|
1829
|
+
// var random = seedrandom(1); // or any seed.
|
|
1830
|
+
// var x = random(); // 0 <= x < 1. Every bit is random.
|
|
1831
|
+
// var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.
|
|
1832
|
+
|
|
1833
|
+
// alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.
|
|
1834
|
+
// Period: ~2^116
|
|
1835
|
+
// Reported to pass all BigCrush tests.
|
|
1836
|
+
var alea = __webpack_require__(9241);
|
|
1837
|
+
|
|
1838
|
+
// xor128, a pure xor-shift generator by George Marsaglia.
|
|
1839
|
+
// Period: 2^128-1.
|
|
1840
|
+
// Reported to fail: MatrixRank and LinearComp.
|
|
1841
|
+
var xor128 = __webpack_require__(87480);
|
|
1842
|
+
|
|
1843
|
+
// xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.
|
|
1844
|
+
// Period: 2^192-2^32
|
|
1845
|
+
// Reported to fail: CollisionOver, SimpPoker, and LinearComp.
|
|
1846
|
+
var xorwow = __webpack_require__(88150);
|
|
1847
|
+
|
|
1848
|
+
// xorshift7, by François Panneton and Pierre L'ecuyer, takes
|
|
1849
|
+
// a different approach: it adds robustness by allowing more shifts
|
|
1850
|
+
// than Marsaglia's original three. It is a 7-shift generator
|
|
1851
|
+
// with 256 bits, that passes BigCrush with no systmatic failures.
|
|
1852
|
+
// Period 2^256-1.
|
|
1853
|
+
// No systematic BigCrush failures reported.
|
|
1854
|
+
var xorshift7 = __webpack_require__(43420);
|
|
1855
|
+
|
|
1856
|
+
// xor4096, by Richard Brent, is a 4096-bit xor-shift with a
|
|
1857
|
+
// very long period that also adds a Weyl generator. It also passes
|
|
1858
|
+
// BigCrush with no systematic failures. Its long period may
|
|
1859
|
+
// be useful if you have many generators and need to avoid
|
|
1860
|
+
// collisions.
|
|
1861
|
+
// Period: 2^4128-2^32.
|
|
1862
|
+
// No systematic BigCrush failures reported.
|
|
1863
|
+
var xor4096 = __webpack_require__(42346);
|
|
1864
|
+
|
|
1865
|
+
// Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random
|
|
1866
|
+
// number generator derived from ChaCha, a modern stream cipher.
|
|
1867
|
+
// https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
|
|
1868
|
+
// Period: ~2^127
|
|
1869
|
+
// No systematic BigCrush failures reported.
|
|
1870
|
+
var tychei = __webpack_require__(98868);
|
|
1871
|
+
|
|
1872
|
+
// The original ARC4-based prng included in this library.
|
|
1873
|
+
// Period: ~2^1600
|
|
1874
|
+
var sr = __webpack_require__(3808);
|
|
1875
|
+
|
|
1876
|
+
sr.alea = alea;
|
|
1877
|
+
sr.xor128 = xor128;
|
|
1878
|
+
sr.xorwow = xorwow;
|
|
1879
|
+
sr.xorshift7 = xorshift7;
|
|
1880
|
+
sr.xor4096 = xor4096;
|
|
1881
|
+
sr.tychei = tychei;
|
|
1882
|
+
|
|
1883
|
+
module.exports = sr;
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
},
|
|
1887
|
+
|
|
1888
|
+
}]);
|