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.
Files changed (201) 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 -12
  199. package/skills/math/SKILL.md +140 -0
  200. package/math.coffee +0 -36
  201. package/math.js +0 -67
@@ -0,0 +1,217 @@
1
+ import type { Vec2 } from './vec2.js';
2
+ /** A 2x2 matrix */
3
+ export type Mat2 = [e1: number, e2: number, e3: number, e4: number];
4
+ /**
5
+ * Creates a new identity mat2
6
+ *
7
+ * @returns a new 2x2 matrix
8
+ */
9
+ export declare function create(): Mat2;
10
+ /**
11
+ * Creates a new mat2 initialized with values from an existing matrix
12
+ *
13
+ * @param a matrix to clone
14
+ * @returns a new 2x2 matrix
15
+ */
16
+ export declare function clone(a: Mat2): Mat2;
17
+ /**
18
+ * Copy the values from one mat2 to another
19
+ *
20
+ * @param out the receiving matrix
21
+ * @param a the source matrix
22
+ * @returns out
23
+ */
24
+ export declare function copy(out: Mat2, a: Mat2): Mat2;
25
+ /**
26
+ * Set a mat2 to the identity matrix
27
+ *
28
+ * @param out the receiving matrix
29
+ * @returns out
30
+ */
31
+ export declare function identity(out: Mat2): Mat2;
32
+ /**
33
+ * Create a new mat2 with the given values
34
+ *
35
+ * @param m00 Component in column 0, row 0 position (index 0)
36
+ * @param m01 Component in column 0, row 1 position (index 1)
37
+ * @param m10 Component in column 1, row 0 position (index 2)
38
+ * @param m11 Component in column 1, row 1 position (index 3)
39
+ * @returns out A new 2x2 matrix
40
+ */
41
+ export declare function fromValues(m00: number, m01: number, m10: number, m11: number): Mat2;
42
+ /**
43
+ * Set the components of a mat2 to the given values
44
+ *
45
+ * @param out the receiving matrix
46
+ * @param m00 Component in column 0, row 0 position (index 0)
47
+ * @param m01 Component in column 0, row 1 position (index 1)
48
+ * @param m10 Component in column 1, row 0 position (index 2)
49
+ * @param m11 Component in column 1, row 1 position (index 3)
50
+ * @returns out
51
+ */
52
+ export declare function set(out: Mat2, m00: number, m01: number, m10: number, m11: number): Mat2;
53
+ /**
54
+ * Transpose the values of a mat2
55
+ *
56
+ * @param out the receiving matrix
57
+ * @param a the source matrix
58
+ * @returns out
59
+ */
60
+ export declare function transpose(out: Mat2, a: Mat2): Mat2;
61
+ /**
62
+ * Inverts a mat2
63
+ *
64
+ * @param out the receiving matrix
65
+ * @param a the source matrix
66
+ * @returns out, or null if source matrix is not invertible
67
+ */
68
+ export declare function invert(out: Mat2, a: Mat2): Mat2 | null;
69
+ /**
70
+ * Calculates the adjugate of a mat2
71
+ *
72
+ * @param out the receiving matrix
73
+ * @param a the source matrix
74
+ * @returns out
75
+ */
76
+ export declare function adjoint(out: Mat2, a: Mat2): Mat2;
77
+ /**
78
+ * Calculates the determinant of a mat2
79
+ *
80
+ * @param a the source matrix
81
+ * @returns determinant of a
82
+ */
83
+ export declare function determinant(a: Mat2): number;
84
+ /**
85
+ * Multiplies two mat2's
86
+ *
87
+ * @param out the receiving matrix
88
+ * @param a the first operand
89
+ * @param b the second operand
90
+ * @returns out
91
+ */
92
+ export declare function multiply(out: Mat2, a: Mat2, b: Mat2): Mat2;
93
+ /**
94
+ * Rotates a mat2 by the given angle
95
+ *
96
+ * @param out the receiving matrix
97
+ * @param a the matrix to rotate
98
+ * @param rad the angle to rotate the matrix by
99
+ * @returns out
100
+ */
101
+ export declare function rotate(out: Mat2, a: Mat2, rad: number): Mat2;
102
+ /**
103
+ * Scales the mat2 by the dimensions in the given vec2
104
+ *
105
+ * @param out the receiving matrix
106
+ * @param a the matrix to rotate
107
+ * @param v the vec2 to scale the matrix by
108
+ * @returns out
109
+ **/
110
+ export declare function scale(out: Mat2, a: Mat2, v: Vec2): Mat2;
111
+ /**
112
+ * Creates a matrix from a given angle
113
+ * This is equivalent to (but much faster than):
114
+ *
115
+ * mat2.identity(dest);
116
+ * mat2.rotate(dest, dest, rad);
117
+ *
118
+ * @param out mat2 receiving operation result
119
+ * @param rad the angle to rotate the matrix by
120
+ * @returns out
121
+ */
122
+ export declare function fromRotation(out: Mat2, rad: number): Mat2;
123
+ /**
124
+ * Creates a matrix from a vector scaling
125
+ * This is equivalent to (but much faster than):
126
+ *
127
+ * mat2.identity(dest);
128
+ * mat2.scale(dest, dest, vec);
129
+ *
130
+ * @param out mat2 receiving operation result
131
+ * @param v Scaling vector
132
+ * @returns out
133
+ */
134
+ export declare function fromScaling(out: Mat2, v: Vec2): Mat2;
135
+ /**
136
+ * Returns a string representation of a mat2
137
+ *
138
+ * @param a matrix to represent as a string
139
+ * @returns string representation of the matrix
140
+ */
141
+ export declare function str(a: Mat2): string;
142
+ /**
143
+ * Returns Frobenius norm of a mat2
144
+ *
145
+ * @param a the matrix to calculate Frobenius norm of
146
+ * @returns Frobenius norm
147
+ */
148
+ export declare function frob(a: Mat2): number;
149
+ /**
150
+ * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
151
+ * @param L the lower triangular matrix
152
+ * @param D the diagonal matrix
153
+ * @param U the upper triangular matrix
154
+ * @param a the input matrix to factorize
155
+ */
156
+ export declare function LDU(L: Mat2, D: Mat2, U: Mat2, a: Mat2): [Mat2, Mat2, Mat2];
157
+ /**
158
+ * Adds two mat2's
159
+ *
160
+ * @param out the receiving matrix
161
+ * @param a the first operand
162
+ * @param b the second operand
163
+ * @returns out
164
+ */
165
+ export declare function add(out: Mat2, a: Mat2, b: Mat2): Mat2;
166
+ /**
167
+ * Subtracts matrix b from matrix a
168
+ *
169
+ * @param out the receiving matrix
170
+ * @param a the first operand
171
+ * @param b the second operand
172
+ * @returns out
173
+ */
174
+ export declare function subtract(out: Mat2, a: Mat2, b: Mat2): Mat2;
175
+ /**
176
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
177
+ *
178
+ * @param a The first matrix.
179
+ * @param b The second matrix.
180
+ * @returns True if the matrices are equal, false otherwise.
181
+ */
182
+ export declare function exactEquals(a: Mat2, b: Mat2): boolean;
183
+ /**
184
+ * Returns whether or not the matrices have approximately the same elements in the same position.
185
+ *
186
+ * @param a The first matrix.
187
+ * @param b The second matrix.
188
+ * @returns True if the matrices are equal, false otherwise.
189
+ */
190
+ export declare function equals(a: Mat2, b: Mat2): boolean;
191
+ /**
192
+ * Multiply each element of the matrix by a scalar.
193
+ *
194
+ * @param out the receiving matrix
195
+ * @param a the matrix to scale
196
+ * @param b amount to scale the matrix's elements by
197
+ * @returns out
198
+ */
199
+ export declare function multiplyScalar(out: Mat2, a: Mat2, b: number): Mat2;
200
+ /**
201
+ * Adds two mat2's after multiplying each element of the second operand by a scalar value.
202
+ *
203
+ * @param out the receiving vector
204
+ * @param a the first operand
205
+ * @param b the second operand
206
+ * @param scale the amount to scale b's elements by before adding
207
+ * @returns out
208
+ */
209
+ export declare function multiplyScalarAndAdd(out: Mat2, a: Mat2, b: Mat2, scale: number): Mat2;
210
+ /**
211
+ * Alias for {@link mat2.multiply}
212
+ */
213
+ export declare const mul: typeof multiply;
214
+ /**
215
+ * Alias for {@link mat2.subtract}
216
+ */
217
+ export declare const sub: typeof subtract;
@@ -0,0 +1,218 @@
1
+ import type { Vec2 } from './vec2.js';
2
+ /** A 2D affine transform matrix */
3
+ export type Mat2d = [e1: number, e2: number, e3: number, e4: number, e5: number, e6: number];
4
+ /**
5
+ * Creates a new identity mat2d
6
+ *
7
+ * @returns a new 2x3 matrix
8
+ */
9
+ export declare function create(): Mat2d;
10
+ /**
11
+ * Creates a new mat2d initialized with values from an existing matrix
12
+ *
13
+ * @param a matrix to clone
14
+ * @returns a new 2x3 matrix
15
+ */
16
+ export declare function clone(a: Mat2d): Mat2d;
17
+ /**
18
+ * Copy the values from one mat2d to another
19
+ *
20
+ * @param out the receiving matrix
21
+ * @param a the source matrix
22
+ * @returns out
23
+ */
24
+ export declare function copy(out: Mat2d, a: Mat2d): Mat2d;
25
+ /**
26
+ * Set a mat2d to the identity matrix
27
+ *
28
+ * @param out the receiving matrix
29
+ * @returns out
30
+ */
31
+ export declare function identity(out: Mat2d): Mat2d;
32
+ /**
33
+ * Create a new mat2d with the given values
34
+ *
35
+ * @param a Component A (index 0)
36
+ * @param b Component B (index 1)
37
+ * @param c Component C (index 2)
38
+ * @param d Component D (index 3)
39
+ * @param tx Component TX (index 4)
40
+ * @param ty Component TY (index 5)
41
+ * @returns A new mat2d
42
+ */
43
+ export declare function fromValues(a: number, b: number, c: number, d: number, tx: number, ty: number): Mat2d;
44
+ /**
45
+ * Set the components of a mat2d to the given values
46
+ *
47
+ * @param out the receiving matrix
48
+ * @param a Component A (index 0)
49
+ * @param b Component B (index 1)
50
+ * @param c Component C (index 2)
51
+ * @param d Component D (index 3)
52
+ * @param tx Component TX (index 4)
53
+ * @param ty Component TY (index 5)
54
+ * @returns out
55
+ */
56
+ export declare function set(out: Mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): Mat2d;
57
+ /**
58
+ * Inverts a mat2d
59
+ *
60
+ * @param out the receiving matrix
61
+ * @param a the source matrix
62
+ * @returns out, or null if source matrix is not invertible
63
+ */
64
+ export declare function invert(out: Mat2d, a: Mat2d): Mat2d | null;
65
+ /**
66
+ * Calculates the determinant of a mat2d
67
+ *
68
+ * @param a the source matrix
69
+ * @returns determinant of a
70
+ */
71
+ export declare function determinant(a: Mat2d): number;
72
+ /**
73
+ * Multiplies two mat2d's
74
+ *
75
+ * @param out the receiving matrix
76
+ * @param a the first operand
77
+ * @param b the second operand
78
+ * @returns out
79
+ */
80
+ export declare function multiply(out: Mat2d, a: Mat2d, b: Mat2d): Mat2d;
81
+ /**
82
+ * Rotates a mat2d by the given angle
83
+ *
84
+ * @param out the receiving matrix
85
+ * @param a the matrix to rotate
86
+ * @param rad the angle to rotate the matrix by
87
+ * @returns out
88
+ */
89
+ export declare function rotate(out: Mat2d, a: Mat2d, rad: number): Mat2d;
90
+ /**
91
+ * Scales the mat2d by the dimensions in the given vec2
92
+ *
93
+ * @param out the receiving matrix
94
+ * @param a the matrix to translate
95
+ * @param v the vec2 to scale the matrix by
96
+ * @returns out
97
+ **/
98
+ export declare function scale(out: Mat2d, a: Mat2d, v: Vec2): Mat2d;
99
+ /**
100
+ * Translates the mat2d by the dimensions in the given vec2
101
+ *
102
+ * @param out the receiving matrix
103
+ * @param a the matrix to translate
104
+ * @param v the vec2 to translate the matrix by
105
+ * @returns out
106
+ **/
107
+ export declare function translate(out: Mat2d, a: Mat2d, v: Vec2): Mat2d;
108
+ /**
109
+ * Creates a matrix from a given angle
110
+ * This is equivalent to (but much faster than):
111
+ *
112
+ * mat2d.identity(dest);
113
+ * mat2d.rotate(dest, dest, rad);
114
+ *
115
+ * @param out mat2d receiving operation result
116
+ * @param rad the angle to rotate the matrix by
117
+ * @returns out
118
+ */
119
+ export declare function fromRotation(out: Mat2d, rad: number): Mat2d;
120
+ /**
121
+ * Creates a matrix from a vector scaling
122
+ * This is equivalent to (but much faster than):
123
+ *
124
+ * mat2d.identity(dest);
125
+ * mat2d.scale(dest, dest, vec);
126
+ *
127
+ * @param out mat2d receiving operation result
128
+ * @param v Scaling vector
129
+ * @returns out
130
+ */
131
+ export declare function fromScaling(out: Mat2d, v: Vec2): Mat2d;
132
+ /**
133
+ * Creates a matrix from a vector translation
134
+ * This is equivalent to (but much faster than):
135
+ *
136
+ * mat2d.identity(dest);
137
+ * mat2d.translate(dest, dest, vec);
138
+ *
139
+ * @param out mat2d receiving operation result
140
+ * @param v Translation vector
141
+ * @returns out
142
+ */
143
+ export declare function fromTranslation(out: Mat2d, v: Vec2): Mat2d;
144
+ /**
145
+ * Returns a string representation of a mat2d
146
+ *
147
+ * @param a matrix to represent as a string
148
+ * @returns string representation of the matrix
149
+ */
150
+ export declare function str(a: Mat2d): string;
151
+ /**
152
+ * Returns Frobenius norm of a mat2d
153
+ *
154
+ * @param a the matrix to calculate Frobenius norm of
155
+ * @returns Frobenius norm
156
+ */
157
+ export declare function frob(a: Mat2d): number;
158
+ /**
159
+ * Adds two mat2d's
160
+ *
161
+ * @param out the receiving matrix
162
+ * @param a the first operand
163
+ * @param b the second operand
164
+ * @returns out
165
+ */
166
+ export declare function add(out: Mat2d, a: Mat2d, b: Mat2d): Mat2d;
167
+ /**
168
+ * Subtracts matrix b from matrix a
169
+ *
170
+ * @param out the receiving matrix
171
+ * @param a the first operand
172
+ * @param b the second operand
173
+ * @returns out
174
+ */
175
+ export declare function subtract(out: Mat2d, a: Mat2d, b: Mat2d): Mat2d;
176
+ /**
177
+ * Multiply each element of the matrix by a scalar.
178
+ *
179
+ * @param out the receiving matrix
180
+ * @param a the matrix to scale
181
+ * @param b amount to scale the matrix's elements by
182
+ * @returns out
183
+ */
184
+ export declare function multiplyScalar(out: Mat2d, a: Mat2d, b: number): Mat2d;
185
+ /**
186
+ * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
187
+ *
188
+ * @param out the receiving vector
189
+ * @param a the first operand
190
+ * @param b the second operand
191
+ * @param scale the amount to scale b's elements by before adding
192
+ * @returns out
193
+ */
194
+ export declare function multiplyScalarAndAdd(out: Mat2d, a: Mat2d, b: Mat2d, scale: number): Mat2d;
195
+ /**
196
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
197
+ *
198
+ * @param a The first matrix.
199
+ * @param b The second matrix.
200
+ * @returns True if the matrices are equal, false otherwise.
201
+ */
202
+ export declare function exactEquals(a: Mat2d, b: Mat2d): boolean;
203
+ /**
204
+ * Returns whether or not the matrices have approximately the same elements in the same position.
205
+ *
206
+ * @param a The first matrix.
207
+ * @param b The second matrix.
208
+ * @returns True if the matrices are equal, false otherwise.
209
+ */
210
+ export declare function equals(a: Mat2d, b: Mat2d): boolean;
211
+ /**
212
+ * Alias for {@link mat2d.multiply}
213
+ */
214
+ export declare const mul: typeof multiply;
215
+ /**
216
+ * Alias for {@link mat2d.subtract}
217
+ */
218
+ export declare const sub: typeof subtract;