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,667 @@
1
+ import type { Quat } from './quat.js';
2
+ import type { Quat2 } from './quat2.js';
3
+ import type { Vec3 } from './vec3.js';
4
+ /** A 4x4 matrix */
5
+ export type Mat4 = [
6
+ e1: number,
7
+ e2: number,
8
+ e3: number,
9
+ e4: number,
10
+ e5: number,
11
+ e6: number,
12
+ e7: number,
13
+ e8: number,
14
+ e9: number,
15
+ e10: number,
16
+ e11: number,
17
+ e12: number,
18
+ e13: number,
19
+ e14: number,
20
+ e15: number,
21
+ e16: number
22
+ ];
23
+ /**
24
+ * Creates a new identity mat4
25
+ *
26
+ * @returns a new 4x4 matrix
27
+ */
28
+ export declare function create(): Mat4;
29
+ /**
30
+ * Creates a new mat4 initialized with values from an existing matrix
31
+ *
32
+ * @param a matrix to clone
33
+ * @returns a new 4x4 matrix
34
+ */
35
+ export declare function clone(a: Mat4): Mat4;
36
+ /**
37
+ * Copy the values from one mat4 to another
38
+ *
39
+ * @param out the receiving matrix
40
+ * @param a the source matrix
41
+ * @returns out
42
+ */
43
+ export declare function copy(out: Mat4, a: Mat4): Mat4;
44
+ /**
45
+ * Create a new mat4 with the given values
46
+ *
47
+ * @param m00 Component in column 0, row 0 position (index 0)
48
+ * @param m01 Component in column 0, row 1 position (index 1)
49
+ * @param m02 Component in column 0, row 2 position (index 2)
50
+ * @param m03 Component in column 0, row 3 position (index 3)
51
+ * @param m10 Component in column 1, row 0 position (index 4)
52
+ * @param m11 Component in column 1, row 1 position (index 5)
53
+ * @param m12 Component in column 1, row 2 position (index 6)
54
+ * @param m13 Component in column 1, row 3 position (index 7)
55
+ * @param m20 Component in column 2, row 0 position (index 8)
56
+ * @param m21 Component in column 2, row 1 position (index 9)
57
+ * @param m22 Component in column 2, row 2 position (index 10)
58
+ * @param m23 Component in column 2, row 3 position (index 11)
59
+ * @param m30 Component in column 3, row 0 position (index 12)
60
+ * @param m31 Component in column 3, row 1 position (index 13)
61
+ * @param m32 Component in column 3, row 2 position (index 14)
62
+ * @param m33 Component in column 3, row 3 position (index 15)
63
+ * @returns A new mat4
64
+ */
65
+ export declare function fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Mat4;
66
+ /**
67
+ * Set the components of a mat4 to the given values
68
+ *
69
+ * @param out the receiving matrix
70
+ * @param m00 Component in column 0, row 0 position (index 0)
71
+ * @param m01 Component in column 0, row 1 position (index 1)
72
+ * @param m02 Component in column 0, row 2 position (index 2)
73
+ * @param m03 Component in column 0, row 3 position (index 3)
74
+ * @param m10 Component in column 1, row 0 position (index 4)
75
+ * @param m11 Component in column 1, row 1 position (index 5)
76
+ * @param m12 Component in column 1, row 2 position (index 6)
77
+ * @param m13 Component in column 1, row 3 position (index 7)
78
+ * @param m20 Component in column 2, row 0 position (index 8)
79
+ * @param m21 Component in column 2, row 1 position (index 9)
80
+ * @param m22 Component in column 2, row 2 position (index 10)
81
+ * @param m23 Component in column 2, row 3 position (index 11)
82
+ * @param m30 Component in column 3, row 0 position (index 12)
83
+ * @param m31 Component in column 3, row 1 position (index 13)
84
+ * @param m32 Component in column 3, row 2 position (index 14)
85
+ * @param m33 Component in column 3, row 3 position (index 15)
86
+ * @returns out
87
+ */
88
+ export declare function set(out: Mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Mat4;
89
+ /**
90
+ * Set a mat4 to the identity matrix
91
+ *
92
+ * @param out the receiving matrix
93
+ * @returns out
94
+ */
95
+ export declare function identity(out: Mat4): Mat4;
96
+ /**
97
+ * Set a mat4 to the zero matrix
98
+ *
99
+ * @param out the receiving matrix
100
+ * @returns out
101
+ */
102
+ export declare function zero(out: Mat4): Mat4;
103
+ /**
104
+ * Transpose the values of a mat4
105
+ *
106
+ * @param out the receiving matrix
107
+ * @param a the source matrix
108
+ * @returns out
109
+ */
110
+ export declare function transpose(out: Mat4, a: Mat4): Mat4;
111
+ /**
112
+ * Inverts a mat4
113
+ *
114
+ * @param out the receiving matrix
115
+ * @param a the source matrix
116
+ * @returns out, or null if source matrix is not invertible
117
+ */
118
+ export declare function invert(out: Mat4, a: Mat4): Mat4 | null;
119
+ /**
120
+ * Inverts only the 3x3 rotation part of a mat4.
121
+ * Sets the translation column and bottom row to [0, 0, 0, 1].
122
+ * Equivalent to Jolt's Mat44::Inversed3x3()
123
+ *
124
+ * @param out the receiving matrix
125
+ * @param a the source matrix
126
+ * @returns out, or null if the 3x3 part is not invertible
127
+ */
128
+ export declare function invert3x3(out: Mat4, a: Mat4): Mat4 | null;
129
+ /**
130
+ * Calculates the adjugate of a mat4
131
+ *
132
+ * @param out the receiving matrix
133
+ * @param a the source matrix
134
+ * @returns out
135
+ */
136
+ export declare function adjoint(out: Mat4, a: Mat4): Mat4;
137
+ /**
138
+ * Calculates the determinant of a mat4
139
+ *
140
+ * @param a the source matrix
141
+ * @returns determinant of a
142
+ */
143
+ export declare function determinant(a: Mat4): number;
144
+ /**
145
+ * Multiplies two mat4s
146
+ *
147
+ * @param out the receiving matrix
148
+ * @param a the first operand
149
+ * @param b the second operand
150
+ * @returns out
151
+ */
152
+ export declare function multiply(out: Mat4, a: Mat4, b: Mat4): Mat4;
153
+ /**
154
+ * Multiplies two mat4s treating them as 3x3 rotation matrices.
155
+ * Only computes the upper-left 3x3 portion, sets the 4th column to [0,0,0,1].
156
+ * More efficient than full mat4.multiply when working with pure rotations.
157
+ *
158
+ * @param out the receiving matrix
159
+ * @param a the first operand
160
+ * @param b the second operand
161
+ * @returns out
162
+ */
163
+ export declare function multiply3x3(out: Mat4, a: Mat4, b: Mat4): Mat4;
164
+ /**
165
+ * Multiplies a mat4 by the transpose of another mat4,
166
+ * treating both as 3x3 rotation matrices.
167
+ * Computes: out = a * transpose(b) (3x3 only)
168
+ * Sets the 4th column to [0,0,0,1].
169
+ *
170
+ * @param out the receiving matrix
171
+ * @param a the first operand
172
+ * @param b the second operand (will be transposed)
173
+ * @returns out
174
+ */
175
+ export declare function multiply3x3RightTransposed(out: Mat4, a: Mat4, b: Mat4): Mat4;
176
+ /**
177
+ * Transform a Vec3 by the transpose of the 3x3 rotation part.
178
+ *
179
+ * @param out the receiving vector
180
+ * @param mat the matrix to transform with
181
+ * @param vec the vector to transform
182
+ * @returns out
183
+ */
184
+ export declare function multiply3x3TransposedVec(out: Vec3, mat: Mat4, vec: Vec3): Vec3;
185
+ /**
186
+ * Transform a Vec3 by only the 3x3 rotation part of a Mat4.
187
+ *
188
+ * @param out the receiving vector
189
+ * @param mat the matrix to transform with
190
+ * @param vec the vector to transform
191
+ * @returns out
192
+ */
193
+ export declare function multiply3x3Vec(out: Vec3, mat: Mat4, vec: Vec3): Vec3;
194
+ /**
195
+ * Cross product matrix (skew-symmetric matrix).
196
+ * Equivalent to Jolt's Mat44::sCrossProduct(Vec3Arg)
197
+ *
198
+ * @param out the receiving matrix
199
+ * @param v the vector to create the cross product matrix from
200
+ * @returns out
201
+ */
202
+ export declare function crossProductMatrix(out: Mat4, v: Vec3): Mat4;
203
+ /**
204
+ * Translate a mat4 by the given vector
205
+ *
206
+ * @param out the receiving matrix
207
+ * @param a the matrix to translate
208
+ * @param v vector to translate by
209
+ * @returns out
210
+ */
211
+ export declare function translate(out: Mat4, a: Mat4, v: Vec3): Mat4;
212
+ /**
213
+ * Scales the mat4 by the dimensions in the given vec3 not using vectorization
214
+ *
215
+ * @param out the receiving matrix
216
+ * @param a the matrix to scale
217
+ * @param v the vec3 to scale the matrix by
218
+ * @returns out
219
+ **/
220
+ export declare function scale(out: Mat4, a: Mat4, v: Vec3): Mat4;
221
+ /**
222
+ * Rotates a mat4 by the given angle around the given axis
223
+ *
224
+ * @param out the receiving matrix
225
+ * @param a the matrix to rotate
226
+ * @param rad the angle to rotate the matrix by
227
+ * @param axis the axis to rotate around
228
+ * @returns out
229
+ */
230
+ export declare function rotate(out: Mat4, a: Mat4, rad: number, axis: Vec3): Mat4 | null;
231
+ /**
232
+ * Rotates a matrix by the given angle around the X axis
233
+ *
234
+ * @param out the receiving matrix
235
+ * @param a the matrix to rotate
236
+ * @param rad the angle to rotate the matrix by
237
+ * @returns out
238
+ */
239
+ export declare function rotateX(out: Mat4, a: Mat4, rad: number): Mat4;
240
+ /**
241
+ * Rotates a matrix by the given angle around the Y axis
242
+ *
243
+ * @param out the receiving matrix
244
+ * @param a the matrix to rotate
245
+ * @param rad the angle to rotate the matrix by
246
+ * @returns out
247
+ */
248
+ export declare function rotateY(out: Mat4, a: Mat4, rad: number): Mat4;
249
+ /**
250
+ * Rotates a matrix by the given angle around the Z axis
251
+ *
252
+ * @param out the receiving matrix
253
+ * @param a the matrix to rotate
254
+ * @param rad the angle to rotate the matrix by
255
+ * @returns out
256
+ */
257
+ export declare function rotateZ(out: Mat4, a: Mat4, rad: number): Mat4;
258
+ /**
259
+ * Creates a matrix from a vector translation
260
+ * This is equivalent to (but much faster than):
261
+ *
262
+ * mat4.identity(dest);
263
+ * mat4.translate(dest, dest, vec);
264
+ *
265
+ * @param out mat4 receiving operation result
266
+ * @param v Translation vector
267
+ * @returns out
268
+ */
269
+ export declare function fromTranslation(out: Mat4, v: Vec3): Mat4;
270
+ /**
271
+ * Creates a matrix from a vector scaling
272
+ * This is equivalent to (but much faster than):
273
+ *
274
+ * mat4.identity(dest);
275
+ * mat4.scale(dest, dest, vec);
276
+ *
277
+ * @param out mat4 receiving operation result
278
+ * @param v Scaling vector
279
+ * @returns out
280
+ */
281
+ export declare function fromScaling(out: Mat4, v: Vec3): Mat4;
282
+ /**
283
+ * Creates a matrix from a given angle around a given axis
284
+ * This is equivalent to (but much faster than):
285
+ *
286
+ * mat4.identity(dest);
287
+ * mat4.rotate(dest, dest, rad, axis);
288
+ *
289
+ * @param out mat4 receiving operation result
290
+ * @param rad the angle to rotate the matrix by
291
+ * @param axis the axis to rotate around
292
+ * @returns out
293
+ */
294
+ export declare function fromRotation(out: Mat4, rad: number, axis: Vec3): Mat4 | null;
295
+ /**
296
+ * Creates a matrix from the given angle around the X axis
297
+ * This is equivalent to (but much faster than):
298
+ *
299
+ * mat4.identity(dest);
300
+ * mat4.rotateX(dest, dest, rad);
301
+ *
302
+ * @param out mat4 receiving operation result
303
+ * @param rad the angle to rotate the matrix by
304
+ * @returns out
305
+ */
306
+ export declare function fromXRotation(out: Mat4, rad: number): Mat4;
307
+ /**
308
+ * Creates a matrix from the given angle around the Y axis
309
+ * This is equivalent to (but much faster than):
310
+ *
311
+ * mat4.identity(dest);
312
+ * mat4.rotateY(dest, dest, rad);
313
+ *
314
+ * @param out mat4 receiving operation result
315
+ * @param rad the angle to rotate the matrix by
316
+ * @returns out
317
+ */
318
+ export declare function fromYRotation(out: Mat4, rad: number): Mat4;
319
+ /**
320
+ * Creates a matrix from the given angle around the Z axis
321
+ * This is equivalent to (but much faster than):
322
+ *
323
+ * mat4.identity(dest);
324
+ * mat4.rotateZ(dest, dest, rad);
325
+ *
326
+ * @param out mat4 receiving operation result
327
+ * @param rad the angle to rotate the matrix by
328
+ * @returns out
329
+ */
330
+ export declare function fromZRotation(out: Mat4, rad: number): Mat4;
331
+ /**
332
+ * Creates a matrix from a quaternion rotation and vector translation
333
+ * This is equivalent to (but much faster than):
334
+ *
335
+ * mat4.identity(dest);
336
+ * mat4.translate(dest, dest, vec);
337
+ * let quatMat = mat4.create();
338
+ * mat4.fromQuat(quatMat, quat);
339
+ * mat4.multiply(dest, dest, quatMat);
340
+ *
341
+ * @param out mat4 receiving operation result
342
+ * @param q Rotation quaternion
343
+ * @param v Translation vector
344
+ * @returns out
345
+ */
346
+ export declare function fromRotationTranslation(out: Mat4, q: Quat | Quat2, v: Vec3): Mat4;
347
+ /**
348
+ * Creates a new mat4 from a dual quat.
349
+ *
350
+ * @param out Matrix
351
+ * @param a Dual Quaternion
352
+ * @returns mat4 receiving operation result
353
+ */
354
+ export declare function fromQuat2(out: Mat4, a: Quat2): Mat4;
355
+ /**
356
+ * Returns the translation vector component of a transformation
357
+ * matrix. If a matrix is built with fromRotationTranslation,
358
+ * the returned vector will be the same as the translation vector
359
+ * originally supplied.
360
+ * @param out Vector to receive translation component
361
+ * @param mat Matrix to be decomposed (input)
362
+ * @return out
363
+ */
364
+ export declare function getTranslation(out: Vec3, mat: Mat4): Vec3;
365
+ /**
366
+ * Returns the scaling factor component of a transformation
367
+ * matrix. If a matrix is built with fromRotationTranslationScale
368
+ * with a normalized Quaternion parameter, the returned vector will be
369
+ * the same as the scaling vector
370
+ * originally supplied.
371
+ * @param out Vector to receive scaling factor component
372
+ * @param mat Matrix to be decomposed (input)
373
+ * @return out
374
+ */
375
+ export declare function getScaling(out: Vec3, mat: Mat4): Vec3;
376
+ /**
377
+ * Returns a quaternion representing the rotational component
378
+ * of a transformation matrix. If a matrix is built with
379
+ * fromRotationTranslation, the returned quaternion will be the
380
+ * same as the quaternion originally supplied.
381
+ * @param out Quaternion to receive the rotation component
382
+ * @param mat Matrix to be decomposed (input)
383
+ * @return out
384
+ */
385
+ export declare function getRotation(out: Quat, mat: Mat4): Quat;
386
+ /**
387
+ * Decomposes a transformation matrix into its rotation, translation
388
+ * and scale components. Returns only the rotation component
389
+ * @param out_r Quaternion to receive the rotation component
390
+ * @param out_t Vector to receive the translation vector
391
+ * @param out_s Vector to receive the scaling factor
392
+ * @param mat Matrix to be decomposed (input)
393
+ * @returns out_r
394
+ */
395
+ export declare function decompose(out_r: Quat, out_t: Vec3, out_s: Vec3, mat: Mat4): Quat;
396
+ /**
397
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale
398
+ * This is equivalent to (but much faster than):
399
+ *
400
+ * mat4.identity(dest);
401
+ * mat4.translate(dest, dest, vec);
402
+ * let quatMat = mat4.create();
403
+ * mat4.fromQuat(quatMat, quat);
404
+ * mat4.multiply(dest, dest, quatMat);
405
+ * mat4.scale(dest, dest, scale)
406
+ *
407
+ * @param out mat4 receiving operation result
408
+ * @param q Rotation quaternion
409
+ * @param v Translation vector
410
+ * @param s Scaling vector
411
+ * @returns out
412
+ */
413
+ export declare function fromRotationTranslationScale(out: Mat4, q: Quat, v: Vec3, s: Vec3): Mat4;
414
+ /**
415
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
416
+ * This is equivalent to (but much faster than):
417
+ *
418
+ * mat4.identity(dest);
419
+ * mat4.translate(dest, dest, vec);
420
+ * mat4.translate(dest, dest, origin);
421
+ * let quatMat = mat4.create();
422
+ * mat4.fromQuat(quatMat, quat);
423
+ * mat4.multiply(dest, dest, quatMat);
424
+ * mat4.scale(dest, dest, scale)
425
+ * mat4.translate(dest, dest, negativeOrigin);
426
+ *
427
+ * @param out mat4 receiving operation result
428
+ * @param q Rotation quaternion
429
+ * @param v Translation vector
430
+ * @param s Scaling vector
431
+ * @param o The origin vector around which to scale and rotate
432
+ * @returns out
433
+ */
434
+ export declare function fromRotationTranslationScaleOrigin(out: Mat4, q: Quat, v: Vec3, s: Vec3, o: Vec3): Mat4;
435
+ /**
436
+ * Calculates a 4x4 matrix from the given quaternion
437
+ *
438
+ * @param out mat4 receiving operation result
439
+ * @param q Quaternion to create matrix from
440
+ *
441
+ * @returns out
442
+ */
443
+ export declare function fromQuat(out: Mat4, q: Quat): Mat4;
444
+ /**
445
+ * Generates a frustum matrix with the given bounds.
446
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
447
+ * which matches WebGL/OpenGL's clip volume.
448
+ *
449
+ * @param out mat4 frustum matrix will be written into
450
+ * @param left Left bound of the frustum
451
+ * @param right Right bound of the frustum
452
+ * @param bottom Bottom bound of the frustum
453
+ * @param top Top bound of the frustum
454
+ * @param near Near bound of the frustum
455
+ * @param far Far bound of the frustum
456
+ * @returns out
457
+ */
458
+ export declare function frustumNO(out: Mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
459
+ /**
460
+ * Generates a frustum matrix with the given bounds, suitable for WebGPU.
461
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
462
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
463
+ *
464
+ * @param out mat4 frustum matrix will be written into
465
+ * @param left Left bound of the frustum
466
+ * @param right Right bound of the frustum
467
+ * @param bottom Bottom bound of the frustum
468
+ * @param top Top bound of the frustum
469
+ * @param near Near bound of the frustum
470
+ * @param far Far bound of the frustum
471
+ * @returns out
472
+ */
473
+ export declare function frustumZO(out: Mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
474
+ /**
475
+ * Generates a perspective projection matrix with the given bounds.
476
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
477
+ * which matches WebGL/OpenGL's clip volume.
478
+ * Passing null/undefined/no value for far will generate infinite projection matrix.
479
+ *
480
+ * @param out mat4 frustum matrix will be written into
481
+ * @param fovy Vertical field of view in radians
482
+ * @param aspect Aspect ratio. typically viewport width/height
483
+ * @param near Near bound of the frustum
484
+ * @param far Far bound of the frustum, can be null or Infinity
485
+ * @returns out
486
+ */
487
+ export declare function perspectiveNO(out: Mat4, fovy: number, aspect: number, near: number, far: number): Mat4;
488
+ /**
489
+ * Generates a perspective projection matrix suitable for WebGPU with the given bounds.
490
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
491
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
492
+ * Passing null/undefined/no value for far will generate infinite projection matrix.
493
+ *
494
+ * @param out mat4 frustum matrix will be written into
495
+ * @param fovy Vertical field of view in radians
496
+ * @param aspect Aspect ratio. typically viewport width/height
497
+ * @param near Near bound of the frustum
498
+ * @param far Far bound of the frustum, can be null or Infinity
499
+ * @returns out
500
+ */
501
+ export declare function perspectiveZO(out: Mat4, fovy: number, aspect: number, near: number, far: number): Mat4;
502
+ /**
503
+ * Generates a perspective projection matrix with the given field of view.
504
+ * This is primarily useful for generating projection matrices to be used
505
+ * with the still experimental WebVR API.
506
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
507
+ * which matches WebGL/OpenGL's clip volume.
508
+ *
509
+ * @param out mat4 frustum matrix will be written into
510
+ * @param fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
511
+ * @param near Near bound of the frustum
512
+ * @param far Far bound of the frustum
513
+ * @returns out
514
+ */
515
+ export declare function perspectiveFromFieldOfViewNO(out: Mat4, fov: {
516
+ upDegrees: number;
517
+ downDegrees: number;
518
+ leftDegrees: number;
519
+ rightDegrees: number;
520
+ }, near: number, far: number): Mat4;
521
+ /**
522
+ * Generates a perspective projection matrix with the given field of view, suitable for WebGPU.
523
+ * This is primarily useful for generating projection matrices to be used
524
+ * with the still experimental WebVR API.
525
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
526
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
527
+ *
528
+ * @param out mat4 frustum matrix will be written into
529
+ * @param fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
530
+ * @param near Near bound of the frustum
531
+ * @param far Far bound of the frustum
532
+ * @returns out
533
+ */
534
+ export declare function perspectiveFromFieldOfViewZO(out: Mat4, fov: {
535
+ upDegrees: number;
536
+ downDegrees: number;
537
+ leftDegrees: number;
538
+ rightDegrees: number;
539
+ }, near: number, far: number): Mat4;
540
+ /**
541
+ * Generates a orthogonal projection matrix with the given bounds.
542
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
543
+ * which matches WebGL/OpenGL's clip volume.
544
+ *
545
+ * @param out mat4 frustum matrix will be written into
546
+ * @param left Left bound of the frustum
547
+ * @param right Right bound of the frustum
548
+ * @param bottom Bottom bound of the frustum
549
+ * @param top Top bound of the frustum
550
+ * @param near Near bound of the frustum
551
+ * @param far Far bound of the frustum
552
+ * @returns out
553
+ */
554
+ export declare function orthoNO(out: Mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
555
+ /**
556
+ * Generates a orthogonal projection matrix with the given bounds.
557
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
558
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
559
+ *
560
+ * @param out mat4 frustum matrix will be written into
561
+ * @param left Left bound of the frustum
562
+ * @param right Right bound of the frustum
563
+ * @param bottom Bottom bound of the frustum
564
+ * @param top Top bound of the frustum
565
+ * @param near Near bound of the frustum
566
+ * @param far Far bound of the frustum
567
+ * @returns out
568
+ */
569
+ export declare function orthoZO(out: Mat4, left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
570
+ /**
571
+ * Generates a look-at matrix with the given eye position, focal point, and up axis.
572
+ * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.
573
+ *
574
+ * @param out mat4 frustum matrix will be written into
575
+ * @param eye Position of the viewer
576
+ * @param center Point the viewer is looking at
577
+ * @param up vec3 pointing up
578
+ * @returns out
579
+ */
580
+ export declare function lookAt(out: Mat4, eye: Vec3, center: Vec3, up: Vec3): Mat4;
581
+ /**
582
+ * Generates a matrix that makes something look at something else.
583
+ *
584
+ * @param out mat4 frustum matrix will be written into
585
+ * @param eye Position of the viewer
586
+ * @param target Point the viewer is looking at
587
+ * @param up vec3 pointing up
588
+ * @returns out
589
+ */
590
+ export declare function targetTo(out: Mat4, eye: Vec3, target: Vec3, up: Vec3): Mat4;
591
+ /**
592
+ * Returns a string representation of a mat4
593
+ *
594
+ * @param a matrix to represent as a string
595
+ * @returns {String} string representation of the matrix
596
+ */
597
+ export declare function str(a: Mat4): string;
598
+ /**
599
+ * Returns Frobenius norm of a mat4
600
+ *
601
+ * @param a the matrix to calculate Frobenius norm of
602
+ * @returns Frobenius norm
603
+ */
604
+ export declare function frob(a: Mat4): number;
605
+ /**
606
+ * Adds two mat4's
607
+ *
608
+ * @param out the receiving matrix
609
+ * @param a the first operand
610
+ * @param b the second operand
611
+ * @returns out
612
+ */
613
+ export declare function add(out: Mat4, a: Mat4, b: Mat4): Mat4;
614
+ /**
615
+ * Subtracts matrix b from matrix a
616
+ *
617
+ * @param out the receiving matrix
618
+ * @param a the first operand
619
+ * @param b the second operand
620
+ * @returns out
621
+ */
622
+ export declare function subtract(out: Mat4, a: Mat4, b: Mat4): Mat4;
623
+ /**
624
+ * Multiply each element of the matrix by a scalar.
625
+ *
626
+ * @param out the receiving matrix
627
+ * @param a the matrix to scale
628
+ * @param b amount to scale the matrix's elements by
629
+ * @returns out
630
+ */
631
+ export declare function multiplyScalar(out: Mat4, a: Mat4, b: number): Mat4;
632
+ /**
633
+ * Adds two mat4's after multiplying each element of the second operand by a scalar value.
634
+ *
635
+ * @param out the receiving vector
636
+ * @param a the first operand
637
+ * @param b the second operand
638
+ * @param scale the amount to scale b's elements by before adding
639
+ * @returns out
640
+ */
641
+ export declare function multiplyScalarAndAdd(out: Mat4, a: Mat4, b: Mat4, scale: number): Mat4;
642
+ /**
643
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
644
+ *
645
+ * @param a The first matrix.
646
+ * @param b The second matrix.
647
+ * @returns {Boolean} True if the matrices are equal, false otherwise.
648
+ */
649
+ export declare function exactEquals(a: Mat4, b: Mat4): boolean;
650
+ /**
651
+ * Returns whether or not the matrices have approximately the same elements in the same position.
652
+ *
653
+ * @param a The first matrix.
654
+ * @param b The second matrix.
655
+ * @returns {Boolean} True if the matrices are equal, false otherwise.
656
+ */
657
+ export declare function equals(a: Mat4, b: Mat4): boolean;
658
+ /**
659
+ * Alias for {@link mat4.multiply}
660
+ * @function
661
+ */
662
+ export declare const mul: typeof multiply;
663
+ /**
664
+ * Alias for {@link mat4.subtract}
665
+ * @function
666
+ */
667
+ export declare const sub: typeof subtract;