@lakuna/umath 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +124 -124
- 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 +63 -63
- 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 +107 -107
- 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 +200 -201
- 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 +116 -116
- 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 +5 -5
- 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 +6 -6
- 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 +70 -70
- 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 +104 -104
- 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 +130 -130
- 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 +101 -101
- 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 +2 -2
- 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 +42 -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 +11 -9
- package/src/algorithms/greatestCommonDivisor.ts +19 -7
- package/src/index.ts +17 -13
- package/src/linalg/DualQuaternion.ts +208 -193
- package/src/linalg/Matrix.ts +28 -28
- package/src/linalg/Matrix2.ts +117 -108
- package/src/linalg/Matrix3.ts +177 -158
- package/src/linalg/Matrix4.ts +386 -348
- package/src/linalg/Quaternion.ts +207 -189
- package/src/linalg/SlowMatrix.ts +19 -18
- package/src/linalg/SlowSquareMatrix.ts +19 -18
- package/src/linalg/SlowVector.ts +170 -169
- package/src/linalg/SquareMatrix.ts +9 -9
- package/src/linalg/Vector.ts +91 -89
- package/src/linalg/Vector2.ts +160 -155
- package/src/linalg/Vector3.ts +206 -199
- package/src/linalg/Vector4.ts +165 -156
- package/src/types/AxisAngle.ts +3 -3
- package/src/types/FieldOfView.ts +3 -3
- package/src/utility/BigNumber.ts +63 -41
- package/src/utility/createAxisAngleLike.ts +1 -0
package/src/linalg/Matrix3.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Matrix4Like } from "./Matrix4.js";
|
|
2
2
|
import type { MatrixLike } from "./Matrix.js";
|
|
3
3
|
import type { QuaternionLike } from "./Quaternion.js";
|
|
4
|
-
import SingularMatrixError from "../utility/SingularMatrixError.js";
|
|
5
4
|
import type SquareMatrix from "./SquareMatrix.js";
|
|
6
5
|
import type { Vector2Like } from "./Vector2.js";
|
|
6
|
+
|
|
7
7
|
import approxRelative from "../algorithms/approxRelative.js";
|
|
8
|
+
import SingularMatrixError from "../utility/SingularMatrixError.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Numbers arranged into three columns and three rows.
|
|
@@ -13,30 +14,39 @@ import approxRelative from "../algorithms/approxRelative.js";
|
|
|
13
14
|
*/
|
|
14
15
|
export interface Matrix3Like extends MatrixLike {
|
|
15
16
|
/** The value in the first column and first row. */
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
18
|
0: number;
|
|
17
19
|
|
|
18
20
|
/** The value in the first column and second row. */
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
22
|
1: number;
|
|
20
23
|
|
|
21
24
|
/** The value in the first column and third row. */
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
22
26
|
2: number;
|
|
23
27
|
|
|
24
28
|
/** The value in the second column and first row. */
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
25
30
|
3: number;
|
|
26
31
|
|
|
27
32
|
/** The value in the second column and second row. */
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
34
|
4: number;
|
|
29
35
|
|
|
30
36
|
/** The value in the second column and third row. */
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
38
|
5: number;
|
|
32
39
|
|
|
33
40
|
/** The value in the third column and first row. */
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
34
42
|
6: number;
|
|
35
43
|
|
|
36
44
|
/** The value in the third column and second row. */
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
37
46
|
7: number;
|
|
38
47
|
|
|
39
48
|
/** The value in the third column and third row. */
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
40
50
|
8: number;
|
|
41
51
|
}
|
|
42
52
|
|
|
@@ -45,9 +55,9 @@ export interface Matrix3Like extends MatrixLike {
|
|
|
45
55
|
* @returns A three-by-three matrix-like object.
|
|
46
56
|
* @public
|
|
47
57
|
*/
|
|
48
|
-
export const createMatrix3Like = (): Float32Array & Matrix3Like =>
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
export const createMatrix3Like = (): Float32Array & Matrix3Like =>
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
60
|
+
new Float32Array(9) as Float32Array & Matrix3Like;
|
|
51
61
|
|
|
52
62
|
/**
|
|
53
63
|
* Create a three-by-three matrix with the given values.
|
|
@@ -820,47 +830,79 @@ export const translate = <T extends Matrix3Like>(
|
|
|
820
830
|
*/
|
|
821
831
|
export default class Matrix3
|
|
822
832
|
extends Float32Array
|
|
823
|
-
implements
|
|
833
|
+
implements Matrix3Like, SquareMatrix
|
|
824
834
|
{
|
|
825
|
-
/**
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
public
|
|
832
|
-
|
|
833
|
-
|
|
835
|
+
/** The value in the first column and first row. */
|
|
836
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
837
|
+
public 0: number;
|
|
838
|
+
|
|
839
|
+
/** The value in the first column and second row. */
|
|
840
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
841
|
+
public 1: number;
|
|
842
|
+
|
|
843
|
+
/** The value in the first column and third row. */
|
|
844
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
845
|
+
public 2: number;
|
|
846
|
+
|
|
847
|
+
/** The value in the second column and first row. */
|
|
848
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
849
|
+
public 3: number;
|
|
850
|
+
|
|
851
|
+
/** The value in the second column and second row. */
|
|
852
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
853
|
+
public 4: number;
|
|
854
|
+
|
|
855
|
+
/** The value in the second column and third row. */
|
|
856
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
857
|
+
public 5: number;
|
|
858
|
+
|
|
859
|
+
/** The value in the third column and first row. */
|
|
860
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
861
|
+
public 6: number;
|
|
862
|
+
|
|
863
|
+
/** The value in the third column and second row. */
|
|
864
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
865
|
+
public 7: number;
|
|
866
|
+
|
|
867
|
+
/** The value in the third column and third row. */
|
|
868
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
869
|
+
public 8: number;
|
|
870
|
+
|
|
871
|
+
/** The number of rows in this matrix. */
|
|
872
|
+
public readonly height: 3;
|
|
873
|
+
|
|
874
|
+
/** The number of columns in this matrix. */
|
|
875
|
+
public readonly width: 3;
|
|
834
876
|
|
|
835
877
|
/**
|
|
836
|
-
*
|
|
837
|
-
* @
|
|
838
|
-
* @returns The transformation matrix.
|
|
839
|
-
* @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
|
|
878
|
+
* Get the determinant of this matrix.
|
|
879
|
+
* @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
|
|
840
880
|
*/
|
|
841
|
-
public
|
|
842
|
-
return
|
|
881
|
+
public get determinant(): number {
|
|
882
|
+
return determinant(this);
|
|
843
883
|
}
|
|
844
884
|
|
|
845
885
|
/**
|
|
846
|
-
*
|
|
847
|
-
* @
|
|
848
|
-
* @returns The transformation matrix.
|
|
849
|
-
* @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
|
|
886
|
+
* Get the Frobenius norm of this matrix.
|
|
887
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
|
|
850
888
|
*/
|
|
851
|
-
public
|
|
852
|
-
return
|
|
889
|
+
public get frob(): number {
|
|
890
|
+
return frob(this);
|
|
853
891
|
}
|
|
854
892
|
|
|
855
893
|
/**
|
|
856
|
-
* Create a
|
|
857
|
-
* @
|
|
858
|
-
* @returns The transformation matrix.
|
|
859
|
-
* @see {@link https://en.wikipedia.org/wiki/Quaternion | Quaternion}
|
|
860
|
-
* @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
|
|
894
|
+
* Create a three-by-three identity matrix.
|
|
895
|
+
* @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
|
|
861
896
|
*/
|
|
862
|
-
public
|
|
863
|
-
|
|
897
|
+
public constructor() {
|
|
898
|
+
super(9);
|
|
899
|
+
|
|
900
|
+
this[0] = 1;
|
|
901
|
+
this[4] = 1;
|
|
902
|
+
this[8] = 1;
|
|
903
|
+
|
|
904
|
+
this.width = 3;
|
|
905
|
+
this.height = 3;
|
|
864
906
|
}
|
|
865
907
|
|
|
866
908
|
/**
|
|
@@ -877,34 +919,53 @@ export default class Matrix3
|
|
|
877
919
|
}
|
|
878
920
|
|
|
879
921
|
/**
|
|
880
|
-
*
|
|
922
|
+
* Create a three-by-three matrix from the upper-left corner of a four-by-four matrix.
|
|
881
923
|
* @param matrix - The four-by-four matrix.
|
|
882
|
-
* @returns The
|
|
883
|
-
* @see {@link https://en.wikipedia.org/wiki/Normal_matrix | Normal matrix}
|
|
924
|
+
* @returns The three-by-three matrix.
|
|
884
925
|
*/
|
|
885
|
-
public static
|
|
886
|
-
return
|
|
926
|
+
public static fromMatrix4(matrix: Matrix4Like): Matrix3 {
|
|
927
|
+
return fromMatrix4(matrix, new Matrix3());
|
|
887
928
|
}
|
|
888
929
|
|
|
889
930
|
/**
|
|
890
|
-
*
|
|
891
|
-
* @param
|
|
892
|
-
* @
|
|
893
|
-
* @
|
|
894
|
-
* @see {@link https://en.wikipedia.org/wiki/
|
|
895
|
-
* @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
|
|
931
|
+
* Create a transformation matrix that represents a rotation by the given quaternion.
|
|
932
|
+
* @param quaternion - The quaternion.
|
|
933
|
+
* @returns The transformation matrix.
|
|
934
|
+
* @see {@link https://en.wikipedia.org/wiki/Quaternion | Quaternion}
|
|
935
|
+
* @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
|
|
896
936
|
*/
|
|
897
|
-
public static
|
|
898
|
-
return
|
|
937
|
+
public static fromQuaternion(quaternion: QuaternionLike): Matrix3 {
|
|
938
|
+
return fromQuaternion(quaternion, new Matrix3());
|
|
899
939
|
}
|
|
900
940
|
|
|
901
941
|
/**
|
|
902
|
-
* Create a
|
|
903
|
-
* @param
|
|
904
|
-
* @returns The
|
|
942
|
+
* Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
|
|
943
|
+
* @param r - The angle in radians.
|
|
944
|
+
* @returns The transformation matrix.
|
|
945
|
+
* @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
|
|
905
946
|
*/
|
|
906
|
-
public static
|
|
907
|
-
return
|
|
947
|
+
public static fromRotation(r: number): Matrix3 {
|
|
948
|
+
return fromRotation(r, new Matrix3());
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
* Create a transformation matrix that represents a scaling by the given vector.
|
|
953
|
+
* @param vector - The scaling vector.
|
|
954
|
+
* @returns The transformation matrix.
|
|
955
|
+
* @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
|
|
956
|
+
*/
|
|
957
|
+
public static fromScaling(vector: Vector2Like): Matrix3 {
|
|
958
|
+
return fromScaling(vector, new Matrix3());
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Create a transformation matrix that represents a translation by the given vector.
|
|
963
|
+
* @param vector - The translation vector.
|
|
964
|
+
* @returns The transformation matrix.
|
|
965
|
+
* @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
|
|
966
|
+
*/
|
|
967
|
+
public static fromTranslation(vector: Vector2Like): Matrix3 {
|
|
968
|
+
return fromTranslation(vector, new Matrix3());
|
|
908
969
|
}
|
|
909
970
|
|
|
910
971
|
/**
|
|
@@ -946,69 +1007,25 @@ export default class Matrix3
|
|
|
946
1007
|
}
|
|
947
1008
|
|
|
948
1009
|
/**
|
|
949
|
-
*
|
|
950
|
-
* @
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
super(9);
|
|
954
|
-
|
|
955
|
-
this[0] = 1;
|
|
956
|
-
this[4] = 1;
|
|
957
|
-
this[8] = 1;
|
|
958
|
-
|
|
959
|
-
this.width = 3;
|
|
960
|
-
this.height = 3;
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
/** The value in the first column and first row. */
|
|
964
|
-
public 0: number;
|
|
965
|
-
|
|
966
|
-
/** The value in the first column and second row. */
|
|
967
|
-
public 1: number;
|
|
968
|
-
|
|
969
|
-
/** The value in the first column and third row. */
|
|
970
|
-
public 2: number;
|
|
971
|
-
|
|
972
|
-
/** The value in the second column and first row. */
|
|
973
|
-
public 3: number;
|
|
974
|
-
|
|
975
|
-
/** The value in the second column and second row. */
|
|
976
|
-
public 4: number;
|
|
977
|
-
|
|
978
|
-
/** The value in the second column and third row. */
|
|
979
|
-
public 5: number;
|
|
980
|
-
|
|
981
|
-
/** The value in the third column and first row. */
|
|
982
|
-
public 6: number;
|
|
983
|
-
|
|
984
|
-
/** The value in the third column and second row. */
|
|
985
|
-
public 7: number;
|
|
986
|
-
|
|
987
|
-
/** The value in the third column and third row. */
|
|
988
|
-
public 8: number;
|
|
989
|
-
|
|
990
|
-
/** The number of columns in this matrix. */
|
|
991
|
-
public readonly width: 3;
|
|
992
|
-
|
|
993
|
-
/** The number of rows in this matrix. */
|
|
994
|
-
public readonly height: 3;
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Determine whether or not this matrix is roughly equivalent to another.
|
|
998
|
-
* @param matrix - The other matrix.
|
|
999
|
-
* @returns Whether or not the matrices are equivalent.
|
|
1010
|
+
* Calculate a three-by-three normal (inverse transpose) matrix from a four-by-four matrix.
|
|
1011
|
+
* @param matrix - The four-by-four matrix.
|
|
1012
|
+
* @returns The normal matrix.
|
|
1013
|
+
* @see {@link https://en.wikipedia.org/wiki/Normal_matrix | Normal matrix}
|
|
1000
1014
|
*/
|
|
1001
|
-
public
|
|
1002
|
-
return
|
|
1015
|
+
public static normalFromMatrix4(matrix: Matrix4Like): Matrix3 {
|
|
1016
|
+
return normalFromMatrix4(matrix, new Matrix3());
|
|
1003
1017
|
}
|
|
1004
1018
|
|
|
1005
1019
|
/**
|
|
1006
|
-
*
|
|
1007
|
-
* @param
|
|
1008
|
-
* @
|
|
1020
|
+
* Generate a two-dimensional projection matrix with the given bounds.
|
|
1021
|
+
* @param width - The width of the projection.
|
|
1022
|
+
* @param height - The height of the projection.
|
|
1023
|
+
* @returns The projection matrix.
|
|
1024
|
+
* @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
|
|
1025
|
+
* @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
|
|
1009
1026
|
*/
|
|
1010
|
-
public
|
|
1011
|
-
return
|
|
1027
|
+
public static projection(width: number, height: number): Matrix3 {
|
|
1028
|
+
return projection(width, height, new Matrix3());
|
|
1012
1029
|
}
|
|
1013
1030
|
|
|
1014
1031
|
/**
|
|
@@ -1048,11 +1065,39 @@ export default class Matrix3
|
|
|
1048
1065
|
}
|
|
1049
1066
|
|
|
1050
1067
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
* @
|
|
1068
|
+
* Determine whether or not this matrix is roughly equivalent to another.
|
|
1069
|
+
* @param matrix - The other matrix.
|
|
1070
|
+
* @returns Whether or not the matrices are equivalent.
|
|
1053
1071
|
*/
|
|
1054
|
-
public
|
|
1055
|
-
return
|
|
1072
|
+
public equals(matrix: Matrix3Like): boolean {
|
|
1073
|
+
return equals(this, matrix);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Determine whether or not this matrix is exactly equivalent to another.
|
|
1078
|
+
* @param matrix - The other matrix.
|
|
1079
|
+
* @returns Whether or not the matrices are equivalent.
|
|
1080
|
+
*/
|
|
1081
|
+
public exactEquals(matrix: Matrix3Like): boolean {
|
|
1082
|
+
return exactEquals(this, matrix);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Reset this matrix to identity.
|
|
1087
|
+
* @returns This matrix.
|
|
1088
|
+
* @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
|
|
1089
|
+
*/
|
|
1090
|
+
public identity(): this {
|
|
1091
|
+
return identity(this);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* Invert this matrix.
|
|
1096
|
+
* @returns The inverted matrix.
|
|
1097
|
+
* @see {@link https://en.wikipedia.org/wiki/Invertible_matrix | Invertible matrix}
|
|
1098
|
+
*/
|
|
1099
|
+
public invert(): Matrix3 {
|
|
1100
|
+
return invert(this, new Matrix3());
|
|
1056
1101
|
}
|
|
1057
1102
|
|
|
1058
1103
|
/**
|
|
@@ -1087,51 +1132,6 @@ export default class Matrix3
|
|
|
1087
1132
|
return multiplyScalarAndAdd(this, matrix, scalar, new Matrix3());
|
|
1088
1133
|
}
|
|
1089
1134
|
|
|
1090
|
-
/**
|
|
1091
|
-
* Subtract another matrix from this one.
|
|
1092
|
-
* @param matrix - The other matrix.
|
|
1093
|
-
* @returns The difference between the matrices.
|
|
1094
|
-
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
1095
|
-
*/
|
|
1096
|
-
public subtract(matrix: Matrix3Like): Matrix3 {
|
|
1097
|
-
return subtract(this, matrix, new Matrix3());
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Transpose this matrix.
|
|
1102
|
-
* @returns The transpose of this matrix.
|
|
1103
|
-
* @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
|
|
1104
|
-
*/
|
|
1105
|
-
public transpose(): Matrix3 {
|
|
1106
|
-
return transpose(this, new Matrix3());
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* Get the determinant of this matrix.
|
|
1111
|
-
* @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
|
|
1112
|
-
*/
|
|
1113
|
-
public get determinant(): number {
|
|
1114
|
-
return determinant(this);
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
* Reset this matrix to identity.
|
|
1119
|
-
* @returns This matrix.
|
|
1120
|
-
* @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
|
|
1121
|
-
*/
|
|
1122
|
-
public identity(): this {
|
|
1123
|
-
return identity(this);
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
* Invert this matrix.
|
|
1128
|
-
* @returns The inverted matrix.
|
|
1129
|
-
* @see {@link https://en.wikipedia.org/wiki/Invertible_matrix | Invertible matrix}
|
|
1130
|
-
*/
|
|
1131
|
-
public invert(): Matrix3 {
|
|
1132
|
-
return invert(this, new Matrix3());
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
1135
|
/**
|
|
1136
1136
|
* Rotate this matrix by the given angle around the Z-axis.
|
|
1137
1137
|
* @param r - The angle in radians.
|
|
@@ -1152,6 +1152,16 @@ export default class Matrix3
|
|
|
1152
1152
|
return scale(this, vector, new Matrix3());
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
|
+
/**
|
|
1156
|
+
* Subtract another matrix from this one.
|
|
1157
|
+
* @param matrix - The other matrix.
|
|
1158
|
+
* @returns The difference between the matrices.
|
|
1159
|
+
* @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
|
|
1160
|
+
*/
|
|
1161
|
+
public subtract(matrix: Matrix3Like): Matrix3 {
|
|
1162
|
+
return subtract(this, matrix, new Matrix3());
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1155
1165
|
/**
|
|
1156
1166
|
* Translate this matrix by the given vector.
|
|
1157
1167
|
* @param vector - The translation vector.
|
|
@@ -1161,4 +1171,13 @@ export default class Matrix3
|
|
|
1161
1171
|
public translate(vector: Vector2Like): Matrix3 {
|
|
1162
1172
|
return translate(this, vector, new Matrix3());
|
|
1163
1173
|
}
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* Transpose this matrix.
|
|
1177
|
+
* @returns The transpose of this matrix.
|
|
1178
|
+
* @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
|
|
1179
|
+
*/
|
|
1180
|
+
public transpose(): Matrix3 {
|
|
1181
|
+
return transpose(this, new Matrix3());
|
|
1182
|
+
}
|
|
1164
1183
|
}
|