@lakuna/umath 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/algorithms/combinations.d.ts +7 -0
- package/dist/algorithms/combinations.d.ts.map +1 -1
- package/dist/algorithms/combinations.js +7 -0
- package/dist/algorithms/combinations.js.map +1 -1
- package/dist/algorithms/degreesToRadians.d.ts +7 -0
- package/dist/algorithms/degreesToRadians.d.ts.map +1 -1
- package/dist/algorithms/degreesToRadians.js +7 -0
- package/dist/algorithms/degreesToRadians.js.map +1 -1
- package/dist/algorithms/factorial.d.ts +6 -0
- package/dist/algorithms/factorial.d.ts.map +1 -1
- package/dist/algorithms/factorial.js +8 -1
- package/dist/algorithms/factorial.js.map +1 -1
- package/dist/algorithms/fibonacci.d.ts +6 -1
- package/dist/algorithms/fibonacci.d.ts.map +1 -1
- package/dist/algorithms/fibonacci.js +5 -0
- package/dist/algorithms/fibonacci.js.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.d.ts +14 -0
- package/dist/algorithms/greatestCommonDivisor.d.ts.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.js +2 -0
- package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
- package/dist/algorithms/hypergeometricPmf.d.ts +9 -0
- package/dist/algorithms/hypergeometricPmf.d.ts.map +1 -1
- package/dist/algorithms/hypergeometricPmf.js +9 -0
- package/dist/algorithms/hypergeometricPmf.js.map +1 -1
- package/dist/algorithms/isPrime.d.ts +6 -0
- package/dist/algorithms/isPrime.d.ts.map +1 -1
- package/dist/algorithms/isPrime.js +7 -0
- package/dist/algorithms/isPrime.js.map +1 -1
- package/dist/algorithms/permutations.d.ts +7 -0
- package/dist/algorithms/permutations.d.ts.map +1 -1
- package/dist/algorithms/permutations.js +7 -0
- package/dist/algorithms/permutations.js.map +1 -1
- package/dist/algorithms/primeFactorization.d.ts +6 -0
- package/dist/algorithms/primeFactorization.d.ts.map +1 -1
- package/dist/algorithms/primeFactorization.js +6 -0
- package/dist/algorithms/primeFactorization.js.map +1 -1
- package/dist/algorithms/radiansToDegrees.d.ts +7 -0
- package/dist/algorithms/radiansToDegrees.d.ts.map +1 -1
- package/dist/algorithms/radiansToDegrees.js +7 -0
- package/dist/algorithms/radiansToDegrees.js.map +1 -1
- package/dist/algorithms/summation.d.ts +8 -0
- package/dist/algorithms/summation.d.ts.map +1 -1
- package/dist/algorithms/summation.js +9 -0
- package/dist/algorithms/summation.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +410 -27
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +429 -54
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix.d.ts +67 -0
- package/dist/linalg/Matrix.d.ts.map +1 -1
- package/dist/linalg/Matrix2.d.ts +309 -20
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +321 -40
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +424 -26
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +437 -52
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +766 -42
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +789 -84
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +359 -21
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +380 -42
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts +70 -0
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +71 -0
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowSquareMatrix.d.ts +55 -0
- package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowSquareMatrix.js +58 -0
- package/dist/linalg/SlowSquareMatrix.js.map +1 -1
- package/dist/linalg/SquareMatrix.d.ts +23 -0
- package/dist/linalg/SquareMatrix.d.ts.map +1 -1
- package/dist/linalg/Vector.d.ts +123 -0
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +450 -33
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +480 -66
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +542 -38
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +579 -76
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +416 -30
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +441 -60
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/types/AxisAngle.d.ts +3 -0
- package/dist/types/AxisAngle.d.ts.map +1 -1
- package/dist/types/FieldOfView.d.ts +5 -0
- package/dist/types/FieldOfView.d.ts.map +1 -1
- package/dist/utility/BigNumber.d.ts +36 -0
- package/dist/utility/BigNumber.d.ts.map +1 -1
- package/dist/utility/BigNumber.js +42 -0
- package/dist/utility/BigNumber.js.map +1 -1
- package/dist/utility/MagnitudeError.d.ts +5 -0
- package/dist/utility/MagnitudeError.d.ts.map +1 -1
- package/dist/utility/MagnitudeError.js +5 -0
- package/dist/utility/MagnitudeError.js.map +1 -1
- package/dist/utility/MatrixSizeError.d.ts +5 -0
- package/dist/utility/MatrixSizeError.d.ts.map +1 -1
- package/dist/utility/MatrixSizeError.js +5 -0
- package/dist/utility/MatrixSizeError.js.map +1 -1
- package/dist/utility/PartialMatrixError.d.ts +5 -0
- package/dist/utility/PartialMatrixError.d.ts.map +1 -1
- package/dist/utility/PartialMatrixError.js +5 -0
- package/dist/utility/PartialMatrixError.js.map +1 -1
- package/dist/utility/SingularMatrixError.d.ts +8 -0
- package/dist/utility/SingularMatrixError.d.ts.map +1 -1
- package/dist/utility/SingularMatrixError.js +8 -0
- package/dist/utility/SingularMatrixError.js.map +1 -1
- package/dist/utility/epsilon.d.ts +1 -0
- package/dist/utility/epsilon.d.ts.map +1 -1
- package/dist/utility/epsilon.js +1 -0
- package/dist/utility/epsilon.js.map +1 -1
- package/package.json +1 -1
- package/src/algorithms/combinations.ts +1 -1
- package/src/algorithms/degreesToRadians.ts +1 -1
- package/src/algorithms/factorial.ts +1 -1
- package/src/algorithms/fibonacci.ts +1 -1
- package/src/algorithms/hypergeometricPmf.ts +1 -1
- package/src/algorithms/isPrime.ts +1 -1
- package/src/algorithms/permutations.ts +1 -1
- package/src/algorithms/primeFactorization.ts +1 -1
- package/src/algorithms/radiansToDegrees.ts +1 -1
- package/src/algorithms/summation.ts +1 -1
- package/src/linalg/DualQuaternion.ts +114 -108
- package/src/linalg/Matrix2.ts +82 -69
- package/src/linalg/Matrix3.ts +106 -93
- package/src/linalg/Matrix4.ts +170 -154
- package/src/linalg/Quaternion.ts +95 -91
- package/src/linalg/SlowMatrix.ts +13 -13
- package/src/linalg/SlowSquareMatrix.ts +11 -11
- package/src/linalg/Vector2.ts +129 -115
- package/src/linalg/Vector3.ts +151 -134
- package/src/linalg/Vector4.ts +120 -103
- package/src/utility/BigNumber.ts +7 -7
package/dist/linalg/Matrix4.d.ts
CHANGED
|
@@ -4,127 +4,851 @@ import type { DualQuaternionLike } from "./DualQuaternion.js";
|
|
|
4
4
|
import type FieldOfView from "../types/FieldOfView.js";
|
|
5
5
|
import type { MatrixLike } from "./Matrix.js";
|
|
6
6
|
import type SquareMatrix from "./SquareMatrix.js";
|
|
7
|
+
/**
|
|
8
|
+
* Numbers arranged into four columns and four rows.
|
|
9
|
+
* @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
|
|
10
|
+
*/
|
|
7
11
|
export interface Matrix4Like extends MatrixLike {
|
|
12
|
+
/** The value in the first column and first row. */
|
|
8
13
|
0: number;
|
|
14
|
+
/** The value in the first column and second row. */
|
|
9
15
|
1: number;
|
|
16
|
+
/** The value in the first column and third row. */
|
|
10
17
|
2: number;
|
|
18
|
+
/** The value in the first column and fourth row. */
|
|
11
19
|
3: number;
|
|
20
|
+
/** The value in the second column and first row. */
|
|
12
21
|
4: number;
|
|
22
|
+
/** The value in the second column and second row. */
|
|
13
23
|
5: number;
|
|
24
|
+
/** The value in the second column and third row. */
|
|
14
25
|
6: number;
|
|
26
|
+
/** The value in the second column and fourth row. */
|
|
15
27
|
7: number;
|
|
28
|
+
/** The value in the third column and first row. */
|
|
16
29
|
8: number;
|
|
30
|
+
/** The value in the third column and second row. */
|
|
17
31
|
9: number;
|
|
32
|
+
/** The value in the third column and third row. */
|
|
18
33
|
10: number;
|
|
34
|
+
/** The value in the third column and fourth row. */
|
|
19
35
|
11: number;
|
|
36
|
+
/** The value in the fourth column and first row. */
|
|
20
37
|
12: number;
|
|
38
|
+
/** The value in the fourth column and second row. */
|
|
21
39
|
13: number;
|
|
40
|
+
/** The value in the fourth column and third row. */
|
|
22
41
|
14: number;
|
|
42
|
+
/** The value in the fourth column and fourth row. */
|
|
23
43
|
15: number;
|
|
24
44
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export declare
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export declare
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export declare
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export declare
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Create a 4x4 matrix-like object.
|
|
47
|
+
* @returns A 4x4 matrix-like object.
|
|
48
|
+
*/
|
|
49
|
+
export declare const createMatrix4Like: () => Matrix4Like;
|
|
50
|
+
/**
|
|
51
|
+
* Create a transformation matrix that represents a translation by the given vector.
|
|
52
|
+
* @param vector - The translation vector.
|
|
53
|
+
* @param out - The matrix to store the result in.
|
|
54
|
+
* @returns The transformation matrix.
|
|
55
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
56
|
+
*/
|
|
57
|
+
export declare const fromTranslation: <T extends Matrix4Like>(vector: Vector3Like, out: T) => T;
|
|
58
|
+
/**
|
|
59
|
+
* Create a transformation matrix that represents a scaling by the given vector.
|
|
60
|
+
* @param vector - The scaling vector.
|
|
61
|
+
* @param out - The matrix to store the result in.
|
|
62
|
+
* @returns The transformation matrix.
|
|
63
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
64
|
+
*/
|
|
65
|
+
export declare const fromScaling: <T extends Matrix4Like>(vector: Vector3Like, out: T) => T;
|
|
66
|
+
/**
|
|
67
|
+
* Reset a matrix to identity.
|
|
68
|
+
* @param out - The matrix to store the result in.
|
|
69
|
+
* @returns The matrix.
|
|
70
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
71
|
+
*/
|
|
72
|
+
export declare const identity: <T extends Matrix4Like>(out: T) => T;
|
|
73
|
+
/**
|
|
74
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
75
|
+
* @param r - The angle in radians.
|
|
76
|
+
* @param axis - The axis to rotate around.
|
|
77
|
+
* @param out - The matrix to store the result in.
|
|
78
|
+
* @returns The transformation matrix.
|
|
79
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
80
|
+
*/
|
|
81
|
+
export declare const fromRotation: <T extends Matrix4Like>(r: number, axis: Vector3Like, out: T) => T;
|
|
82
|
+
/**
|
|
83
|
+
* Create a transformation matrix that represents a rotation by the given angle around the X-axis.
|
|
84
|
+
* @param r - The angle in radians.
|
|
85
|
+
* @param out - The matrix to store the result in.
|
|
86
|
+
* @returns The transformation matrix.
|
|
87
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
88
|
+
*/
|
|
89
|
+
export declare const fromXRotation: <T extends Matrix4Like>(r: number, out: T) => T;
|
|
90
|
+
/**
|
|
91
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Y-axis.
|
|
92
|
+
* @param r - The angle in radians.
|
|
93
|
+
* @param out - The matrix to store the result in.
|
|
94
|
+
* @returns The transformation matrix.
|
|
95
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
96
|
+
*/
|
|
97
|
+
export declare const fromYRotation: <T extends Matrix4Like>(r: number, out: T) => T;
|
|
98
|
+
/**
|
|
99
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
100
|
+
* @param r - The angle in radians.
|
|
101
|
+
* @param out - The matrix to store the result in.
|
|
102
|
+
* @returns The transformation matrix.
|
|
103
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
104
|
+
*/
|
|
105
|
+
export declare const fromZRotation: <T extends Matrix4Like>(r: number, out: T) => T;
|
|
106
|
+
/**
|
|
107
|
+
* Create a transformation matrix from the given rotation and translation.
|
|
108
|
+
* @param rotation - The rotation quaternion.
|
|
109
|
+
* @param translation - The translation vector.
|
|
110
|
+
* @param out - The matrix to store the result in.
|
|
111
|
+
* @returns The transformation matrix.
|
|
112
|
+
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
113
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
114
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
115
|
+
*/
|
|
116
|
+
export declare const fromRotationTranslation: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, out: T) => T;
|
|
117
|
+
/**
|
|
118
|
+
* Create a transformation matrix from the given rotation, translation, and scale.
|
|
119
|
+
* @param rotation - The rotation quaternion.
|
|
120
|
+
* @param translation - The translation vector.
|
|
121
|
+
* @param scaling - The scaling vector.
|
|
122
|
+
* @param out - The matrix to store the result in.
|
|
123
|
+
* @returns The transformation matrix.
|
|
124
|
+
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
125
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
126
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
127
|
+
*/
|
|
128
|
+
export declare const fromRotationTranslationScale: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, out: T) => T;
|
|
129
|
+
/**
|
|
130
|
+
* Create a transformation matrix from the given rotation, translation, and scale around the given origin.
|
|
131
|
+
* @param rotation - The rotation quaternion.
|
|
132
|
+
* @param translation - The translation vector.
|
|
133
|
+
* @param scaling - The scaling vector.
|
|
134
|
+
* @param origin - The origin vector.
|
|
135
|
+
* @param out - The matrix to store the result in.
|
|
136
|
+
* @returns The transformation matrix.
|
|
137
|
+
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
138
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
139
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
140
|
+
*/
|
|
141
|
+
export declare const fromRotationTranslationScaleOrigin: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, origin: Vector3Like, out: T) => T;
|
|
142
|
+
/**
|
|
143
|
+
* Create a transformation matrix from a dual quaternion.
|
|
144
|
+
* @param quaternion - The dual quaternion.
|
|
145
|
+
* @param out - The matrix to store the result in.
|
|
146
|
+
* @returns The transformation matrix.
|
|
147
|
+
* @see [Dual quaternion](https://en.wikipedia.org/wiki/Dual_quaternion)
|
|
148
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
149
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
150
|
+
*/
|
|
151
|
+
export declare const fromDualQuaternion: <T extends Matrix4Like>(quaternion: DualQuaternionLike, out: T) => T;
|
|
152
|
+
/**
|
|
153
|
+
* Generate a frustum matrix with the given bounds.
|
|
154
|
+
* @param left - The left bound of the frustum.
|
|
155
|
+
* @param right - The right bound of the frustum.
|
|
156
|
+
* @param bottom - The bottom bound of the frustum.
|
|
157
|
+
* @param top - The top bound of the frustum.
|
|
158
|
+
* @param near - The near bound of the frustum.
|
|
159
|
+
* @param far - The far bound of the frustum.
|
|
160
|
+
* @param out - The matrix to store the result in.
|
|
161
|
+
* @returns The frustum matrix.
|
|
162
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
163
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
164
|
+
*/
|
|
165
|
+
export declare const frustum: <T extends Matrix4Like>(left: number, right: number, bottom: number, top: number, near: number, far: number, out: T) => T;
|
|
166
|
+
/**
|
|
167
|
+
* Create a perspective projection matrix with the given bounds.
|
|
168
|
+
* @param fov - The vertical field of view in radians.
|
|
169
|
+
* @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
|
|
170
|
+
* @param near - The near bound of the frustum.
|
|
171
|
+
* @param far - The far bound of the frustum.
|
|
172
|
+
* @param out - The matrix to store the result in.
|
|
173
|
+
* @returns The perspective projection matrix.
|
|
174
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
175
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
176
|
+
*/
|
|
177
|
+
export declare const perspective: <T extends Matrix4Like>(fov: number, aspect: number, near: number, far: number, out: T) => T;
|
|
178
|
+
/**
|
|
179
|
+
* Create a perspective projection matrix from a field of view. Useful for generating projection matrices to be used with the WebXR API.
|
|
180
|
+
* @param fov - The field of view.
|
|
181
|
+
* @param near - The near bound of the frustum.
|
|
182
|
+
* @param far - The far bound of the frustum.
|
|
183
|
+
* @param out - The matrix to store the result in.
|
|
184
|
+
* @returns The perspective projection matrix.
|
|
185
|
+
* @see [WebXR API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API)
|
|
186
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
187
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
188
|
+
*/
|
|
189
|
+
export declare const perspectiveFromFieldOfView: <T extends Matrix4Like>(fov: FieldOfView, near: number, far: number, out: T) => T;
|
|
190
|
+
/**
|
|
191
|
+
* Generate an orthogonal projection matrix with the given bounds.
|
|
192
|
+
* @param left - The left bound of the frustum.
|
|
193
|
+
* @param right - The right bound of the frustum.
|
|
194
|
+
* @param bottom - The bottom bound of the frustum.
|
|
195
|
+
* @param top - The top bound of the frustum.
|
|
196
|
+
* @param near - The near bound of the frustum.
|
|
197
|
+
* @param far - The far bound of the frustum.
|
|
198
|
+
* @param out - The matrix to store the result in.
|
|
199
|
+
* @returns The frustum matrix.
|
|
200
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
201
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
202
|
+
*/
|
|
203
|
+
export declare const ortho: <T extends Matrix4Like>(left: number, right: number, bottom: number, top: number, near: number, far: number, out: T) => T;
|
|
204
|
+
/**
|
|
205
|
+
* Generate a look-at matrix. If you want a matrix that actually makes an object look at another object, use `targetTo` instead.
|
|
206
|
+
* @param eye - The position of the viewer.
|
|
207
|
+
* @param center - The point that the viewer is looking at.
|
|
208
|
+
* @param up - The local up direction.
|
|
209
|
+
* @param out - The matrix to store the result in.
|
|
210
|
+
* @returns The look-at matrix.
|
|
211
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
212
|
+
*/
|
|
213
|
+
export declare const lookAt: <T extends Matrix4Like>(eye: Vector3Like, center: Vector3Like, up: Vector3Like, out: T) => T;
|
|
214
|
+
/**
|
|
215
|
+
* Create a matrix that makes something look at something else.
|
|
216
|
+
* @param eye - The position of the viewer.
|
|
217
|
+
* @param center - The point that the viewer is looking at.
|
|
218
|
+
* @param up - The local up direction.
|
|
219
|
+
* @param out - The matrix to store the result in.
|
|
220
|
+
* @returns The transformation matrix.
|
|
221
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
222
|
+
*/
|
|
223
|
+
export declare const targetTo: <T extends Matrix4Like>(eye: Vector3Like, target: Vector3Like, up: Vector3Like, out: T) => T;
|
|
224
|
+
/**
|
|
225
|
+
* Add two matrices.
|
|
226
|
+
* @param a - The augend.
|
|
227
|
+
* @param b - The addend.
|
|
228
|
+
* @param out - The matrix to store the result in.
|
|
229
|
+
* @returns The sum.
|
|
230
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
231
|
+
*/
|
|
232
|
+
export declare const add: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
|
|
233
|
+
/**
|
|
234
|
+
* Create a two-by-two matrix with the given values.
|
|
235
|
+
* @param c0r0 - The value in the first column and first row.
|
|
236
|
+
* @param c0r1 - The value in the first column and second row.
|
|
237
|
+
* @param c0r2 - The value in the first column and third row.
|
|
238
|
+
* @param c0r3 - The value in the first column and fourth row.
|
|
239
|
+
* @param c1r0 - The value in the second column and first row.
|
|
240
|
+
* @param c1r1 - The value in the second column and second row.
|
|
241
|
+
* @param c1r2 - The value in the second column and third row.
|
|
242
|
+
* @param c1r3 - The value in the second column and fourth row.
|
|
243
|
+
* @param c2r0 - The value in the third column and first row.
|
|
244
|
+
* @param c2r1 - The value in the third column and second row.
|
|
245
|
+
* @param c2r2 - The value in the third column and third row.
|
|
246
|
+
* @param c2r3 - The value in the third column and fourth row.
|
|
247
|
+
* @param c3r0 - The value in the fourth column and first row.
|
|
248
|
+
* @param c3r1 - The value in the fourth column and second row.
|
|
249
|
+
* @param c3r2 - The value in the fourth column and third row.
|
|
250
|
+
* @param c3r3 - The value in the fourth column and fourth row.
|
|
251
|
+
* @param out - The matrix to store the result in.
|
|
252
|
+
* @returns The matrix.
|
|
253
|
+
*/
|
|
254
|
+
export declare const fromValues: <T extends Matrix4Like>(c0r0: number, c0r1: number, c0r2: number, c0r3: number, c1r0: number, c1r1: number, c1r2: number, c1r3: number, c2r0: number, c2r1: number, c2r2: number, c2r3: number, c3r0: number, c3r1: number, c3r2: number, c3r3: number, out: T) => T;
|
|
255
|
+
/**
|
|
256
|
+
* Determine whether or not two matrices are roughly equivalent.
|
|
257
|
+
* @param a - The first matrix.
|
|
258
|
+
* @param b - The second matrix.
|
|
259
|
+
* @returns Whether or not the matrices are equivalent.
|
|
260
|
+
*/
|
|
261
|
+
export declare const equals: (a: Matrix4Like, b: Matrix4Like) => boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Determine whether or not two matrices are exactly equivalent.
|
|
264
|
+
* @param a - The first matrix.
|
|
265
|
+
* @param b - The second matrix.
|
|
266
|
+
* @returns Whether the matrices are equivalent.
|
|
267
|
+
*/
|
|
268
|
+
export declare const exactEquals: (a: Matrix4Like, b: Matrix4Like) => boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Calculate the adjugate of a matrix.
|
|
271
|
+
* @param matrix - The matrix.
|
|
272
|
+
* @param out - The matrix to store the result in.
|
|
273
|
+
* @returns The adjugate of the matrix.
|
|
274
|
+
* @see [Adjugate matrix](https://en.wikipedia.org/wiki/Adjugate_matrix)
|
|
275
|
+
*/
|
|
276
|
+
export declare const adjoint: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
|
|
277
|
+
/**
|
|
278
|
+
* Copy the values of one matrix into another.
|
|
279
|
+
* @param matrix - The matrix to copy.
|
|
280
|
+
* @param out - The matrix to store the result in.
|
|
281
|
+
* @returns This matrix.
|
|
282
|
+
*/
|
|
283
|
+
export declare const copy: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
|
|
284
|
+
/**
|
|
285
|
+
* Calculate the Frobenius norm of a matrix.
|
|
286
|
+
* @param matrix - The matrix.
|
|
287
|
+
* @returns The Frobenius norm.
|
|
288
|
+
* @see [Matrix norm](https://en.wikipedia.org/wiki/Matrix_norm)
|
|
289
|
+
*/
|
|
290
|
+
export declare const frob: (matrix: Matrix4Like) => number;
|
|
291
|
+
/**
|
|
292
|
+
* Multiply two matrices.
|
|
293
|
+
* @param a - The multiplicand.
|
|
294
|
+
* @param b - The multiplier.
|
|
295
|
+
* @param out - The matrix to store the result in.
|
|
296
|
+
* @returns The product.
|
|
297
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
298
|
+
*/
|
|
299
|
+
export declare const multiply: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
|
|
300
|
+
/**
|
|
301
|
+
* Multiply a matrix by a scalar value.
|
|
302
|
+
* @param matrix - The multiplicand.
|
|
303
|
+
* @param scalar - The multiplier.
|
|
304
|
+
* @param out - The matrix to store the result in.
|
|
305
|
+
* @returns The product.
|
|
306
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
307
|
+
*/
|
|
308
|
+
export declare const multiplyScalar: <T extends Matrix4Like>(matrix: Matrix4Like, scalar: number, out: T) => T;
|
|
309
|
+
/**
|
|
310
|
+
* Add a matrix to another after multiplying the other by a scalar.
|
|
311
|
+
* @param a - The augend.
|
|
312
|
+
* @param b - The addend.
|
|
313
|
+
* @param scalar - The multiplier.
|
|
314
|
+
* @param out - The matrix to store the result in.
|
|
315
|
+
* @returns The sum.
|
|
316
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
317
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
318
|
+
*/
|
|
319
|
+
export declare const multiplyScalarAndAdd: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, scalar: number, out: T) => T;
|
|
320
|
+
/**
|
|
321
|
+
* Subtract two matrices.
|
|
322
|
+
* @param a - The minuend.
|
|
323
|
+
* @param b - The subtrahend.
|
|
324
|
+
* @param out - The matrix to store the result in.
|
|
325
|
+
* @returns The difference.
|
|
326
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
327
|
+
*/
|
|
328
|
+
export declare const subtract: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
|
|
329
|
+
/**
|
|
330
|
+
* Transpose a matrix.
|
|
331
|
+
* @param matrix - The matrix.
|
|
332
|
+
* @param out - The matrix to store the result in.
|
|
333
|
+
* @returns The transpose.
|
|
334
|
+
* @see [Transpose](https://en.wikipedia.org/wiki/Transpose)
|
|
335
|
+
*/
|
|
336
|
+
export declare const transpose: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
|
|
337
|
+
/**
|
|
338
|
+
* Calculate the determinant of a matrix.
|
|
339
|
+
* @param matrix - The matrix.
|
|
340
|
+
* @returns The determinant.
|
|
341
|
+
* @see [Determinant](https://en.wikipedia.org/wiki/Determinant)
|
|
342
|
+
*/
|
|
343
|
+
export declare const determinant: (matrix: Matrix4Like) => number;
|
|
344
|
+
/**
|
|
345
|
+
* Invert a matrix.
|
|
346
|
+
* @param matrix - The matrix.
|
|
347
|
+
* @param out - The matrix to store the result in.
|
|
348
|
+
* @returns The inverted matrix.
|
|
349
|
+
* @see [Invertible matrix](https://en.wikipedia.org/wiki/Invertible_matrix)
|
|
350
|
+
*/
|
|
351
|
+
export declare const invert: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
|
|
352
|
+
/**
|
|
353
|
+
* Scale a matrix by the given vector.
|
|
354
|
+
* @param matrix - The matrix.
|
|
355
|
+
* @param vector - The scaling vector.
|
|
356
|
+
* @param out - The matrix to store the result in.
|
|
357
|
+
* @returns The scaled matrix.
|
|
358
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
359
|
+
*/
|
|
360
|
+
export declare const scale: <T extends Matrix4Like>(matrix: Matrix4Like, vector: Vector3Like, out: T) => T;
|
|
361
|
+
/**
|
|
362
|
+
* Translate a matrix by the given vector.
|
|
363
|
+
* @param matrix - The matrix.
|
|
364
|
+
* @param vector - The translation vector.
|
|
365
|
+
* @param out - The matrix to store the result in.
|
|
366
|
+
* @returns The translated matrix.
|
|
367
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
368
|
+
*/
|
|
369
|
+
export declare const translate: <T extends Matrix4Like>(matrix: Matrix4Like, vector: Vector3Like, out: T) => T;
|
|
370
|
+
/**
|
|
371
|
+
* Rotate a matrix by the given angle around the given axis.
|
|
372
|
+
* @param matrix - The matrix.
|
|
373
|
+
* @param radians - The angle in radians.
|
|
374
|
+
* @param axis - The axis.
|
|
375
|
+
* @param out - The matrix to store the result in.
|
|
376
|
+
* @returns The rotated matrix.
|
|
377
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
378
|
+
*/
|
|
379
|
+
export declare const rotate: <T extends Matrix4Like>(matrix: Matrix4Like, radians: number, axis: Vector3Like, out: T) => T;
|
|
380
|
+
/**
|
|
381
|
+
* Rotate a matrix by the given angle around the X-axis.
|
|
382
|
+
* @param matrix - The matrix.
|
|
383
|
+
* @param r - The angle in radians.
|
|
384
|
+
* @param out - The matrix to store the result in.
|
|
385
|
+
* @returns The rotated matrix.
|
|
386
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
387
|
+
*/
|
|
388
|
+
export declare const rotateX: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
|
|
389
|
+
/**
|
|
390
|
+
* Rotate a matrix by the given angle around the Y-axis.
|
|
391
|
+
* @param matrix - The matrix.
|
|
392
|
+
* @param r - The angle in radians.
|
|
393
|
+
* @param out - The matrix to store the result in.
|
|
394
|
+
* @returns The rotated matrix.
|
|
395
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
396
|
+
*/
|
|
397
|
+
export declare const rotateY: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
|
|
398
|
+
/**
|
|
399
|
+
* Rotate a matrix by the given angle around the Z-axis.
|
|
400
|
+
* @param matrix - The matrix.
|
|
401
|
+
* @param r - The angle in radians.
|
|
402
|
+
* @param out - The matrix to store the result in.
|
|
403
|
+
* @returns The rotated matrix.
|
|
404
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
405
|
+
*/
|
|
406
|
+
export declare const rotateZ: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
|
|
407
|
+
/**
|
|
408
|
+
* Get the translation vector component of a transformation matrix.
|
|
409
|
+
* @param matrix - The matrix.
|
|
410
|
+
* @param out - The vector to store the result in.
|
|
411
|
+
* @returns The translation vector.
|
|
412
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
413
|
+
*/
|
|
414
|
+
export declare const getTranslation: <T extends Vector3Like>(matrix: Matrix4Like, out: T) => T;
|
|
415
|
+
/**
|
|
416
|
+
* Set the translation vector component of a transformation matrix.
|
|
417
|
+
* @param matrix - The matrix.
|
|
418
|
+
* @param translation - The translation vector.
|
|
419
|
+
* @param out - The matrix to store the result in.
|
|
420
|
+
* @returns The transformation matrix.
|
|
421
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
422
|
+
*/
|
|
423
|
+
export declare const setTranslation: <T extends Matrix4Like>(matrix: Matrix4Like, translation: Vector3Like, out: T) => T;
|
|
424
|
+
/**
|
|
425
|
+
* Get the scaling factor of a transformation matrix.
|
|
426
|
+
* @param matrix - The matrix.
|
|
427
|
+
* @param out - The vector to store the result in.
|
|
428
|
+
* @returns The scaling vector.
|
|
429
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
430
|
+
*/
|
|
431
|
+
export declare const getScaling: <T extends Vector3Like>(matrix: Matrix4Like, out: T) => T;
|
|
432
|
+
/**
|
|
433
|
+
* Get the rotational component of a transformation matrix.
|
|
434
|
+
* @param matrix - The matrix.
|
|
435
|
+
* @param out - The quaternion to store the result in.
|
|
436
|
+
* @returns The rotation.
|
|
437
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
438
|
+
*/
|
|
439
|
+
export declare const getRotation: <T extends QuaternionLike>(matrix: Matrix4Like, out: T) => T;
|
|
440
|
+
/**
|
|
441
|
+
* A four-by-four matrix.
|
|
442
|
+
* @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
|
|
443
|
+
*/
|
|
67
444
|
export default class Matrix4 extends Float32Array implements SquareMatrix, Matrix4Like {
|
|
445
|
+
/**
|
|
446
|
+
* Create a transformation matrix that represents a translation by the given vector.
|
|
447
|
+
* @param vector - The translation vector.
|
|
448
|
+
* @param out - The matrix to store the result in.
|
|
449
|
+
* @returns The transformation matrix.
|
|
450
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
451
|
+
*/
|
|
68
452
|
static fromTranslation<T extends Matrix4Like>(vector: Vector3Like, out?: T): T;
|
|
453
|
+
/**
|
|
454
|
+
* Create a transformation matrix that represents a scaling by the given vector.
|
|
455
|
+
* @param vector - The scaling vector.
|
|
456
|
+
* @param out - The matrix to store the result in.
|
|
457
|
+
* @returns The transformation matrix.
|
|
458
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
459
|
+
*/
|
|
69
460
|
static fromScaling<T extends Matrix4Like>(vector: Vector3Like, out?: T): T;
|
|
461
|
+
/**
|
|
462
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
463
|
+
* @param r - The angle in radians.
|
|
464
|
+
* @param axis - The axis to rotate around.
|
|
465
|
+
* @param out - The matrix to store the result in.
|
|
466
|
+
* @returns The transformation matrix.
|
|
467
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
468
|
+
*/
|
|
70
469
|
static fromRotation<T extends Matrix4Like>(r: number, axis: Vector3Like, out?: T): T;
|
|
470
|
+
/**
|
|
471
|
+
* Create a transformation matrix that represents a rotation by the given angle around the X-axis.
|
|
472
|
+
* @param r - The angle in radians.
|
|
473
|
+
* @param out - The matrix to store the result in.
|
|
474
|
+
* @returns The transformation matrix.
|
|
475
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
476
|
+
*/
|
|
71
477
|
static fromXRotation<T extends Matrix4Like>(r: number, out?: T): T;
|
|
478
|
+
/**
|
|
479
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Y-axis.
|
|
480
|
+
* @param r - The angle in radians.
|
|
481
|
+
* @param out - The matrix to store the result in.
|
|
482
|
+
* @returns The transformation matrix.
|
|
483
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
484
|
+
*/
|
|
72
485
|
static fromYRotation<T extends Matrix4Like>(r: number, out?: T): T;
|
|
486
|
+
/**
|
|
487
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
488
|
+
* @param r - The angle in radians.
|
|
489
|
+
* @param out - The matrix to store the result in.
|
|
490
|
+
* @returns The transformation matrix.
|
|
491
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
492
|
+
*/
|
|
73
493
|
static fromZRotation<T extends Matrix4Like>(r: number, out?: T): T;
|
|
494
|
+
/**
|
|
495
|
+
* Create a transformation matrix from the given rotation and translation.
|
|
496
|
+
* @param rotation - The rotation quaternion.
|
|
497
|
+
* @param translation - The translation vector.
|
|
498
|
+
* @param out - The matrix to store the result in.
|
|
499
|
+
* @returns The transformation matrix.
|
|
500
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
501
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
502
|
+
*/
|
|
74
503
|
static fromRotationTranslation<T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, out?: T): T;
|
|
504
|
+
/**
|
|
505
|
+
* Create a transformation matrix from the given rotation, translation, and scale.
|
|
506
|
+
* @param rotation - The rotation quaternion.
|
|
507
|
+
* @param translation - The translation vector.
|
|
508
|
+
* @param scaling - The scaling vector.
|
|
509
|
+
* @param out - The matrix to store the result in.
|
|
510
|
+
* @returns The transformation matrix.
|
|
511
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
512
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
513
|
+
*/
|
|
75
514
|
static fromRotationTranslationScale<T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, out?: T): T;
|
|
515
|
+
/**
|
|
516
|
+
* Create a transformation matrix from the given rotation, translation, and scale around the given origin.
|
|
517
|
+
* @param rotation - The rotation quaternion.
|
|
518
|
+
* @param translation - The translation vector.
|
|
519
|
+
* @param scaling - The scaling vector.
|
|
520
|
+
* @param origin - The origin vector.
|
|
521
|
+
* @param out - The matrix to store the result in.
|
|
522
|
+
* @returns The transformation matrix.
|
|
523
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
524
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
525
|
+
*/
|
|
76
526
|
static fromRotationTranslationScaleOrigin<T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, origin: Vector3Like, out?: T): T;
|
|
527
|
+
/**
|
|
528
|
+
* Create a transformation matrix from a dual quaternion.
|
|
529
|
+
* @param quaternion - The dual quaternion.
|
|
530
|
+
* @param out - The matrix to store the result in.
|
|
531
|
+
* @returns The transformation matrix.
|
|
532
|
+
* @see [Dual quaternion](https://en.wikipedia.org/wiki/Dual_quaternion)
|
|
533
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
534
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
535
|
+
*/
|
|
77
536
|
static fromDualQuaternion<T extends Matrix4Like>(quaternion: DualQuaternionLike, out?: T): T;
|
|
537
|
+
/**
|
|
538
|
+
* Generate a frustum matrix with the given bounds.
|
|
539
|
+
* @param left - The left bound of the frustum.
|
|
540
|
+
* @param right - The right bound of the frustum.
|
|
541
|
+
* @param bottom - The bottom bound of the frustum.
|
|
542
|
+
* @param top - The top bound of the frustum.
|
|
543
|
+
* @param near - The near bound of the frustum.
|
|
544
|
+
* @param far - The far bound of the frustum.
|
|
545
|
+
* @param out - The matrix to store the result in.
|
|
546
|
+
* @returns The frustum matrix.
|
|
547
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
548
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
549
|
+
*/
|
|
78
550
|
static frustum<T extends Matrix4Like>(left: number, right: number, bottom: number, top: number, near: number, far: number, out?: T): T;
|
|
551
|
+
/**
|
|
552
|
+
* Create a perspective projection matrix with the given bounds.
|
|
553
|
+
* @param fov - The vertical field of view in radians.
|
|
554
|
+
* @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
|
|
555
|
+
* @param near - The near bound of the frustum.
|
|
556
|
+
* @param far - The far bound of the frustum.
|
|
557
|
+
* @param out - The matrix to store the result in.
|
|
558
|
+
* @returns The perspective projection matrix.
|
|
559
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
560
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
561
|
+
*/
|
|
79
562
|
static perspective<T extends Matrix4Like>(fov: number, aspect: number, near: number, far: number, out?: T): T;
|
|
563
|
+
/**
|
|
564
|
+
* Create a perspective projection matrix from a field of view. Useful for generating projection matrices to be used with the WebXR API.
|
|
565
|
+
* @param fov - The field of view.
|
|
566
|
+
* @param near - The near bound of the frustum.
|
|
567
|
+
* @param far - The far bound of the frustum.
|
|
568
|
+
* @param out - The matrix to store the result in.
|
|
569
|
+
* @returns The perspective projection matrix.
|
|
570
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
571
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
572
|
+
* @see [WebXR API](https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API)
|
|
573
|
+
*/
|
|
80
574
|
static perspectiveFromFieldOfView<T extends Matrix4Like>(fov: FieldOfView, near: number, far: number, out?: T): T;
|
|
575
|
+
/**
|
|
576
|
+
* Generate an orthogonal projection matrix with the given bounds.
|
|
577
|
+
* @param left - The left bound of the frustum.
|
|
578
|
+
* @param right - The right bound of the frustum.
|
|
579
|
+
* @param bottom - The bottom bound of the frustum.
|
|
580
|
+
* @param top - The top bound of the frustum.
|
|
581
|
+
* @param near - The near bound of the frustum.
|
|
582
|
+
* @param far - The far bound of the frustum.
|
|
583
|
+
* @param out - The matrix to store the result in.
|
|
584
|
+
* @returns The frustum matrix.
|
|
585
|
+
* @see [Camera matrix](https://en.wikipedia.org/wiki/Camera_matrix)
|
|
586
|
+
* @see [3D projection](https://en.wikipedia.org/wiki/3D_projection)
|
|
587
|
+
*/
|
|
81
588
|
static ortho<T extends Matrix4Like>(left: number, right: number, bottom: number, top: number, near: number, far: number, out?: T): T;
|
|
589
|
+
/**
|
|
590
|
+
* Generate a look-at matrix. If you want a matrix that actually makes an object look at another object, use `targetTo` instead.
|
|
591
|
+
* @param eye - The position of the viewer.
|
|
592
|
+
* @param center - The point that the viewer is looking at.
|
|
593
|
+
* @param up - The local up direction.
|
|
594
|
+
* @param out - The matrix to store the result in.
|
|
595
|
+
* @returns The look-at matrix.
|
|
596
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
597
|
+
*/
|
|
82
598
|
static lookAt<T extends Matrix4Like>(eye: Vector3Like, center: Vector3Like, up?: Vector3Like, out?: T): T;
|
|
599
|
+
/**
|
|
600
|
+
* Create a matrix that makes something look at something else.
|
|
601
|
+
* @param eye - The position of the viewer.
|
|
602
|
+
* @param target - The point that the viewer is looking at.
|
|
603
|
+
* @param up - The local up direction.
|
|
604
|
+
* @param out - The matrix to store the result in.
|
|
605
|
+
* @returns The transformation matrix.
|
|
606
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
607
|
+
*/
|
|
83
608
|
static targetTo<T extends Matrix4Like>(eye: Vector3Like, target: Vector3Like, up?: Vector3Like, out?: T): T;
|
|
609
|
+
/**
|
|
610
|
+
* Create a two-by-two matrix with the given values.
|
|
611
|
+
* @param c0r0 - The value in the first column and first row.
|
|
612
|
+
* @param c0r1 - The value in the first column and second row.
|
|
613
|
+
* @param c0r2 - The value in the first column and third row.
|
|
614
|
+
* @param c0r3 - The value in the first column and fourth row.
|
|
615
|
+
* @param c1r0 - The value in the second column and first row.
|
|
616
|
+
* @param c1r1 - The value in the second column and second row.
|
|
617
|
+
* @param c1r2 - The value in the second column and third row.
|
|
618
|
+
* @param c1r3 - The value in the second column and fourth row.
|
|
619
|
+
* @param c2r0 - The value in the third column and first row.
|
|
620
|
+
* @param c2r1 - The value in the third column and second row.
|
|
621
|
+
* @param c2r2 - The value in the third column and third row.
|
|
622
|
+
* @param c2r3 - The value in the third column and fourth row.
|
|
623
|
+
* @param c3r0 - The value in the fourth column and first row.
|
|
624
|
+
* @param c3r1 - The value in the fourth column and second row.
|
|
625
|
+
* @param c3r2 - The value in the fourth column and third row.
|
|
626
|
+
* @param c3r3 - The value in the fourth column and fourth row.
|
|
627
|
+
* @param out - The matrix to store the result in.
|
|
628
|
+
* @returns The matrix.
|
|
629
|
+
*/
|
|
84
630
|
static fromValues<T extends Matrix4Like>(c0r0: number, c0r1: number, c0r2: number, c0r3: number, c1r0: number, c1r1: number, c1r2: number, c1r3: number, c2r0: number, c2r1: number, c2r2: number, c2r3: number, c3r0: number, c3r1: number, c3r2: number, c3r3: number, out?: T): T;
|
|
631
|
+
/**
|
|
632
|
+
* Create a four-by-four identity matrix.
|
|
633
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
634
|
+
*/
|
|
85
635
|
constructor();
|
|
636
|
+
/** The value in the first column and first row. */
|
|
86
637
|
0: number;
|
|
638
|
+
/** The value in the first column and second row. */
|
|
87
639
|
1: number;
|
|
640
|
+
/** The value in the first column and third row. */
|
|
88
641
|
2: number;
|
|
642
|
+
/** The value in the first column and fourth row. */
|
|
89
643
|
3: number;
|
|
644
|
+
/** The value in the second column and first row. */
|
|
90
645
|
4: number;
|
|
646
|
+
/** The value in the second column and second row. */
|
|
91
647
|
5: number;
|
|
648
|
+
/** The value in the second column and third row. */
|
|
92
649
|
6: number;
|
|
650
|
+
/** The value in the second column and fourth row. */
|
|
93
651
|
7: number;
|
|
652
|
+
/** The value in the third column and first row. */
|
|
94
653
|
8: number;
|
|
654
|
+
/** The value in the third column and second row. */
|
|
95
655
|
9: number;
|
|
656
|
+
/** The value in the third column and third row. */
|
|
96
657
|
10: number;
|
|
658
|
+
/** The value in the third column and fourth row. */
|
|
97
659
|
11: number;
|
|
660
|
+
/** The value in the fourth column and first row. */
|
|
98
661
|
12: number;
|
|
662
|
+
/** The value in the fourth column and second row. */
|
|
99
663
|
13: number;
|
|
664
|
+
/** The value in the fourth column and third row. */
|
|
100
665
|
14: number;
|
|
666
|
+
/** The value in the fourth column and fourth row. */
|
|
101
667
|
15: number;
|
|
668
|
+
/** The number of columns in this matrix. */
|
|
102
669
|
readonly width: 4;
|
|
670
|
+
/** The number of rows in this matrix. */
|
|
103
671
|
readonly height: 4;
|
|
672
|
+
/**
|
|
673
|
+
* Determine whether or not this matrix is roughly equivalent to another.
|
|
674
|
+
* @param matrix - The other matrix.
|
|
675
|
+
* @returns Whether or not the matrices are equivalent.
|
|
676
|
+
*/
|
|
104
677
|
equals(matrix: Matrix4Like): boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Determine whether or not this matrix is exactly equivalent to another.
|
|
680
|
+
* @param matrix - The other matrix.
|
|
681
|
+
* @returns Whether or not the matrices are equivalent.
|
|
682
|
+
*/
|
|
105
683
|
exactEquals(matrix: Matrix4Like): boolean;
|
|
684
|
+
/**
|
|
685
|
+
* Add two matrices of the same size.
|
|
686
|
+
* @param matrix - The other matrix.
|
|
687
|
+
* @param out - The matrix to store the result in.
|
|
688
|
+
* @returns The sum of the matrices.
|
|
689
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
690
|
+
*/
|
|
106
691
|
add<T extends Matrix4Like>(matrix: Matrix4Like, out?: T): T;
|
|
692
|
+
/**
|
|
693
|
+
* Calculate the adjugate of this matrix.
|
|
694
|
+
* @param out - The matrix to store the result in.
|
|
695
|
+
* @returns The adjugate of this matrix.
|
|
696
|
+
* @see [Adjugate matrix](https://en.wikipedia.org/wiki/Adjugate_matrix)
|
|
697
|
+
*/
|
|
107
698
|
adjoint<T extends Matrix4Like>(out?: T): T;
|
|
699
|
+
/**
|
|
700
|
+
* Copy the values from this matrix to another one.
|
|
701
|
+
* @param out - The matrix to store the result in.
|
|
702
|
+
* @returns The copy.
|
|
703
|
+
*/
|
|
108
704
|
clone<T extends Matrix4Like>(out?: T): T;
|
|
705
|
+
/**
|
|
706
|
+
* Copy the values of another matrix into this one.
|
|
707
|
+
* @param matrix - The matrix to copy.
|
|
708
|
+
* @returns This matrix.
|
|
709
|
+
*/
|
|
109
710
|
copy(matrix: Matrix4Like): this;
|
|
711
|
+
/**
|
|
712
|
+
* Get the Frobenius norm of this matrix.
|
|
713
|
+
* @see [Matrix norm](https://en.wikipedia.org/wiki/Matrix_norm)
|
|
714
|
+
*/
|
|
110
715
|
get frob(): number;
|
|
716
|
+
/**
|
|
717
|
+
* Multiply this matrix by another.
|
|
718
|
+
* @param matrix - The other matrix.
|
|
719
|
+
* @param out - The matrix to store the result in.
|
|
720
|
+
* @returns The product of the matrices.
|
|
721
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
722
|
+
*/
|
|
111
723
|
multiply<T extends Matrix4Like>(matrix: Matrix4Like, out?: T): T;
|
|
724
|
+
/**
|
|
725
|
+
* Multiply this matrix by a scalar value.
|
|
726
|
+
* @param scalar - The scalar value.
|
|
727
|
+
* @param out - The matrix to store the result in.
|
|
728
|
+
* @returns The product of the matrix and the scalar value.
|
|
729
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
730
|
+
*/
|
|
112
731
|
multiplyScalar<T extends Matrix4Like>(scalar: number, out?: T): T;
|
|
732
|
+
/**
|
|
733
|
+
* Add this matrix to another after multiplying the other by a scalar.
|
|
734
|
+
* @param matrix - The other matrix.
|
|
735
|
+
* @param scalar - The scalar.
|
|
736
|
+
* @param out - The matrix to store the result in.
|
|
737
|
+
* @returns The sum.
|
|
738
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
739
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
740
|
+
*/
|
|
113
741
|
multiplyScalarAndAdd<T extends Matrix4Like>(matrix: Matrix4Like, scalar: number, out?: T): T;
|
|
742
|
+
/**
|
|
743
|
+
* Subtract another matrix from this one.
|
|
744
|
+
* @param matrix - The other matrix.
|
|
745
|
+
* @param out - The matrix to store the result in.
|
|
746
|
+
* @returns The difference between the matrices.
|
|
747
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
748
|
+
*/
|
|
114
749
|
subtract<T extends Matrix4Like>(matrix: Matrix4Like, out?: T): T;
|
|
750
|
+
/**
|
|
751
|
+
* Transpose this matrix.
|
|
752
|
+
* @param out - The matrix to store the result in.
|
|
753
|
+
* @returns The transpose of this matrix.
|
|
754
|
+
* @see [Transpose](https://en.wikipedia.org/wiki/Transpose)
|
|
755
|
+
*/
|
|
115
756
|
transpose<T extends Matrix4Like>(out?: T): T;
|
|
757
|
+
/**
|
|
758
|
+
* Get the determinant of this matrix.
|
|
759
|
+
* @see [Determinant](https://en.wikipedia.org/wiki/Determinant)
|
|
760
|
+
*/
|
|
116
761
|
get determinant(): number;
|
|
762
|
+
/**
|
|
763
|
+
* Reset this matrix to identity.
|
|
764
|
+
* @returns This matrix.
|
|
765
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
766
|
+
*/
|
|
117
767
|
identity(): this;
|
|
768
|
+
/**
|
|
769
|
+
* Invert this matrix.
|
|
770
|
+
* @param out - The matrix to store the result in.
|
|
771
|
+
* @returns The inverted matrix.
|
|
772
|
+
* @see [Invertible matrix](https://en.wikipedia.org/wiki/Invertible_matrix)
|
|
773
|
+
*/
|
|
118
774
|
invert<T extends Matrix4Like>(out?: T): T;
|
|
775
|
+
/**
|
|
776
|
+
* Scale this matrix by the given vector.
|
|
777
|
+
* @param vector - The scaling vector.
|
|
778
|
+
* @param out - The matrix to store the result in.
|
|
779
|
+
* @returns The scaled matrix.
|
|
780
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
781
|
+
*/
|
|
119
782
|
scale<T extends Matrix4Like>(vector: Vector3Like, out?: T): T;
|
|
783
|
+
/**
|
|
784
|
+
* Translate this matrix by the given vector.
|
|
785
|
+
* @param vector - The translation vector.
|
|
786
|
+
* @param out - The matrix to store the result in.
|
|
787
|
+
* @returns The translated matrix.
|
|
788
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
789
|
+
*/
|
|
120
790
|
translate<T extends Matrix4Like>(vector: Vector3Like, out?: T): T;
|
|
791
|
+
/**
|
|
792
|
+
* Rotate this matrix by the given angle around the given axis.
|
|
793
|
+
* @param r - The angle in radians.
|
|
794
|
+
* @param axis - The axis.
|
|
795
|
+
* @param out - The matrix to store the result in.
|
|
796
|
+
* @returns The rotated matrix.
|
|
797
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
798
|
+
*/
|
|
121
799
|
rotate<T extends Matrix4Like>(r: number, axis: Vector3Like, out?: T): T;
|
|
800
|
+
/**
|
|
801
|
+
* Rotate this matrix by the given angle around the X-axis.
|
|
802
|
+
* @param r - The angle in radians.
|
|
803
|
+
* @param out - The matrix to store the result in.
|
|
804
|
+
* @returns The rotated matrix.
|
|
805
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
806
|
+
*/
|
|
122
807
|
rotateX<T extends Matrix4Like>(r: number, out?: T): T;
|
|
808
|
+
/**
|
|
809
|
+
* Rotate this matrix by the given angle around the Y-axis.
|
|
810
|
+
* @param r - The angle in radians.
|
|
811
|
+
* @param out - The matrix to store the result in.
|
|
812
|
+
* @returns The rotated matrix.
|
|
813
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
814
|
+
*/
|
|
123
815
|
rotateY<T extends Matrix4Like>(r: number, out?: T): T;
|
|
816
|
+
/**
|
|
817
|
+
* Rotate this matrix by the given angle around the Z-axis.
|
|
818
|
+
* @param r - The angle in radians.
|
|
819
|
+
* @param out - The matrix to store the result in.
|
|
820
|
+
* @returns The rotated matrix.
|
|
821
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
822
|
+
*/
|
|
124
823
|
rotateZ<T extends Matrix4Like>(r: number, out?: T): T;
|
|
824
|
+
/**
|
|
825
|
+
* Get the translation vector component of this transformation matrix.
|
|
826
|
+
* @param out - The vector to store the result in.
|
|
827
|
+
* @returns The translation.
|
|
828
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
829
|
+
*/
|
|
125
830
|
getTranslation<T extends Vector3Like>(out?: T): T;
|
|
831
|
+
/**
|
|
832
|
+
* Set the translation vector component of this transformation matrix.
|
|
833
|
+
* @param translation - The translation vector.
|
|
834
|
+
* @param out - The matrix to store the result in.
|
|
835
|
+
* @returns The transformation matrix.
|
|
836
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
837
|
+
*/
|
|
126
838
|
setTranslation<T extends Matrix4Like>(translation: Vector3Like, out?: T): T;
|
|
839
|
+
/**
|
|
840
|
+
* Get the scaling vector component of this transformation matrix.
|
|
841
|
+
* @param out - The vector to store the result in.
|
|
842
|
+
* @returns The scaling.
|
|
843
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
844
|
+
*/
|
|
127
845
|
getScaling<T extends Vector3Like>(out?: T): T;
|
|
846
|
+
/**
|
|
847
|
+
* Get the scaling vector component of this transformation matrix.
|
|
848
|
+
* @param out - The quaternion to store the result in.
|
|
849
|
+
* @returns The rotation.
|
|
850
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
851
|
+
*/
|
|
128
852
|
getRotation<T extends QuaternionLike>(out?: T): T;
|
|
129
853
|
}
|
|
130
854
|
//# sourceMappingURL=Matrix4.d.ts.map
|