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,422 @@
1
+ import { EPSILON } from './scalar.js';
2
+
3
+ /**
4
+ * Creates a new identity mat2d
5
+ *
6
+ * @returns a new 2x3 matrix
7
+ */
8
+ function create() {
9
+ return [1, 0, 0, 1, 0, 0];
10
+ }
11
+ /**
12
+ * Creates a new mat2d initialized with values from an existing matrix
13
+ *
14
+ * @param a matrix to clone
15
+ * @returns a new 2x3 matrix
16
+ */
17
+ function clone(a) {
18
+ return [a[0], a[1], a[2], a[3], a[4], a[5]];
19
+ }
20
+ /**
21
+ * Copy the values from one mat2d 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
+ out[4] = a[4];
33
+ out[5] = a[5];
34
+ return out;
35
+ }
36
+ /**
37
+ * Set a mat2d to the identity matrix
38
+ *
39
+ * @param out the receiving matrix
40
+ * @returns out
41
+ */
42
+ function identity(out) {
43
+ out[0] = 1;
44
+ out[1] = 0;
45
+ out[2] = 0;
46
+ out[3] = 1;
47
+ out[4] = 0;
48
+ out[5] = 0;
49
+ return out;
50
+ }
51
+ /**
52
+ * Create a new mat2d with the given values
53
+ *
54
+ * @param a Component A (index 0)
55
+ * @param b Component B (index 1)
56
+ * @param c Component C (index 2)
57
+ * @param d Component D (index 3)
58
+ * @param tx Component TX (index 4)
59
+ * @param ty Component TY (index 5)
60
+ * @returns A new mat2d
61
+ */
62
+ function fromValues(a, b, c, d, tx, ty) {
63
+ return [a, b, c, d, tx, ty];
64
+ }
65
+ /**
66
+ * Set the components of a mat2d to the given values
67
+ *
68
+ * @param out the receiving matrix
69
+ * @param a Component A (index 0)
70
+ * @param b Component B (index 1)
71
+ * @param c Component C (index 2)
72
+ * @param d Component D (index 3)
73
+ * @param tx Component TX (index 4)
74
+ * @param ty Component TY (index 5)
75
+ * @returns out
76
+ */
77
+ function set(out, a, b, c, d, tx, ty) {
78
+ out[0] = a;
79
+ out[1] = b;
80
+ out[2] = c;
81
+ out[3] = d;
82
+ out[4] = tx;
83
+ out[5] = ty;
84
+ return out;
85
+ }
86
+ /**
87
+ * Inverts a mat2d
88
+ *
89
+ * @param out the receiving matrix
90
+ * @param a the source matrix
91
+ * @returns out, or null if source matrix is not invertible
92
+ */
93
+ function invert(out, a) {
94
+ const aa = a[0];
95
+ const ab = a[1];
96
+ const ac = a[2];
97
+ const ad = a[3];
98
+ const atx = a[4];
99
+ const aty = a[5];
100
+ let det = aa * ad - ab * ac;
101
+ if (!det) {
102
+ return null;
103
+ }
104
+ det = 1.0 / det;
105
+ out[0] = ad * det;
106
+ out[1] = -ab * det;
107
+ out[2] = -ac * det;
108
+ out[3] = aa * det;
109
+ out[4] = (ac * aty - ad * atx) * det;
110
+ out[5] = (ab * atx - aa * aty) * det;
111
+ return out;
112
+ }
113
+ /**
114
+ * Calculates the determinant of a mat2d
115
+ *
116
+ * @param a the source matrix
117
+ * @returns determinant of a
118
+ */
119
+ function determinant(a) {
120
+ return a[0] * a[3] - a[1] * a[2];
121
+ }
122
+ /**
123
+ * Multiplies two mat2d's
124
+ *
125
+ * @param out the receiving matrix
126
+ * @param a the first operand
127
+ * @param b the second operand
128
+ * @returns out
129
+ */
130
+ function multiply(out, a, b) {
131
+ const a0 = a[0];
132
+ const a1 = a[1];
133
+ const a2 = a[2];
134
+ const a3 = a[3];
135
+ const a4 = a[4];
136
+ const a5 = a[5];
137
+ const b0 = b[0];
138
+ const b1 = b[1];
139
+ const b2 = b[2];
140
+ const b3 = b[3];
141
+ const b4 = b[4];
142
+ const b5 = b[5];
143
+ out[0] = a0 * b0 + a2 * b1;
144
+ out[1] = a1 * b0 + a3 * b1;
145
+ out[2] = a0 * b2 + a2 * b3;
146
+ out[3] = a1 * b2 + a3 * b3;
147
+ out[4] = a0 * b4 + a2 * b5 + a4;
148
+ out[5] = a1 * b4 + a3 * b5 + a5;
149
+ return out;
150
+ }
151
+ /**
152
+ * Rotates a mat2d by the given angle
153
+ *
154
+ * @param out the receiving matrix
155
+ * @param a the matrix to rotate
156
+ * @param rad the angle to rotate the matrix by
157
+ * @returns out
158
+ */
159
+ function rotate(out, a, rad) {
160
+ const a0 = a[0];
161
+ const a1 = a[1];
162
+ const a2 = a[2];
163
+ const a3 = a[3];
164
+ const a4 = a[4];
165
+ const a5 = a[5];
166
+ const s = Math.sin(rad);
167
+ const c = Math.cos(rad);
168
+ out[0] = a0 * c + a2 * s;
169
+ out[1] = a1 * c + a3 * s;
170
+ out[2] = a0 * -s + a2 * c;
171
+ out[3] = a1 * -s + a3 * c;
172
+ out[4] = a4;
173
+ out[5] = a5;
174
+ return out;
175
+ }
176
+ /**
177
+ * Scales the mat2d by the dimensions in the given vec2
178
+ *
179
+ * @param out the receiving matrix
180
+ * @param a the matrix to translate
181
+ * @param v the vec2 to scale the matrix by
182
+ * @returns out
183
+ **/
184
+ function scale(out, a, v) {
185
+ const a0 = a[0];
186
+ const a1 = a[1];
187
+ const a2 = a[2];
188
+ const a3 = a[3];
189
+ const a4 = a[4];
190
+ const a5 = a[5];
191
+ const v0 = v[0];
192
+ const v1 = v[1];
193
+ out[0] = a0 * v0;
194
+ out[1] = a1 * v0;
195
+ out[2] = a2 * v1;
196
+ out[3] = a3 * v1;
197
+ out[4] = a4;
198
+ out[5] = a5;
199
+ return out;
200
+ }
201
+ /**
202
+ * Translates the mat2d by the dimensions in the given vec2
203
+ *
204
+ * @param out the receiving matrix
205
+ * @param a the matrix to translate
206
+ * @param v the vec2 to translate the matrix by
207
+ * @returns out
208
+ **/
209
+ function translate(out, a, v) {
210
+ const a0 = a[0];
211
+ const a1 = a[1];
212
+ const a2 = a[2];
213
+ const a3 = a[3];
214
+ const a4 = a[4];
215
+ const a5 = a[5];
216
+ const v0 = v[0];
217
+ const v1 = v[1];
218
+ out[0] = a0;
219
+ out[1] = a1;
220
+ out[2] = a2;
221
+ out[3] = a3;
222
+ out[4] = a0 * v0 + a2 * v1 + a4;
223
+ out[5] = a1 * v0 + a3 * v1 + a5;
224
+ return out;
225
+ }
226
+ /**
227
+ * Creates a matrix from a given angle
228
+ * This is equivalent to (but much faster than):
229
+ *
230
+ * mat2d.identity(dest);
231
+ * mat2d.rotate(dest, dest, rad);
232
+ *
233
+ * @param out mat2d receiving operation result
234
+ * @param rad the angle to rotate the matrix by
235
+ * @returns out
236
+ */
237
+ function fromRotation(out, rad) {
238
+ const s = Math.sin(rad);
239
+ const c = Math.cos(rad);
240
+ out[0] = c;
241
+ out[1] = s;
242
+ out[2] = -s;
243
+ out[3] = c;
244
+ out[4] = 0;
245
+ out[5] = 0;
246
+ return out;
247
+ }
248
+ /**
249
+ * Creates a matrix from a vector scaling
250
+ * This is equivalent to (but much faster than):
251
+ *
252
+ * mat2d.identity(dest);
253
+ * mat2d.scale(dest, dest, vec);
254
+ *
255
+ * @param out mat2d receiving operation result
256
+ * @param v Scaling vector
257
+ * @returns out
258
+ */
259
+ function fromScaling(out, v) {
260
+ out[0] = v[0];
261
+ out[1] = 0;
262
+ out[2] = 0;
263
+ out[3] = v[1];
264
+ out[4] = 0;
265
+ out[5] = 0;
266
+ return out;
267
+ }
268
+ /**
269
+ * Creates a matrix from a vector translation
270
+ * This is equivalent to (but much faster than):
271
+ *
272
+ * mat2d.identity(dest);
273
+ * mat2d.translate(dest, dest, vec);
274
+ *
275
+ * @param out mat2d receiving operation result
276
+ * @param v Translation vector
277
+ * @returns out
278
+ */
279
+ function fromTranslation(out, v) {
280
+ out[0] = 1;
281
+ out[1] = 0;
282
+ out[2] = 0;
283
+ out[3] = 1;
284
+ out[4] = v[0];
285
+ out[5] = v[1];
286
+ return out;
287
+ }
288
+ /**
289
+ * Returns a string representation of a mat2d
290
+ *
291
+ * @param a matrix to represent as a string
292
+ * @returns string representation of the matrix
293
+ */
294
+ function str(a) {
295
+ return `mat2d(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]})`;
296
+ }
297
+ /**
298
+ * Returns Frobenius norm of a mat2d
299
+ *
300
+ * @param a the matrix to calculate Frobenius norm of
301
+ * @returns Frobenius norm
302
+ */
303
+ function frob(a) {
304
+ return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);
305
+ }
306
+ /**
307
+ * Adds two mat2d's
308
+ *
309
+ * @param out the receiving matrix
310
+ * @param a the first operand
311
+ * @param b the second operand
312
+ * @returns out
313
+ */
314
+ function add(out, a, b) {
315
+ out[0] = a[0] + b[0];
316
+ out[1] = a[1] + b[1];
317
+ out[2] = a[2] + b[2];
318
+ out[3] = a[3] + b[3];
319
+ out[4] = a[4] + b[4];
320
+ out[5] = a[5] + b[5];
321
+ return out;
322
+ }
323
+ /**
324
+ * Subtracts matrix b from matrix a
325
+ *
326
+ * @param out the receiving matrix
327
+ * @param a the first operand
328
+ * @param b the second operand
329
+ * @returns out
330
+ */
331
+ function subtract(out, a, b) {
332
+ out[0] = a[0] - b[0];
333
+ out[1] = a[1] - b[1];
334
+ out[2] = a[2] - b[2];
335
+ out[3] = a[3] - b[3];
336
+ out[4] = a[4] - b[4];
337
+ out[5] = a[5] - b[5];
338
+ return out;
339
+ }
340
+ /**
341
+ * Multiply each element of the matrix by a scalar.
342
+ *
343
+ * @param out the receiving matrix
344
+ * @param a the matrix to scale
345
+ * @param b amount to scale the matrix's elements by
346
+ * @returns out
347
+ */
348
+ function multiplyScalar(out, a, b) {
349
+ out[0] = a[0] * b;
350
+ out[1] = a[1] * b;
351
+ out[2] = a[2] * b;
352
+ out[3] = a[3] * b;
353
+ out[4] = a[4] * b;
354
+ out[5] = a[5] * b;
355
+ return out;
356
+ }
357
+ /**
358
+ * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
359
+ *
360
+ * @param out the receiving vector
361
+ * @param a the first operand
362
+ * @param b the second operand
363
+ * @param scale the amount to scale b's elements by before adding
364
+ * @returns out
365
+ */
366
+ function multiplyScalarAndAdd(out, a, b, scale) {
367
+ out[0] = a[0] + b[0] * scale;
368
+ out[1] = a[1] + b[1] * scale;
369
+ out[2] = a[2] + b[2] * scale;
370
+ out[3] = a[3] + b[3] * scale;
371
+ out[4] = a[4] + b[4] * scale;
372
+ out[5] = a[5] + b[5] * scale;
373
+ return out;
374
+ }
375
+ /**
376
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
377
+ *
378
+ * @param a The first matrix.
379
+ * @param b The second matrix.
380
+ * @returns True if the matrices are equal, false otherwise.
381
+ */
382
+ function exactEquals(a, b) {
383
+ 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];
384
+ }
385
+ /**
386
+ * Returns whether or not the matrices have approximately the same elements in the same position.
387
+ *
388
+ * @param a The first matrix.
389
+ * @param b The second matrix.
390
+ * @returns True if the matrices are equal, false otherwise.
391
+ */
392
+ function equals(a, b) {
393
+ const a0 = a[0];
394
+ const a1 = a[1];
395
+ const a2 = a[2];
396
+ const a3 = a[3];
397
+ const a4 = a[4];
398
+ const a5 = a[5];
399
+ const b0 = b[0];
400
+ const b1 = b[1];
401
+ const b2 = b[2];
402
+ const b3 = b[3];
403
+ const b4 = b[4];
404
+ const b5 = b[5];
405
+ return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
406
+ Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
407
+ Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&
408
+ Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) &&
409
+ Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&
410
+ Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)));
411
+ }
412
+ /**
413
+ * Alias for {@link mat2d.multiply}
414
+ */
415
+ const mul = multiply;
416
+ /**
417
+ * Alias for {@link mat2d.subtract}
418
+ */
419
+ const sub = subtract;
420
+
421
+ export { add, clone, copy, create, determinant, equals, exactEquals, frob, fromRotation, fromScaling, fromTranslation, fromValues, identity, invert, mul, multiply, multiplyScalar, multiplyScalarAndAdd, rotate, scale, set, str, sub, subtract, translate };
422
+ //# sourceMappingURL=mat2d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mat2d.js","sources":["../../src/core/mat2d.ts"],"sourcesContent":["import { EPSILON } from './scalar';\nimport type { Vec2 } from './vec2';\n\n/** A 2D affine transform matrix */\nexport type Mat2d = [e1: number, e2: number, e3: number, e4: number, e5: number, e6: number];\n\n/**\n * Creates a new identity mat2d\n *\n * @returns a new 2x3 matrix\n */\nexport function create(): Mat2d {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param a matrix to clone\n * @returns a new 2x3 matrix\n */\nexport function clone(a: Mat2d): Mat2d {\n return [a[0], a[1], a[2], a[3], a[4], a[5]];\n}\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param out the receiving matrix\n * @param a the source matrix\n * @returns out\n */\nexport function copy(out: Mat2d, a: Mat2d): Mat2d {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n}\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param out the receiving matrix\n * @returns out\n */\nexport function identity(out: Mat2d): Mat2d {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Create a new mat2d with the given values\n *\n * @param a Component A (index 0)\n * @param b Component B (index 1)\n * @param c Component C (index 2)\n * @param d Component D (index 3)\n * @param tx Component TX (index 4)\n * @param ty Component TY (index 5)\n * @returns A new mat2d\n */\nexport function fromValues(a: number, b: number, c: number, d: number, tx: number, ty: number): Mat2d {\n return [a, b, c, d, tx, ty];\n}\n\n/**\n * Set the components of a mat2d to the given values\n *\n * @param out the receiving matrix\n * @param a Component A (index 0)\n * @param b Component B (index 1)\n * @param c Component C (index 2)\n * @param d Component D (index 3)\n * @param tx Component TX (index 4)\n * @param ty Component TY (index 5)\n * @returns out\n */\nexport function set(out: Mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): Mat2d {\n out[0] = a;\n out[1] = b;\n out[2] = c;\n out[3] = d;\n out[4] = tx;\n out[5] = ty;\n return out;\n}\n\n/**\n * Inverts a mat2d\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: Mat2d, a: Mat2d): Mat2d | null {\n const aa = a[0];\n const ab = a[1];\n const ac = a[2];\n const ad = a[3];\n const atx = a[4];\n const aty = a[5];\n\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param a the source matrix\n * @returns determinant of a\n */\nexport function determinant(a: Mat2d): number {\n return a[0] * a[3] - a[1] * a[2];\n}\n\n/**\n * Multiplies two mat2d'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: Mat2d, a: Mat2d, b: Mat2d): Mat2d {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\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 out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n}\n\n/**\n * Rotates a mat2d 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: Mat2d, a: Mat2d, rad: number): Mat2d {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\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 out[4] = a4;\n out[5] = a5;\n return out;\n}\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param out the receiving matrix\n * @param a the matrix to translate\n * @param v the vec2 to scale the matrix by\n * @returns out\n **/\nexport function scale(out: Mat2d, a: Mat2d, v: Vec2): Mat2d {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\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 out[4] = a4;\n out[5] = a5;\n return out;\n}\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param out the receiving matrix\n * @param a the matrix to translate\n * @param v the vec2 to translate the matrix by\n * @returns out\n **/\nexport function translate(out: Mat2d, a: Mat2d, v: Vec2): Mat2d {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const v0 = v[0];\n const v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\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 * mat2d.identity(dest);\n * mat2d.rotate(dest, dest, rad);\n *\n * @param out mat2d receiving operation result\n * @param rad the angle to rotate the matrix by\n * @returns out\n */\nexport function fromRotation(out: Mat2d, rad: number): Mat2d {\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 out[4] = 0;\n out[5] = 0;\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 * mat2d.identity(dest);\n * mat2d.scale(dest, dest, vec);\n *\n * @param out mat2d receiving operation result\n * @param v Scaling vector\n * @returns out\n */\nexport function fromScaling(out: Mat2d, v: Vec2): Mat2d {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = v[1];\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat2d.identity(dest);\n * mat2d.translate(dest, dest, vec);\n *\n * @param out mat2d receiving operation result\n * @param v Translation vector\n * @returns out\n */\nexport function fromTranslation(out: Mat2d, v: Vec2): Mat2d {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = v[0];\n out[5] = v[1];\n return out;\n}\n\n/**\n * Returns a string representation of a mat2d\n *\n * @param a matrix to represent as a string\n * @returns string representation of the matrix\n */\nexport function str(a: Mat2d): string {\n return `mat2d(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]}, ${a[4]}, ${a[5]})`;\n}\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param a the matrix to calculate Frobenius norm of\n * @returns Frobenius norm\n */\nexport function frob(a: Mat2d): number {\n return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + 1);\n}\n\n/**\n * Adds two mat2d'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: Mat2d, a: Mat2d, b: Mat2d): Mat2d {\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 out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\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: Mat2d, a: Mat2d, b: Mat2d): Mat2d {\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 out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n return out;\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: Mat2d, a: Mat2d, b: number): Mat2d {\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 out[4] = a[4] * b;\n out[5] = a[5] * b;\n return out;\n}\n\n/**\n * Adds two mat2d'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: Mat2d, a: Mat2d, b: Mat2d, scale: number): Mat2d {\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 out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\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: Mat2d, b: Mat2d): boolean {\n 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];\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: Mat2d, b: Mat2d): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const a3 = a[3];\n const a4 = a[4];\n const a5 = a[5];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n const b3 = b[3];\n const b4 = b[4];\n const b5 = b[5];\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 Math.abs(a4 - b4) <= EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) &&\n Math.abs(a5 - b5) <= EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5))\n );\n}\n\n/**\n * Alias for {@link mat2d.multiply}\n */\nexport const mul = multiply;\n\n/**\n * Alias for {@link mat2d.subtract}\n */\nexport const sub = subtract;\n"],"names":[],"mappings":";;AAMA;;;;AAIG;SACa,MAAM,GAAA;AAClB,IAAA,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7B;AAEA;;;;;AAKG;AACG,SAAU,KAAK,CAAC,CAAQ,EAAA;AAC1B,IAAA,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C;AAEA;;;;;;AAMG;AACG,SAAU,IAAI,CAAC,GAAU,EAAE,CAAQ,EAAA;IACrC,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,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