math 0.0.0 → 0.1.0
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/API.md +1605 -0
- package/LICENSE +21 -0
- package/README.md +197 -0
- package/dist/color/color.js +136 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/colorspace.js +43 -0
- package/dist/color/colorspace.js.map +1 -0
- package/dist/color/hsl.js +123 -0
- package/dist/color/hsl.js.map +1 -0
- package/dist/color/index.js +7 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/parse.js +276 -0
- package/dist/color/parse.js.map +1 -0
- package/dist/core/angle.js +43 -0
- package/dist/core/angle.js.map +1 -0
- package/dist/core/euler.js +212 -0
- package/dist/core/euler.js.map +1 -0
- package/dist/core/mat2.js +385 -0
- package/dist/core/mat2.js.map +1 -0
- package/dist/core/mat2d.js +422 -0
- package/dist/core/mat2d.js.map +1 -0
- package/dist/core/mat3.js +749 -0
- package/dist/core/mat3.js.map +1 -0
- package/dist/core/mat4.js +2197 -0
- package/dist/core/mat4.js.map +1 -0
- package/dist/core/polar.js +200 -0
- package/dist/core/polar.js.map +1 -0
- package/dist/core/quat.js +730 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/quat2.js +883 -0
- package/dist/core/quat2.js.map +1 -0
- package/dist/core/scalar.js +112 -0
- package/dist/core/scalar.js.map +1 -0
- package/dist/core/spherical.js +248 -0
- package/dist/core/spherical.js.map +1 -0
- package/dist/core/vec2.js +597 -0
- package/dist/core/vec2.js.map +1 -0
- package/dist/core/vec3.js +916 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/core/vec4.js +573 -0
- package/dist/core/vec4.js.map +1 -0
- package/dist/geometry/circumcircle.js +39 -0
- package/dist/geometry/circumcircle.js.map +1 -0
- package/dist/geometry/index.js +6 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/polygon2-decompose.js +411 -0
- package/dist/geometry/polygon2-decompose.js.map +1 -0
- package/dist/geometry/polygon2-triangulate.js +222 -0
- package/dist/geometry/polygon2-triangulate.js.map +1 -0
- package/dist/geometry/quickhull2.js +123 -0
- package/dist/geometry/quickhull2.js.map +1 -0
- package/dist/geometry/quickhull3.js +605 -0
- package/dist/geometry/quickhull3.js.map +1 -0
- package/dist/ik/fabrik2.js +675 -0
- package/dist/ik/fabrik2.js.map +1 -0
- package/dist/ik/fabrik3.js +912 -0
- package/dist/ik/fabrik3.js.map +1 -0
- package/dist/ik/index.js +5 -0
- package/dist/ik/index.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/noise/fractal.js +185 -0
- package/dist/noise/fractal.js.map +1 -0
- package/dist/noise/index.js +16 -0
- package/dist/noise/index.js.map +1 -0
- package/dist/noise/perlin2d.js +50 -0
- package/dist/noise/perlin2d.js.map +1 -0
- package/dist/noise/perlin3d.js +72 -0
- package/dist/noise/perlin3d.js.map +1 -0
- package/dist/noise/permutation.js +120 -0
- package/dist/noise/permutation.js.map +1 -0
- package/dist/noise/simplex2d.js +84 -0
- package/dist/noise/simplex2d.js.map +1 -0
- package/dist/noise/simplex3d.js +147 -0
- package/dist/noise/simplex3d.js.map +1 -0
- package/dist/noise/simplex4d.js +149 -0
- package/dist/noise/simplex4d.js.map +1 -0
- package/dist/noise/worley2d.js +50 -0
- package/dist/noise/worley2d.js.map +1 -0
- package/dist/noise/worley3d.js +61 -0
- package/dist/noise/worley3d.js.map +1 -0
- package/dist/random/index.js +9 -0
- package/dist/random/index.js.map +1 -0
- package/dist/random/isaac32.js +164 -0
- package/dist/random/isaac32.js.map +1 -0
- package/dist/random/isaac64.js +215 -0
- package/dist/random/isaac64.js.map +1 -0
- package/dist/random/mulberry32.js +48 -0
- package/dist/random/mulberry32.js.map +1 -0
- package/dist/random/random.js +120 -0
- package/dist/random/random.js.map +1 -0
- package/dist/shapes/box2.js +300 -0
- package/dist/shapes/box2.js.map +1 -0
- package/dist/shapes/box3.js +550 -0
- package/dist/shapes/box3.js.map +1 -0
- package/dist/shapes/circle.js +6 -0
- package/dist/shapes/circle.js.map +1 -0
- package/dist/shapes/frustum.js +662 -0
- package/dist/shapes/frustum.js.map +1 -0
- package/dist/shapes/index.js +25 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/obb3.js +557 -0
- package/dist/shapes/obb3.js.map +1 -0
- package/dist/shapes/plane3.js +267 -0
- package/dist/shapes/plane3.js.map +1 -0
- package/dist/shapes/polygon2.js +451 -0
- package/dist/shapes/polygon2.js.map +1 -0
- package/dist/shapes/raycast3.js +164 -0
- package/dist/shapes/raycast3.js.map +1 -0
- package/dist/shapes/segment2.js +82 -0
- package/dist/shapes/segment2.js.map +1 -0
- package/dist/shapes/sphere.js +23 -0
- package/dist/shapes/sphere.js.map +1 -0
- package/dist/shapes/triangle2.js +79 -0
- package/dist/shapes/triangle2.js.map +1 -0
- package/dist/shapes/triangle3.js +60 -0
- package/dist/shapes/triangle3.js.map +1 -0
- package/dist/src/color/color.d.ts +50 -0
- package/dist/src/color/colorspace.d.ts +15 -0
- package/dist/src/color/hsl.d.ts +28 -0
- package/dist/src/color/index.d.ts +5 -0
- package/dist/src/color/parse.d.ts +15 -0
- package/dist/src/core/angle.d.ts +29 -0
- package/dist/src/core/arrays.d.ts +4 -0
- package/dist/src/core/euler.d.ts +78 -0
- package/dist/src/core/index.d.ts +27 -0
- package/dist/src/core/mat2.d.ts +217 -0
- package/dist/src/core/mat2d.d.ts +218 -0
- package/dist/src/core/mat3.d.ts +295 -0
- package/dist/src/core/mat4.d.ts +667 -0
- package/dist/src/core/polar.d.ts +151 -0
- package/dist/src/core/quat.d.ts +370 -0
- package/dist/src/core/quat2.d.ts +344 -0
- package/dist/src/core/scalar.d.ts +75 -0
- package/dist/src/core/spherical.d.ts +165 -0
- package/dist/src/core/vec2.d.ts +403 -0
- package/dist/src/core/vec3.d.ts +493 -0
- package/dist/src/core/vec4.d.ts +336 -0
- package/dist/src/geometry/circumcircle.d.ts +9 -0
- package/dist/src/geometry/index.d.ts +5 -0
- package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
- package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
- package/dist/src/geometry/quickhull2.d.ts +10 -0
- package/dist/src/geometry/quickhull3.d.ts +27 -0
- package/dist/src/ik/fabrik2.d.ts +314 -0
- package/dist/src/ik/fabrik3.d.ts +371 -0
- package/dist/src/ik/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/noise/fractal.d.ts +95 -0
- package/dist/src/noise/index.d.ts +9 -0
- package/dist/src/noise/perlin2d.d.ts +19 -0
- package/dist/src/noise/perlin3d.d.ts +20 -0
- package/dist/src/noise/permutation.d.ts +22 -0
- package/dist/src/noise/simplex2d.d.ts +19 -0
- package/dist/src/noise/simplex3d.d.ts +20 -0
- package/dist/src/noise/simplex4d.d.ts +24 -0
- package/dist/src/noise/worley2d.d.ts +22 -0
- package/dist/src/noise/worley3d.d.ts +23 -0
- package/dist/src/random/index.d.ts +8 -0
- package/dist/src/random/isaac32.d.ts +62 -0
- package/dist/src/random/isaac64.d.ts +75 -0
- package/dist/src/random/mulberry32.d.ts +43 -0
- package/dist/src/random/random.d.ts +67 -0
- package/dist/src/shapes/box2.d.ts +174 -0
- package/dist/src/shapes/box3.d.ts +213 -0
- package/dist/src/shapes/circle.d.ts +7 -0
- package/dist/src/shapes/frustum.d.ts +147 -0
- package/dist/src/shapes/index.d.ts +20 -0
- package/dist/src/shapes/obb3.d.ts +105 -0
- package/dist/src/shapes/plane3.d.ts +130 -0
- package/dist/src/shapes/polygon2.d.ts +155 -0
- package/dist/src/shapes/raycast3.d.ts +42 -0
- package/dist/src/shapes/segment2.d.ts +34 -0
- package/dist/src/shapes/sphere.d.ts +19 -0
- package/dist/src/shapes/triangle2.d.ts +53 -0
- package/dist/src/shapes/triangle3.d.ts +29 -0
- package/dist/src/time/easing.d.ts +21 -0
- package/dist/src/time/index.d.ts +6 -0
- package/dist/src/time/spring-core.d.ts +15 -0
- package/dist/src/time/spring.d.ts +36 -0
- package/dist/src/time/spring2.d.ts +11 -0
- package/dist/src/time/spring3.d.ts +11 -0
- package/dist/src/time/spring4.d.ts +11 -0
- package/dist/time/easing.js +24 -0
- package/dist/time/easing.js.map +1 -0
- package/dist/time/index.js +11 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/spring-core.js +48 -0
- package/dist/time/spring-core.js.map +1 -0
- package/dist/time/spring.js +62 -0
- package/dist/time/spring.js.map +1 -0
- package/dist/time/spring2.js +31 -0
- package/dist/time/spring2.js.map +1 -0
- package/dist/time/spring3.js +32 -0
- package/dist/time/spring3.js.map +1 -0
- package/dist/time/spring4.js +32 -0
- package/dist/time/spring4.js.map +1 -0
- package/package.json +90 -12
- package/skills/math/SKILL.md +140 -0
- package/math.coffee +0 -36
- package/math.js +0 -67
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
import { EPSILON } from './scalar.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new identity mat3
|
|
5
|
+
*
|
|
6
|
+
* @returns a new 3x3 matrix
|
|
7
|
+
*/
|
|
8
|
+
function create() {
|
|
9
|
+
return [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Copies the upper-left 3x3 values into the given mat3.
|
|
13
|
+
*
|
|
14
|
+
* @param out the receiving 3x3 matrix
|
|
15
|
+
* @param a the source 4x4 matrix
|
|
16
|
+
* @returns out
|
|
17
|
+
*/
|
|
18
|
+
function fromMat4(out, a) {
|
|
19
|
+
out[0] = a[0];
|
|
20
|
+
out[1] = a[1];
|
|
21
|
+
out[2] = a[2];
|
|
22
|
+
out[3] = a[4];
|
|
23
|
+
out[4] = a[5];
|
|
24
|
+
out[5] = a[6];
|
|
25
|
+
out[6] = a[8];
|
|
26
|
+
out[7] = a[9];
|
|
27
|
+
out[8] = a[10];
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new mat3 initialized with values from an existing matrix
|
|
32
|
+
*
|
|
33
|
+
* @param a matrix to clone
|
|
34
|
+
* @returns a new 3x3 matrix
|
|
35
|
+
*/
|
|
36
|
+
function clone(a) {
|
|
37
|
+
return [a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Copy the values from one mat3 to another
|
|
41
|
+
*
|
|
42
|
+
* @param out the receiving matrix
|
|
43
|
+
* @param a the source matrix
|
|
44
|
+
* @returns out
|
|
45
|
+
*/
|
|
46
|
+
function copy(out, a) {
|
|
47
|
+
out[0] = a[0];
|
|
48
|
+
out[1] = a[1];
|
|
49
|
+
out[2] = a[2];
|
|
50
|
+
out[3] = a[3];
|
|
51
|
+
out[4] = a[4];
|
|
52
|
+
out[5] = a[5];
|
|
53
|
+
out[6] = a[6];
|
|
54
|
+
out[7] = a[7];
|
|
55
|
+
out[8] = a[8];
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create a new mat3 with the given values
|
|
60
|
+
*
|
|
61
|
+
* @param m00 Component in column 0, row 0 position (index 0)
|
|
62
|
+
* @param m01 Component in column 0, row 1 position (index 1)
|
|
63
|
+
* @param m02 Component in column 0, row 2 position (index 2)
|
|
64
|
+
* @param m10 Component in column 1, row 0 position (index 3)
|
|
65
|
+
* @param m11 Component in column 1, row 1 position (index 4)
|
|
66
|
+
* @param m12 Component in column 1, row 2 position (index 5)
|
|
67
|
+
* @param m20 Component in column 2, row 0 position (index 6)
|
|
68
|
+
* @param m21 Component in column 2, row 1 position (index 7)
|
|
69
|
+
* @param m22 Component in column 2, row 2 position (index 8)
|
|
70
|
+
* @returns A new mat3
|
|
71
|
+
*/
|
|
72
|
+
function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
|
73
|
+
return [m00, m01, m02, m10, m11, m12, m20, m21, m22];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Set the components of a mat3 to the given values
|
|
77
|
+
*
|
|
78
|
+
* @param out the receiving matrix
|
|
79
|
+
* @param m00 Component in column 0, row 0 position (index 0)
|
|
80
|
+
* @param m01 Component in column 0, row 1 position (index 1)
|
|
81
|
+
* @param m02 Component in column 0, row 2 position (index 2)
|
|
82
|
+
* @param m10 Component in column 1, row 0 position (index 3)
|
|
83
|
+
* @param m11 Component in column 1, row 1 position (index 4)
|
|
84
|
+
* @param m12 Component in column 1, row 2 position (index 5)
|
|
85
|
+
* @param m20 Component in column 2, row 0 position (index 6)
|
|
86
|
+
* @param m21 Component in column 2, row 1 position (index 7)
|
|
87
|
+
* @param m22 Component in column 2, row 2 position (index 8)
|
|
88
|
+
* @returns out
|
|
89
|
+
*/
|
|
90
|
+
function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
|
|
91
|
+
out[0] = m00;
|
|
92
|
+
out[1] = m01;
|
|
93
|
+
out[2] = m02;
|
|
94
|
+
out[3] = m10;
|
|
95
|
+
out[4] = m11;
|
|
96
|
+
out[5] = m12;
|
|
97
|
+
out[6] = m20;
|
|
98
|
+
out[7] = m21;
|
|
99
|
+
out[8] = m22;
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Set a mat3 to the identity matrix
|
|
104
|
+
*
|
|
105
|
+
* @param out the receiving matrix
|
|
106
|
+
* @returns out
|
|
107
|
+
*/
|
|
108
|
+
function identity(out) {
|
|
109
|
+
out[0] = 1;
|
|
110
|
+
out[1] = 0;
|
|
111
|
+
out[2] = 0;
|
|
112
|
+
out[3] = 0;
|
|
113
|
+
out[4] = 1;
|
|
114
|
+
out[5] = 0;
|
|
115
|
+
out[6] = 0;
|
|
116
|
+
out[7] = 0;
|
|
117
|
+
out[8] = 1;
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Set a mat3 to the zero matrix
|
|
122
|
+
*
|
|
123
|
+
* @param out the receiving matrix
|
|
124
|
+
* @returns out
|
|
125
|
+
*/
|
|
126
|
+
function zero(out) {
|
|
127
|
+
out[0] = 0;
|
|
128
|
+
out[1] = 0;
|
|
129
|
+
out[2] = 0;
|
|
130
|
+
out[3] = 0;
|
|
131
|
+
out[4] = 0;
|
|
132
|
+
out[5] = 0;
|
|
133
|
+
out[6] = 0;
|
|
134
|
+
out[7] = 0;
|
|
135
|
+
out[8] = 0;
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Transpose the values of a mat3
|
|
140
|
+
*
|
|
141
|
+
* @param out the receiving matrix
|
|
142
|
+
* @param a the source matrix
|
|
143
|
+
* @returns out
|
|
144
|
+
*/
|
|
145
|
+
function transpose(out, a) {
|
|
146
|
+
// If we are transposing ourselves we can skip a few steps but have to cache some values
|
|
147
|
+
if (out === a) {
|
|
148
|
+
const a01 = a[1];
|
|
149
|
+
const a02 = a[2];
|
|
150
|
+
const a12 = a[5];
|
|
151
|
+
out[1] = a[3];
|
|
152
|
+
out[2] = a[6];
|
|
153
|
+
out[3] = a01;
|
|
154
|
+
out[5] = a[7];
|
|
155
|
+
out[6] = a02;
|
|
156
|
+
out[7] = a12;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
out[0] = a[0];
|
|
160
|
+
out[1] = a[3];
|
|
161
|
+
out[2] = a[6];
|
|
162
|
+
out[3] = a[1];
|
|
163
|
+
out[4] = a[4];
|
|
164
|
+
out[5] = a[7];
|
|
165
|
+
out[6] = a[2];
|
|
166
|
+
out[7] = a[5];
|
|
167
|
+
out[8] = a[8];
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Inverts a mat3
|
|
173
|
+
*
|
|
174
|
+
* @param out the receiving matrix
|
|
175
|
+
* @param a the source matrix
|
|
176
|
+
* @returns out
|
|
177
|
+
*/
|
|
178
|
+
function invert(out, a) {
|
|
179
|
+
const a00 = a[0];
|
|
180
|
+
const a01 = a[1];
|
|
181
|
+
const a02 = a[2];
|
|
182
|
+
const a10 = a[3];
|
|
183
|
+
const a11 = a[4];
|
|
184
|
+
const a12 = a[5];
|
|
185
|
+
const a20 = a[6];
|
|
186
|
+
const a21 = a[7];
|
|
187
|
+
const a22 = a[8];
|
|
188
|
+
const b01 = a22 * a11 - a12 * a21;
|
|
189
|
+
const b11 = -a22 * a10 + a12 * a20;
|
|
190
|
+
const b21 = a21 * a10 - a11 * a20;
|
|
191
|
+
// Calculate the determinant
|
|
192
|
+
let det = a00 * b01 + a01 * b11 + a02 * b21;
|
|
193
|
+
if (!det) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
det = 1.0 / det;
|
|
197
|
+
out[0] = b01 * det;
|
|
198
|
+
out[1] = (-a22 * a01 + a02 * a21) * det;
|
|
199
|
+
out[2] = (a12 * a01 - a02 * a11) * det;
|
|
200
|
+
out[3] = b11 * det;
|
|
201
|
+
out[4] = (a22 * a00 - a02 * a20) * det;
|
|
202
|
+
out[5] = (-a12 * a00 + a02 * a10) * det;
|
|
203
|
+
out[6] = b21 * det;
|
|
204
|
+
out[7] = (-a21 * a00 + a01 * a20) * det;
|
|
205
|
+
out[8] = (a11 * a00 - a01 * a10) * det;
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Calculates the adjugate of a mat3
|
|
210
|
+
*
|
|
211
|
+
* @param out the receiving matrix
|
|
212
|
+
* @param a the source matrix
|
|
213
|
+
* @returns out
|
|
214
|
+
*/
|
|
215
|
+
function adjoint(out, a) {
|
|
216
|
+
const a00 = a[0];
|
|
217
|
+
const a01 = a[1];
|
|
218
|
+
const a02 = a[2];
|
|
219
|
+
const a10 = a[3];
|
|
220
|
+
const a11 = a[4];
|
|
221
|
+
const a12 = a[5];
|
|
222
|
+
const a20 = a[6];
|
|
223
|
+
const a21 = a[7];
|
|
224
|
+
const a22 = a[8];
|
|
225
|
+
out[0] = a11 * a22 - a12 * a21;
|
|
226
|
+
out[1] = a02 * a21 - a01 * a22;
|
|
227
|
+
out[2] = a01 * a12 - a02 * a11;
|
|
228
|
+
out[3] = a12 * a20 - a10 * a22;
|
|
229
|
+
out[4] = a00 * a22 - a02 * a20;
|
|
230
|
+
out[5] = a02 * a10 - a00 * a12;
|
|
231
|
+
out[6] = a10 * a21 - a11 * a20;
|
|
232
|
+
out[7] = a01 * a20 - a00 * a21;
|
|
233
|
+
out[8] = a00 * a11 - a01 * a10;
|
|
234
|
+
return out;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Calculates the determinant of a mat3
|
|
238
|
+
*
|
|
239
|
+
* @param a the source matrix
|
|
240
|
+
* @returns determinant of a
|
|
241
|
+
*/
|
|
242
|
+
function determinant(a) {
|
|
243
|
+
const a00 = a[0];
|
|
244
|
+
const a01 = a[1];
|
|
245
|
+
const a02 = a[2];
|
|
246
|
+
const a10 = a[3];
|
|
247
|
+
const a11 = a[4];
|
|
248
|
+
const a12 = a[5];
|
|
249
|
+
const a20 = a[6];
|
|
250
|
+
const a21 = a[7];
|
|
251
|
+
const a22 = a[8];
|
|
252
|
+
return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Multiplies two mat3's
|
|
256
|
+
*
|
|
257
|
+
* @param out the receiving matrix
|
|
258
|
+
* @param a the first operand
|
|
259
|
+
* @param b the second operand
|
|
260
|
+
* @returns out
|
|
261
|
+
*/
|
|
262
|
+
function multiply(out, a, b) {
|
|
263
|
+
const a00 = a[0];
|
|
264
|
+
const a01 = a[1];
|
|
265
|
+
const a02 = a[2];
|
|
266
|
+
const a10 = a[3];
|
|
267
|
+
const a11 = a[4];
|
|
268
|
+
const a12 = a[5];
|
|
269
|
+
const a20 = a[6];
|
|
270
|
+
const a21 = a[7];
|
|
271
|
+
const a22 = a[8];
|
|
272
|
+
const b00 = b[0];
|
|
273
|
+
const b01 = b[1];
|
|
274
|
+
const b02 = b[2];
|
|
275
|
+
const b10 = b[3];
|
|
276
|
+
const b11 = b[4];
|
|
277
|
+
const b12 = b[5];
|
|
278
|
+
const b20 = b[6];
|
|
279
|
+
const b21 = b[7];
|
|
280
|
+
const b22 = b[8];
|
|
281
|
+
out[0] = b00 * a00 + b01 * a10 + b02 * a20;
|
|
282
|
+
out[1] = b00 * a01 + b01 * a11 + b02 * a21;
|
|
283
|
+
out[2] = b00 * a02 + b01 * a12 + b02 * a22;
|
|
284
|
+
out[3] = b10 * a00 + b11 * a10 + b12 * a20;
|
|
285
|
+
out[4] = b10 * a01 + b11 * a11 + b12 * a21;
|
|
286
|
+
out[5] = b10 * a02 + b11 * a12 + b12 * a22;
|
|
287
|
+
out[6] = b20 * a00 + b21 * a10 + b22 * a20;
|
|
288
|
+
out[7] = b20 * a01 + b21 * a11 + b22 * a21;
|
|
289
|
+
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
|
290
|
+
return out;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Translate a mat3 by the given vector
|
|
294
|
+
*
|
|
295
|
+
* @param out the receiving matrix
|
|
296
|
+
* @param a the matrix to translate
|
|
297
|
+
* @param v vector to translate by
|
|
298
|
+
* @returns out
|
|
299
|
+
*/
|
|
300
|
+
function translate(out, a, v) {
|
|
301
|
+
const a00 = a[0];
|
|
302
|
+
const a01 = a[1];
|
|
303
|
+
const a02 = a[2];
|
|
304
|
+
const a10 = a[3];
|
|
305
|
+
const a11 = a[4];
|
|
306
|
+
const a12 = a[5];
|
|
307
|
+
const a20 = a[6];
|
|
308
|
+
const a21 = a[7];
|
|
309
|
+
const a22 = a[8];
|
|
310
|
+
const x = v[0];
|
|
311
|
+
const y = v[1];
|
|
312
|
+
out[0] = a00;
|
|
313
|
+
out[1] = a01;
|
|
314
|
+
out[2] = a02;
|
|
315
|
+
out[3] = a10;
|
|
316
|
+
out[4] = a11;
|
|
317
|
+
out[5] = a12;
|
|
318
|
+
out[6] = x * a00 + y * a10 + a20;
|
|
319
|
+
out[7] = x * a01 + y * a11 + a21;
|
|
320
|
+
out[8] = x * a02 + y * a12 + a22;
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Rotates a mat3 by the given angle
|
|
325
|
+
*
|
|
326
|
+
* @param out the receiving matrix
|
|
327
|
+
* @param a the matrix to rotate
|
|
328
|
+
* @param rad the angle to rotate the matrix by
|
|
329
|
+
* @returns out
|
|
330
|
+
*/
|
|
331
|
+
function rotate(out, a, rad) {
|
|
332
|
+
const a00 = a[0];
|
|
333
|
+
const a01 = a[1];
|
|
334
|
+
const a02 = a[2];
|
|
335
|
+
const a10 = a[3];
|
|
336
|
+
const a11 = a[4];
|
|
337
|
+
const a12 = a[5];
|
|
338
|
+
const a20 = a[6];
|
|
339
|
+
const a21 = a[7];
|
|
340
|
+
const a22 = a[8];
|
|
341
|
+
const s = Math.sin(rad);
|
|
342
|
+
const c = Math.cos(rad);
|
|
343
|
+
out[0] = c * a00 + s * a10;
|
|
344
|
+
out[1] = c * a01 + s * a11;
|
|
345
|
+
out[2] = c * a02 + s * a12;
|
|
346
|
+
out[3] = c * a10 - s * a00;
|
|
347
|
+
out[4] = c * a11 - s * a01;
|
|
348
|
+
out[5] = c * a12 - s * a02;
|
|
349
|
+
out[6] = a20;
|
|
350
|
+
out[7] = a21;
|
|
351
|
+
out[8] = a22;
|
|
352
|
+
return out;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Scales the mat3 by the dimensions in the given vec2
|
|
356
|
+
*
|
|
357
|
+
* @param out the receiving matrix
|
|
358
|
+
* @param a the matrix to rotate
|
|
359
|
+
* @param v the vec2 to scale the matrix by
|
|
360
|
+
* @returns out
|
|
361
|
+
**/
|
|
362
|
+
function scale(out, a, v) {
|
|
363
|
+
const x = v[0];
|
|
364
|
+
const y = v[1];
|
|
365
|
+
out[0] = x * a[0];
|
|
366
|
+
out[1] = x * a[1];
|
|
367
|
+
out[2] = x * a[2];
|
|
368
|
+
out[3] = y * a[3];
|
|
369
|
+
out[4] = y * a[4];
|
|
370
|
+
out[5] = y * a[5];
|
|
371
|
+
out[6] = a[6];
|
|
372
|
+
out[7] = a[7];
|
|
373
|
+
out[8] = a[8];
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Creates a matrix from a vector translation
|
|
378
|
+
* This is equivalent to (but much faster than):
|
|
379
|
+
*
|
|
380
|
+
* mat3.identity(dest);
|
|
381
|
+
* mat3.translate(dest, dest, vec);
|
|
382
|
+
*
|
|
383
|
+
* @param out mat3 receiving operation result
|
|
384
|
+
* @param v Translation vector
|
|
385
|
+
* @returns out
|
|
386
|
+
*/
|
|
387
|
+
function fromTranslation(out, v) {
|
|
388
|
+
out[0] = 1;
|
|
389
|
+
out[1] = 0;
|
|
390
|
+
out[2] = 0;
|
|
391
|
+
out[3] = 0;
|
|
392
|
+
out[4] = 1;
|
|
393
|
+
out[5] = 0;
|
|
394
|
+
out[6] = v[0];
|
|
395
|
+
out[7] = v[1];
|
|
396
|
+
out[8] = 1;
|
|
397
|
+
return out;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Creates a matrix from a given angle
|
|
401
|
+
* This is equivalent to (but much faster than):
|
|
402
|
+
*
|
|
403
|
+
* mat3.identity(dest);
|
|
404
|
+
* mat3.rotate(dest, dest, rad);
|
|
405
|
+
*
|
|
406
|
+
* @param out mat3 receiving operation result
|
|
407
|
+
* @param rad the angle to rotate the matrix by
|
|
408
|
+
* @returns out
|
|
409
|
+
*/
|
|
410
|
+
function fromRotation(out, rad) {
|
|
411
|
+
const s = Math.sin(rad);
|
|
412
|
+
const c = Math.cos(rad);
|
|
413
|
+
out[0] = c;
|
|
414
|
+
out[1] = s;
|
|
415
|
+
out[2] = 0;
|
|
416
|
+
out[3] = -s;
|
|
417
|
+
out[4] = c;
|
|
418
|
+
out[5] = 0;
|
|
419
|
+
out[6] = 0;
|
|
420
|
+
out[7] = 0;
|
|
421
|
+
out[8] = 1;
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Creates a matrix from a vector scaling
|
|
426
|
+
* This is equivalent to (but much faster than):
|
|
427
|
+
*
|
|
428
|
+
* mat3.identity(dest);
|
|
429
|
+
* mat3.scale(dest, dest, vec);
|
|
430
|
+
*
|
|
431
|
+
* @param out mat3 receiving operation result
|
|
432
|
+
* @param v Scaling vector
|
|
433
|
+
* @returns out
|
|
434
|
+
*/
|
|
435
|
+
function fromScaling(out, v) {
|
|
436
|
+
out[0] = v[0];
|
|
437
|
+
out[1] = 0;
|
|
438
|
+
out[2] = 0;
|
|
439
|
+
out[3] = 0;
|
|
440
|
+
out[4] = v[1];
|
|
441
|
+
out[5] = 0;
|
|
442
|
+
out[6] = 0;
|
|
443
|
+
out[7] = 0;
|
|
444
|
+
out[8] = 1;
|
|
445
|
+
return out;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Copies the values from a mat2d into a mat3
|
|
449
|
+
*
|
|
450
|
+
* @param out the receiving matrix
|
|
451
|
+
* @param a the matrix to copy
|
|
452
|
+
* @returns out
|
|
453
|
+
**/
|
|
454
|
+
function fromMat2d(out, a) {
|
|
455
|
+
out[0] = a[0];
|
|
456
|
+
out[1] = a[1];
|
|
457
|
+
out[2] = 0;
|
|
458
|
+
out[3] = a[2];
|
|
459
|
+
out[4] = a[3];
|
|
460
|
+
out[5] = 0;
|
|
461
|
+
out[6] = a[4];
|
|
462
|
+
out[7] = a[5];
|
|
463
|
+
out[8] = 1;
|
|
464
|
+
return out;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Calculates a 3x3 matrix from the given quaternion
|
|
468
|
+
*
|
|
469
|
+
* @param out mat3 receiving operation result
|
|
470
|
+
* @param q Quaternion to create matrix from
|
|
471
|
+
*
|
|
472
|
+
* @returns out
|
|
473
|
+
*/
|
|
474
|
+
function fromQuat(out, q) {
|
|
475
|
+
const x = q[0];
|
|
476
|
+
const y = q[1];
|
|
477
|
+
const z = q[2];
|
|
478
|
+
const w = q[3];
|
|
479
|
+
const x2 = x + x;
|
|
480
|
+
const y2 = y + y;
|
|
481
|
+
const z2 = z + z;
|
|
482
|
+
const xx = x * x2;
|
|
483
|
+
const yx = y * x2;
|
|
484
|
+
const yy = y * y2;
|
|
485
|
+
const zx = z * x2;
|
|
486
|
+
const zy = z * y2;
|
|
487
|
+
const zz = z * z2;
|
|
488
|
+
const wx = w * x2;
|
|
489
|
+
const wy = w * y2;
|
|
490
|
+
const wz = w * z2;
|
|
491
|
+
out[0] = 1 - yy - zz;
|
|
492
|
+
out[3] = yx - wz;
|
|
493
|
+
out[6] = zx + wy;
|
|
494
|
+
out[1] = yx + wz;
|
|
495
|
+
out[4] = 1 - xx - zz;
|
|
496
|
+
out[7] = zy - wx;
|
|
497
|
+
out[2] = zx - wy;
|
|
498
|
+
out[5] = zy + wx;
|
|
499
|
+
out[8] = 1 - xx - yy;
|
|
500
|
+
return out;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
|
|
504
|
+
*
|
|
505
|
+
* @param out mat3 receiving operation result
|
|
506
|
+
* @param a Mat4 to derive the normal matrix from
|
|
507
|
+
*
|
|
508
|
+
* @returns out
|
|
509
|
+
*/
|
|
510
|
+
function normalFromMat4(out, a) {
|
|
511
|
+
const a00 = a[0];
|
|
512
|
+
const a01 = a[1];
|
|
513
|
+
const a02 = a[2];
|
|
514
|
+
const a03 = a[3];
|
|
515
|
+
const a10 = a[4];
|
|
516
|
+
const a11 = a[5];
|
|
517
|
+
const a12 = a[6];
|
|
518
|
+
const a13 = a[7];
|
|
519
|
+
const a20 = a[8];
|
|
520
|
+
const a21 = a[9];
|
|
521
|
+
const a22 = a[10];
|
|
522
|
+
const a23 = a[11];
|
|
523
|
+
const a30 = a[12];
|
|
524
|
+
const a31 = a[13];
|
|
525
|
+
const a32 = a[14];
|
|
526
|
+
const a33 = a[15];
|
|
527
|
+
const b00 = a00 * a11 - a01 * a10;
|
|
528
|
+
const b01 = a00 * a12 - a02 * a10;
|
|
529
|
+
const b02 = a00 * a13 - a03 * a10;
|
|
530
|
+
const b03 = a01 * a12 - a02 * a11;
|
|
531
|
+
const b04 = a01 * a13 - a03 * a11;
|
|
532
|
+
const b05 = a02 * a13 - a03 * a12;
|
|
533
|
+
const b06 = a20 * a31 - a21 * a30;
|
|
534
|
+
const b07 = a20 * a32 - a22 * a30;
|
|
535
|
+
const b08 = a20 * a33 - a23 * a30;
|
|
536
|
+
const b09 = a21 * a32 - a22 * a31;
|
|
537
|
+
const b10 = a21 * a33 - a23 * a31;
|
|
538
|
+
const b11 = a22 * a33 - a23 * a32;
|
|
539
|
+
// Calculate the determinant
|
|
540
|
+
let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
|
|
541
|
+
if (!det) {
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
det = 1.0 / det;
|
|
545
|
+
out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
|
|
546
|
+
out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
|
|
547
|
+
out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
|
|
548
|
+
out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
|
|
549
|
+
out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
|
|
550
|
+
out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
|
|
551
|
+
out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
|
|
552
|
+
out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
|
|
553
|
+
out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
|
|
554
|
+
return out;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Generates a 2D projection matrix with the given bounds
|
|
558
|
+
*
|
|
559
|
+
* @param out mat3 frustum matrix will be written into
|
|
560
|
+
* @param width Width of your gl context
|
|
561
|
+
* @param height Height of gl context
|
|
562
|
+
* @returns out
|
|
563
|
+
*/
|
|
564
|
+
function projection(out, width, height) {
|
|
565
|
+
out[0] = 2 / width;
|
|
566
|
+
out[1] = 0;
|
|
567
|
+
out[2] = 0;
|
|
568
|
+
out[3] = 0;
|
|
569
|
+
out[4] = -2 / height;
|
|
570
|
+
out[5] = 0;
|
|
571
|
+
out[6] = -1;
|
|
572
|
+
out[7] = 1;
|
|
573
|
+
out[8] = 1;
|
|
574
|
+
return out;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Returns a string representation of a mat3
|
|
578
|
+
*
|
|
579
|
+
* @param a matrix to represent as a string
|
|
580
|
+
* @returns string representation of the matrix
|
|
581
|
+
*/
|
|
582
|
+
function str(a) {
|
|
583
|
+
return `mat3(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]}, ${a[6]}, ${a[7]}, ${a[8]})`;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Returns Frobenius norm of a mat3
|
|
587
|
+
*
|
|
588
|
+
* @param a the matrix to calculate Frobenius norm of
|
|
589
|
+
* @returns Frobenius norm
|
|
590
|
+
*/
|
|
591
|
+
function frob(a) {
|
|
592
|
+
return Math.sqrt(a[0] * a[0] +
|
|
593
|
+
a[1] * a[1] +
|
|
594
|
+
a[2] * a[2] +
|
|
595
|
+
a[3] * a[3] +
|
|
596
|
+
a[4] * a[4] +
|
|
597
|
+
a[5] * a[5] +
|
|
598
|
+
a[6] * a[6] +
|
|
599
|
+
a[7] * a[7] +
|
|
600
|
+
a[8] * a[8]);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Adds two mat3's
|
|
604
|
+
*
|
|
605
|
+
* @param out the receiving matrix
|
|
606
|
+
* @param a the first operand
|
|
607
|
+
* @param b the second operand
|
|
608
|
+
* @returns out
|
|
609
|
+
*/
|
|
610
|
+
function add(out, a, b) {
|
|
611
|
+
out[0] = a[0] + b[0];
|
|
612
|
+
out[1] = a[1] + b[1];
|
|
613
|
+
out[2] = a[2] + b[2];
|
|
614
|
+
out[3] = a[3] + b[3];
|
|
615
|
+
out[4] = a[4] + b[4];
|
|
616
|
+
out[5] = a[5] + b[5];
|
|
617
|
+
out[6] = a[6] + b[6];
|
|
618
|
+
out[7] = a[7] + b[7];
|
|
619
|
+
out[8] = a[8] + b[8];
|
|
620
|
+
return out;
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Subtracts matrix b from matrix a
|
|
624
|
+
*
|
|
625
|
+
* @param out the receiving matrix
|
|
626
|
+
* @param a the first operand
|
|
627
|
+
* @param b the second operand
|
|
628
|
+
* @returns out
|
|
629
|
+
*/
|
|
630
|
+
function subtract(out, a, b) {
|
|
631
|
+
out[0] = a[0] - b[0];
|
|
632
|
+
out[1] = a[1] - b[1];
|
|
633
|
+
out[2] = a[2] - b[2];
|
|
634
|
+
out[3] = a[3] - b[3];
|
|
635
|
+
out[4] = a[4] - b[4];
|
|
636
|
+
out[5] = a[5] - b[5];
|
|
637
|
+
out[6] = a[6] - b[6];
|
|
638
|
+
out[7] = a[7] - b[7];
|
|
639
|
+
out[8] = a[8] - b[8];
|
|
640
|
+
return out;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Multiply each element of the matrix by a scalar.
|
|
644
|
+
*
|
|
645
|
+
* @param out the receiving matrix
|
|
646
|
+
* @param a the matrix to scale
|
|
647
|
+
* @param b amount to scale the matrix's elements by
|
|
648
|
+
* @returns out
|
|
649
|
+
*/
|
|
650
|
+
function multiplyScalar(out, a, b) {
|
|
651
|
+
out[0] = a[0] * b;
|
|
652
|
+
out[1] = a[1] * b;
|
|
653
|
+
out[2] = a[2] * b;
|
|
654
|
+
out[3] = a[3] * b;
|
|
655
|
+
out[4] = a[4] * b;
|
|
656
|
+
out[5] = a[5] * b;
|
|
657
|
+
out[6] = a[6] * b;
|
|
658
|
+
out[7] = a[7] * b;
|
|
659
|
+
out[8] = a[8] * b;
|
|
660
|
+
return out;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Adds two mat3's after multiplying each element of the second operand by a scalar value.
|
|
664
|
+
*
|
|
665
|
+
* @param out the receiving vector
|
|
666
|
+
* @param a the first operand
|
|
667
|
+
* @param b the second operand
|
|
668
|
+
* @param scale the amount to scale b's elements by before adding
|
|
669
|
+
* @returns out
|
|
670
|
+
*/
|
|
671
|
+
function multiplyScalarAndAdd(out, a, b, scale) {
|
|
672
|
+
out[0] = a[0] + b[0] * scale;
|
|
673
|
+
out[1] = a[1] + b[1] * scale;
|
|
674
|
+
out[2] = a[2] + b[2] * scale;
|
|
675
|
+
out[3] = a[3] + b[3] * scale;
|
|
676
|
+
out[4] = a[4] + b[4] * scale;
|
|
677
|
+
out[5] = a[5] + b[5] * scale;
|
|
678
|
+
out[6] = a[6] + b[6] * scale;
|
|
679
|
+
out[7] = a[7] + b[7] * scale;
|
|
680
|
+
out[8] = a[8] + b[8] * scale;
|
|
681
|
+
return out;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
|
|
685
|
+
*
|
|
686
|
+
* @param a The first matrix.
|
|
687
|
+
* @param b The second matrix.
|
|
688
|
+
* @returns True if the matrices are equal, false otherwise.
|
|
689
|
+
*/
|
|
690
|
+
function exactEquals(a, b) {
|
|
691
|
+
return (a[0] === b[0] &&
|
|
692
|
+
a[1] === b[1] &&
|
|
693
|
+
a[2] === b[2] &&
|
|
694
|
+
a[3] === b[3] &&
|
|
695
|
+
a[4] === b[4] &&
|
|
696
|
+
a[5] === b[5] &&
|
|
697
|
+
a[6] === b[6] &&
|
|
698
|
+
a[7] === b[7] &&
|
|
699
|
+
a[8] === b[8]);
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Returns whether or not the matrices have approximately the same elements in the same position.
|
|
703
|
+
*
|
|
704
|
+
* @param a The first matrix.
|
|
705
|
+
* @param b The second matrix.
|
|
706
|
+
* @returns True if the matrices are equal, false otherwise.
|
|
707
|
+
*/
|
|
708
|
+
function equals(a, b) {
|
|
709
|
+
const a0 = a[0];
|
|
710
|
+
const a1 = a[1];
|
|
711
|
+
const a2 = a[2];
|
|
712
|
+
const a3 = a[3];
|
|
713
|
+
const a4 = a[4];
|
|
714
|
+
const a5 = a[5];
|
|
715
|
+
const a6 = a[6];
|
|
716
|
+
const a7 = a[7];
|
|
717
|
+
const a8 = a[8];
|
|
718
|
+
const b0 = b[0];
|
|
719
|
+
const b1 = b[1];
|
|
720
|
+
const b2 = b[2];
|
|
721
|
+
const b3 = b[3];
|
|
722
|
+
const b4 = b[4];
|
|
723
|
+
const b5 = b[5];
|
|
724
|
+
const b6 = b[6];
|
|
725
|
+
const b7 = b[7];
|
|
726
|
+
const b8 = b[8];
|
|
727
|
+
return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
|
|
728
|
+
Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
|
|
729
|
+
Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&
|
|
730
|
+
Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&
|
|
731
|
+
Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&
|
|
732
|
+
Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) &&
|
|
733
|
+
Math.abs(a6 - b6) <= EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) &&
|
|
734
|
+
Math.abs(a7 - b7) <= EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) &&
|
|
735
|
+
Math.abs(a8 - b8) <= EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)));
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Alias for {@link mat3.multiply}
|
|
739
|
+
* @function
|
|
740
|
+
*/
|
|
741
|
+
const mul = multiply;
|
|
742
|
+
/**
|
|
743
|
+
* Alias for {@link mat3.subtract}
|
|
744
|
+
* @function
|
|
745
|
+
*/
|
|
746
|
+
const sub = subtract;
|
|
747
|
+
|
|
748
|
+
export { add, adjoint, clone, copy, create, determinant, equals, exactEquals, frob, fromMat2d, fromMat4, fromQuat, fromRotation, fromScaling, fromTranslation, fromValues, identity, invert, mul, multiply, multiplyScalar, multiplyScalarAndAdd, normalFromMat4, projection, rotate, scale, set, str, sub, subtract, translate, transpose, zero };
|
|
749
|
+
//# sourceMappingURL=mat3.js.map
|