math 0.0.3 → 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.
Files changed (203) hide show
  1. package/API.md +1605 -0
  2. package/LICENSE +21 -0
  3. package/README.md +197 -0
  4. package/dist/color/color.js +136 -0
  5. package/dist/color/color.js.map +1 -0
  6. package/dist/color/colorspace.js +43 -0
  7. package/dist/color/colorspace.js.map +1 -0
  8. package/dist/color/hsl.js +123 -0
  9. package/dist/color/hsl.js.map +1 -0
  10. package/dist/color/index.js +7 -0
  11. package/dist/color/index.js.map +1 -0
  12. package/dist/color/parse.js +276 -0
  13. package/dist/color/parse.js.map +1 -0
  14. package/dist/core/angle.js +43 -0
  15. package/dist/core/angle.js.map +1 -0
  16. package/dist/core/euler.js +212 -0
  17. package/dist/core/euler.js.map +1 -0
  18. package/dist/core/mat2.js +385 -0
  19. package/dist/core/mat2.js.map +1 -0
  20. package/dist/core/mat2d.js +422 -0
  21. package/dist/core/mat2d.js.map +1 -0
  22. package/dist/core/mat3.js +749 -0
  23. package/dist/core/mat3.js.map +1 -0
  24. package/dist/core/mat4.js +2197 -0
  25. package/dist/core/mat4.js.map +1 -0
  26. package/dist/core/polar.js +200 -0
  27. package/dist/core/polar.js.map +1 -0
  28. package/dist/core/quat.js +730 -0
  29. package/dist/core/quat.js.map +1 -0
  30. package/dist/core/quat2.js +883 -0
  31. package/dist/core/quat2.js.map +1 -0
  32. package/dist/core/scalar.js +112 -0
  33. package/dist/core/scalar.js.map +1 -0
  34. package/dist/core/spherical.js +248 -0
  35. package/dist/core/spherical.js.map +1 -0
  36. package/dist/core/vec2.js +597 -0
  37. package/dist/core/vec2.js.map +1 -0
  38. package/dist/core/vec3.js +916 -0
  39. package/dist/core/vec3.js.map +1 -0
  40. package/dist/core/vec4.js +573 -0
  41. package/dist/core/vec4.js.map +1 -0
  42. package/dist/geometry/circumcircle.js +39 -0
  43. package/dist/geometry/circumcircle.js.map +1 -0
  44. package/dist/geometry/index.js +6 -0
  45. package/dist/geometry/index.js.map +1 -0
  46. package/dist/geometry/polygon2-decompose.js +411 -0
  47. package/dist/geometry/polygon2-decompose.js.map +1 -0
  48. package/dist/geometry/polygon2-triangulate.js +222 -0
  49. package/dist/geometry/polygon2-triangulate.js.map +1 -0
  50. package/dist/geometry/quickhull2.js +123 -0
  51. package/dist/geometry/quickhull2.js.map +1 -0
  52. package/dist/geometry/quickhull3.js +605 -0
  53. package/dist/geometry/quickhull3.js.map +1 -0
  54. package/dist/ik/fabrik2.js +675 -0
  55. package/dist/ik/fabrik2.js.map +1 -0
  56. package/dist/ik/fabrik3.js +912 -0
  57. package/dist/ik/fabrik3.js.map +1 -0
  58. package/dist/ik/index.js +5 -0
  59. package/dist/ik/index.js.map +1 -0
  60. package/dist/index.js +27 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/noise/fractal.js +185 -0
  63. package/dist/noise/fractal.js.map +1 -0
  64. package/dist/noise/index.js +16 -0
  65. package/dist/noise/index.js.map +1 -0
  66. package/dist/noise/perlin2d.js +50 -0
  67. package/dist/noise/perlin2d.js.map +1 -0
  68. package/dist/noise/perlin3d.js +72 -0
  69. package/dist/noise/perlin3d.js.map +1 -0
  70. package/dist/noise/permutation.js +120 -0
  71. package/dist/noise/permutation.js.map +1 -0
  72. package/dist/noise/simplex2d.js +84 -0
  73. package/dist/noise/simplex2d.js.map +1 -0
  74. package/dist/noise/simplex3d.js +147 -0
  75. package/dist/noise/simplex3d.js.map +1 -0
  76. package/dist/noise/simplex4d.js +149 -0
  77. package/dist/noise/simplex4d.js.map +1 -0
  78. package/dist/noise/worley2d.js +50 -0
  79. package/dist/noise/worley2d.js.map +1 -0
  80. package/dist/noise/worley3d.js +61 -0
  81. package/dist/noise/worley3d.js.map +1 -0
  82. package/dist/random/index.js +9 -0
  83. package/dist/random/index.js.map +1 -0
  84. package/dist/random/isaac32.js +164 -0
  85. package/dist/random/isaac32.js.map +1 -0
  86. package/dist/random/isaac64.js +215 -0
  87. package/dist/random/isaac64.js.map +1 -0
  88. package/dist/random/mulberry32.js +48 -0
  89. package/dist/random/mulberry32.js.map +1 -0
  90. package/dist/random/random.js +120 -0
  91. package/dist/random/random.js.map +1 -0
  92. package/dist/shapes/box2.js +300 -0
  93. package/dist/shapes/box2.js.map +1 -0
  94. package/dist/shapes/box3.js +550 -0
  95. package/dist/shapes/box3.js.map +1 -0
  96. package/dist/shapes/circle.js +6 -0
  97. package/dist/shapes/circle.js.map +1 -0
  98. package/dist/shapes/frustum.js +662 -0
  99. package/dist/shapes/frustum.js.map +1 -0
  100. package/dist/shapes/index.js +25 -0
  101. package/dist/shapes/index.js.map +1 -0
  102. package/dist/shapes/obb3.js +557 -0
  103. package/dist/shapes/obb3.js.map +1 -0
  104. package/dist/shapes/plane3.js +267 -0
  105. package/dist/shapes/plane3.js.map +1 -0
  106. package/dist/shapes/polygon2.js +451 -0
  107. package/dist/shapes/polygon2.js.map +1 -0
  108. package/dist/shapes/raycast3.js +164 -0
  109. package/dist/shapes/raycast3.js.map +1 -0
  110. package/dist/shapes/segment2.js +82 -0
  111. package/dist/shapes/segment2.js.map +1 -0
  112. package/dist/shapes/sphere.js +23 -0
  113. package/dist/shapes/sphere.js.map +1 -0
  114. package/dist/shapes/triangle2.js +79 -0
  115. package/dist/shapes/triangle2.js.map +1 -0
  116. package/dist/shapes/triangle3.js +60 -0
  117. package/dist/shapes/triangle3.js.map +1 -0
  118. package/dist/src/color/color.d.ts +50 -0
  119. package/dist/src/color/colorspace.d.ts +15 -0
  120. package/dist/src/color/hsl.d.ts +28 -0
  121. package/dist/src/color/index.d.ts +5 -0
  122. package/dist/src/color/parse.d.ts +15 -0
  123. package/dist/src/core/angle.d.ts +29 -0
  124. package/dist/src/core/arrays.d.ts +4 -0
  125. package/dist/src/core/euler.d.ts +78 -0
  126. package/dist/src/core/index.d.ts +27 -0
  127. package/dist/src/core/mat2.d.ts +217 -0
  128. package/dist/src/core/mat2d.d.ts +218 -0
  129. package/dist/src/core/mat3.d.ts +295 -0
  130. package/dist/src/core/mat4.d.ts +667 -0
  131. package/dist/src/core/polar.d.ts +151 -0
  132. package/dist/src/core/quat.d.ts +370 -0
  133. package/dist/src/core/quat2.d.ts +344 -0
  134. package/dist/src/core/scalar.d.ts +75 -0
  135. package/dist/src/core/spherical.d.ts +165 -0
  136. package/dist/src/core/vec2.d.ts +403 -0
  137. package/dist/src/core/vec3.d.ts +493 -0
  138. package/dist/src/core/vec4.d.ts +336 -0
  139. package/dist/src/geometry/circumcircle.d.ts +9 -0
  140. package/dist/src/geometry/index.d.ts +5 -0
  141. package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
  142. package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
  143. package/dist/src/geometry/quickhull2.d.ts +10 -0
  144. package/dist/src/geometry/quickhull3.d.ts +27 -0
  145. package/dist/src/ik/fabrik2.d.ts +314 -0
  146. package/dist/src/ik/fabrik3.d.ts +371 -0
  147. package/dist/src/ik/index.d.ts +2 -0
  148. package/dist/src/index.d.ts +1 -0
  149. package/dist/src/noise/fractal.d.ts +95 -0
  150. package/dist/src/noise/index.d.ts +9 -0
  151. package/dist/src/noise/perlin2d.d.ts +19 -0
  152. package/dist/src/noise/perlin3d.d.ts +20 -0
  153. package/dist/src/noise/permutation.d.ts +22 -0
  154. package/dist/src/noise/simplex2d.d.ts +19 -0
  155. package/dist/src/noise/simplex3d.d.ts +20 -0
  156. package/dist/src/noise/simplex4d.d.ts +24 -0
  157. package/dist/src/noise/worley2d.d.ts +22 -0
  158. package/dist/src/noise/worley3d.d.ts +23 -0
  159. package/dist/src/random/index.d.ts +8 -0
  160. package/dist/src/random/isaac32.d.ts +62 -0
  161. package/dist/src/random/isaac64.d.ts +75 -0
  162. package/dist/src/random/mulberry32.d.ts +43 -0
  163. package/dist/src/random/random.d.ts +67 -0
  164. package/dist/src/shapes/box2.d.ts +174 -0
  165. package/dist/src/shapes/box3.d.ts +213 -0
  166. package/dist/src/shapes/circle.d.ts +7 -0
  167. package/dist/src/shapes/frustum.d.ts +147 -0
  168. package/dist/src/shapes/index.d.ts +20 -0
  169. package/dist/src/shapes/obb3.d.ts +105 -0
  170. package/dist/src/shapes/plane3.d.ts +130 -0
  171. package/dist/src/shapes/polygon2.d.ts +155 -0
  172. package/dist/src/shapes/raycast3.d.ts +42 -0
  173. package/dist/src/shapes/segment2.d.ts +34 -0
  174. package/dist/src/shapes/sphere.d.ts +19 -0
  175. package/dist/src/shapes/triangle2.d.ts +53 -0
  176. package/dist/src/shapes/triangle3.d.ts +29 -0
  177. package/dist/src/time/easing.d.ts +21 -0
  178. package/dist/src/time/index.d.ts +6 -0
  179. package/dist/src/time/spring-core.d.ts +15 -0
  180. package/dist/src/time/spring.d.ts +36 -0
  181. package/dist/src/time/spring2.d.ts +11 -0
  182. package/dist/src/time/spring3.d.ts +11 -0
  183. package/dist/src/time/spring4.d.ts +11 -0
  184. package/dist/time/easing.js +24 -0
  185. package/dist/time/easing.js.map +1 -0
  186. package/dist/time/index.js +11 -0
  187. package/dist/time/index.js.map +1 -0
  188. package/dist/time/spring-core.js +48 -0
  189. package/dist/time/spring-core.js.map +1 -0
  190. package/dist/time/spring.js +62 -0
  191. package/dist/time/spring.js.map +1 -0
  192. package/dist/time/spring2.js +31 -0
  193. package/dist/time/spring2.js.map +1 -0
  194. package/dist/time/spring3.js +32 -0
  195. package/dist/time/spring3.js.map +1 -0
  196. package/dist/time/spring4.js +32 -0
  197. package/dist/time/spring4.js.map +1 -0
  198. package/package.json +90 -16
  199. package/skills/math/SKILL.md +140 -0
  200. package/AUTHORS +0 -1
  201. package/Cakefile +0 -28
  202. package/math.coffee +0 -112
  203. package/math.js +0 -141
@@ -0,0 +1,385 @@
1
+ import { EPSILON } from './scalar.js';
2
+
3
+ /**
4
+ * Creates a new identity mat2
5
+ *
6
+ * @returns a new 2x2 matrix
7
+ */
8
+ function create() {
9
+ return [1, 0, 0, 1];
10
+ }
11
+ /**
12
+ * Creates a new mat2 initialized with values from an existing matrix
13
+ *
14
+ * @param a matrix to clone
15
+ * @returns a new 2x2 matrix
16
+ */
17
+ function clone(a) {
18
+ return [a[0], a[1], a[2], a[3]];
19
+ }
20
+ /**
21
+ * Copy the values from one mat2 to another
22
+ *
23
+ * @param out the receiving matrix
24
+ * @param a the source matrix
25
+ * @returns out
26
+ */
27
+ function copy(out, a) {
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
+ * Set a mat2 to the identity matrix
36
+ *
37
+ * @param out the receiving matrix
38
+ * @returns out
39
+ */
40
+ function identity(out) {
41
+ out[0] = 1;
42
+ out[1] = 0;
43
+ out[2] = 0;
44
+ out[3] = 1;
45
+ return out;
46
+ }
47
+ /**
48
+ * Create a new mat2 with the given values
49
+ *
50
+ * @param m00 Component in column 0, row 0 position (index 0)
51
+ * @param m01 Component in column 0, row 1 position (index 1)
52
+ * @param m10 Component in column 1, row 0 position (index 2)
53
+ * @param m11 Component in column 1, row 1 position (index 3)
54
+ * @returns out A new 2x2 matrix
55
+ */
56
+ function fromValues(m00, m01, m10, m11) {
57
+ return [m00, m01, m10, m11];
58
+ }
59
+ /**
60
+ * Set the components of a mat2 to the given values
61
+ *
62
+ * @param out the receiving matrix
63
+ * @param m00 Component in column 0, row 0 position (index 0)
64
+ * @param m01 Component in column 0, row 1 position (index 1)
65
+ * @param m10 Component in column 1, row 0 position (index 2)
66
+ * @param m11 Component in column 1, row 1 position (index 3)
67
+ * @returns out
68
+ */
69
+ function set(out, m00, m01, m10, m11) {
70
+ out[0] = m00;
71
+ out[1] = m01;
72
+ out[2] = m10;
73
+ out[3] = m11;
74
+ return out;
75
+ }
76
+ /**
77
+ * Transpose the values of a mat2
78
+ *
79
+ * @param out the receiving matrix
80
+ * @param a the source matrix
81
+ * @returns out
82
+ */
83
+ function transpose(out, a) {
84
+ // If we are transposing ourselves we can skip a few steps but have to cache
85
+ // some values
86
+ if (out === a) {
87
+ const a1 = a[1];
88
+ out[1] = a[2];
89
+ out[2] = a1;
90
+ }
91
+ else {
92
+ out[0] = a[0];
93
+ out[1] = a[2];
94
+ out[2] = a[1];
95
+ out[3] = a[3];
96
+ }
97
+ return out;
98
+ }
99
+ /**
100
+ * Inverts a mat2
101
+ *
102
+ * @param out the receiving matrix
103
+ * @param a the source matrix
104
+ * @returns out, or null if source matrix is not invertible
105
+ */
106
+ function invert(out, a) {
107
+ const a0 = a[0];
108
+ const a1 = a[1];
109
+ const a2 = a[2];
110
+ const a3 = a[3];
111
+ // Calculate the determinant
112
+ let det = a0 * a3 - a2 * a1;
113
+ if (!det) {
114
+ return null;
115
+ }
116
+ det = 1.0 / det;
117
+ out[0] = a3 * det;
118
+ out[1] = -a1 * det;
119
+ out[2] = -a2 * det;
120
+ out[3] = a0 * det;
121
+ return out;
122
+ }
123
+ /**
124
+ * Calculates the adjugate of a mat2
125
+ *
126
+ * @param out the receiving matrix
127
+ * @param a the source matrix
128
+ * @returns out
129
+ */
130
+ function adjoint(out, a) {
131
+ // Caching this value is necessary if out == a
132
+ const a0 = a[0];
133
+ out[0] = a[3];
134
+ out[1] = -a[1];
135
+ out[2] = -a[2];
136
+ out[3] = a0;
137
+ return out;
138
+ }
139
+ /**
140
+ * Calculates the determinant of a mat2
141
+ *
142
+ * @param a the source matrix
143
+ * @returns determinant of a
144
+ */
145
+ function determinant(a) {
146
+ return a[0] * a[3] - a[2] * a[1];
147
+ }
148
+ /**
149
+ * Multiplies two mat2's
150
+ *
151
+ * @param out the receiving matrix
152
+ * @param a the first operand
153
+ * @param b the second operand
154
+ * @returns out
155
+ */
156
+ function multiply(out, a, b) {
157
+ const a0 = a[0];
158
+ const a1 = a[1];
159
+ const a2 = a[2];
160
+ const a3 = a[3];
161
+ const b0 = b[0];
162
+ const b1 = b[1];
163
+ const b2 = b[2];
164
+ const b3 = b[3];
165
+ out[0] = a0 * b0 + a2 * b1;
166
+ out[1] = a1 * b0 + a3 * b1;
167
+ out[2] = a0 * b2 + a2 * b3;
168
+ out[3] = a1 * b2 + a3 * b3;
169
+ return out;
170
+ }
171
+ /**
172
+ * Rotates a mat2 by the given angle
173
+ *
174
+ * @param out the receiving matrix
175
+ * @param a the matrix to rotate
176
+ * @param rad the angle to rotate the matrix by
177
+ * @returns out
178
+ */
179
+ function rotate(out, a, rad) {
180
+ const a0 = a[0];
181
+ const a1 = a[1];
182
+ const a2 = a[2];
183
+ const a3 = a[3];
184
+ const s = Math.sin(rad);
185
+ const c = Math.cos(rad);
186
+ out[0] = a0 * c + a2 * s;
187
+ out[1] = a1 * c + a3 * s;
188
+ out[2] = a0 * -s + a2 * c;
189
+ out[3] = a1 * -s + a3 * c;
190
+ return out;
191
+ }
192
+ /**
193
+ * Scales the mat2 by the dimensions in the given vec2
194
+ *
195
+ * @param out the receiving matrix
196
+ * @param a the matrix to rotate
197
+ * @param v the vec2 to scale the matrix by
198
+ * @returns out
199
+ **/
200
+ function scale(out, a, v) {
201
+ const a0 = a[0];
202
+ const a1 = a[1];
203
+ const a2 = a[2];
204
+ const a3 = a[3];
205
+ const v0 = v[0];
206
+ const v1 = v[1];
207
+ out[0] = a0 * v0;
208
+ out[1] = a1 * v0;
209
+ out[2] = a2 * v1;
210
+ out[3] = a3 * v1;
211
+ return out;
212
+ }
213
+ /**
214
+ * Creates a matrix from a given angle
215
+ * This is equivalent to (but much faster than):
216
+ *
217
+ * mat2.identity(dest);
218
+ * mat2.rotate(dest, dest, rad);
219
+ *
220
+ * @param out mat2 receiving operation result
221
+ * @param rad the angle to rotate the matrix by
222
+ * @returns out
223
+ */
224
+ function fromRotation(out, rad) {
225
+ const s = Math.sin(rad);
226
+ const c = Math.cos(rad);
227
+ out[0] = c;
228
+ out[1] = s;
229
+ out[2] = -s;
230
+ out[3] = c;
231
+ return out;
232
+ }
233
+ /**
234
+ * Creates a matrix from a vector scaling
235
+ * This is equivalent to (but much faster than):
236
+ *
237
+ * mat2.identity(dest);
238
+ * mat2.scale(dest, dest, vec);
239
+ *
240
+ * @param out mat2 receiving operation result
241
+ * @param v Scaling vector
242
+ * @returns out
243
+ */
244
+ function fromScaling(out, v) {
245
+ out[0] = v[0];
246
+ out[1] = 0;
247
+ out[2] = 0;
248
+ out[3] = v[1];
249
+ return out;
250
+ }
251
+ /**
252
+ * Returns a string representation of a mat2
253
+ *
254
+ * @param a matrix to represent as a string
255
+ * @returns string representation of the matrix
256
+ */
257
+ function str(a) {
258
+ return `mat2(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;
259
+ }
260
+ /**
261
+ * Returns Frobenius norm of a mat2
262
+ *
263
+ * @param a the matrix to calculate Frobenius norm of
264
+ * @returns Frobenius norm
265
+ */
266
+ function frob(a) {
267
+ return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);
268
+ }
269
+ /**
270
+ * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
271
+ * @param L the lower triangular matrix
272
+ * @param D the diagonal matrix
273
+ * @param U the upper triangular matrix
274
+ * @param a the input matrix to factorize
275
+ */
276
+ function LDU(L, D, U, a) {
277
+ L[2] = a[2] / a[0];
278
+ U[0] = a[0];
279
+ U[1] = a[1];
280
+ U[3] = a[3] - L[2] * U[1];
281
+ return [L, D, U];
282
+ }
283
+ /**
284
+ * Adds two mat2's
285
+ *
286
+ * @param out the receiving matrix
287
+ * @param a the first operand
288
+ * @param b the second operand
289
+ * @returns out
290
+ */
291
+ function add(out, a, b) {
292
+ out[0] = a[0] + b[0];
293
+ out[1] = a[1] + b[1];
294
+ out[2] = a[2] + b[2];
295
+ out[3] = a[3] + b[3];
296
+ return out;
297
+ }
298
+ /**
299
+ * Subtracts matrix b from matrix a
300
+ *
301
+ * @param out the receiving matrix
302
+ * @param a the first operand
303
+ * @param b the second operand
304
+ * @returns out
305
+ */
306
+ function subtract(out, a, b) {
307
+ out[0] = a[0] - b[0];
308
+ out[1] = a[1] - b[1];
309
+ out[2] = a[2] - b[2];
310
+ out[3] = a[3] - b[3];
311
+ return out;
312
+ }
313
+ /**
314
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
315
+ *
316
+ * @param a The first matrix.
317
+ * @param b The second matrix.
318
+ * @returns True if the matrices are equal, false otherwise.
319
+ */
320
+ function exactEquals(a, b) {
321
+ return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
322
+ }
323
+ /**
324
+ * Returns whether or not the matrices have approximately the same elements in the same position.
325
+ *
326
+ * @param a The first matrix.
327
+ * @param b The second matrix.
328
+ * @returns True if the matrices are equal, false otherwise.
329
+ */
330
+ function equals(a, b) {
331
+ const a0 = a[0];
332
+ const a1 = a[1];
333
+ const a2 = a[2];
334
+ const a3 = a[3];
335
+ const b0 = b[0];
336
+ const b1 = b[1];
337
+ const b2 = b[2];
338
+ const b3 = b[3];
339
+ return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
340
+ Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
341
+ Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&
342
+ Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)));
343
+ }
344
+ /**
345
+ * Multiply each element of the matrix by a scalar.
346
+ *
347
+ * @param out the receiving matrix
348
+ * @param a the matrix to scale
349
+ * @param b amount to scale the matrix's elements by
350
+ * @returns out
351
+ */
352
+ function multiplyScalar(out, a, b) {
353
+ out[0] = a[0] * b;
354
+ out[1] = a[1] * b;
355
+ out[2] = a[2] * b;
356
+ out[3] = a[3] * b;
357
+ return out;
358
+ }
359
+ /**
360
+ * Adds two mat2's after multiplying each element of the second operand by a scalar value.
361
+ *
362
+ * @param out the receiving vector
363
+ * @param a the first operand
364
+ * @param b the second operand
365
+ * @param scale the amount to scale b's elements by before adding
366
+ * @returns out
367
+ */
368
+ function multiplyScalarAndAdd(out, a, b, scale) {
369
+ out[0] = a[0] + b[0] * scale;
370
+ out[1] = a[1] + b[1] * scale;
371
+ out[2] = a[2] + b[2] * scale;
372
+ out[3] = a[3] + b[3] * scale;
373
+ return out;
374
+ }
375
+ /**
376
+ * Alias for {@link mat2.multiply}
377
+ */
378
+ const mul = multiply;
379
+ /**
380
+ * Alias for {@link mat2.subtract}
381
+ */
382
+ const sub = subtract;
383
+
384
+ export { LDU, add, adjoint, clone, copy, create, determinant, equals, exactEquals, frob, fromRotation, fromScaling, fromValues, identity, invert, mul, multiply, multiplyScalar, multiplyScalarAndAdd, rotate, scale, set, str, sub, subtract, transpose };
385
+ //# sourceMappingURL=mat2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mat2.js","sources":["../../src/core/mat2.ts"],"sourcesContent":["import { EPSILON } from './scalar';\nimport type { Vec2 } from './vec2';\n\n/** A 2x2 matrix */\nexport type Mat2 = [e1: number, e2: number, e3: number, e4: number];\n\n/**\n * Creates a new identity mat2\n *\n * @returns a new 2x2 matrix\n */\nexport function create(): Mat2 {\n return [1, 0, 0, 1];\n}\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param a matrix to clone\n * @returns a new 2x2 matrix\n */\nexport function clone(a: Mat2): Mat2 {\n return [a[0], a[1], a[2], a[3]];\n}\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param out the receiving matrix\n * @param a the source matrix\n * @returns out\n */\nexport function copy(out: Mat2, a: Mat2): Mat2 {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param out the receiving matrix\n * @returns out\n */\nexport function identity(out: Mat2): Mat2 {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n\n/**\n * Create a new mat2 with the given values\n *\n * @param m00 Component in column 0, row 0 position (index 0)\n * @param m01 Component in column 0, row 1 position (index 1)\n * @param m10 Component in column 1, row 0 position (index 2)\n * @param m11 Component in column 1, row 1 position (index 3)\n * @returns out A new 2x2 matrix\n */\nexport function fromValues(m00: number, m01: number, m10: number, m11: number): Mat2 {\n return [m00, m01, m10, m11];\n}\n\n/**\n * Set the components of a mat2 to the given values\n *\n * @param out the receiving matrix\n * @param m00 Component in column 0, row 0 position (index 0)\n * @param m01 Component in column 0, row 1 position (index 1)\n * @param m10 Component in column 1, row 0 position (index 2)\n * @param m11 Component in column 1, row 1 position (index 3)\n * @returns out\n */\nexport function set(out: Mat2, m00: number, m01: number, m10: number, m11: number): Mat2 {\n out[0] = m00;\n out[1] = m01;\n out[2] = m10;\n out[3] = m11;\n return out;\n}\n\n/**\n * Transpose the values of a mat2\n *\n * @param out the receiving matrix\n * @param a the source matrix\n * @returns out\n */\nexport function transpose(out: Mat2, a: Mat2): Mat2 {\n // If we are transposing ourselves we can skip a few steps but have to cache\n // some values\n if (out === a) {\n const a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n}\n\n/**\n * Inverts a mat2\n *\n * @param out the receiving matrix\n * @param a the source matrix\n * @returns out, or null if source matrix is not invertible\n */\nexport function invert(out: Mat2, a: Mat2): Mat2 | null {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n\n // Calculate the determinant\n let det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n}\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param out the receiving matrix\n * @param a the source matrix\n * @returns out\n */\nexport function adjoint(out: Mat2, a: Mat2): Mat2 {\n // Caching this value is necessary if out == a\n const a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n}\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param a the source matrix\n * @returns determinant of a\n */\nexport function determinant(a: Mat2): number {\n return a[0] * a[3] - a[2] * a[1];\n}\n\n/**\n * Multiplies two mat2's\n *\n * @param out the receiving matrix\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function multiply(out: Mat2, a: Mat2, b: Mat2): Mat2 {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n}\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param out the receiving matrix\n * @param a the matrix to rotate\n * @param rad the angle to rotate the matrix by\n * @returns out\n */\nexport function rotate(out: Mat2, a: Mat2, rad: number): Mat2 {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n}\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param out the receiving matrix\n * @param a the matrix to rotate\n * @param v the vec2 to scale the matrix by\n * @returns out\n **/\nexport function scale(out: Mat2, a: Mat2, v: Vec2): Mat2 {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n}\n\n/**\n * Creates a matrix from a given angle\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.rotate(dest, dest, rad);\n *\n * @param out mat2 receiving operation result\n * @param rad the angle to rotate the matrix by\n * @returns out\n */\nexport function fromRotation(out: Mat2, rad: number): Mat2 {\n const s = Math.sin(rad);\n const c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = -s;\n out[3] = c;\n return out;\n}\n\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat2.identity(dest);\n * mat2.scale(dest, dest, vec);\n *\n * @param out mat2 receiving operation result\n * @param v Scaling vector\n * @returns out\n */\nexport function fromScaling(out: Mat2, v: Vec2): Mat2 {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2\n *\n * @param a matrix to represent as a string\n * @returns string representation of the matrix\n */\nexport function str(a: Mat2): string {\n return `mat2(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;\n}\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param a the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\nexport function frob(a: Mat2): number {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3]);\n}\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param L the lower triangular matrix\n * @param D the diagonal matrix\n * @param U the upper triangular matrix\n * @param a the input matrix to factorize\n */\n\nexport function LDU(L: Mat2, D: Mat2, U: Mat2, a: Mat2): [Mat2, Mat2, Mat2] {\n L[2] = a[2] / a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n}\n\n/**\n * Adds two mat2's\n *\n * @param out the receiving matrix\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function add(out: Mat2, a: Mat2, b: Mat2): Mat2 {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n\n/**\n * Subtracts matrix b from matrix a\n *\n * @param out the receiving matrix\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function subtract(out: Mat2, a: Mat2, b: Mat2): Mat2 {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param a The first matrix.\n * @param b The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\nexport function exactEquals(a: Mat2, b: Mat2): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param a The first matrix.\n * @param b The second matrix.\n * @returns True if the matrices are equal, false otherwise.\n */\nexport function equals(a: Mat2, b: Mat2): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n return (\n Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&\n Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3))\n );\n}\n\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param out the receiving matrix\n * @param a the matrix to scale\n * @param b amount to scale the matrix's elements by\n * @returns out\n */\nexport function multiplyScalar(out: Mat2, a: Mat2, b: number): Mat2 {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n\n/**\n * Adds two mat2's after multiplying each element of the second operand by a scalar value.\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param scale the amount to scale b's elements by before adding\n * @returns out\n */\nexport function multiplyScalarAndAdd(out: Mat2, a: Mat2, b: Mat2, scale: number): Mat2 {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n\n/**\n * Alias for {@link mat2.multiply}\n */\nexport const mul = multiply;\n\n/**\n * Alias for {@link mat2.subtract}\n */\nexport const sub = subtract;\n"],"names":[],"mappings":";;AAMA;;;;AAIG;SACa,MAAM,GAAA;IAClB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACvB;AAEA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,CAAO,EAAA;IACzB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC;AAEA;;;;;;AAMG;AACG,SAAU,IAAI,CAAC,GAAS,EAAE,CAAO,EAAA;IACnC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACb,IAAA,OAAO,GAAG;AACd;AAEA;;;;;AAKG;AACG,SAAU,QAAQ,CAAC,GAAS,EAAA;AAC9B,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACV,IAAA,OAAO,GAAG;AACd;AAEA;;;;;;;;AAQG;AACG,SAAU,UAAU,CAAC,GAAW,EAAE,GAAW,EAAE,GAAW,EAAE,GAAW,EAAA;IACzE,OAAO,CAAC,GAAG,EAA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