@galacean/engine-math 0.0.0-experimental-backup.0 → 0.0.0-experimental-backup.4
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/package.json +1 -1
- package/types/BoundingBox.d.ts +103 -0
- package/types/BoundingFrustum.d.ts +63 -0
- package/types/BoundingSphere.d.ts +43 -0
- package/types/CollisionUtil.d.ts +122 -0
- package/types/Color.d.ts +175 -0
- package/types/IClone.d.ts +10 -0
- package/types/ICopy.d.ts +15 -0
- package/types/MathUtil.d.ts +53 -0
- package/types/Matrix.d.ts +298 -0
- package/types/Matrix3x3.d.ts +228 -0
- package/types/Plane.d.ts +48 -0
- package/types/Quaternion.d.ts +333 -0
- package/types/Rand.d.ts +30 -0
- package/types/Ray.d.ts +44 -0
- package/types/Rect.d.ts +52 -0
- package/types/SphericalHarmonics3.d.ts +56 -0
- package/types/Vector2.d.ts +219 -0
- package/types/Vector3.d.ts +321 -0
- package/types/Vector4.d.ts +253 -0
- package/types/enums/ContainmentType.d.ts +11 -0
- package/types/enums/FrustumFace.d.ts +17 -0
- package/types/enums/PlaneIntersectionType.d.ts +11 -0
- package/types/index.d.ts +20 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { IClone } from "./IClone";
|
|
2
|
+
import { ICopy } from "./ICopy";
|
|
3
|
+
import { Quaternion } from "./Quaternion";
|
|
4
|
+
import { Vector3 } from "./Vector3";
|
|
5
|
+
/**
|
|
6
|
+
* Represents a 4x4 mathematical matrix.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Matrix implements IClone<Matrix>, ICopy<Matrix, Matrix> {
|
|
9
|
+
private static readonly _tempVec30;
|
|
10
|
+
private static readonly _tempVec31;
|
|
11
|
+
private static readonly _tempVec32;
|
|
12
|
+
private static readonly _tempMat30;
|
|
13
|
+
/**
|
|
14
|
+
* Determines the product of two matrices.
|
|
15
|
+
* @param left - The first matrix to multiply
|
|
16
|
+
* @param right - The second matrix to multiply
|
|
17
|
+
* @param out - The product of the two matrices
|
|
18
|
+
*/
|
|
19
|
+
static multiply(left: Matrix, right: Matrix, out: Matrix): void;
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether the specified matrices are equals.
|
|
22
|
+
* @param left - The first matrix to compare
|
|
23
|
+
* @param right - The second matrix to compare
|
|
24
|
+
* @returns True if the specified matrices are equals, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
static equals(left: Matrix, right: Matrix): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Performs a linear interpolation between two matrices.
|
|
29
|
+
* @param start - The first matrix
|
|
30
|
+
* @param end - The second matrix
|
|
31
|
+
* @param t - The blend amount where 0 returns start and 1 end
|
|
32
|
+
* @param out - The result of linear blending between two matrices
|
|
33
|
+
*/
|
|
34
|
+
static lerp(start: Matrix, end: Matrix, t: number, out: Matrix): void;
|
|
35
|
+
/**
|
|
36
|
+
* Determines the sum of two matrices.
|
|
37
|
+
* @param left - The first matrix to add
|
|
38
|
+
* @param right - The second matrix to add
|
|
39
|
+
* @param out - The sum of two matrices
|
|
40
|
+
*/
|
|
41
|
+
static add(left: Matrix, right: Matrix, out: Matrix): void;
|
|
42
|
+
/**
|
|
43
|
+
* Multiplies a matrix by a scalar.
|
|
44
|
+
* @param source - The matrix to multiply
|
|
45
|
+
* @param scalar - The scalar to multiply
|
|
46
|
+
* @param out - The result of multiplying a matrix by a scalar
|
|
47
|
+
*/
|
|
48
|
+
static multiplyScalar(source: Matrix, scalar: number, out: Matrix): void;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate a rotation matrix from a quaternion.
|
|
51
|
+
* @param quaternion - The quaternion used to calculate the matrix
|
|
52
|
+
* @param out - The calculated rotation matrix
|
|
53
|
+
*/
|
|
54
|
+
static rotationQuaternion(quaternion: Quaternion, out: Matrix): void;
|
|
55
|
+
/**
|
|
56
|
+
* Calculate a matrix rotates around an arbitrary axis.
|
|
57
|
+
* @param axis - The axis
|
|
58
|
+
* @param r - The rotation angle in radians
|
|
59
|
+
* @param out - The matrix after rotate
|
|
60
|
+
*/
|
|
61
|
+
static rotationAxisAngle(axis: Vector3, r: number, out: Matrix): void;
|
|
62
|
+
/**
|
|
63
|
+
* Calculate a matrix from a quaternion and a translation.
|
|
64
|
+
* @param quaternion - The quaternion used to calculate the matrix
|
|
65
|
+
* @param translation - The translation used to calculate the matrix
|
|
66
|
+
* @param out - The calculated matrix
|
|
67
|
+
*/
|
|
68
|
+
static rotationTranslation(quaternion: Quaternion, translation: Vector3, out: Matrix): void;
|
|
69
|
+
/**
|
|
70
|
+
* Calculate an affine matrix.
|
|
71
|
+
* @param scale - The scale used to calculate matrix
|
|
72
|
+
* @param rotation - The rotation used to calculate matrix
|
|
73
|
+
* @param translation - The translation used to calculate matrix
|
|
74
|
+
* @param out - The calculated matrix
|
|
75
|
+
*/
|
|
76
|
+
static affineTransformation(scale: Vector3, rotation: Quaternion, translation: Vector3, out: Matrix): void;
|
|
77
|
+
/**
|
|
78
|
+
* Calculate a matrix from scale vector.
|
|
79
|
+
* @param s - The scale vector
|
|
80
|
+
* @param out - The calculated matrix
|
|
81
|
+
*/
|
|
82
|
+
static scaling(s: Vector3, out: Matrix): void;
|
|
83
|
+
/**
|
|
84
|
+
* Calculate a matrix from translation vector.
|
|
85
|
+
* @param translation - The translation vector
|
|
86
|
+
* @param out - The calculated matrix
|
|
87
|
+
*/
|
|
88
|
+
static translation(translation: Vector3, out: Matrix): void;
|
|
89
|
+
/**
|
|
90
|
+
* Calculate the inverse of the specified matrix.
|
|
91
|
+
* @param a - The matrix whose inverse is to be calculated
|
|
92
|
+
* @param out - The inverse of the specified matrix
|
|
93
|
+
*/
|
|
94
|
+
static invert(a: Matrix, out: Matrix): void;
|
|
95
|
+
/**
|
|
96
|
+
* Calculate a right-handed look-at matrix.
|
|
97
|
+
* @param eye - The position of the viewer's eye
|
|
98
|
+
* @param target - The camera look-at target
|
|
99
|
+
* @param up - The camera's up vector
|
|
100
|
+
* @param out - The calculated look-at matrix
|
|
101
|
+
*/
|
|
102
|
+
static lookAt(eye: Vector3, target: Vector3, up: Vector3, out: Matrix): void;
|
|
103
|
+
/**
|
|
104
|
+
* Calculate an orthographic projection matrix.
|
|
105
|
+
* @param left - The left edge of the viewing
|
|
106
|
+
* @param right - The right edge of the viewing
|
|
107
|
+
* @param bottom - The bottom edge of the viewing
|
|
108
|
+
* @param top - The top edge of the viewing
|
|
109
|
+
* @param near - The depth of the near plane
|
|
110
|
+
* @param far - The depth of the far plane
|
|
111
|
+
* @param out - The calculated orthographic projection matrix
|
|
112
|
+
*/
|
|
113
|
+
static ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, out: Matrix): void;
|
|
114
|
+
/**
|
|
115
|
+
* Calculate a perspective projection matrix.
|
|
116
|
+
* @param fovY - Field of view in the y direction, in radians
|
|
117
|
+
* @param aspect - Aspect ratio, defined as view space width divided by height
|
|
118
|
+
* @param near - The depth of the near plane
|
|
119
|
+
* @param far - The depth of the far plane
|
|
120
|
+
* @param out - The calculated perspective projection matrix
|
|
121
|
+
*/
|
|
122
|
+
static perspective(fovY: number, aspect: number, near: number, far: number, out: Matrix): void;
|
|
123
|
+
/**
|
|
124
|
+
* The specified matrix rotates around an arbitrary axis.
|
|
125
|
+
* @param m - The specified matrix
|
|
126
|
+
* @param axis - The axis
|
|
127
|
+
* @param r - The rotation angle in radians
|
|
128
|
+
* @param out - The rotated matrix
|
|
129
|
+
*/
|
|
130
|
+
static rotateAxisAngle(m: Matrix, axis: Vector3, r: number, out: Matrix): void;
|
|
131
|
+
/**
|
|
132
|
+
* Scale a matrix by a given vector.
|
|
133
|
+
* @param m - The matrix
|
|
134
|
+
* @param s - The given vector
|
|
135
|
+
* @param out - The scaled matrix
|
|
136
|
+
*/
|
|
137
|
+
static scale(m: Matrix, s: Vector3, out: Matrix): void;
|
|
138
|
+
/**
|
|
139
|
+
* Translate a matrix by a given vector.
|
|
140
|
+
* @param m - The matrix
|
|
141
|
+
* @param v - The given vector
|
|
142
|
+
* @param out - The translated matrix
|
|
143
|
+
*/
|
|
144
|
+
static translate(m: Matrix, v: Vector3, out: Matrix): void;
|
|
145
|
+
/**
|
|
146
|
+
* Calculate the transpose of the specified matrix.
|
|
147
|
+
* @param a - The specified matrix
|
|
148
|
+
* @param out - The transpose of the specified matrix
|
|
149
|
+
*/
|
|
150
|
+
static transpose(a: Matrix, out: Matrix): void;
|
|
151
|
+
/**
|
|
152
|
+
* An array containing the elements of the matrix (column matrix).
|
|
153
|
+
* @remarks
|
|
154
|
+
* elements[0] first column and first row value m11
|
|
155
|
+
* elements[1] first column and second row value m12
|
|
156
|
+
* elements[2] first column and third row value m13
|
|
157
|
+
* elements[3] first column and fourth row value m14
|
|
158
|
+
* elements[4] second column and first row value m21
|
|
159
|
+
* and so on
|
|
160
|
+
*/
|
|
161
|
+
elements: Float32Array;
|
|
162
|
+
/**
|
|
163
|
+
* Constructor of 4x4 Matrix.
|
|
164
|
+
* @param m11 - default 1, column 1, row 1
|
|
165
|
+
* @param m12 - default 0, column 1, row 2
|
|
166
|
+
* @param m13 - default 0, column 1, row 3
|
|
167
|
+
* @param m14 - default 0, column 1, row 4
|
|
168
|
+
* @param m21 - default 0, column 2, row 1
|
|
169
|
+
* @param m22 - default 1, column 2, row 2
|
|
170
|
+
* @param m23 - default 0, column 2, row 3
|
|
171
|
+
* @param m24 - default 0, column 2, row 4
|
|
172
|
+
* @param m31 - default 0, column 3, row 1
|
|
173
|
+
* @param m32 - default 0, column 3, row 2
|
|
174
|
+
* @param m33 - default 1, column 3, row 3
|
|
175
|
+
* @param m34 - default 0, column 3, row 4
|
|
176
|
+
* @param m41 - default 0, column 4, row 1
|
|
177
|
+
* @param m42 - default 0, column 4, row 2
|
|
178
|
+
* @param m43 - default 0, column 4, row 3
|
|
179
|
+
* @param m44 - default 1, column 4, row 4
|
|
180
|
+
*/
|
|
181
|
+
constructor(m11?: number, m12?: number, m13?: number, m14?: number, m21?: number, m22?: number, m23?: number, m24?: number, m31?: number, m32?: number, m33?: number, m34?: number, m41?: number, m42?: number, m43?: number, m44?: number);
|
|
182
|
+
/**
|
|
183
|
+
* Set the value of this matrix, and return this matrix.
|
|
184
|
+
* @param m11 - column 1, row 1
|
|
185
|
+
* @param m12 - column 1, row 2
|
|
186
|
+
* @param m13 - column 1, row 3
|
|
187
|
+
* @param m14 - column 1, row 4
|
|
188
|
+
* @param m21 - column 2, row 1
|
|
189
|
+
* @param m22 - column 2, row 2
|
|
190
|
+
* @param m23 - column 2, row 3
|
|
191
|
+
* @param m24 - column 2, row 4
|
|
192
|
+
* @param m31 - column 3, row 1
|
|
193
|
+
* @param m32 - column 3, row 2
|
|
194
|
+
* @param m33 - column 3, row 3
|
|
195
|
+
* @param m34 - column 3, row 4
|
|
196
|
+
* @param m41 - column 4, row 1
|
|
197
|
+
* @param m42 - column 4, row 2
|
|
198
|
+
* @param m43 - column 4, row 3
|
|
199
|
+
* @param m44 - column 4, row 4
|
|
200
|
+
* @returns This matrix
|
|
201
|
+
*/
|
|
202
|
+
set(m11: number, m12: number, m13: number, m14: number, m21: number, m22: number, m23: number, m24: number, m31: number, m32: number, m33: number, m34: number, m41: number, m42: number, m43: number, m44: number): Matrix;
|
|
203
|
+
/**
|
|
204
|
+
* Determines the product of this matrix and the specified matrix.
|
|
205
|
+
* @param right - The specified matrix
|
|
206
|
+
* @returns This matrix that store the product of the two matrices
|
|
207
|
+
*/
|
|
208
|
+
multiply(right: Matrix): Matrix;
|
|
209
|
+
/**
|
|
210
|
+
* Calculate a determinant of this matrix.
|
|
211
|
+
* @returns The determinant of this matrix
|
|
212
|
+
*/
|
|
213
|
+
determinant(): number;
|
|
214
|
+
/**
|
|
215
|
+
* Decompose this matrix to translation, rotation and scale elements.
|
|
216
|
+
* @param translation - Translation vector as an output parameter
|
|
217
|
+
* @param rotation - Rotation quaternion as an output parameter
|
|
218
|
+
* @param scale - Scale vector as an output parameter
|
|
219
|
+
* @returns True if this matrix can be decomposed, false otherwise
|
|
220
|
+
*/
|
|
221
|
+
decompose(translation: Vector3, rotation: Quaternion, scale: Vector3): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Get rotation from this matrix.
|
|
224
|
+
* @param out - Rotation quaternion as an output parameter
|
|
225
|
+
* @returns The out
|
|
226
|
+
*/
|
|
227
|
+
getRotation(out: Quaternion): Quaternion;
|
|
228
|
+
/**
|
|
229
|
+
* Get scale from this matrix.
|
|
230
|
+
* @param out - Scale vector as an output parameter
|
|
231
|
+
* @returns The out
|
|
232
|
+
*/
|
|
233
|
+
getScaling(out: Vector3): Vector3;
|
|
234
|
+
/**
|
|
235
|
+
* Get translation from this matrix.
|
|
236
|
+
* @param out - Translation vector as an output parameter
|
|
237
|
+
* @returns The out
|
|
238
|
+
*/
|
|
239
|
+
getTranslation(out: Vector3): Vector3;
|
|
240
|
+
/**
|
|
241
|
+
* Identity this matrix.
|
|
242
|
+
* @returns This matrix after identity
|
|
243
|
+
*/
|
|
244
|
+
identity(): Matrix;
|
|
245
|
+
/**
|
|
246
|
+
* Invert the matrix.
|
|
247
|
+
* @returns The matrix after invert
|
|
248
|
+
*/
|
|
249
|
+
invert(): Matrix;
|
|
250
|
+
/**
|
|
251
|
+
* This matrix rotates around an arbitrary axis.
|
|
252
|
+
* @param axis - The axis
|
|
253
|
+
* @param r - The rotation angle in radians
|
|
254
|
+
* @returns This matrix after rotate
|
|
255
|
+
*/
|
|
256
|
+
rotateAxisAngle(axis: Vector3, r: number): Matrix;
|
|
257
|
+
/**
|
|
258
|
+
* Scale this matrix by a given vector.
|
|
259
|
+
* @param s - The given vector
|
|
260
|
+
* @returns This matrix after scale
|
|
261
|
+
*/
|
|
262
|
+
scale(s: Vector3): Matrix;
|
|
263
|
+
/**
|
|
264
|
+
* Translate this matrix by a given vector.
|
|
265
|
+
* @param v - The given vector
|
|
266
|
+
* @returns This matrix after translate
|
|
267
|
+
*/
|
|
268
|
+
translate(v: Vector3): Matrix;
|
|
269
|
+
/**
|
|
270
|
+
* Calculate the transpose of this matrix.
|
|
271
|
+
* @returns This matrix after transpose
|
|
272
|
+
*/
|
|
273
|
+
transpose(): Matrix;
|
|
274
|
+
/**
|
|
275
|
+
* Creates a clone of this matrix.
|
|
276
|
+
* @returns A clone of this matrix
|
|
277
|
+
*/
|
|
278
|
+
clone(): Matrix;
|
|
279
|
+
/**
|
|
280
|
+
* Copy this matrix from the specified matrix.
|
|
281
|
+
* @param source - The specified matrix
|
|
282
|
+
* @returns This matrix
|
|
283
|
+
*/
|
|
284
|
+
copyFrom(source: Matrix): Matrix;
|
|
285
|
+
/**
|
|
286
|
+
* Copy the value of this matrix from an array.
|
|
287
|
+
* @param array - The array
|
|
288
|
+
* @param offset - The start offset of the array
|
|
289
|
+
* @returns This matrix
|
|
290
|
+
*/
|
|
291
|
+
copyFromArray(array: ArrayLike<number>, offset?: number): Matrix;
|
|
292
|
+
/**
|
|
293
|
+
* Copy the value of this matrix to an array.
|
|
294
|
+
* @param out - The array
|
|
295
|
+
* @param outOffset - The start offset of the array
|
|
296
|
+
*/
|
|
297
|
+
copyToArray(out: number[] | Float32Array | Float64Array, outOffset?: number): void;
|
|
298
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { IClone } from "./IClone";
|
|
2
|
+
import { ICopy } from "./ICopy";
|
|
3
|
+
import { Matrix } from "./Matrix";
|
|
4
|
+
import { Quaternion } from "./Quaternion";
|
|
5
|
+
import { Vector2 } from "./Vector2";
|
|
6
|
+
/**
|
|
7
|
+
* Represents a 3x3 mathematical matrix.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Matrix3x3 implements IClone<Matrix3x3>, ICopy<Matrix3x3, Matrix3x3> {
|
|
10
|
+
/**
|
|
11
|
+
* Determines the sum of two matrices.
|
|
12
|
+
* @param left - The first matrix to add
|
|
13
|
+
* @param right - The second matrix to add
|
|
14
|
+
* @param out - The sum of two matrices
|
|
15
|
+
*/
|
|
16
|
+
static add(left: Matrix3x3, right: Matrix3x3, out: Matrix3x3): void;
|
|
17
|
+
/**
|
|
18
|
+
* Determines the difference between two matrices.
|
|
19
|
+
* @param left - The first matrix to subtract
|
|
20
|
+
* @param right - The second matrix to subtract
|
|
21
|
+
* @param out - The difference between two matrices
|
|
22
|
+
*/
|
|
23
|
+
static subtract(left: Matrix3x3, right: Matrix3x3, out: Matrix3x3): void;
|
|
24
|
+
/**
|
|
25
|
+
* Determines the product of two matrices.
|
|
26
|
+
* @param left - The first matrix to multiply
|
|
27
|
+
* @param right - The second matrix to multiply
|
|
28
|
+
* @param out - The product of two matrices
|
|
29
|
+
*/
|
|
30
|
+
static multiply(left: Matrix3x3, right: Matrix3x3, out: Matrix3x3): void;
|
|
31
|
+
/**
|
|
32
|
+
* Determines whether the specified matrices are equals.
|
|
33
|
+
* @param left - The first matrix to compare
|
|
34
|
+
* @param right - The second matrix to compare
|
|
35
|
+
* @returns True if the specified matrices are equals, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
static equals(left: Matrix3x3, right: Matrix3x3): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Performs a linear interpolation between two matrices.
|
|
40
|
+
* @param start - The first matrix
|
|
41
|
+
* @param end - The second matrix
|
|
42
|
+
* @param t - The blend amount where 0 returns start and 1 end
|
|
43
|
+
* @param out - The result of linear blending between two matrices
|
|
44
|
+
*/
|
|
45
|
+
static lerp(start: Matrix3x3, end: Matrix3x3, t: number, out: Matrix3x3): void;
|
|
46
|
+
/**
|
|
47
|
+
* Calculate a rotation matrix from a quaternion.
|
|
48
|
+
* @param quaternion - The quaternion used to calculate the matrix
|
|
49
|
+
* @param out - The calculated rotation matrix
|
|
50
|
+
*/
|
|
51
|
+
static rotationQuaternion(quaternion: Quaternion, out: Matrix3x3): void;
|
|
52
|
+
/**
|
|
53
|
+
* Calculate a matrix from scale vector.
|
|
54
|
+
* @param s - The scale vector
|
|
55
|
+
* @param out - The calculated matrix
|
|
56
|
+
*/
|
|
57
|
+
static scaling(s: Vector2, out: Matrix3x3): void;
|
|
58
|
+
/**
|
|
59
|
+
* Calculate a matrix from translation vector.
|
|
60
|
+
* @param translation - The translation vector
|
|
61
|
+
* @param out - The calculated matrix
|
|
62
|
+
*/
|
|
63
|
+
static translation(translation: Vector2, out: Matrix3x3): void;
|
|
64
|
+
/**
|
|
65
|
+
* Calculate the inverse of the specified matrix.
|
|
66
|
+
* @param a - The matrix whose inverse is to be calculated
|
|
67
|
+
* @param out - The inverse of the specified matrix
|
|
68
|
+
*/
|
|
69
|
+
static invert(a: Matrix3x3, out: Matrix3x3): void;
|
|
70
|
+
/**
|
|
71
|
+
* Calculate a 3x3 normal matrix from a 4x4 matrix.
|
|
72
|
+
* @remarks The calculation process is the transpose matrix of the inverse matrix.
|
|
73
|
+
* @param mat4 - The 4x4 matrix
|
|
74
|
+
* @param out - THe 3x3 normal matrix
|
|
75
|
+
*/
|
|
76
|
+
static normalMatrix(mat4: Matrix, out: Matrix3x3): void;
|
|
77
|
+
/**
|
|
78
|
+
* The specified matrix rotates around an angle.
|
|
79
|
+
* @param a - The specified matrix
|
|
80
|
+
* @param r - The rotation angle in radians
|
|
81
|
+
* @param out - The rotated matrix
|
|
82
|
+
*/
|
|
83
|
+
static rotate(a: Matrix3x3, r: number, out: Matrix3x3): void;
|
|
84
|
+
/**
|
|
85
|
+
* Scale a matrix by a given vector.
|
|
86
|
+
* @param m - The matrix
|
|
87
|
+
* @param s - The given vector
|
|
88
|
+
* @param out - The scaled matrix
|
|
89
|
+
*/
|
|
90
|
+
static scale(m: Matrix3x3, s: Vector2, out: Matrix3x3): void;
|
|
91
|
+
/**
|
|
92
|
+
* Translate a matrix by a given vector.
|
|
93
|
+
* @param m - The matrix
|
|
94
|
+
* @param translation - The given vector
|
|
95
|
+
* @param out - The translated matrix
|
|
96
|
+
*/
|
|
97
|
+
static translate(m: Matrix3x3, translation: Vector2, out: Matrix3x3): void;
|
|
98
|
+
/**
|
|
99
|
+
* Calculate the transpose of the specified matrix.
|
|
100
|
+
* @param a - The specified matrix
|
|
101
|
+
* @param out - The transpose of the specified matrix
|
|
102
|
+
*/
|
|
103
|
+
static transpose(a: Matrix3x3, out: Matrix3x3): void;
|
|
104
|
+
/**
|
|
105
|
+
* An array containing the elements of the matrix (column matrix).
|
|
106
|
+
* @remarks
|
|
107
|
+
* elements[0] first column and first row value m11
|
|
108
|
+
* elements[1] first column and second row value m12
|
|
109
|
+
* elements[2] first column and third row value m13
|
|
110
|
+
* elements[3] second column and first row value m21
|
|
111
|
+
* and so on
|
|
112
|
+
*/
|
|
113
|
+
elements: Float32Array;
|
|
114
|
+
/**
|
|
115
|
+
* Constructor of 3*3 matrix.
|
|
116
|
+
* @param m11 - Default 1 column 1, row 1
|
|
117
|
+
* @param m12 - Default 0 column 1, row 2
|
|
118
|
+
* @param m13 - Default 0 column 1, row 3
|
|
119
|
+
* @param m21 - Default 0 column 2, row 1
|
|
120
|
+
* @param m22 - Default 1 column 2, row 2
|
|
121
|
+
* @param m23 - Default 0 column 2, row 3
|
|
122
|
+
* @param m31 - Default 0 column 3, row 1
|
|
123
|
+
* @param m32 - Default 0 column 3, row 2
|
|
124
|
+
* @param m33 - Default 1 column 3, row 3
|
|
125
|
+
*/
|
|
126
|
+
constructor(m11?: number, m12?: number, m13?: number, m21?: number, m22?: number, m23?: number, m31?: number, m32?: number, m33?: number);
|
|
127
|
+
/**
|
|
128
|
+
* Set the value of this matrix, and return this matrix.
|
|
129
|
+
* @param m11
|
|
130
|
+
* @param m12
|
|
131
|
+
* @param m13
|
|
132
|
+
* @param m21
|
|
133
|
+
* @param m22
|
|
134
|
+
* @param m23
|
|
135
|
+
* @param m31
|
|
136
|
+
* @param m32
|
|
137
|
+
* @param m33
|
|
138
|
+
* @returns This matrix
|
|
139
|
+
*/
|
|
140
|
+
set(m11: number, m12: number, m13: number, m21: number, m22: number, m23: number, m31: number, m32: number, m33: number): Matrix3x3;
|
|
141
|
+
/**
|
|
142
|
+
* Determines the sum of this matrix and the specified matrix.
|
|
143
|
+
* @param right - The specified matrix
|
|
144
|
+
* @returns This matrix that store the sum of the two matrices
|
|
145
|
+
*/
|
|
146
|
+
add(right: Matrix3x3): Matrix3x3;
|
|
147
|
+
/**
|
|
148
|
+
* Determines the difference between this matrix and the specified matrix.
|
|
149
|
+
* @param right - The specified matrix
|
|
150
|
+
* @returns This matrix that store the difference between the two matrices
|
|
151
|
+
*/
|
|
152
|
+
subtract(right: Matrix3x3): Matrix3x3;
|
|
153
|
+
/**
|
|
154
|
+
* Determines the product of this matrix and the specified matrix.
|
|
155
|
+
* @param right - The specified matrix
|
|
156
|
+
* @returns This matrix that store the product of the two matrices
|
|
157
|
+
*/
|
|
158
|
+
multiply(right: Matrix3x3): Matrix3x3;
|
|
159
|
+
/**
|
|
160
|
+
* Calculate a determinant of this matrix.
|
|
161
|
+
* @returns The determinant of this matrix
|
|
162
|
+
*/
|
|
163
|
+
determinant(): number;
|
|
164
|
+
/**
|
|
165
|
+
* Identity this matrix.
|
|
166
|
+
* @returns This matrix after identity
|
|
167
|
+
*/
|
|
168
|
+
identity(): Matrix3x3;
|
|
169
|
+
/**
|
|
170
|
+
* Invert the matrix.
|
|
171
|
+
* @returns The matrix after invert
|
|
172
|
+
*/
|
|
173
|
+
invert(): Matrix3x3;
|
|
174
|
+
/**
|
|
175
|
+
* This matrix rotates around an angle.
|
|
176
|
+
* @param r - The rotation angle in radians
|
|
177
|
+
* @returns This matrix after rotate
|
|
178
|
+
*/
|
|
179
|
+
rotate(r: number): Matrix3x3;
|
|
180
|
+
/**
|
|
181
|
+
* Scale this matrix by a given vector.
|
|
182
|
+
* @param s - The given vector
|
|
183
|
+
* @returns This matrix after scale
|
|
184
|
+
*/
|
|
185
|
+
scale(s: Vector2): Matrix3x3;
|
|
186
|
+
/**
|
|
187
|
+
* Translate this matrix by a given vector.
|
|
188
|
+
* @param translation - The given vector
|
|
189
|
+
* @returns This matrix after translate
|
|
190
|
+
*/
|
|
191
|
+
translate(translation: Vector2): Matrix3x3;
|
|
192
|
+
/**
|
|
193
|
+
* Calculate the transpose of this matrix.
|
|
194
|
+
* @returns This matrix after transpose
|
|
195
|
+
*/
|
|
196
|
+
transpose(): Matrix3x3;
|
|
197
|
+
/**
|
|
198
|
+
* Creates a clone of this matrix.
|
|
199
|
+
* @returns A clone of this matrix
|
|
200
|
+
*/
|
|
201
|
+
clone(): Matrix3x3;
|
|
202
|
+
/**
|
|
203
|
+
* Copy this matrix from the specified matrix.
|
|
204
|
+
* @param source - The specified matrix
|
|
205
|
+
* @returns This matrix
|
|
206
|
+
*/
|
|
207
|
+
copyFrom(source: Matrix3x3): Matrix3x3;
|
|
208
|
+
/**
|
|
209
|
+
* Copy the value of this matrix from an array.
|
|
210
|
+
* @param array - The array
|
|
211
|
+
* @param offset - The start offset of the array
|
|
212
|
+
* @returns This matrix
|
|
213
|
+
*/
|
|
214
|
+
copyFromArray(array: ArrayLike<number>, offset?: number): Matrix3x3;
|
|
215
|
+
/**
|
|
216
|
+
* Copy the value of this matrix to an array.
|
|
217
|
+
* @param out - The array
|
|
218
|
+
* @param outOffset - The start offset of the array
|
|
219
|
+
*/
|
|
220
|
+
copyToArray(out: number[] | Float32Array | Float64Array, outOffset?: number): void;
|
|
221
|
+
/**
|
|
222
|
+
* Copy the value of this 3x3 matrix from the specified 4x4 matrix.
|
|
223
|
+
* upper-left principle
|
|
224
|
+
* @param source - The specified 4x4 matrix
|
|
225
|
+
* @returns This 3x3 matrix
|
|
226
|
+
*/
|
|
227
|
+
copyFromMatrix(source: Matrix): Matrix3x3;
|
|
228
|
+
}
|
package/types/Plane.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IClone } from "./IClone";
|
|
2
|
+
import { ICopy } from "./ICopy";
|
|
3
|
+
import { Vector3 } from "./Vector3";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a plane in three-dimensional space.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Plane implements IClone<Plane>, ICopy<Plane, Plane> {
|
|
8
|
+
/**
|
|
9
|
+
* Normalize the normal vector of the specified plane.
|
|
10
|
+
* @param p - The specified plane
|
|
11
|
+
* @param out - A normalized version of the specified plane
|
|
12
|
+
*/
|
|
13
|
+
static normalize(p: Plane, out: Plane): void;
|
|
14
|
+
/**
|
|
15
|
+
* Calculate the plane that contains the three specified points.
|
|
16
|
+
* @param point0 - The first point
|
|
17
|
+
* @param point1 - The second point
|
|
18
|
+
* @param point2 - The third point
|
|
19
|
+
* @param out - The calculated plane
|
|
20
|
+
*/
|
|
21
|
+
static fromPoints(point0: Vector3, point1: Vector3, point2: Vector3, out: Plane): void;
|
|
22
|
+
/** The normal of the plane. */
|
|
23
|
+
readonly normal: Vector3;
|
|
24
|
+
/** The distance of the plane along its normal to the origin. */
|
|
25
|
+
distance: number;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor of Plane.
|
|
28
|
+
* @param normal - The normal vector
|
|
29
|
+
* @param distance - The distance of the plane along its normal to the origin
|
|
30
|
+
*/
|
|
31
|
+
constructor(normal?: Vector3, distance?: number);
|
|
32
|
+
/**
|
|
33
|
+
* Normalize the normal vector of this plane.
|
|
34
|
+
* @returns The plane after normalize
|
|
35
|
+
*/
|
|
36
|
+
normalize(): Plane;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a clone of this plane.
|
|
39
|
+
* @returns A clone of this plane
|
|
40
|
+
*/
|
|
41
|
+
clone(): Plane;
|
|
42
|
+
/**
|
|
43
|
+
* Copy this plane from the specified plane.
|
|
44
|
+
* @param source - The specified plane
|
|
45
|
+
* @returns This plane
|
|
46
|
+
*/
|
|
47
|
+
copyFrom(source: Plane): Plane;
|
|
48
|
+
}
|