@lakuna/umath 2.0.0 → 3.0.1
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/greatestCommonDivisor.d.ts.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.js +14 -4
- package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +158 -158
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +173 -165
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix.d.ts +24 -24
- package/dist/linalg/Matrix.d.ts.map +1 -1
- package/dist/linalg/Matrix2.d.ts +85 -85
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +92 -88
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +134 -134
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +147 -138
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +245 -246
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +272 -251
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +147 -146
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +175 -161
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts +12 -12
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +12 -12
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowSquareMatrix.d.ts +7 -7
- package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowSquareMatrix.js +15 -15
- package/dist/linalg/SlowSquareMatrix.js.map +1 -1
- package/dist/linalg/SlowVector.d.ts +77 -77
- package/dist/linalg/SlowVector.d.ts.map +1 -1
- package/dist/linalg/SlowVector.js +153 -153
- package/dist/linalg/SlowVector.js.map +1 -1
- package/dist/linalg/SquareMatrix.d.ts +8 -8
- package/dist/linalg/SquareMatrix.d.ts.map +1 -1
- package/dist/linalg/Vector.d.ts +85 -84
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +143 -143
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +145 -143
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +173 -173
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +176 -173
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +137 -137
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +144 -140
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/types/AxisAngle.d.ts +11 -1
- package/dist/types/AxisAngle.d.ts.map +1 -1
- package/dist/types/FieldOfView.d.ts +2 -2
- package/dist/types/FieldOfView.d.ts.map +1 -1
- package/dist/utility/BigNumber.d.ts +21 -11
- package/dist/utility/BigNumber.d.ts.map +1 -1
- package/dist/utility/BigNumber.js +49 -31
- package/dist/utility/BigNumber.js.map +1 -1
- package/dist/utility/createAxisAngleLike.d.ts.map +1 -1
- package/dist/utility/createAxisAngleLike.js.map +1 -1
- package/package.json +13 -12
- package/src/algorithms/greatestCommonDivisor.ts +19 -7
- package/src/index.ts +21 -14
- package/src/linalg/DualQuaternion.ts +264 -238
- package/src/linalg/Matrix.ts +31 -28
- package/src/linalg/Matrix2.ts +157 -137
- package/src/linalg/Matrix3.ts +222 -191
- package/src/linalg/Matrix4.ts +464 -412
- package/src/linalg/Quaternion.ts +267 -234
- package/src/linalg/SlowMatrix.ts +31 -27
- package/src/linalg/SlowSquareMatrix.ts +19 -18
- package/src/linalg/SlowVector.ts +175 -174
- package/src/linalg/SquareMatrix.ts +9 -9
- package/src/linalg/Vector.ts +91 -89
- package/src/linalg/Vector2.ts +250 -217
- package/src/linalg/Vector3.ts +309 -269
- package/src/linalg/Vector4.ts +246 -206
- package/src/types/AxisAngle.ts +13 -1
- package/src/types/FieldOfView.ts +3 -3
- package/src/utility/BigNumber.ts +71 -38
- package/src/utility/createAxisAngleLike.ts +1 -0
|
@@ -5,11 +5,6 @@ import type { default as Matrix, MatrixLike } from "./Matrix.js";
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export default class SlowMatrix extends Float32Array implements Matrix {
|
|
8
|
-
/**
|
|
9
|
-
* Create a variable-size matrix from the given columns.
|
|
10
|
-
* @param cols - The columns in the matrix.
|
|
11
|
-
*/
|
|
12
|
-
constructor(...cols: number[][]);
|
|
13
8
|
/** The number of rows in this matrix. */
|
|
14
9
|
readonly height: number;
|
|
15
10
|
/** The number of columns in this matrix. */
|
|
@@ -19,13 +14,18 @@ export default class SlowMatrix extends Float32Array implements Matrix {
|
|
|
19
14
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
|
|
20
15
|
*/
|
|
21
16
|
get frob(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Create a variable-size matrix from the given columns.
|
|
19
|
+
* @param cols - The columns in the matrix.
|
|
20
|
+
*/
|
|
21
|
+
constructor(...cols: readonly (readonly number[])[]);
|
|
22
22
|
/**
|
|
23
23
|
* Add two matrices of the same size.
|
|
24
24
|
* @param matrix - The other matrix.
|
|
25
25
|
* @returns The sum of the matrices.
|
|
26
26
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
27
27
|
*/
|
|
28
|
-
add(matrix: MatrixLike): SlowMatrix;
|
|
28
|
+
add(matrix: Readonly<MatrixLike>): SlowMatrix;
|
|
29
29
|
/**
|
|
30
30
|
* Create a copy of this matrix.
|
|
31
31
|
* @returns A copy of this matrix.
|
|
@@ -36,26 +36,26 @@ export default class SlowMatrix extends Float32Array implements Matrix {
|
|
|
36
36
|
* @param matrix - The matrix to copy.
|
|
37
37
|
* @returns This matrix.
|
|
38
38
|
*/
|
|
39
|
-
copy(matrix: MatrixLike): this;
|
|
39
|
+
copy(matrix: Readonly<MatrixLike>): this;
|
|
40
40
|
/**
|
|
41
41
|
* Determine whether or not this matrix is roughly equivalent to another.
|
|
42
42
|
* @param matrix - The other matrix.
|
|
43
43
|
* @returns Whether or not the matrices are equivalent.
|
|
44
44
|
*/
|
|
45
|
-
equals(matrix: MatrixLike): boolean;
|
|
45
|
+
equals(matrix: Readonly<MatrixLike>): boolean;
|
|
46
46
|
/**
|
|
47
47
|
* Determine whether this matrix is exactly equivalent to another.
|
|
48
48
|
* @param matrix - The other matrix.
|
|
49
49
|
* @returns Whether the matrices are equivalent.
|
|
50
50
|
*/
|
|
51
|
-
exactEquals(matrix: MatrixLike): boolean;
|
|
51
|
+
exactEquals(matrix: Readonly<MatrixLike>): boolean;
|
|
52
52
|
/**
|
|
53
53
|
* Multiply this matrix by another.
|
|
54
54
|
* @param matrix - The other matrix.
|
|
55
55
|
* @returns The product of the matrices.
|
|
56
56
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
|
|
57
57
|
*/
|
|
58
|
-
multiply(matrix: MatrixLike): SlowMatrix;
|
|
58
|
+
multiply(matrix: Readonly<MatrixLike>): SlowMatrix;
|
|
59
59
|
/**
|
|
60
60
|
* Multiply this matrix by a scalar value.
|
|
61
61
|
* @param scalar - The scalar value.
|
|
@@ -71,14 +71,14 @@ export default class SlowMatrix extends Float32Array implements Matrix {
|
|
|
71
71
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
72
72
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
|
|
73
73
|
*/
|
|
74
|
-
multiplyScalarAndAdd(matrix: MatrixLike
|
|
74
|
+
multiplyScalarAndAdd(matrix: Readonly<MatrixLike>, scalar: number): SlowMatrix;
|
|
75
75
|
/**
|
|
76
76
|
* Subtract another matrix from this one.
|
|
77
77
|
* @param matrix - The other matrix.
|
|
78
78
|
* @returns The difference between the matrices.
|
|
79
79
|
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
80
80
|
*/
|
|
81
|
-
subtract(matrix: MatrixLike): SlowMatrix;
|
|
81
|
+
subtract(matrix: Readonly<MatrixLike>): SlowMatrix;
|
|
82
82
|
/**
|
|
83
83
|
* Transpose this matrix.
|
|
84
84
|
* @returns The transpose of this matrix.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowMatrix.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SlowMatrix.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,IAAI,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA4BjE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAa,YAAW,MAAM;IACrE,yCAAyC;IACzC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,4CAA4C;IAC5C,SAAgB,KAAK,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;OAGG;gBACgB,GAAG,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE;IAc1D;;;;;OAKG;IACI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;IAoBpD;;;OAGG;IACI,KAAK,IAAI,UAAU;IAW1B;;;;OAIG;IACI,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAgB/C;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO;IAkBpD;;;;OAIG;IACI,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO;IAkBzD;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;IA0BzD;;;;;OAKG;IACI,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IASjD;;;;;;;OAOG;IACI,oBAAoB,CAC1B,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC5B,MAAM,EAAE,MAAM,GACZ,UAAU;IAoBb;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;IAoBzD;;;;OAIG;IACI,SAAS,IAAI,UAAU;CAU9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import approx from "../algorithms/approx.js";
|
|
1
2
|
import MatrixSizeError from "../utility/MatrixSizeError.js";
|
|
2
3
|
import PartialMatrixError from "../utility/PartialMatrixError.js";
|
|
3
|
-
import approx from "../algorithms/approx.js";
|
|
4
4
|
/**
|
|
5
5
|
* Determine whether the given `MatrixLike` has size information.
|
|
6
6
|
* @internal
|
|
@@ -15,6 +15,17 @@ const isSized = (matrix) => "width" in matrix &&
|
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
17
|
export default class SlowMatrix extends Float32Array {
|
|
18
|
+
/** The number of rows in this matrix. */
|
|
19
|
+
height;
|
|
20
|
+
/** The number of columns in this matrix. */
|
|
21
|
+
width;
|
|
22
|
+
/**
|
|
23
|
+
* Get the Frobenius norm of this matrix.
|
|
24
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
|
|
25
|
+
*/
|
|
26
|
+
get frob() {
|
|
27
|
+
return Math.hypot(...this);
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* Create a variable-size matrix from the given columns.
|
|
20
31
|
* @param cols - The columns in the matrix.
|
|
@@ -30,17 +41,6 @@ export default class SlowMatrix extends Float32Array {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
|
-
/** The number of rows in this matrix. */
|
|
34
|
-
height;
|
|
35
|
-
/** The number of columns in this matrix. */
|
|
36
|
-
width;
|
|
37
|
-
/**
|
|
38
|
-
* Get the Frobenius norm of this matrix.
|
|
39
|
-
* @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
|
|
40
|
-
*/
|
|
41
|
-
get frob() {
|
|
42
|
-
return Math.hypot(...this);
|
|
43
|
-
}
|
|
44
44
|
/**
|
|
45
45
|
* Add two matrices of the same size.
|
|
46
46
|
* @param matrix - The other matrix.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowMatrix.js","sourceRoot":"","sources":["../../src/linalg/SlowMatrix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SlowMatrix.js","sourceRoot":"","sources":["../../src/linalg/SlowMatrix.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,kBAAkB,MAAM,kCAAkC,CAAC;AAclE;;;GAGG;AACH,MAAM,OAAO,GAAG,CAAC,MAA4B,EAA6B,EAAE,CAC3E,OAAO,IAAI,MAAM;IACjB,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;IAChC,QAAQ,IAAI,MAAM;IAClB,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;AAEnC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAY;IACnD,yCAAyC;IACzB,MAAM,CAAS;IAE/B,4CAA4C;IAC5B,KAAK,CAAS;IAE9B;;;O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AC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACzD,CAAC;QACF,CAAC;QAED,OAAO,IAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,SAAS;QACf,MAAM,IAAI,GAAe,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;YACtD,CAAC;QACF,CAAC;QAED,OAAO,IAAI,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC;CACD"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import SlowMatrix from "./SlowMatrix.js";
|
|
2
1
|
import type SquareMatrix from "./SquareMatrix.js";
|
|
2
|
+
import SlowMatrix from "./SlowMatrix.js";
|
|
3
3
|
/**
|
|
4
4
|
* A variable-size matrix with the same number of rows and columns.
|
|
5
5
|
* @see {@link https://en.wikipedia.org/wiki/Square_matrix | Square matrix}
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default class SlowSquareMatrix extends SlowMatrix implements SquareMatrix {
|
|
9
|
-
/**
|
|
10
|
-
* Create a variable-size matrix with the same number of rows and columns from the given columns.
|
|
11
|
-
* @param cols - The columns in the matrix.
|
|
12
|
-
* @see {@link https://en.wikipedia.org/wiki/Square_matrix | Square matrix}
|
|
13
|
-
*/
|
|
14
|
-
constructor(...cols: number[][]);
|
|
15
9
|
/**
|
|
16
10
|
* Get the determinant of this matrix.
|
|
17
11
|
* @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
|
|
18
12
|
*/
|
|
19
13
|
get determinant(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Create a variable-size matrix with the same number of rows and columns from the given columns.
|
|
16
|
+
* @param cols - The columns in the matrix.
|
|
17
|
+
* @see {@link https://en.wikipedia.org/wiki/Square_matrix | Square matrix}
|
|
18
|
+
*/
|
|
19
|
+
constructor(...cols: readonly (readonly number[])[]);
|
|
20
20
|
/**
|
|
21
21
|
* Calculate the adjugate of this matrix.
|
|
22
22
|
* @returns The adjugate of this matrix.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowSquareMatrix.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowSquareMatrix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SlowSquareMatrix.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowSquareMatrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAIlD,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBACpB,SAAQ,UACR,YAAW,YAAY;IAEvB;;;OAGG;IACH,IAAW,WAAW,IAAI,MAAM,CAmB/B;IAED;;;;OAIG;gBACgB,GAAG,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE;IAY1D;;;;OAIG;IACI,OAAO,IAAI,gBAAgB;IAIlC;;;OAGG;IACa,KAAK,IAAI,gBAAgB;IAezC;;;;OAIG;IACI,QAAQ,IAAI,gBAAgB;IAanC;;;;OAIG;IACI,QAAQ,IAAI,IAAI;IAUvB;;;;OAIG;IACI,MAAM,IAAI,gBAAgB;IAgEjC;;;;;;OAMG;IACI,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9C;;;;;OAKG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB;IAyB5D;;;;OAIG;IACa,SAAS,IAAI,gBAAgB;CAe7C"}
|
|
@@ -7,21 +7,6 @@ import SlowMatrix from "./SlowMatrix.js";
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export default class SlowSquareMatrix extends SlowMatrix {
|
|
10
|
-
/**
|
|
11
|
-
* Create a variable-size matrix with the same number of rows and columns from the given columns.
|
|
12
|
-
* @param cols - The columns in the matrix.
|
|
13
|
-
* @see {@link https://en.wikipedia.org/wiki/Square_matrix | Square matrix}
|
|
14
|
-
*/
|
|
15
|
-
constructor(...cols) {
|
|
16
|
-
super(...cols);
|
|
17
|
-
// Ensure that every column is the same height and that the height is equal to the width.
|
|
18
|
-
for (let i = 0; i < this.width; i++) {
|
|
19
|
-
const col = cols[i];
|
|
20
|
-
if (col?.length !== this.height) {
|
|
21
|
-
throw new MatrixSizeError();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
10
|
/**
|
|
26
11
|
* Get the determinant of this matrix.
|
|
27
12
|
* @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
|
|
@@ -43,6 +28,21 @@ export default class SlowSquareMatrix extends SlowMatrix {
|
|
|
43
28
|
}
|
|
44
29
|
return out;
|
|
45
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a variable-size matrix with the same number of rows and columns from the given columns.
|
|
33
|
+
* @param cols - The columns in the matrix.
|
|
34
|
+
* @see {@link https://en.wikipedia.org/wiki/Square_matrix | Square matrix}
|
|
35
|
+
*/
|
|
36
|
+
constructor(...cols) {
|
|
37
|
+
super(...cols);
|
|
38
|
+
// Ensure that every column is the same height and that the height is equal to the width.
|
|
39
|
+
for (let i = 0; i < this.width; i++) {
|
|
40
|
+
const col = cols[i];
|
|
41
|
+
if (col?.length !== this.height) {
|
|
42
|
+
throw new MatrixSizeError();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
46
|
/**
|
|
47
47
|
* Calculate the adjugate of this matrix.
|
|
48
48
|
* @returns The adjugate of this matrix.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowSquareMatrix.js","sourceRoot":"","sources":["../../src/linalg/SlowSquareMatrix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SlowSquareMatrix.js","sourceRoot":"","sources":["../../src/linalg/SlowSquareMatrix.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAC5D,OAAO,mBAAmB,MAAM,mCAAmC,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBACpB,SAAQ,UAAU;IAGlB;;;OAGG;IACH,IAAW,WAAW;QACrB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,eAAe,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,OAAO,CAAC,KAAK,WAAW,EAAE,CAAC;gBAC9B,MAAM,IAAI,eAAe,EAAE,CAAC;YAC7B,CAAC;YACD,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAA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AE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBACpC,IAAI,OAAO,CAAC,KAAK,WAAW,EAAE,CAAC;oBAC9B,MAAM,IAAI,eAAe,EAAE,CAAC;gBAC7B,CAAC;gBAED,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACF,CAAC;QAED,OAAO,IAAI,gBAAgB,CAAC,GAAG,IAAI,CAAC,CAAC;IACtC,CAAC;CACD"}
|
|
@@ -6,29 +6,26 @@ import type { VectorLike } from "./Vector.js";
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export default class SlowVector extends Float32Array implements Vector {
|
|
9
|
+
/** Get the magnitude (length) of this vector. */
|
|
10
|
+
get magnitude(): number;
|
|
11
|
+
/** Get the squared magnitude (length) of this vector. */
|
|
12
|
+
get squaredMagnitude(): number;
|
|
9
13
|
/**
|
|
10
14
|
* Create a variable-size vector from the given values.
|
|
11
15
|
* @param values - The values in the vector.
|
|
12
16
|
*/
|
|
13
|
-
constructor(...values: number[]);
|
|
14
|
-
/**
|
|
15
|
-
* Determine whether this vector is roughly equivalent to another.
|
|
16
|
-
* @param vector - The other vector.
|
|
17
|
-
* @returns Whether the vectors are equivalent.
|
|
18
|
-
*/
|
|
19
|
-
equals(vector: VectorLike): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Determine whether this vector is exactly equivalent to another.
|
|
22
|
-
* @param vector - The other vector.
|
|
23
|
-
* @returns Whether the vectors are equivalent.
|
|
24
|
-
*/
|
|
25
|
-
exactEquals(vector: VectorLike): boolean;
|
|
17
|
+
constructor(...values: readonly number[]);
|
|
26
18
|
/**
|
|
27
19
|
* Add two vectors of the same size.
|
|
28
20
|
* @param vector - The other vector.
|
|
29
21
|
* @returns The sum of the vectors.
|
|
30
22
|
*/
|
|
31
|
-
add(vector: VectorLike): SlowVector;
|
|
23
|
+
add(vector: Readonly<VectorLike>): SlowVector;
|
|
24
|
+
/**
|
|
25
|
+
* Round up the components of this vector.
|
|
26
|
+
* @returns The rounded vector.
|
|
27
|
+
*/
|
|
28
|
+
ceil(): SlowVector;
|
|
32
29
|
/**
|
|
33
30
|
* Create a copy of this vector.
|
|
34
31
|
* @returns A copy of this vector.
|
|
@@ -39,58 +36,101 @@ export default class SlowVector extends Float32Array implements Vector {
|
|
|
39
36
|
* @param vector - The vector to copy.
|
|
40
37
|
* @returns This vector.
|
|
41
38
|
*/
|
|
42
|
-
copy(vector: VectorLike): this;
|
|
39
|
+
copy(vector: Readonly<VectorLike>): this;
|
|
43
40
|
/**
|
|
44
|
-
*
|
|
41
|
+
* Calculate the Euclidean distance between this vector and another.
|
|
45
42
|
* @param vector - The other vector.
|
|
46
|
-
* @returns The
|
|
43
|
+
* @returns The distance.
|
|
47
44
|
*/
|
|
48
|
-
|
|
45
|
+
distance(vector: Readonly<VectorLike>): number;
|
|
49
46
|
/**
|
|
50
47
|
* Divide this vector by another.
|
|
51
48
|
* @param vector - The other vector.
|
|
52
49
|
* @returns The quotient of the vectors.
|
|
53
50
|
*/
|
|
54
|
-
divide(vector: VectorLike): SlowVector;
|
|
51
|
+
divide(vector: Readonly<VectorLike>): SlowVector;
|
|
55
52
|
/**
|
|
56
|
-
*
|
|
53
|
+
* Calculate the dot product of this and another vector.
|
|
57
54
|
* @param vector - The other vector.
|
|
58
|
-
* @returns The
|
|
55
|
+
* @returns The dot product.
|
|
56
|
+
* @see {@link https://en.wikipedia.org/wiki/Dot_product | Dot product}
|
|
59
57
|
*/
|
|
60
|
-
|
|
58
|
+
dot(vector: Readonly<VectorLike>): number;
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @
|
|
60
|
+
* Determine whether this vector is roughly equivalent to another.
|
|
61
|
+
* @param vector - The other vector.
|
|
62
|
+
* @returns Whether the vectors are equivalent.
|
|
64
63
|
*/
|
|
65
|
-
|
|
64
|
+
equals(vector: Readonly<VectorLike>): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Determine whether this vector is exactly equivalent to another.
|
|
67
|
+
* @param vector - The other vector.
|
|
68
|
+
* @returns Whether the vectors are equivalent.
|
|
69
|
+
*/
|
|
70
|
+
exactEquals(vector: Readonly<VectorLike>): boolean;
|
|
66
71
|
/**
|
|
67
72
|
* Round down the components of this vector.
|
|
68
73
|
* @returns The rounded vector.
|
|
69
74
|
*/
|
|
70
75
|
floor(): SlowVector;
|
|
71
76
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @returns The
|
|
77
|
+
* Calculate the multiplicative inverse of the components of this vector.
|
|
78
|
+
* @returns The inverted vector.
|
|
74
79
|
*/
|
|
75
|
-
|
|
80
|
+
invert(): SlowVector;
|
|
76
81
|
/**
|
|
77
|
-
*
|
|
82
|
+
* Perform a linear interpolation between this and another vector.
|
|
78
83
|
* @param vector - The other vector.
|
|
79
|
-
* @
|
|
84
|
+
* @param t - The interpolation amount (in `[0,1]`).
|
|
85
|
+
* @returns The interpolated vector.
|
|
80
86
|
*/
|
|
81
|
-
|
|
87
|
+
lerp(vector: Readonly<VectorLike>, t: number): SlowVector;
|
|
82
88
|
/**
|
|
83
89
|
* Return the maximum of this and another vector.
|
|
84
90
|
* @param vector - The other vector.
|
|
85
91
|
* @returns The maximum.
|
|
86
92
|
*/
|
|
87
|
-
max(vector: VectorLike): SlowVector;
|
|
93
|
+
max(vector: Readonly<VectorLike>): SlowVector;
|
|
94
|
+
/**
|
|
95
|
+
* Return the minimum of this and another vector.
|
|
96
|
+
* @param vector - The other vector.
|
|
97
|
+
* @returns The minimum.
|
|
98
|
+
*/
|
|
99
|
+
min(vector: Readonly<VectorLike>): SlowVector;
|
|
100
|
+
/**
|
|
101
|
+
* Multiply this vector by another.
|
|
102
|
+
* @param vector - The other vector.
|
|
103
|
+
* @returns The product of the vectors.
|
|
104
|
+
*/
|
|
105
|
+
multiply(vector: Readonly<VectorLike>): SlowVector;
|
|
106
|
+
/**
|
|
107
|
+
* Negate this vector.
|
|
108
|
+
* @returns The negated vector.
|
|
109
|
+
*/
|
|
110
|
+
negate(): SlowVector;
|
|
111
|
+
/**
|
|
112
|
+
* Normalize this vector.
|
|
113
|
+
* @returns The normalized vector.
|
|
114
|
+
* @see {@link https://en.wikipedia.org/wiki/Unit_vector | Unit vector}
|
|
115
|
+
*/
|
|
116
|
+
normalize(): SlowVector;
|
|
88
117
|
/**
|
|
89
118
|
* Raise each component of this vector to the given power.
|
|
90
119
|
* @param exponent - The exponent (power) to raise each component to.
|
|
91
120
|
* @returns The power (result of the exponentiation).
|
|
92
121
|
*/
|
|
93
122
|
pow(exponent: number): SlowVector;
|
|
123
|
+
/**
|
|
124
|
+
* Set this vector to a random value with the given magnitude.
|
|
125
|
+
* @param magnitude - The magnitude.
|
|
126
|
+
* @returns This vector.
|
|
127
|
+
*/
|
|
128
|
+
random(magnitude: number): this;
|
|
129
|
+
/**
|
|
130
|
+
* Round the components of this vector.
|
|
131
|
+
* @returns The rounded vector.
|
|
132
|
+
*/
|
|
133
|
+
round(): SlowVector;
|
|
94
134
|
/**
|
|
95
135
|
* Scale this vector by a scalar.
|
|
96
136
|
* @param scalar - The scalar.
|
|
@@ -103,59 +143,19 @@ export default class SlowVector extends Float32Array implements Vector {
|
|
|
103
143
|
* @param scalar - The scalar.
|
|
104
144
|
* @returns The sum.
|
|
105
145
|
*/
|
|
106
|
-
scaleAndAdd(vector: VectorLike
|
|
107
|
-
/**
|
|
108
|
-
* Calculate the Euclidean distance between this vector and another.
|
|
109
|
-
* @param vector - The other vector.
|
|
110
|
-
* @returns The distance.
|
|
111
|
-
*/
|
|
112
|
-
distance(vector: VectorLike): number;
|
|
146
|
+
scaleAndAdd(vector: Readonly<VectorLike>, scalar: number): SlowVector;
|
|
113
147
|
/**
|
|
114
148
|
* Calculate the squared Euclidean distance between this vector and another.
|
|
115
149
|
* @param vector - The other vector.
|
|
116
150
|
* @returns The squared distance.
|
|
117
151
|
*/
|
|
118
|
-
squaredDistance(vector: VectorLike): number;
|
|
119
|
-
/** Get the magnitude (length) of this vector. */
|
|
120
|
-
get magnitude(): number;
|
|
121
|
-
/** Get the squared magnitude (length) of this vector. */
|
|
122
|
-
get squaredMagnitude(): number;
|
|
123
|
-
/**
|
|
124
|
-
* Negate this vector.
|
|
125
|
-
* @returns The negated vector.
|
|
126
|
-
*/
|
|
127
|
-
negate(): SlowVector;
|
|
128
|
-
/**
|
|
129
|
-
* Calculate the multiplicative inverse of the components of this vector.
|
|
130
|
-
* @returns The inverted vector.
|
|
131
|
-
*/
|
|
132
|
-
invert(): SlowVector;
|
|
133
|
-
/**
|
|
134
|
-
* Normalize this vector.
|
|
135
|
-
* @returns The normalized vector.
|
|
136
|
-
* @see {@link https://en.wikipedia.org/wiki/Unit_vector | Unit vector}
|
|
137
|
-
*/
|
|
138
|
-
normalize(): SlowVector;
|
|
152
|
+
squaredDistance(vector: Readonly<VectorLike>): number;
|
|
139
153
|
/**
|
|
140
|
-
*
|
|
141
|
-
* @param vector - The other vector.
|
|
142
|
-
* @returns The dot product.
|
|
143
|
-
* @see {@link https://en.wikipedia.org/wiki/Dot_product | Dot product}
|
|
144
|
-
*/
|
|
145
|
-
dot(vector: VectorLike): number;
|
|
146
|
-
/**
|
|
147
|
-
* Perform a linear interpolation between this and another vector.
|
|
154
|
+
* Subtract another vector from this one.
|
|
148
155
|
* @param vector - The other vector.
|
|
149
|
-
* @
|
|
150
|
-
* @returns The interpolated vector.
|
|
151
|
-
*/
|
|
152
|
-
lerp(vector: VectorLike, t: number): SlowVector;
|
|
153
|
-
/**
|
|
154
|
-
* Set this vector to a random value with the given magnitude.
|
|
155
|
-
* @param magnitude - The magnitude.
|
|
156
|
-
* @returns This vector.
|
|
156
|
+
* @returns The difference between the vectors.
|
|
157
157
|
*/
|
|
158
|
-
|
|
158
|
+
subtract(vector: Readonly<VectorLike>): SlowVector;
|
|
159
159
|
/**
|
|
160
160
|
* Set this to the zero vector.
|
|
161
161
|
* @returns This vector.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlowVector.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowVector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SlowVector.d.ts","sourceRoot":"","sources":["../../src/linalg/SlowVector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAqB9C;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,YAAa,YAAW,MAAM;IACrE,iDAAiD;IACjD,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,yDAAyD;IACzD,IAAW,gBAAgB,IAAI,MAAM,CAOpC;IAED;;;OAGG;gBACgB,GAAG,MAAM,EAAE,SAAS,MAAM,EAAE;IAI/C;;;;OAIG;IACI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;IAapD;;;OAGG;IACI,IAAI,IAAI,UAAU;IASzB;;;OAGG;IACI,KAAK,IAAI,UAAU;IAI1B;;;;OAIG;IACI,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAY/C;;;;OAIG;IACI,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM;IAarD;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,UAAU;IA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