@lakuna/umath 1.3.4 → 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/README.md +7 -9
- package/dist/algorithms/combinations.d.ts +7 -0
- package/dist/algorithms/combinations.d.ts.map +1 -1
- package/dist/algorithms/combinations.js +8 -1
- 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 +15 -5
- 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 +6 -1
- 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 +7 -9
- 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 +10 -1
- 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 +8 -1
- 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 +8 -1
- package/dist/algorithms/permutations.js.map +1 -1
- package/dist/algorithms/primeFactorization.d.ts +7 -1
- package/dist/algorithms/primeFactorization.d.ts.map +1 -1
- package/dist/algorithms/primeFactorization.js +10 -3
- 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/index.d.ts +32 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -27
- package/dist/index.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +460 -83
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +514 -133
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix.d.ts +80 -12
- package/dist/linalg/Matrix.d.ts.map +1 -1
- package/dist/linalg/Matrix2.d.ts +337 -52
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +345 -61
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +470 -72
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +488 -94
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +842 -137
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +896 -175
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +395 -70
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +416 -70
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts +79 -9
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +147 -27
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowSquareMatrix.d.ts +58 -3
- package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowSquareMatrix.js +111 -21
- package/dist/linalg/SlowSquareMatrix.js.map +1 -1
- package/dist/linalg/SquareMatrix.d.ts +26 -3
- package/dist/linalg/SquareMatrix.d.ts.map +1 -1
- package/dist/linalg/Vector.d.ts +148 -24
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +484 -84
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +487 -71
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +582 -98
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +625 -134
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +450 -75
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +447 -62
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/types/AxisAngle.d.ts +4 -1
- 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 +41 -8
- package/dist/utility/BigNumber.d.ts.map +1 -1
- package/dist/utility/BigNumber.js +47 -5
- 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 +6 -1
- 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 +20 -51
- package/src/algorithms/combinations.ts +4 -4
- package/src/algorithms/degreesToRadians.ts +3 -3
- package/src/algorithms/factorial.ts +13 -8
- package/src/algorithms/fibonacci.ts +3 -3
- package/src/algorithms/greatestCommonDivisor.ts +15 -19
- package/src/algorithms/hypergeometricPmf.ts +5 -6
- package/src/algorithms/isPrime.ts +4 -4
- package/src/algorithms/permutations.ts +4 -4
- package/src/algorithms/primeFactorization.ts +9 -9
- package/src/algorithms/radiansToDegrees.ts +3 -3
- package/src/algorithms/summation.ts +5 -5
- package/src/index.ts +35 -33
- package/src/linalg/DualQuaternion.ts +558 -804
- package/src/linalg/Matrix.ts +35 -36
- package/src/linalg/Matrix2.ts +277 -413
- package/src/linalg/Matrix3.ts +532 -737
- package/src/linalg/Matrix4.ts +1078 -1604
- package/src/linalg/Quaternion.ts +415 -690
- package/src/linalg/SlowMatrix.ts +118 -69
- package/src/linalg/SlowSquareMatrix.ts +85 -56
- package/src/linalg/SquareMatrix.ts +7 -7
- package/src/linalg/Vector.ts +71 -70
- package/src/linalg/Vector2.ts +380 -576
- package/src/linalg/Vector3.ts +544 -840
- package/src/linalg/Vector4.ts +383 -549
- package/src/types/AxisAngle.ts +1 -1
- package/src/utility/BigNumber.ts +33 -42
- package/src/utility/MagnitudeError.ts +4 -4
- package/src/utility/MatrixSizeError.ts +2 -3
- package/src/utility/PartialMatrixError.ts +2 -3
- package/src/utility/SingularMatrixError.ts +2 -2
- package/src/utility/epsilon.ts +1 -4
- package/dist/types/IntegerRepresentation.d.ts +0 -2
- package/dist/types/IntegerRepresentation.d.ts.map +0 -1
- package/dist/types/IntegerRepresentation.js +0 -2
- package/dist/types/IntegerRepresentation.js.map +0 -1
- package/src/types/IntegerRepresentation.ts +0 -2
package/dist/linalg/Matrix2.d.ts
CHANGED
|
@@ -1,63 +1,348 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import type { MatrixLike } from "./Matrix.js";
|
|
2
|
+
import type SquareMatrix from "./SquareMatrix.js";
|
|
3
|
+
import type { Vector2Like } from "./Vector2.js";
|
|
4
|
+
/**
|
|
5
|
+
* Numbers arranged into two columns and two rows.
|
|
6
|
+
* @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
|
|
7
|
+
*/
|
|
8
|
+
export interface Matrix2Like extends MatrixLike {
|
|
9
|
+
/** The value in the first column and first row. */
|
|
10
|
+
0: number;
|
|
11
|
+
/** The value in the first column and second row. */
|
|
12
|
+
1: number;
|
|
13
|
+
/** The value in the second column and first row. */
|
|
14
|
+
2: number;
|
|
15
|
+
/** The value in the second column and second row. */
|
|
16
|
+
3: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a 2x2 matrix-like object.
|
|
20
|
+
* @returns A 2x2 matrix-like object.
|
|
21
|
+
*/
|
|
22
|
+
export declare const createMatrix2Like: () => Matrix2Like;
|
|
23
|
+
/**
|
|
24
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
25
|
+
* @param r - The angle in radians.
|
|
26
|
+
* @param out - The matrix to store the result in.
|
|
27
|
+
* @returns The transformation matrix.
|
|
28
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
29
|
+
*/
|
|
30
|
+
export declare const fromRotation: <T extends Matrix2Like>(r: number, out: T) => T;
|
|
31
|
+
/**
|
|
32
|
+
* Create a transformation matrix that represents a scaling by the given vector.
|
|
33
|
+
* @param v - The scaling vector.
|
|
34
|
+
* @param out - The matrix to store the result in.
|
|
35
|
+
* @returns The transformation matrix.
|
|
36
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
37
|
+
*/
|
|
38
|
+
export declare const fromScaling: <T extends Matrix2Like>(vector: Vector2Like, out: T) => T;
|
|
39
|
+
/**
|
|
40
|
+
* Create a two-by-two matrix with the given values.
|
|
41
|
+
* @param c0r0 - The value in the first column and first row.
|
|
42
|
+
* @param c0r1 - The value in the first column and second row.
|
|
43
|
+
* @param c1r0 - The value in the second column and first row.
|
|
44
|
+
* @param c1r1 - The value in the second column and second row.
|
|
45
|
+
* @param out - The matrix to store the result in.
|
|
46
|
+
* @returns The matrix.
|
|
47
|
+
*/
|
|
48
|
+
export declare const fromValues: <T extends Matrix2Like>(c0r0: number, c0r1: number, c1r0: number, c1r1: number, out: T) => T;
|
|
49
|
+
/**
|
|
50
|
+
* Determine whether or not two matrices are roughly equivalent.
|
|
51
|
+
* @param a - The first matrix.
|
|
52
|
+
* @param b - The second matrix.
|
|
53
|
+
* @returns Whether or not the matrices are equivalent.
|
|
54
|
+
*/
|
|
55
|
+
export declare const equals: (a: Matrix2Like, b: Matrix2Like) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Determine whether or not two matrices are exactly equivalent.
|
|
58
|
+
* @param a - The first matrix.
|
|
59
|
+
* @param b - The second matrix.
|
|
60
|
+
* @returns Whether the matrices are equivalent.
|
|
61
|
+
*/
|
|
62
|
+
export declare const exactEquals: (a: Matrix2Like, b: Matrix2Like) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Add two matrices.
|
|
65
|
+
* @param a - The augend.
|
|
66
|
+
* @param b - The addend.
|
|
67
|
+
* @param out - The matrix to store the result in.
|
|
68
|
+
* @returns The sum.
|
|
69
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
70
|
+
*/
|
|
71
|
+
export declare const add: <T extends Matrix2Like>(a: Matrix2Like, b: Matrix2Like, out: T) => T;
|
|
72
|
+
/**
|
|
73
|
+
* Calculate the adjugate of a matrix.
|
|
74
|
+
* @param matrix - The matrix.
|
|
75
|
+
* @param out - The matrix to store the result in.
|
|
76
|
+
* @returns The adjugate of the matrix.
|
|
77
|
+
* @see [Adjugate matrix](https://en.wikipedia.org/wiki/Adjugate_matrix)
|
|
78
|
+
*/
|
|
79
|
+
export declare const adjoint: <T extends Matrix2Like>(matrix: Matrix2Like, out: T) => T;
|
|
80
|
+
/**
|
|
81
|
+
* Copy the values from one matrix into another.
|
|
82
|
+
* @param matrix - The matrix to copy.
|
|
83
|
+
* @param out - The matrix to store the result in.
|
|
84
|
+
* @returns The copy matrix.
|
|
85
|
+
*/
|
|
86
|
+
export declare const copy: <T extends Matrix2Like>(matrix: Matrix2Like, out: T) => T;
|
|
87
|
+
/**
|
|
88
|
+
* Calculate the Frobenius norm of a matrix.
|
|
89
|
+
* @param matrix - The matrix.
|
|
90
|
+
* @returns The Frobenius norm.
|
|
91
|
+
* @see [Matrix norm](https://en.wikipedia.org/wiki/Matrix_norm)
|
|
92
|
+
*/
|
|
93
|
+
export declare const frob: (matrix: Matrix2Like) => number;
|
|
94
|
+
/**
|
|
95
|
+
* Multiply one matrix by another.
|
|
96
|
+
* @param a - The multiplicand.
|
|
97
|
+
* @param b - The multiplier.
|
|
98
|
+
* @param out - The matrix to store the result in.
|
|
99
|
+
* @returns The product.
|
|
100
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
101
|
+
*/
|
|
102
|
+
export declare const multiply: <T extends Matrix2Like>(a: Matrix2Like, b: Matrix2Like, out: T) => T;
|
|
103
|
+
/**
|
|
104
|
+
* Multiply a matrix by a scalar value.
|
|
105
|
+
* @param matrix - The multiplicand.
|
|
106
|
+
* @param scalar - The multiplier.
|
|
107
|
+
* @param out - The matrix to store the result in.
|
|
108
|
+
* @returns The product.
|
|
109
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
110
|
+
*/
|
|
111
|
+
export declare const multiplyScalar: <T extends Matrix2Like>(matrix: Matrix2Like, scalar: number, out: T) => T;
|
|
112
|
+
/**
|
|
113
|
+
* Add a matrix to another after multiplying the other by a scalar.
|
|
114
|
+
* @param a - The augend.
|
|
115
|
+
* @param b - The addend.
|
|
116
|
+
* @param scalar - The multiplier.
|
|
117
|
+
* @param out - The matrix to store the result in.
|
|
118
|
+
* @returns The sum.
|
|
119
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
120
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
121
|
+
*/
|
|
122
|
+
export declare const multiplyScalarAndAdd: <T extends Matrix2Like>(a: Matrix2Like, b: Matrix2Like, scalar: number, out: T) => T;
|
|
123
|
+
/**
|
|
124
|
+
* Subtract one matrix from another.
|
|
125
|
+
* @param a - The minuend.
|
|
126
|
+
* @param b - The subtrahend.
|
|
127
|
+
* @param out - The matrix to store the result in.
|
|
128
|
+
* @returns The difference.
|
|
129
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
130
|
+
*/
|
|
131
|
+
export declare const subtract: <T extends Matrix2Like>(a: Matrix2Like, b: Matrix2Like, out: T) => T;
|
|
132
|
+
/**
|
|
133
|
+
* Transpose a matrix.
|
|
134
|
+
* @param matrix - The matrix.
|
|
135
|
+
* @param out - The matrix to store the result in.
|
|
136
|
+
* @returns The transpose of the matrix.
|
|
137
|
+
* @see [Transpose](https://en.wikipedia.org/wiki/Transpose)
|
|
138
|
+
*/
|
|
139
|
+
export declare const transpose: <T extends Matrix2Like>(matrix: Matrix2Like, out: T) => T;
|
|
140
|
+
/**
|
|
141
|
+
* Calculate the determinant of a matrix.
|
|
142
|
+
* @param matrix- The matrix.
|
|
143
|
+
* @returns The determinant.
|
|
144
|
+
* @see [Determinant](https://en.wikipedia.org/wiki/Determinant)
|
|
145
|
+
*/
|
|
146
|
+
export declare const determinant: (matrix: Matrix2Like) => number;
|
|
147
|
+
/**
|
|
148
|
+
* Reset a matrix to identity.
|
|
149
|
+
* @param out - The matrix to store the result in.
|
|
150
|
+
* @returns The matrix.
|
|
151
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
152
|
+
*/
|
|
153
|
+
export declare const identity: <T extends Matrix2Like>(out: T) => T;
|
|
154
|
+
/**
|
|
155
|
+
* Invert a matrix.
|
|
156
|
+
* @param matrix - The matrix.
|
|
157
|
+
* @param out - The matrix to store the result in.
|
|
158
|
+
* @returns The inverted matrix.
|
|
159
|
+
* @see [Invertible matrix](https://en.wikipedia.org/wiki/Invertible_matrix)
|
|
160
|
+
*/
|
|
161
|
+
export declare const invert: <T extends Matrix2Like>(matrix: Matrix2Like, out: T) => T;
|
|
162
|
+
/**
|
|
163
|
+
* Rotate a matrix by the given angle.
|
|
164
|
+
* @param matrix - The matrix.
|
|
165
|
+
* @param r - The angle in radians.
|
|
166
|
+
* @param out - The matrix to store the result in.
|
|
167
|
+
* @returns The rotated matrix.
|
|
168
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
169
|
+
*/
|
|
170
|
+
export declare const rotate: <T extends Matrix2Like>(matrix: Matrix2Like, r: number, out: T) => T;
|
|
171
|
+
/**
|
|
172
|
+
* Scale a matrix by the given vector.
|
|
173
|
+
* @param matrix - The matrix.
|
|
174
|
+
* @param vector - The scaling vector.
|
|
175
|
+
* @param out - The matrix to store the result in.
|
|
176
|
+
* @returns The scaled matrix.
|
|
177
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
178
|
+
*/
|
|
179
|
+
export declare const scale: <T extends Matrix2Like>(matrix: Matrix2Like, vector: Vector2Like, out: T) => T;
|
|
180
|
+
/**
|
|
181
|
+
* A two-by-two matrix.
|
|
182
|
+
* @see [Matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics))
|
|
183
|
+
*/
|
|
184
|
+
export default class Matrix2 extends Float32Array implements SquareMatrix, Matrix2Like {
|
|
185
|
+
/**
|
|
186
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
187
|
+
* @param r - The angle in radians.
|
|
188
|
+
* @param out - The matrix to store the result in.
|
|
189
|
+
* @returns The transformation matrix.
|
|
190
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
191
|
+
*/
|
|
192
|
+
static fromRotation<T extends Matrix2Like>(r: number, out?: T): T;
|
|
193
|
+
/**
|
|
194
|
+
* Create a transformation matrix that represents a scaling by the given vector.
|
|
195
|
+
* @param vector - The scaling vector.
|
|
196
|
+
* @param out - The matrix to store the result in.
|
|
197
|
+
* @returns The transformation matrix.
|
|
198
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
199
|
+
*/
|
|
200
|
+
static fromScaling<T extends Matrix2Like>(vector: Vector2Like, out?: T): T;
|
|
201
|
+
/**
|
|
202
|
+
* Create a two-by-two matrix with the given values.
|
|
203
|
+
* @param c0r0 - The value in the first column and first row.
|
|
204
|
+
* @param c0r1 - The value in the first column and second row.
|
|
205
|
+
* @param c1r0 - The value in the second column and first row.
|
|
206
|
+
* @param c1r1 - The value in the second column and second row.
|
|
207
|
+
* @param out - The matrix to store the result in.
|
|
208
|
+
* @returns The matrix.
|
|
209
|
+
*/
|
|
210
|
+
static fromValues<T extends Matrix2Like>(c0r0: number, c0r1: number, c1r0: number, c1r1: number, out?: T): T;
|
|
211
|
+
/**
|
|
212
|
+
* Create a two-by-two identity matrix.
|
|
213
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
214
|
+
*/
|
|
31
215
|
constructor();
|
|
216
|
+
/** The value in the first column and first row. */
|
|
217
|
+
0: number;
|
|
218
|
+
/** The value in the first column and second row. */
|
|
219
|
+
1: number;
|
|
220
|
+
/** The value in the second column and first row. */
|
|
221
|
+
2: number;
|
|
222
|
+
/** The value in the second column and second row. */
|
|
223
|
+
3: number;
|
|
224
|
+
/** The number of columns in this matrix. */
|
|
32
225
|
readonly width: 2;
|
|
226
|
+
/** The number of rows in this matrix. */
|
|
33
227
|
readonly height: 2;
|
|
228
|
+
/**
|
|
229
|
+
* Determine whether or not this matrix is roughly equivalent to another.
|
|
230
|
+
* @param matrix - The other matrix.
|
|
231
|
+
* @returns Whether the matrices are equivalent.
|
|
232
|
+
*/
|
|
34
233
|
equals(matrix: Matrix2Like): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Determine whether or not this matrix is exactly equivalent to another.
|
|
236
|
+
* @param matrix - The other matrix.
|
|
237
|
+
* @returns Whether the matrices are equivalent.
|
|
238
|
+
*/
|
|
35
239
|
exactEquals(matrix: Matrix2Like): boolean;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Add another matrix to this one.
|
|
242
|
+
* @param matrix - The other matrix.
|
|
243
|
+
* @param out - The matrix to store the result in.
|
|
244
|
+
* @returns The sum of the matrices.
|
|
245
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
246
|
+
*/
|
|
247
|
+
add<T extends Matrix2Like>(matrix: Matrix2Like, out?: T): T;
|
|
248
|
+
/**
|
|
249
|
+
* Calculate the adjugate of this matrix.
|
|
250
|
+
* @param out - The matrix to store the result in.
|
|
251
|
+
* @returns The adjugate of this matrix.
|
|
252
|
+
* @see [Adjugate matrix](https://en.wikipedia.org/wiki/Adjugate_matrix)
|
|
253
|
+
*/
|
|
254
|
+
adjoint<T extends Matrix2Like>(out?: T): T;
|
|
255
|
+
/**
|
|
256
|
+
* Copy the values from this matrix to another one.
|
|
257
|
+
* @param out - The matrix to store the result in.
|
|
258
|
+
* @returns The copy.
|
|
259
|
+
*/
|
|
260
|
+
clone<T extends Matrix2Like>(out?: T): T;
|
|
261
|
+
/**
|
|
262
|
+
* Copy the values of another matrix into this one.
|
|
263
|
+
* @param matrix - The matrix to copy.
|
|
264
|
+
* @returns This matrix.
|
|
265
|
+
*/
|
|
42
266
|
copy(matrix: Matrix2Like): this;
|
|
267
|
+
/**
|
|
268
|
+
* Get the Frobenius norm of this matrix.
|
|
269
|
+
* @see [Matrix norm](https://en.wikipedia.org/wiki/Matrix_norm)
|
|
270
|
+
*/
|
|
43
271
|
get frob(): number;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Multiply this matrix by another.
|
|
274
|
+
* @param matrix - The other matrix.
|
|
275
|
+
* @param out - The matrix to store the result in.
|
|
276
|
+
* @returns The product of the matrices.
|
|
277
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
278
|
+
*/
|
|
279
|
+
multiply<T extends Matrix2Like>(matrix: Matrix2Like, out?: T): T;
|
|
280
|
+
/**
|
|
281
|
+
* Multiply this matrix by a scalar value.
|
|
282
|
+
* @param scalar - The scalar value.
|
|
283
|
+
* @param out - The matrix to store the result in.
|
|
284
|
+
* @returns The product of the matrix and the scalar value.
|
|
285
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
286
|
+
*/
|
|
287
|
+
multiplyScalar<T extends Matrix2Like>(scalar: number, out?: T): T;
|
|
288
|
+
/**
|
|
289
|
+
* Add this matrix to another after multiplying the other by a scalar.
|
|
290
|
+
* @param matrix - The other matrix.
|
|
291
|
+
* @param scalar - The scalar.
|
|
292
|
+
* @param out - The matrix to store the result in.
|
|
293
|
+
* @returns The sum.
|
|
294
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
295
|
+
* @see [Matrix multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication)
|
|
296
|
+
*/
|
|
297
|
+
multiplyScalarAndAdd<T extends Matrix2Like>(matrix: Matrix2Like, scalar: number, out?: T): T;
|
|
298
|
+
/**
|
|
299
|
+
* Subtract another matrix from this one.
|
|
300
|
+
* @param matrix - The other matrix.
|
|
301
|
+
* @param out - The matrix to store the result in.
|
|
302
|
+
* @returns The difference between the matrices.
|
|
303
|
+
* @see [Matrix addition](https://en.wikipedia.org/wiki/Matrix_addition)
|
|
304
|
+
*/
|
|
305
|
+
subtract<T extends Matrix2Like>(matrix: Matrix2Like, out?: T): T;
|
|
306
|
+
/**
|
|
307
|
+
* Transpose this matrix.
|
|
308
|
+
* @param out - The matrix to store the result in.
|
|
309
|
+
* @returns The transpose of this matrix.
|
|
310
|
+
* @see [Transpose](https://en.wikipedia.org/wiki/Transpose)
|
|
311
|
+
*/
|
|
312
|
+
transpose<T extends Matrix2Like>(out?: T): T;
|
|
313
|
+
/**
|
|
314
|
+
* Get the determinant of this matrix.
|
|
315
|
+
* @see [Determinant](https://en.wikipedia.org/wiki/Determinant)
|
|
316
|
+
*/
|
|
54
317
|
get determinant(): number;
|
|
318
|
+
/**
|
|
319
|
+
* Reset this matrix to identity.
|
|
320
|
+
* @returns This matrix.
|
|
321
|
+
* @see [Identity matrix](https://en.wikipedia.org/wiki/Identity_matrix)
|
|
322
|
+
*/
|
|
55
323
|
identity(): this;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Invert this matrix.
|
|
326
|
+
* @param out - The matrix to store the result in.
|
|
327
|
+
* @returns The inverted matrix.
|
|
328
|
+
* @see [Invertible matrix](https://en.wikipedia.org/wiki/Invertible_matrix)
|
|
329
|
+
*/
|
|
330
|
+
invert<T extends Matrix2Like>(out?: T): T;
|
|
331
|
+
/**
|
|
332
|
+
* Rotate this matrix by the given angle.
|
|
333
|
+
* @param r - The angle in radians.
|
|
334
|
+
* @param out - The matrix to store the result in.
|
|
335
|
+
* @returns The rotated matrix.
|
|
336
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
337
|
+
*/
|
|
338
|
+
rotate<T extends Matrix2Like>(r: number, out?: T): T;
|
|
339
|
+
/**
|
|
340
|
+
* Scale this matrix by the given vector.
|
|
341
|
+
* @param vector - The scaling vector.
|
|
342
|
+
* @param out - The matrix to store the result in.
|
|
343
|
+
* @returns The scaled matrix.
|
|
344
|
+
* @see [Transformation matrix](https://en.wikipedia.org/wiki/Transformation_matrix)
|
|
345
|
+
*/
|
|
346
|
+
scale<T extends Matrix2Like>(vector: Vector2Like, out?: T): T;
|
|
62
347
|
}
|
|
63
348
|
//# sourceMappingURL=Matrix2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matrix2.d.ts","sourceRoot":"","sources":["../../src/linalg/Matrix2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,
|
|
1
|
+
{"version":3,"file":"Matrix2.d.ts","sourceRoot":"","sources":["../../src/linalg/Matrix2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC9C,mDAAmD;IACnD,CAAC,EAAE,MAAM,CAAC;IAEV,oDAAoD;IACp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