lecodes-cli 0.1.3 → 0.1.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/dist/index.js +740 -267
- package/package.json +4 -3
- package/runtime/inject.js +4629 -0
- package/runtime/gl-matrix/common.js +0 -54
- package/runtime/gl-matrix/header.js +0 -12
- package/runtime/gl-matrix/index.js +0 -11
- package/runtime/gl-matrix/mat2.js +0 -425
- package/runtime/gl-matrix/mat2d.js +0 -476
- package/runtime/gl-matrix/mat3.js +0 -765
- package/runtime/gl-matrix/mat4.js +0 -1947
- package/runtime/gl-matrix/quat.js +0 -737
- package/runtime/gl-matrix/quat2.js +0 -822
- package/runtime/gl-matrix/vec2.js +0 -620
- package/runtime/gl-matrix/vec3.js +0 -791
- package/runtime/gl-matrix/vec4.js +0 -652
- package/runtime/worker/animate.js +0 -304
- package/runtime/worker/chunk-4ZN32GYS.js +0 -34
- package/runtime/worker/chunk-G5ZA3LKB.js +0 -52
- package/runtime/worker/chunk-MI3UXE5H.js +0 -1395
- package/runtime/worker/creator.js +0 -930
- package/runtime/worker/globals.js +0 -208
- package/runtime/worker/ui.js +0 -763
- package/runtime/worker/utils.js +0 -16
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common utilities
|
|
3
|
-
* @module glMatrix
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// Configuration Constants
|
|
7
|
-
export var EPSILON = 0.000001;
|
|
8
|
-
export var RANDOM = Math.random;
|
|
9
|
-
export var ANGLE_ORDER = "zyx";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Symmetric round
|
|
13
|
-
* see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background
|
|
14
|
-
*
|
|
15
|
-
* @param {Number} a value to round
|
|
16
|
-
*/
|
|
17
|
-
export function round(a) {
|
|
18
|
-
if (a >= 0) return Math.round(a);
|
|
19
|
-
return a % 0.5 === 0 ? Math.floor(a) : Math.round(a);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Convert Degree To Radian
|
|
25
|
-
*
|
|
26
|
-
* @param {Number} a Angle in Degrees
|
|
27
|
-
*/
|
|
28
|
-
export function toRadian(a) {
|
|
29
|
-
return a * 0.017453292519943295;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Convert Radian To Degree
|
|
34
|
-
*
|
|
35
|
-
* @param {Number} a Angle in Radians
|
|
36
|
-
*/
|
|
37
|
-
export function toDegree(a) {
|
|
38
|
-
return a * 57.29577951308232;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Tests whether or not the arguments have approximately the same value, within an absolute
|
|
43
|
-
* or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
|
|
44
|
-
* than or equal to 1.0, and a relative tolerance is used for larger values)
|
|
45
|
-
*
|
|
46
|
-
* @param {Number} a The first number to test.
|
|
47
|
-
* @param {Number} b The second number to test.
|
|
48
|
-
* @param {Number} tolerance Absolute or relative tolerance (default glMatrix.EPSILON)
|
|
49
|
-
* @returns {Boolean} True if the numbers are approximately equal, false otherwise.
|
|
50
|
-
*/
|
|
51
|
-
export function equals(a, b) {
|
|
52
|
-
var tolerance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EPSILON;
|
|
53
|
-
return Math.abs(a - b) <= tolerance * Math.max(1, Math.abs(a), Math.abs(b));
|
|
54
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as glMatrix from "gl-matrix/common";
|
|
2
|
-
import * as mat2 from "gl-matrix/mat2";
|
|
3
|
-
import * as mat2d from "gl-matrix/mat2d";
|
|
4
|
-
import * as mat3 from "gl-matrix/mat3";
|
|
5
|
-
import * as mat4 from "gl-matrix/mat4";
|
|
6
|
-
import * as quat from "gl-matrix/quat";
|
|
7
|
-
import * as quat2 from "gl-matrix/quat2";
|
|
8
|
-
import * as vec2 from "gl-matrix/vec2";
|
|
9
|
-
import * as vec3 from "gl-matrix/vec3";
|
|
10
|
-
import * as vec4 from "gl-matrix/vec4";
|
|
11
|
-
|
|
12
|
-
export { glMatrix, mat2, mat2d, mat3, mat4, quat, quat2, vec2, vec3, vec4 };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as glMatrix from "./common.js";
|
|
2
|
-
import * as mat2 from "./mat2.js";
|
|
3
|
-
import * as mat2d from "./mat2d.js";
|
|
4
|
-
import * as mat3 from "./mat3.js";
|
|
5
|
-
import * as mat4 from "./mat4.js";
|
|
6
|
-
import * as quat from "./quat.js";
|
|
7
|
-
import * as quat2 from "./quat2.js";
|
|
8
|
-
import * as vec2 from "./vec2.js";
|
|
9
|
-
import * as vec3 from "./vec3.js";
|
|
10
|
-
import * as vec4 from "./vec4.js";
|
|
11
|
-
export { glMatrix, mat2, mat2d, mat3, mat4, quat, quat2, vec2, vec3, vec4 };
|
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import * as glMatrix from "./common.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 2x2 Matrix
|
|
5
|
-
* @module mat2
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new identity mat2
|
|
10
|
-
*
|
|
11
|
-
* @returns {mat2} a new 2x2 matrix
|
|
12
|
-
*/
|
|
13
|
-
export function create() {
|
|
14
|
-
var out = new Float32Array(4);
|
|
15
|
-
out[0] = 1;
|
|
16
|
-
out[3] = 1;
|
|
17
|
-
return out;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new mat2 initialized with values from an existing matrix
|
|
22
|
-
*
|
|
23
|
-
* @param {ReadonlyMat2} a matrix to clone
|
|
24
|
-
* @returns {mat2} a new 2x2 matrix
|
|
25
|
-
*/
|
|
26
|
-
export function clone(a) {
|
|
27
|
-
var out = new Float32Array(4);
|
|
28
|
-
out[0] = a[0];
|
|
29
|
-
out[1] = a[1];
|
|
30
|
-
out[2] = a[2];
|
|
31
|
-
out[3] = a[3];
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Copy the values from one mat2 to another
|
|
37
|
-
*
|
|
38
|
-
* @param {mat2} out the receiving matrix
|
|
39
|
-
* @param {ReadonlyMat2} a the source matrix
|
|
40
|
-
* @returns {mat2} out
|
|
41
|
-
*/
|
|
42
|
-
export function copy(out, a) {
|
|
43
|
-
out[0] = a[0];
|
|
44
|
-
out[1] = a[1];
|
|
45
|
-
out[2] = a[2];
|
|
46
|
-
out[3] = a[3];
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Set a mat2 to the identity matrix
|
|
52
|
-
*
|
|
53
|
-
* @param {mat2} out the receiving matrix
|
|
54
|
-
* @returns {mat2} out
|
|
55
|
-
*/
|
|
56
|
-
export function identity(out) {
|
|
57
|
-
out[0] = 1;
|
|
58
|
-
out[1] = 0;
|
|
59
|
-
out[2] = 0;
|
|
60
|
-
out[3] = 1;
|
|
61
|
-
return out;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Create a new mat2 with the given values
|
|
66
|
-
*
|
|
67
|
-
* @param {Number} m00 Component in column 0, row 0 position (index 0)
|
|
68
|
-
* @param {Number} m01 Component in column 0, row 1 position (index 1)
|
|
69
|
-
* @param {Number} m10 Component in column 1, row 0 position (index 2)
|
|
70
|
-
* @param {Number} m11 Component in column 1, row 1 position (index 3)
|
|
71
|
-
* @returns {mat2} out A new 2x2 matrix
|
|
72
|
-
*/
|
|
73
|
-
export function fromValues(m00, m01, m10, m11) {
|
|
74
|
-
var out = new Float32Array(4);
|
|
75
|
-
out[0] = m00;
|
|
76
|
-
out[1] = m01;
|
|
77
|
-
out[2] = m10;
|
|
78
|
-
out[3] = m11;
|
|
79
|
-
return out;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Set the components of a mat2 to the given values
|
|
84
|
-
*
|
|
85
|
-
* @param {mat2} out the receiving matrix
|
|
86
|
-
* @param {Number} m00 Component in column 0, row 0 position (index 0)
|
|
87
|
-
* @param {Number} m01 Component in column 0, row 1 position (index 1)
|
|
88
|
-
* @param {Number} m10 Component in column 1, row 0 position (index 2)
|
|
89
|
-
* @param {Number} m11 Component in column 1, row 1 position (index 3)
|
|
90
|
-
* @returns {mat2} out
|
|
91
|
-
*/
|
|
92
|
-
export function set(out, m00, m01, m10, m11) {
|
|
93
|
-
out[0] = m00;
|
|
94
|
-
out[1] = m01;
|
|
95
|
-
out[2] = m10;
|
|
96
|
-
out[3] = m11;
|
|
97
|
-
return out;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Transpose the values of a mat2
|
|
102
|
-
*
|
|
103
|
-
* @param {mat2} out the receiving matrix
|
|
104
|
-
* @param {ReadonlyMat2} a the source matrix
|
|
105
|
-
* @returns {mat2} out
|
|
106
|
-
*/
|
|
107
|
-
export function transpose(out, a) {
|
|
108
|
-
// If we are transposing ourselves we can skip a few steps but have to cache
|
|
109
|
-
// some values
|
|
110
|
-
if (out === a) {
|
|
111
|
-
var a1 = a[1];
|
|
112
|
-
out[1] = a[2];
|
|
113
|
-
out[2] = a1;
|
|
114
|
-
} else {
|
|
115
|
-
out[0] = a[0];
|
|
116
|
-
out[1] = a[2];
|
|
117
|
-
out[2] = a[1];
|
|
118
|
-
out[3] = a[3];
|
|
119
|
-
}
|
|
120
|
-
return out;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Inverts a mat2
|
|
125
|
-
*
|
|
126
|
-
* @param {mat2} out the receiving matrix
|
|
127
|
-
* @param {ReadonlyMat2} a the source matrix
|
|
128
|
-
* @returns {mat2 | null} out, or null if source matrix is not invertible
|
|
129
|
-
*/
|
|
130
|
-
export function invert(out, a) {
|
|
131
|
-
var a0 = a[0],
|
|
132
|
-
a1 = a[1],
|
|
133
|
-
a2 = a[2],
|
|
134
|
-
a3 = a[3];
|
|
135
|
-
|
|
136
|
-
// Calculate the determinant
|
|
137
|
-
var det = a0 * a3 - a2 * a1;
|
|
138
|
-
if (!det) {
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
det = 1.0 / det;
|
|
142
|
-
out[0] = a3 * det;
|
|
143
|
-
out[1] = -a1 * det;
|
|
144
|
-
out[2] = -a2 * det;
|
|
145
|
-
out[3] = a0 * det;
|
|
146
|
-
return out;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Calculates the adjugate of a mat2
|
|
151
|
-
*
|
|
152
|
-
* @param {mat2} out the receiving matrix
|
|
153
|
-
* @param {ReadonlyMat2} a the source matrix
|
|
154
|
-
* @returns {mat2} out
|
|
155
|
-
*/
|
|
156
|
-
export function adjoint(out, a) {
|
|
157
|
-
// Caching this value is necessary if out == a
|
|
158
|
-
var a0 = a[0];
|
|
159
|
-
out[0] = a[3];
|
|
160
|
-
out[1] = -a[1];
|
|
161
|
-
out[2] = -a[2];
|
|
162
|
-
out[3] = a0;
|
|
163
|
-
return out;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Calculates the determinant of a mat2
|
|
168
|
-
*
|
|
169
|
-
* @param {ReadonlyMat2} a the source matrix
|
|
170
|
-
* @returns {Number} determinant of a
|
|
171
|
-
*/
|
|
172
|
-
export function determinant(a) {
|
|
173
|
-
return a[0] * a[3] - a[2] * a[1];
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Multiplies two mat2's
|
|
178
|
-
*
|
|
179
|
-
* @param {mat2} out the receiving matrix
|
|
180
|
-
* @param {ReadonlyMat2} a the first operand
|
|
181
|
-
* @param {ReadonlyMat2} b the second operand
|
|
182
|
-
* @returns {mat2} out
|
|
183
|
-
*/
|
|
184
|
-
export function multiply(out, a, b) {
|
|
185
|
-
var a0 = a[0],
|
|
186
|
-
a1 = a[1],
|
|
187
|
-
a2 = a[2],
|
|
188
|
-
a3 = a[3];
|
|
189
|
-
var b0 = b[0],
|
|
190
|
-
b1 = b[1],
|
|
191
|
-
b2 = b[2],
|
|
192
|
-
b3 = b[3];
|
|
193
|
-
out[0] = a0 * b0 + a2 * b1;
|
|
194
|
-
out[1] = a1 * b0 + a3 * b1;
|
|
195
|
-
out[2] = a0 * b2 + a2 * b3;
|
|
196
|
-
out[3] = a1 * b2 + a3 * b3;
|
|
197
|
-
return out;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Rotates a mat2 by the given angle
|
|
202
|
-
*
|
|
203
|
-
* @param {mat2} out the receiving matrix
|
|
204
|
-
* @param {ReadonlyMat2} a the matrix to rotate
|
|
205
|
-
* @param {Number} rad the angle to rotate the matrix by
|
|
206
|
-
* @returns {mat2} out
|
|
207
|
-
*/
|
|
208
|
-
export function rotate(out, a, rad) {
|
|
209
|
-
var a0 = a[0],
|
|
210
|
-
a1 = a[1],
|
|
211
|
-
a2 = a[2],
|
|
212
|
-
a3 = a[3];
|
|
213
|
-
var s = Math.sin(rad);
|
|
214
|
-
var c = Math.cos(rad);
|
|
215
|
-
out[0] = a0 * c + a2 * s;
|
|
216
|
-
out[1] = a1 * c + a3 * s;
|
|
217
|
-
out[2] = a0 * -s + a2 * c;
|
|
218
|
-
out[3] = a1 * -s + a3 * c;
|
|
219
|
-
return out;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Scales the mat2 by the dimensions in the given vec2
|
|
224
|
-
*
|
|
225
|
-
* @param {mat2} out the receiving matrix
|
|
226
|
-
* @param {ReadonlyMat2} a the matrix to rotate
|
|
227
|
-
* @param {ReadonlyVec2} v the vec2 to scale the matrix by
|
|
228
|
-
* @returns {mat2} out
|
|
229
|
-
**/
|
|
230
|
-
export function scale(out, a, v) {
|
|
231
|
-
var a0 = a[0],
|
|
232
|
-
a1 = a[1],
|
|
233
|
-
a2 = a[2],
|
|
234
|
-
a3 = a[3];
|
|
235
|
-
var v0 = v[0],
|
|
236
|
-
v1 = v[1];
|
|
237
|
-
out[0] = a0 * v0;
|
|
238
|
-
out[1] = a1 * v0;
|
|
239
|
-
out[2] = a2 * v1;
|
|
240
|
-
out[3] = a3 * v1;
|
|
241
|
-
return out;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Creates a matrix from a given angle
|
|
246
|
-
* This is equivalent to (but much faster than):
|
|
247
|
-
*
|
|
248
|
-
* mat2.identity(dest);
|
|
249
|
-
* mat2.rotate(dest, dest, rad);
|
|
250
|
-
*
|
|
251
|
-
* @param {mat2} out mat2 receiving operation result
|
|
252
|
-
* @param {Number} rad the angle to rotate the matrix by
|
|
253
|
-
* @returns {mat2} out
|
|
254
|
-
*/
|
|
255
|
-
export function fromRotation(out, rad) {
|
|
256
|
-
var s = Math.sin(rad);
|
|
257
|
-
var c = Math.cos(rad);
|
|
258
|
-
out[0] = c;
|
|
259
|
-
out[1] = s;
|
|
260
|
-
out[2] = -s;
|
|
261
|
-
out[3] = c;
|
|
262
|
-
return out;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Creates a matrix from a vector scaling
|
|
267
|
-
* This is equivalent to (but much faster than):
|
|
268
|
-
*
|
|
269
|
-
* mat2.identity(dest);
|
|
270
|
-
* mat2.scale(dest, dest, vec);
|
|
271
|
-
*
|
|
272
|
-
* @param {mat2} out mat2 receiving operation result
|
|
273
|
-
* @param {ReadonlyVec2} v Scaling vector
|
|
274
|
-
* @returns {mat2} out
|
|
275
|
-
*/
|
|
276
|
-
export function fromScaling(out, v) {
|
|
277
|
-
out[0] = v[0];
|
|
278
|
-
out[1] = 0;
|
|
279
|
-
out[2] = 0;
|
|
280
|
-
out[3] = v[1];
|
|
281
|
-
return out;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Returns a string representation of a mat2
|
|
286
|
-
*
|
|
287
|
-
* @param {ReadonlyMat2} a matrix to represent as a string
|
|
288
|
-
* @returns {String} string representation of the matrix
|
|
289
|
-
*/
|
|
290
|
-
export function str(a) {
|
|
291
|
-
return "mat2(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")";
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Returns Frobenius norm of a mat2
|
|
296
|
-
*
|
|
297
|
-
* @param {ReadonlyMat2} a the matrix to calculate Frobenius norm of
|
|
298
|
-
* @returns {Number} Frobenius norm
|
|
299
|
-
*/
|
|
300
|
-
export function frob(a) {
|
|
301
|
-
return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
|
|
306
|
-
* @param {ReadonlyMat2} L the lower triangular matrix
|
|
307
|
-
* @param {ReadonlyMat2} D the diagonal matrix
|
|
308
|
-
* @param {ReadonlyMat2} U the upper triangular matrix
|
|
309
|
-
* @param {ReadonlyMat2} a the input matrix to factorize
|
|
310
|
-
*/
|
|
311
|
-
|
|
312
|
-
export function LDU(L, D, U, a) {
|
|
313
|
-
L[2] = a[2] / a[0];
|
|
314
|
-
U[0] = a[0];
|
|
315
|
-
U[1] = a[1];
|
|
316
|
-
U[3] = a[3] - L[2] * U[1];
|
|
317
|
-
return [L, D, U];
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Adds two mat2's
|
|
322
|
-
*
|
|
323
|
-
* @param {mat2} out the receiving matrix
|
|
324
|
-
* @param {ReadonlyMat2} a the first operand
|
|
325
|
-
* @param {ReadonlyMat2} b the second operand
|
|
326
|
-
* @returns {mat2} out
|
|
327
|
-
*/
|
|
328
|
-
export function add(out, a, b) {
|
|
329
|
-
out[0] = a[0] + b[0];
|
|
330
|
-
out[1] = a[1] + b[1];
|
|
331
|
-
out[2] = a[2] + b[2];
|
|
332
|
-
out[3] = a[3] + b[3];
|
|
333
|
-
return out;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Subtracts matrix b from matrix a
|
|
338
|
-
*
|
|
339
|
-
* @param {mat2} out the receiving matrix
|
|
340
|
-
* @param {ReadonlyMat2} a the first operand
|
|
341
|
-
* @param {ReadonlyMat2} b the second operand
|
|
342
|
-
* @returns {mat2} out
|
|
343
|
-
*/
|
|
344
|
-
export function subtract(out, a, b) {
|
|
345
|
-
out[0] = a[0] - b[0];
|
|
346
|
-
out[1] = a[1] - b[1];
|
|
347
|
-
out[2] = a[2] - b[2];
|
|
348
|
-
out[3] = a[3] - b[3];
|
|
349
|
-
return out;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
|
|
354
|
-
*
|
|
355
|
-
* @param {ReadonlyMat2} a The first matrix.
|
|
356
|
-
* @param {ReadonlyMat2} b The second matrix.
|
|
357
|
-
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
358
|
-
*/
|
|
359
|
-
export function exactEquals(a, b) {
|
|
360
|
-
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Returns whether or not the matrices have approximately the same elements in the same position.
|
|
365
|
-
*
|
|
366
|
-
* @param {ReadonlyMat2} a The first matrix.
|
|
367
|
-
* @param {ReadonlyMat2} b The second matrix.
|
|
368
|
-
* @returns {Boolean} True if the matrices are equal, false otherwise.
|
|
369
|
-
*/
|
|
370
|
-
export function equals(a, b) {
|
|
371
|
-
var a0 = a[0],
|
|
372
|
-
a1 = a[1],
|
|
373
|
-
a2 = a[2],
|
|
374
|
-
a3 = a[3];
|
|
375
|
-
var b0 = b[0],
|
|
376
|
-
b1 = b[1],
|
|
377
|
-
b2 = b[2],
|
|
378
|
-
b3 = b[3];
|
|
379
|
-
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));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Multiply each element of the matrix by a scalar.
|
|
384
|
-
*
|
|
385
|
-
* @param {mat2} out the receiving matrix
|
|
386
|
-
* @param {ReadonlyMat2} a the matrix to scale
|
|
387
|
-
* @param {Number} b amount to scale the matrix's elements by
|
|
388
|
-
* @returns {mat2} out
|
|
389
|
-
*/
|
|
390
|
-
export function multiplyScalar(out, a, b) {
|
|
391
|
-
out[0] = a[0] * b;
|
|
392
|
-
out[1] = a[1] * b;
|
|
393
|
-
out[2] = a[2] * b;
|
|
394
|
-
out[3] = a[3] * b;
|
|
395
|
-
return out;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* Adds two mat2's after multiplying each element of the second operand by a scalar value.
|
|
400
|
-
*
|
|
401
|
-
* @param {mat2} out the receiving vector
|
|
402
|
-
* @param {ReadonlyMat2} a the first operand
|
|
403
|
-
* @param {ReadonlyMat2} b the second operand
|
|
404
|
-
* @param {Number} scale the amount to scale b's elements by before adding
|
|
405
|
-
* @returns {mat2} out
|
|
406
|
-
*/
|
|
407
|
-
export function multiplyScalarAndAdd(out, a, b, scale) {
|
|
408
|
-
out[0] = a[0] + b[0] * scale;
|
|
409
|
-
out[1] = a[1] + b[1] * scale;
|
|
410
|
-
out[2] = a[2] + b[2] * scale;
|
|
411
|
-
out[3] = a[3] + b[3] * scale;
|
|
412
|
-
return out;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Alias for {@link mat2.multiply}
|
|
417
|
-
* @function
|
|
418
|
-
*/
|
|
419
|
-
export var mul = multiply;
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Alias for {@link mat2.subtract}
|
|
423
|
-
* @function
|
|
424
|
-
*/
|
|
425
|
-
export var sub = subtract;
|