@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.
Files changed (88) hide show
  1. package/LICENSE +1 -1
  2. package/dist/algorithms/greatestCommonDivisor.d.ts.map +1 -1
  3. package/dist/algorithms/greatestCommonDivisor.js +14 -4
  4. package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
  5. package/dist/index.d.ts +12 -12
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/linalg/DualQuaternion.d.ts +158 -158
  9. package/dist/linalg/DualQuaternion.d.ts.map +1 -1
  10. package/dist/linalg/DualQuaternion.js +173 -165
  11. package/dist/linalg/DualQuaternion.js.map +1 -1
  12. package/dist/linalg/Matrix.d.ts +24 -24
  13. package/dist/linalg/Matrix.d.ts.map +1 -1
  14. package/dist/linalg/Matrix2.d.ts +85 -85
  15. package/dist/linalg/Matrix2.d.ts.map +1 -1
  16. package/dist/linalg/Matrix2.js +92 -88
  17. package/dist/linalg/Matrix2.js.map +1 -1
  18. package/dist/linalg/Matrix3.d.ts +134 -134
  19. package/dist/linalg/Matrix3.d.ts.map +1 -1
  20. package/dist/linalg/Matrix3.js +147 -138
  21. package/dist/linalg/Matrix3.js.map +1 -1
  22. package/dist/linalg/Matrix4.d.ts +245 -246
  23. package/dist/linalg/Matrix4.d.ts.map +1 -1
  24. package/dist/linalg/Matrix4.js +272 -251
  25. package/dist/linalg/Matrix4.js.map +1 -1
  26. package/dist/linalg/Quaternion.d.ts +147 -146
  27. package/dist/linalg/Quaternion.d.ts.map +1 -1
  28. package/dist/linalg/Quaternion.js +175 -161
  29. package/dist/linalg/Quaternion.js.map +1 -1
  30. package/dist/linalg/SlowMatrix.d.ts +12 -12
  31. package/dist/linalg/SlowMatrix.d.ts.map +1 -1
  32. package/dist/linalg/SlowMatrix.js +12 -12
  33. package/dist/linalg/SlowMatrix.js.map +1 -1
  34. package/dist/linalg/SlowSquareMatrix.d.ts +7 -7
  35. package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
  36. package/dist/linalg/SlowSquareMatrix.js +15 -15
  37. package/dist/linalg/SlowSquareMatrix.js.map +1 -1
  38. package/dist/linalg/SlowVector.d.ts +77 -77
  39. package/dist/linalg/SlowVector.d.ts.map +1 -1
  40. package/dist/linalg/SlowVector.js +153 -153
  41. package/dist/linalg/SlowVector.js.map +1 -1
  42. package/dist/linalg/SquareMatrix.d.ts +8 -8
  43. package/dist/linalg/SquareMatrix.d.ts.map +1 -1
  44. package/dist/linalg/Vector.d.ts +85 -84
  45. package/dist/linalg/Vector.d.ts.map +1 -1
  46. package/dist/linalg/Vector2.d.ts +143 -143
  47. package/dist/linalg/Vector2.d.ts.map +1 -1
  48. package/dist/linalg/Vector2.js +145 -143
  49. package/dist/linalg/Vector2.js.map +1 -1
  50. package/dist/linalg/Vector3.d.ts +173 -173
  51. package/dist/linalg/Vector3.d.ts.map +1 -1
  52. package/dist/linalg/Vector3.js +176 -173
  53. package/dist/linalg/Vector3.js.map +1 -1
  54. package/dist/linalg/Vector4.d.ts +137 -137
  55. package/dist/linalg/Vector4.d.ts.map +1 -1
  56. package/dist/linalg/Vector4.js +144 -140
  57. package/dist/linalg/Vector4.js.map +1 -1
  58. package/dist/types/AxisAngle.d.ts +11 -1
  59. package/dist/types/AxisAngle.d.ts.map +1 -1
  60. package/dist/types/FieldOfView.d.ts +2 -2
  61. package/dist/types/FieldOfView.d.ts.map +1 -1
  62. package/dist/utility/BigNumber.d.ts +21 -11
  63. package/dist/utility/BigNumber.d.ts.map +1 -1
  64. package/dist/utility/BigNumber.js +49 -31
  65. package/dist/utility/BigNumber.js.map +1 -1
  66. package/dist/utility/createAxisAngleLike.d.ts.map +1 -1
  67. package/dist/utility/createAxisAngleLike.js.map +1 -1
  68. package/package.json +13 -12
  69. package/src/algorithms/greatestCommonDivisor.ts +19 -7
  70. package/src/index.ts +21 -14
  71. package/src/linalg/DualQuaternion.ts +264 -238
  72. package/src/linalg/Matrix.ts +31 -28
  73. package/src/linalg/Matrix2.ts +157 -137
  74. package/src/linalg/Matrix3.ts +222 -191
  75. package/src/linalg/Matrix4.ts +464 -412
  76. package/src/linalg/Quaternion.ts +267 -234
  77. package/src/linalg/SlowMatrix.ts +31 -27
  78. package/src/linalg/SlowSquareMatrix.ts +19 -18
  79. package/src/linalg/SlowVector.ts +175 -174
  80. package/src/linalg/SquareMatrix.ts +9 -9
  81. package/src/linalg/Vector.ts +91 -89
  82. package/src/linalg/Vector2.ts +250 -217
  83. package/src/linalg/Vector3.ts +309 -269
  84. package/src/linalg/Vector4.ts +246 -206
  85. package/src/types/AxisAngle.ts +13 -1
  86. package/src/types/FieldOfView.ts +3 -3
  87. package/src/utility/BigNumber.ts +71 -38
  88. package/src/utility/createAxisAngleLike.ts +1 -0
@@ -1,9 +1,9 @@
1
- import Quaternion, { type QuaternionLike } from "./Quaternion.js";
2
- import Vector3, { type Vector3Like } from "./Vector3.js";
3
- import type { DualQuaternionLike } from "./DualQuaternion.js";
4
1
  import type FieldOfView from "../types/FieldOfView.js";
2
+ import type { DualQuaternionLike } from "./DualQuaternion.js";
5
3
  import type { MatrixLike } from "./Matrix.js";
6
4
  import type SquareMatrix from "./SquareMatrix.js";
5
+ import Quaternion, { type QuaternionLike } from "./Quaternion.js";
6
+ import Vector3, { type Vector3Like } from "./Vector3.js";
7
7
  /**
8
8
  * Numbers arranged into four columns and four rows.
9
9
  * @see {@link https://en.wikipedia.org/wiki/Matrix_(mathematics) | Matrix}
@@ -80,7 +80,7 @@ export declare const fromValues: <T extends Matrix4Like>(c0r0: number, c0r1: num
80
80
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
81
81
  * @public
82
82
  */
83
- export declare const fromTranslation: <T extends Matrix4Like>(vector: Vector3Like, out: T) => T;
83
+ export declare const fromTranslation: <T extends Matrix4Like>(vector: Readonly<Vector3Like>, out: T) => T;
84
84
  /**
85
85
  * Create a transformation matrix that represents a scaling by the given vector. This is equivalent to (but faster than) `scale(identity(out), vector, out)`.
86
86
  * @param vector - The scaling vector.
@@ -89,7 +89,7 @@ export declare const fromTranslation: <T extends Matrix4Like>(vector: Vector3Lik
89
89
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
90
90
  * @public
91
91
  */
92
- export declare const fromScaling: <T extends Matrix4Like>(vector: Vector3Like, out: T) => T;
92
+ export declare const fromScaling: <T extends Matrix4Like>(vector: Readonly<Vector3Like>, out: T) => T;
93
93
  /**
94
94
  * Reset a matrix to identity.
95
95
  * @param out - The matrix to store the result in.
@@ -107,7 +107,7 @@ export declare const identity: <T extends Matrix4Like>(out: T) => T;
107
107
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
108
108
  * @public
109
109
  */
110
- export declare const fromRotation: <T extends Matrix4Like>(radians: number, axis: Vector3Like, out: T) => T;
110
+ export declare const fromRotation: <T extends Matrix4Like>(radians: number, axis: Readonly<Vector3Like>, out: T) => T;
111
111
  /**
112
112
  * Create a transformation matrix that represents a rotation by the given angle around the X-axis. This is equivalent to (but faster than) `rotateX(identity(out), radians, out)`.
113
113
  * @param radians - The angle in radians.
@@ -146,7 +146,7 @@ export declare const fromZRotation: <T extends Matrix4Like>(radians: number, out
146
146
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
147
147
  * @public
148
148
  */
149
- export declare const fromRotationTranslation: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, out: T) => T;
149
+ export declare const fromRotationTranslation: <T extends Matrix4Like>(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>, out: T) => T;
150
150
  /**
151
151
  * Create a transformation matrix from the given rotation, translation, and scale. This is equivalent to (but faster than) `scale(multiply(translate(identity(out), translation, out), fromQuaternion(rotation, createMatrix4Like()), out), scaling, out)`.
152
152
  * @param rotation - The rotation quaternion.
@@ -159,7 +159,7 @@ export declare const fromRotationTranslation: <T extends Matrix4Like>(rotation:
159
159
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
160
160
  * @public
161
161
  */
162
- export declare const fromRotationTranslationScale: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, out: T) => T;
162
+ export declare const fromRotationTranslationScale: <T extends Matrix4Like>(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>, scaling: Readonly<Vector3Like>, out: T) => T;
163
163
  /**
164
164
  * Create a transformation matrix from the given rotation, translation, and scale around the given origin. This is equivalent to (but faster than) `translate(scale(multiply(translate(translate(identity(out), translation, out), origin, out), fromQuaternion(rotation, createMatrix4Like()), out), scaling, out), negate(origin), out)`.
165
165
  * @param rotation - The rotation quaternion.
@@ -173,7 +173,7 @@ export declare const fromRotationTranslationScale: <T extends Matrix4Like>(rotat
173
173
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
174
174
  * @public
175
175
  */
176
- export declare const fromRotationTranslationScaleOrigin: <T extends Matrix4Like>(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, origin: Vector3Like, out: T) => T;
176
+ export declare const fromRotationTranslationScaleOrigin: <T extends Matrix4Like>(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>, scaling: Readonly<Vector3Like>, origin: Readonly<Vector3Like>, out: T) => T;
177
177
  /**
178
178
  * Create a transformation matrix from a quaternion.
179
179
  * @param quaternion - The quaternion.
@@ -183,7 +183,7 @@ export declare const fromRotationTranslationScaleOrigin: <T extends Matrix4Like>
183
183
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
184
184
  * @public
185
185
  */
186
- export declare const fromQuaternion: <T extends Matrix4Like>(quaternion: QuaternionLike, out: T) => T;
186
+ export declare const fromQuaternion: <T extends Matrix4Like>(quaternion: Readonly<QuaternionLike>, out: T) => T;
187
187
  /**
188
188
  * Create a transformation matrix from a dual quaternion.
189
189
  * @param quaternion - The dual quaternion.
@@ -194,7 +194,7 @@ export declare const fromQuaternion: <T extends Matrix4Like>(quaternion: Quatern
194
194
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
195
195
  * @public
196
196
  */
197
- export declare const fromDualQuaternion: <T extends Matrix4Like>(quaternion: DualQuaternionLike, out: T) => T;
197
+ export declare const fromDualQuaternion: <T extends Matrix4Like>(quaternion: Readonly<DualQuaternionLike>, out: T) => T;
198
198
  /**
199
199
  * Generate a frustum matrix with the given bounds.
200
200
  * @param left - The left bound of the frustum.
@@ -248,7 +248,7 @@ export declare const perspectiveGpu: <T extends Matrix4Like>(fov: number, aspect
248
248
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
249
249
  * @public
250
250
  */
251
- export declare const perspectiveFromFieldOfView: <T extends Matrix4Like>(fov: FieldOfView, near: number, far: number, out: T) => T;
251
+ export declare const perspectiveFromFieldOfView: <T extends Matrix4Like>(fov: Readonly<FieldOfView>, near: number, far: number, out: T) => T;
252
252
  /**
253
253
  * Generate an orthogonal projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[-1, 1]` (OpenGL/WebGL).
254
254
  * @param left - The left bound of the frustum.
@@ -289,7 +289,7 @@ export declare const orthoGpu: <T extends Matrix4Like>(left: number, right: numb
289
289
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
290
290
  * @public
291
291
  */
292
- export declare const lookAt: <T extends Matrix4Like>(eye: Vector3Like, center: Vector3Like, up: Vector3Like, out: T) => T;
292
+ export declare const lookAt: <T extends Matrix4Like>(eye: Readonly<Vector3Like>, center: Readonly<Vector3Like>, up: Readonly<Vector3Like>, out: T) => T;
293
293
  /**
294
294
  * Create a matrix that makes something look at something else.
295
295
  * @param eye - The position of the viewer.
@@ -300,7 +300,7 @@ export declare const lookAt: <T extends Matrix4Like>(eye: Vector3Like, center: V
300
300
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
301
301
  * @public
302
302
  */
303
- export declare const targetTo: <T extends Matrix4Like>(eye: Vector3Like, target: Vector3Like, up: Vector3Like, out: T) => T;
303
+ export declare const targetTo: <T extends Matrix4Like>(eye: Readonly<Vector3Like>, target: Readonly<Vector3Like>, up: Readonly<Vector3Like>, out: T) => T;
304
304
  /**
305
305
  * Add two matrices.
306
306
  * @param a - The augend.
@@ -310,7 +310,7 @@ export declare const targetTo: <T extends Matrix4Like>(eye: Vector3Like, target:
310
310
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
311
311
  * @public
312
312
  */
313
- export declare const add: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
313
+ export declare const add: <T extends Matrix4Like>(a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>, out: T) => T;
314
314
  /**
315
315
  * Determine whether or not two matrices are roughly equivalent.
316
316
  * @param a - The first matrix.
@@ -318,7 +318,7 @@ export declare const add: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like
318
318
  * @returns Whether or not the matrices are equivalent.
319
319
  * @public
320
320
  */
321
- export declare const equals: (a: Matrix4Like, b: Matrix4Like) => boolean;
321
+ export declare const equals: (a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>) => boolean;
322
322
  /**
323
323
  * Determine whether or not two matrices are exactly equivalent.
324
324
  * @param a - The first matrix.
@@ -326,7 +326,7 @@ export declare const equals: (a: Matrix4Like, b: Matrix4Like) => boolean;
326
326
  * @returns Whether the matrices are equivalent.
327
327
  * @public
328
328
  */
329
- export declare const exactEquals: (a: Matrix4Like, b: Matrix4Like) => boolean;
329
+ export declare const exactEquals: (a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>) => boolean;
330
330
  /**
331
331
  * Calculate the adjugate of a matrix.
332
332
  * @param matrix - The matrix.
@@ -335,7 +335,7 @@ export declare const exactEquals: (a: Matrix4Like, b: Matrix4Like) => boolean;
335
335
  * @see {@link https://en.wikipedia.org/wiki/Adjugate_matrix | Adjugate matrix}
336
336
  * @public
337
337
  */
338
- export declare const adjoint: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
338
+ export declare const adjoint: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
339
339
  /**
340
340
  * Copy the values of one matrix into another.
341
341
  * @param matrix - The matrix to copy.
@@ -343,7 +343,7 @@ export declare const adjoint: <T extends Matrix4Like>(matrix: Matrix4Like, out:
343
343
  * @returns This matrix.
344
344
  * @public
345
345
  */
346
- export declare const copy: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
346
+ export declare const copy: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
347
347
  /**
348
348
  * Calculate the Frobenius norm of a matrix.
349
349
  * @param matrix - The matrix.
@@ -351,7 +351,7 @@ export declare const copy: <T extends Matrix4Like>(matrix: Matrix4Like, out: T)
351
351
  * @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
352
352
  * @public
353
353
  */
354
- export declare const frob: (matrix: Matrix4Like) => number;
354
+ export declare const frob: (matrix: Readonly<Matrix4Like>) => number;
355
355
  /**
356
356
  * Multiply two matrices.
357
357
  * @param a - The multiplier.
@@ -361,7 +361,7 @@ export declare const frob: (matrix: Matrix4Like) => number;
361
361
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
362
362
  * @public
363
363
  */
364
- export declare const multiply: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
364
+ export declare const multiply: <T extends Matrix4Like>(a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>, out: T) => T;
365
365
  /**
366
366
  * Multiply a matrix by a scalar value.
367
367
  * @param matrix - The multiplicand.
@@ -371,7 +371,7 @@ export declare const multiply: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix
371
371
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
372
372
  * @public
373
373
  */
374
- export declare const multiplyScalar: <T extends Matrix4Like>(matrix: Matrix4Like, scalar: number, out: T) => T;
374
+ export declare const multiplyScalar: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, scalar: number, out: T) => T;
375
375
  /**
376
376
  * Add a matrix to another after multiplying the other by a scalar.
377
377
  * @param a - The augend.
@@ -383,7 +383,7 @@ export declare const multiplyScalar: <T extends Matrix4Like>(matrix: Matrix4Like
383
383
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
384
384
  * @public
385
385
  */
386
- export declare const multiplyScalarAndAdd: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, scalar: number, out: T) => T;
386
+ export declare const multiplyScalarAndAdd: <T extends Matrix4Like>(a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>, scalar: number, out: T) => T;
387
387
  /**
388
388
  * Subtract two matrices.
389
389
  * @param a - The minuend.
@@ -393,7 +393,7 @@ export declare const multiplyScalarAndAdd: <T extends Matrix4Like>(a: Matrix4Lik
393
393
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
394
394
  * @public
395
395
  */
396
- export declare const subtract: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix4Like, out: T) => T;
396
+ export declare const subtract: <T extends Matrix4Like>(a: Readonly<Matrix4Like>, b: Readonly<Matrix4Like>, out: T) => T;
397
397
  /**
398
398
  * Transpose a matrix.
399
399
  * @param matrix - The matrix.
@@ -402,7 +402,7 @@ export declare const subtract: <T extends Matrix4Like>(a: Matrix4Like, b: Matrix
402
402
  * @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
403
403
  * @public
404
404
  */
405
- export declare const transpose: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
405
+ export declare const transpose: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
406
406
  /**
407
407
  * Calculate the determinant of a matrix.
408
408
  * @param matrix - The matrix.
@@ -410,7 +410,7 @@ export declare const transpose: <T extends Matrix4Like>(matrix: Matrix4Like, out
410
410
  * @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
411
411
  * @public
412
412
  */
413
- export declare const determinant: (matrix: Matrix4Like) => number;
413
+ export declare const determinant: (matrix: Readonly<Matrix4Like>) => number;
414
414
  /**
415
415
  * Invert a matrix.
416
416
  * @param matrix - The matrix.
@@ -419,7 +419,7 @@ export declare const determinant: (matrix: Matrix4Like) => number;
419
419
  * @see {@link https://en.wikipedia.org/wiki/Invertible_matrix | Invertible matrix}
420
420
  * @public
421
421
  */
422
- export declare const invert: <T extends Matrix4Like>(matrix: Matrix4Like, out: T) => T;
422
+ export declare const invert: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
423
423
  /**
424
424
  * Scale a matrix by the given vector.
425
425
  * @param matrix - The matrix.
@@ -429,7 +429,7 @@ export declare const invert: <T extends Matrix4Like>(matrix: Matrix4Like, out: T
429
429
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
430
430
  * @public
431
431
  */
432
- export declare const scale: <T extends Matrix4Like>(matrix: Matrix4Like, vector: Vector3Like, out: T) => T;
432
+ export declare const scale: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, vector: Readonly<Vector3Like>, out: T) => T;
433
433
  /**
434
434
  * Translate a matrix by the given vector.
435
435
  * @param matrix - The matrix.
@@ -439,7 +439,7 @@ export declare const scale: <T extends Matrix4Like>(matrix: Matrix4Like, vector:
439
439
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
440
440
  * @public
441
441
  */
442
- export declare const translate: <T extends Matrix4Like>(matrix: Matrix4Like, vector: Vector3Like, out: T) => T;
442
+ export declare const translate: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, vector: Readonly<Vector3Like>, out: T) => T;
443
443
  /**
444
444
  * Rotate a matrix by the given angle around the given axis.
445
445
  * @param matrix - The matrix.
@@ -450,7 +450,7 @@ export declare const translate: <T extends Matrix4Like>(matrix: Matrix4Like, vec
450
450
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
451
451
  * @public
452
452
  */
453
- export declare const rotate: <T extends Matrix4Like>(matrix: Matrix4Like, radians: number, axis: Vector3Like, out: T) => T;
453
+ export declare const rotate: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, radians: number, axis: Readonly<Vector3Like>, out: T) => T;
454
454
  /**
455
455
  * Rotate a matrix by the given angle around the X-axis.
456
456
  * @param matrix - The matrix.
@@ -460,7 +460,7 @@ export declare const rotate: <T extends Matrix4Like>(matrix: Matrix4Like, radian
460
460
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
461
461
  * @public
462
462
  */
463
- export declare const rotateX: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
463
+ export declare const rotateX: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, r: number, out: T) => T;
464
464
  /**
465
465
  * Rotate a matrix by the given angle around the Y-axis.
466
466
  * @param matrix - The matrix.
@@ -470,7 +470,7 @@ export declare const rotateX: <T extends Matrix4Like>(matrix: Matrix4Like, r: nu
470
470
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
471
471
  * @public
472
472
  */
473
- export declare const rotateY: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
473
+ export declare const rotateY: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, r: number, out: T) => T;
474
474
  /**
475
475
  * Rotate a matrix by the given angle around the Z-axis.
476
476
  * @param matrix - The matrix.
@@ -480,7 +480,7 @@ export declare const rotateY: <T extends Matrix4Like>(matrix: Matrix4Like, r: nu
480
480
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
481
481
  * @public
482
482
  */
483
- export declare const rotateZ: <T extends Matrix4Like>(matrix: Matrix4Like, r: number, out: T) => T;
483
+ export declare const rotateZ: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, r: number, out: T) => T;
484
484
  /**
485
485
  * Get the translation vector component of a transformation matrix.
486
486
  * @param matrix - The matrix.
@@ -489,7 +489,7 @@ export declare const rotateZ: <T extends Matrix4Like>(matrix: Matrix4Like, r: nu
489
489
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
490
490
  * @public
491
491
  */
492
- export declare const getTranslation: <T extends Vector3Like>(matrix: Matrix4Like, out: T) => T;
492
+ export declare const getTranslation: <T extends Vector3Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
493
493
  /**
494
494
  * Set the translation vector component of a transformation matrix.
495
495
  * @param matrix - The matrix.
@@ -499,7 +499,7 @@ export declare const getTranslation: <T extends Vector3Like>(matrix: Matrix4Like
499
499
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
500
500
  * @public
501
501
  */
502
- export declare const setTranslation: <T extends Matrix4Like>(matrix: Matrix4Like, translation: Vector3Like, out: T) => T;
502
+ export declare const setTranslation: <T extends Matrix4Like>(matrix: Readonly<Matrix4Like>, translation: Readonly<Vector3Like>, out: T) => T;
503
503
  /**
504
504
  * Get the scaling factor of a transformation matrix.
505
505
  * @param matrix - The matrix.
@@ -508,7 +508,7 @@ export declare const setTranslation: <T extends Matrix4Like>(matrix: Matrix4Like
508
508
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
509
509
  * @public
510
510
  */
511
- export declare const getScaling: <T extends Vector3Like>(matrix: Matrix4Like, out: T) => T;
511
+ export declare const getScaling: <T extends Vector3Like>(matrix: Readonly<Matrix4Like>, out: T) => T;
512
512
  /**
513
513
  * Get the rotational component of a transformation matrix.
514
514
  * @param matrix - The matrix.
@@ -517,56 +517,106 @@ export declare const getScaling: <T extends Vector3Like>(matrix: Matrix4Like, ou
517
517
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
518
518
  * @public
519
519
  */
520
- export declare const getRotation: <T extends QuaternionLike>(matrix: Matrix4Like, out: T) => T;
520
+ export declare const getRotation: <T extends QuaternionLike>(matrix: Readonly<Matrix4Like>, out: T) => T;
521
521
  /**
522
522
  * A four-by-four matrix.
523
523
  * @see {@link https://en.wikipedia.org/wiki/Matrix_(mathematics) | Matrix}
524
524
  * @public
525
525
  */
526
- export default class Matrix4 extends Float32Array implements SquareMatrix, Matrix4Like {
526
+ export default class Matrix4 extends Float32Array implements Matrix4Like, SquareMatrix {
527
+ /** The value in the first column and first row. */
528
+ 0: number;
529
+ /** The value in the first column and second row. */
530
+ 1: number;
531
+ /** The value in the first column and third row. */
532
+ 2: number;
533
+ /** The value in the first column and fourth row. */
534
+ 3: number;
535
+ /** The value in the second column and first row. */
536
+ 4: number;
537
+ /** The value in the second column and second row. */
538
+ 5: number;
539
+ /** The value in the second column and third row. */
540
+ 6: number;
541
+ /** The value in the second column and fourth row. */
542
+ 7: number;
543
+ /** The value in the third column and first row. */
544
+ 8: number;
545
+ /** The value in the third column and second row. */
546
+ 9: number;
547
+ /** The value in the third column and third row. */
548
+ 10: number;
549
+ /** The value in the third column and fourth row. */
550
+ 11: number;
551
+ /** The value in the fourth column and first row. */
552
+ 12: number;
553
+ /** The value in the fourth column and second row. */
554
+ 13: number;
555
+ /** The value in the fourth column and third row. */
556
+ 14: number;
557
+ /** The value in the fourth column and fourth row. */
558
+ 15: number;
559
+ /** The number of rows in this matrix. */
560
+ readonly height: 4;
561
+ /** The number of columns in this matrix. */
562
+ readonly width: 4;
527
563
  /**
528
- * Create a transformation matrix that represents a translation by the given vector.
529
- * @param vector - The translation vector.
530
- * @returns The transformation matrix.
564
+ * Get the determinant of this matrix.
565
+ * @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
566
+ */
567
+ get determinant(): number;
568
+ /**
569
+ * Get the Frobenius norm of this matrix.
570
+ * @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
571
+ */
572
+ get frob(): number;
573
+ /**
574
+ * Get the scaling vector component of this transformation matrix.
575
+ * @returns The rotation.
576
+ * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
577
+ */
578
+ get rotation(): Quaternion;
579
+ /**
580
+ * Get the scaling vector component of this transformation matrix.
581
+ * @returns The scaling.
531
582
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
532
583
  */
533
- static fromTranslation(vector: Vector3Like): Matrix4;
584
+ get scaling(): Vector3;
534
585
  /**
535
- * Create a transformation matrix that represents a scaling by the given vector.
536
- * @param vector - The scaling vector.
537
- * @returns The transformation matrix.
586
+ * The translation vector component of this transformation matrix.
538
587
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
539
588
  */
540
- static fromScaling(vector: Vector3Like): Matrix4;
589
+ get translation(): Vector3;
541
590
  /**
542
- * Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
543
- * @param r - The angle in radians.
544
- * @param axis - The axis to rotate around.
545
- * @returns The transformation matrix.
546
- * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
591
+ * Create a four-by-four identity matrix.
592
+ * @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
547
593
  */
548
- static fromRotation(r: number, axis: Vector3Like): Matrix4;
594
+ constructor();
549
595
  /**
550
- * Create a transformation matrix that represents a rotation by the given angle around the X-axis.
551
- * @param r - The angle in radians.
596
+ * Create a transformation matrix from a dual quaternion.
597
+ * @param quaternion - The dual quaternion.
552
598
  * @returns The transformation matrix.
599
+ * @see {@link https://en.wikipedia.org/wiki/Dual_quaternion | Dual quaternion}
553
600
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
601
+ * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
554
602
  */
555
- static fromXRotation(r: number): Matrix4;
603
+ static fromDualQuaternion(quaternion: Readonly<DualQuaternionLike>): Matrix4;
556
604
  /**
557
- * Create a transformation matrix that represents a rotation by the given angle around the Y-axis.
558
- * @param r - The angle in radians.
605
+ * Create a transformation matrix from a quaternion.
606
+ * @param quaternion - The quaternion.
559
607
  * @returns The transformation matrix.
560
608
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
609
+ * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
561
610
  */
562
- static fromYRotation(r: number): Matrix4;
611
+ static fromQuaternion(quaternion: Readonly<QuaternionLike>): Matrix4;
563
612
  /**
564
613
  * Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
565
614
  * @param r - The angle in radians.
615
+ * @param axis - The axis to rotate around.
566
616
  * @returns The transformation matrix.
567
617
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
568
618
  */
569
- static fromZRotation(r: number): Matrix4;
619
+ static fromRotation(r: number, axis: Readonly<Vector3Like>): Matrix4;
570
620
  /**
571
621
  * Create a transformation matrix from the given rotation and translation.
572
622
  * @param rotation - The rotation quaternion.
@@ -575,7 +625,7 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
575
625
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
576
626
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
577
627
  */
578
- static fromRotationTranslation(rotation: QuaternionLike, translation: Vector3Like): Matrix4;
628
+ static fromRotationTranslation(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>): Matrix4;
579
629
  /**
580
630
  * Create a transformation matrix from the given rotation, translation, and scale.
581
631
  * @param rotation - The rotation quaternion.
@@ -585,7 +635,7 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
585
635
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
586
636
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
587
637
  */
588
- static fromRotationTranslationScale(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like): Matrix4;
638
+ static fromRotationTranslationScale(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>, scaling: Readonly<Vector3Like>): Matrix4;
589
639
  /**
590
640
  * Create a transformation matrix from the given rotation, translation, and scale around the given origin.
591
641
  * @param rotation - The rotation quaternion.
@@ -596,24 +646,63 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
596
646
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
597
647
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
598
648
  */
599
- static fromRotationTranslationScaleOrigin(rotation: QuaternionLike, translation: Vector3Like, scaling: Vector3Like, origin: Vector3Like): Matrix4;
649
+ static fromRotationTranslationScaleOrigin(rotation: Readonly<QuaternionLike>, translation: Readonly<Vector3Like>, scaling: Readonly<Vector3Like>, origin: Readonly<Vector3Like>): Matrix4;
600
650
  /**
601
- * Create a transformation matrix from a dual quaternion.
602
- * @param quaternion - The dual quaternion.
651
+ * Create a transformation matrix that represents a scaling by the given vector.
652
+ * @param vector - The scaling vector.
603
653
  * @returns The transformation matrix.
604
- * @see {@link https://en.wikipedia.org/wiki/Dual_quaternion | Dual quaternion}
605
- * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
606
654
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
607
655
  */
608
- static fromDualQuaternion(quaternion: DualQuaternionLike): Matrix4;
656
+ static fromScaling(vector: Readonly<Vector3Like>): Matrix4;
609
657
  /**
610
- * Create a transformation matrix from a quaternion.
611
- * @param quaternion - The quaternion.
658
+ * Create a transformation matrix that represents a translation by the given vector.
659
+ * @param vector - The translation vector.
612
660
  * @returns The transformation matrix.
613
- * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
614
661
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
615
662
  */
616
- static fromQuaternion(quaternion: QuaternionLike): Matrix4;
663
+ static fromTranslation(vector: Readonly<Vector3Like>): Matrix4;
664
+ /**
665
+ * Create a two-by-two matrix with the given values.
666
+ * @param c0r0 - The value in the first column and first row.
667
+ * @param c0r1 - The value in the first column and second row.
668
+ * @param c0r2 - The value in the first column and third row.
669
+ * @param c0r3 - The value in the first column and fourth row.
670
+ * @param c1r0 - The value in the second column and first row.
671
+ * @param c1r1 - The value in the second column and second row.
672
+ * @param c1r2 - The value in the second column and third row.
673
+ * @param c1r3 - The value in the second column and fourth row.
674
+ * @param c2r0 - The value in the third column and first row.
675
+ * @param c2r1 - The value in the third column and second row.
676
+ * @param c2r2 - The value in the third column and third row.
677
+ * @param c2r3 - The value in the third column and fourth row.
678
+ * @param c3r0 - The value in the fourth column and first row.
679
+ * @param c3r1 - The value in the fourth column and second row.
680
+ * @param c3r2 - The value in the fourth column and third row.
681
+ * @param c3r3 - The value in the fourth column and fourth row.
682
+ * @returns The matrix.
683
+ */
684
+ static fromValues(c0r0: number, c0r1: number, c0r2: number, c0r3: number, c1r0: number, c1r1: number, c1r2: number, c1r3: number, c2r0: number, c2r1: number, c2r2: number, c2r3: number, c3r0: number, c3r1: number, c3r2: number, c3r3: number): Matrix4;
685
+ /**
686
+ * Create a transformation matrix that represents a rotation by the given angle around the X-axis.
687
+ * @param r - The angle in radians.
688
+ * @returns The transformation matrix.
689
+ * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
690
+ */
691
+ static fromXRotation(r: number): Matrix4;
692
+ /**
693
+ * Create a transformation matrix that represents a rotation by the given angle around the Y-axis.
694
+ * @param r - The angle in radians.
695
+ * @returns The transformation matrix.
696
+ * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
697
+ */
698
+ static fromYRotation(r: number): Matrix4;
699
+ /**
700
+ * Create a transformation matrix that represents a rotation by the given angle around the Z-axis.
701
+ * @param r - The angle in radians.
702
+ * @returns The transformation matrix.
703
+ * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
704
+ */
705
+ static fromZRotation(r: number): Matrix4;
617
706
  /**
618
707
  * Generate a frustum matrix with the given bounds.
619
708
  * @param left - The left bound of the frustum.
@@ -628,73 +717,73 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
628
717
  */
629
718
  static frustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
630
719
  /**
631
- * Create a perspective projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[-1, 1]` (OpenGL/WebGL).
632
- * @param fov - The vertical field of view in radians.
633
- * @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
720
+ * Generate a look-at matrix. If you want a matrix that actually makes an object look at another object, use `targetTo` instead.
721
+ * @param eye - The position of the viewer.
722
+ * @param center - The point that the viewer is looking at.
723
+ * @param up - The local up direction.
724
+ * @returns The look-at matrix.
725
+ * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
726
+ */
727
+ static lookAt(eye: Readonly<Vector3Like>, center: Readonly<Vector3Like>, up?: Readonly<Vector3Like>): Matrix4;
728
+ /**
729
+ * Generate an orthogonal projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[-1, 1]` (OpenGL/WebGL).
730
+ * @param left - The left bound of the frustum.
731
+ * @param right - The right bound of the frustum.
732
+ * @param bottom - The bottom bound of the frustum.
733
+ * @param top - The top bound of the frustum.
634
734
  * @param near - The near bound of the frustum.
635
735
  * @param far - The far bound of the frustum.
636
- * @returns The perspective projection matrix.
736
+ * @returns The frustum matrix.
637
737
  * @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
638
738
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
639
739
  */
640
- static perspective(fov: number, aspect: number, near: number, far: number): Matrix4;
740
+ static ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
641
741
  /**
642
- * Create a perspective projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[0, 1]` (WebGPU/Vulkan/DirectX/Metal).
643
- * @param fov - The vertical field of view in radians.
644
- * @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
742
+ * Generate an orthogonal projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[0, 1]` (WebGPU/Vulkan/DirectX/Metal).
743
+ * @param left - The left bound of the frustum.
744
+ * @param right - The right bound of the frustum.
745
+ * @param bottom - The bottom bound of the frustum.
746
+ * @param top - The top bound of the frustum.
645
747
  * @param near - The near bound of the frustum.
646
748
  * @param far - The far bound of the frustum.
647
- * @returns The perspective projection matrix.
749
+ * @returns The frustum matrix.
648
750
  * @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
649
751
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
650
752
  */
651
- static perspectiveGpu(fov: number, aspect: number, near: number, far: number): Matrix4;
753
+ static orthoGpu(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
652
754
  /**
653
- * Create a perspective projection matrix from a field of view. Useful for generating projection matrices to be used with the WebXR API.
654
- * @param fov - The field of view.
755
+ * Create a perspective projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[-1, 1]` (OpenGL/WebGL).
756
+ * @param fov - The vertical field of view in radians.
757
+ * @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
655
758
  * @param near - The near bound of the frustum.
656
759
  * @param far - The far bound of the frustum.
657
760
  * @returns The perspective projection matrix.
658
761
  * @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
659
762
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
660
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API | WebXR API}
661
763
  */
662
- static perspectiveFromFieldOfView(fov: FieldOfView, near: number, far: number): Matrix4;
764
+ static perspective(fov: number, aspect: number, near: number, far: number): Matrix4;
663
765
  /**
664
- * Generate an orthogonal projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[-1, 1]` (OpenGL/WebGL).
665
- * @param left - The left bound of the frustum.
666
- * @param right - The right bound of the frustum.
667
- * @param bottom - The bottom bound of the frustum.
668
- * @param top - The top bound of the frustum.
766
+ * Create a perspective projection matrix from a field of view. Useful for generating projection matrices to be used with the WebXR API.
767
+ * @param fov - The field of view.
669
768
  * @param near - The near bound of the frustum.
670
769
  * @param far - The far bound of the frustum.
671
- * @returns The frustum matrix.
770
+ * @returns The perspective projection matrix.
672
771
  * @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
673
772
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
773
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API | WebXR API}
674
774
  */
675
- static ortho(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
775
+ static perspectiveFromFieldOfView(fov: Readonly<FieldOfView>, near: number, far: number): Matrix4;
676
776
  /**
677
- * Generate an orthogonal projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[0, 1]` (WebGPU/Vulkan/DirectX/Metal).
678
- * @param left - The left bound of the frustum.
679
- * @param right - The right bound of the frustum.
680
- * @param bottom - The bottom bound of the frustum.
681
- * @param top - The top bound of the frustum.
777
+ * Create a perspective projection matrix with the given bounds such that the near and far clip planes correspond to a normalized device coordinate Z range of `[0, 1]` (WebGPU/Vulkan/DirectX/Metal).
778
+ * @param fov - The vertical field of view in radians.
779
+ * @param aspect - The aspect ratio (typically the width of the viewport divided by its height).
682
780
  * @param near - The near bound of the frustum.
683
781
  * @param far - The far bound of the frustum.
684
- * @returns The frustum matrix.
782
+ * @returns The perspective projection matrix.
685
783
  * @see {@link https://en.wikipedia.org/wiki/Camera_matrix | Camera matrix}
686
784
  * @see {@link https://en.wikipedia.org/wiki/3D_projection | 3D projection}
687
785
  */
688
- static orthoGpu(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4;
689
- /**
690
- * Generate a look-at matrix. If you want a matrix that actually makes an object look at another object, use `targetTo` instead.
691
- * @param eye - The position of the viewer.
692
- * @param center - The point that the viewer is looking at.
693
- * @param up - The local up direction.
694
- * @returns The look-at matrix.
695
- * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
696
- */
697
- static lookAt(eye: Vector3Like, center: Vector3Like, up?: Vector3Like): Matrix4;
786
+ static perspectiveGpu(fov: number, aspect: number, near: number, far: number): Matrix4;
698
787
  /**
699
788
  * Create a matrix that makes something look at something else.
700
789
  * @param eye - The position of the viewer.
@@ -703,88 +792,14 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
703
792
  * @returns The transformation matrix.
704
793
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
705
794
  */
706
- static targetTo(eye: Vector3Like, target: Vector3Like, up?: Vector3Like): Matrix4;
707
- /**
708
- * Create a two-by-two matrix with the given values.
709
- * @param c0r0 - The value in the first column and first row.
710
- * @param c0r1 - The value in the first column and second row.
711
- * @param c0r2 - The value in the first column and third row.
712
- * @param c0r3 - The value in the first column and fourth row.
713
- * @param c1r0 - The value in the second column and first row.
714
- * @param c1r1 - The value in the second column and second row.
715
- * @param c1r2 - The value in the second column and third row.
716
- * @param c1r3 - The value in the second column and fourth row.
717
- * @param c2r0 - The value in the third column and first row.
718
- * @param c2r1 - The value in the third column and second row.
719
- * @param c2r2 - The value in the third column and third row.
720
- * @param c2r3 - The value in the third column and fourth row.
721
- * @param c3r0 - The value in the fourth column and first row.
722
- * @param c3r1 - The value in the fourth column and second row.
723
- * @param c3r2 - The value in the fourth column and third row.
724
- * @param c3r3 - The value in the fourth column and fourth row.
725
- * @returns The matrix.
726
- */
727
- static fromValues(c0r0: number, c0r1: number, c0r2: number, c0r3: number, c1r0: number, c1r1: number, c1r2: number, c1r3: number, c2r0: number, c2r1: number, c2r2: number, c2r3: number, c3r0: number, c3r1: number, c3r2: number, c3r3: number): Matrix4;
728
- /**
729
- * Create a four-by-four identity matrix.
730
- * @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
731
- */
732
- constructor();
733
- /** The value in the first column and first row. */
734
- 0: number;
735
- /** The value in the first column and second row. */
736
- 1: number;
737
- /** The value in the first column and third row. */
738
- 2: number;
739
- /** The value in the first column and fourth row. */
740
- 3: number;
741
- /** The value in the second column and first row. */
742
- 4: number;
743
- /** The value in the second column and second row. */
744
- 5: number;
745
- /** The value in the second column and third row. */
746
- 6: number;
747
- /** The value in the second column and fourth row. */
748
- 7: number;
749
- /** The value in the third column and first row. */
750
- 8: number;
751
- /** The value in the third column and second row. */
752
- 9: number;
753
- /** The value in the third column and third row. */
754
- 10: number;
755
- /** The value in the third column and fourth row. */
756
- 11: number;
757
- /** The value in the fourth column and first row. */
758
- 12: number;
759
- /** The value in the fourth column and second row. */
760
- 13: number;
761
- /** The value in the fourth column and third row. */
762
- 14: number;
763
- /** The value in the fourth column and fourth row. */
764
- 15: number;
765
- /** The number of columns in this matrix. */
766
- readonly width: 4;
767
- /** The number of rows in this matrix. */
768
- readonly height: 4;
769
- /**
770
- * Determine whether or not this matrix is roughly equivalent to another.
771
- * @param matrix - The other matrix.
772
- * @returns Whether or not the matrices are equivalent.
773
- */
774
- equals(matrix: Matrix4Like): boolean;
775
- /**
776
- * Determine whether or not this matrix is exactly equivalent to another.
777
- * @param matrix - The other matrix.
778
- * @returns Whether or not the matrices are equivalent.
779
- */
780
- exactEquals(matrix: Matrix4Like): boolean;
795
+ static targetTo(eye: Readonly<Vector3Like>, target: Readonly<Vector3Like>, up?: Readonly<Vector3Like>): Matrix4;
781
796
  /**
782
797
  * Add two matrices of the same size.
783
798
  * @param matrix - The other matrix.
784
799
  * @returns The sum of the matrices.
785
800
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
786
801
  */
787
- add(matrix: Matrix4Like): Matrix4;
802
+ add(matrix: Readonly<Matrix4Like>): Matrix4;
788
803
  /**
789
804
  * Calculate the adjugate of this matrix.
790
805
  * @returns The adjugate of this matrix.
@@ -801,19 +816,38 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
801
816
  * @param matrix - The matrix to copy.
802
817
  * @returns This matrix.
803
818
  */
804
- copy(matrix: Matrix4Like): this;
819
+ copy(matrix: Readonly<Matrix4Like>): this;
805
820
  /**
806
- * Get the Frobenius norm of this matrix.
807
- * @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
821
+ * Determine whether or not this matrix is roughly equivalent to another.
822
+ * @param matrix - The other matrix.
823
+ * @returns Whether or not the matrices are equivalent.
808
824
  */
809
- get frob(): number;
825
+ equals(matrix: Readonly<Matrix4Like>): boolean;
826
+ /**
827
+ * Determine whether or not this matrix is exactly equivalent to another.
828
+ * @param matrix - The other matrix.
829
+ * @returns Whether or not the matrices are equivalent.
830
+ */
831
+ exactEquals(matrix: Readonly<Matrix4Like>): boolean;
832
+ /**
833
+ * Reset this matrix to identity.
834
+ * @returns This matrix.
835
+ * @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
836
+ */
837
+ identity(): this;
838
+ /**
839
+ * Invert this matrix.
840
+ * @returns The inverted matrix.
841
+ * @see {@link https://en.wikipedia.org/wiki/Invertible_matrix | Invertible matrix}
842
+ */
843
+ invert(): Matrix4;
810
844
  /**
811
845
  * Multiply this matrix by another.
812
846
  * @param matrix - The other matrix.
813
847
  * @returns The product of the matrices.
814
848
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
815
849
  */
816
- multiply(matrix: Matrix4Like): Matrix4;
850
+ multiply(matrix: Readonly<Matrix4Like>): Matrix4;
817
851
  /**
818
852
  * Multiply this matrix by a scalar value.
819
853
  * @param scalar - The scalar value.
@@ -829,51 +863,7 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
829
863
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
830
864
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
831
865
  */
832
- multiplyScalarAndAdd(matrix: Matrix4Like, scalar: number): Matrix4;
833
- /**
834
- * Subtract another matrix from this one.
835
- * @param matrix - The other matrix.
836
- * @returns The difference between the matrices.
837
- * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
838
- */
839
- subtract(matrix: Matrix4Like): Matrix4;
840
- /**
841
- * Transpose this matrix.
842
- * @returns The transpose of this matrix.
843
- * @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
844
- */
845
- transpose(): Matrix4;
846
- /**
847
- * Get the determinant of this matrix.
848
- * @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
849
- */
850
- get determinant(): number;
851
- /**
852
- * Reset this matrix to identity.
853
- * @returns This matrix.
854
- * @see {@link https://en.wikipedia.org/wiki/Identity_matrix | Identity matrix}
855
- */
856
- identity(): this;
857
- /**
858
- * Invert this matrix.
859
- * @returns The inverted matrix.
860
- * @see {@link https://en.wikipedia.org/wiki/Invertible_matrix | Invertible matrix}
861
- */
862
- invert(): Matrix4;
863
- /**
864
- * Scale this matrix by the given vector.
865
- * @param vector - The scaling vector.
866
- * @returns The scaled matrix.
867
- * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
868
- */
869
- scale(vector: Vector3Like): Matrix4;
870
- /**
871
- * Translate this matrix by the given vector.
872
- * @param vector - The translation vector.
873
- * @returns The translated matrix.
874
- * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
875
- */
876
- translate(vector: Vector3Like): Matrix4;
866
+ multiplyScalarAndAdd(matrix: Readonly<Matrix4Like>, scalar: number): Matrix4;
877
867
  /**
878
868
  * Rotate this matrix by the given angle around the given axis.
879
869
  * @param r - The angle in radians.
@@ -881,7 +871,7 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
881
871
  * @returns The rotated matrix.
882
872
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
883
873
  */
884
- rotate(r: number, axis: Vector3Like): Matrix4;
874
+ rotate(r: number, axis: Readonly<Vector3Like>): Matrix4;
885
875
  /**
886
876
  * Rotate this matrix by the given angle around the X-axis.
887
877
  * @param r - The angle in radians.
@@ -904,29 +894,38 @@ export default class Matrix4 extends Float32Array implements SquareMatrix, Matri
904
894
  */
905
895
  rotateZ(r: number): Matrix4;
906
896
  /**
907
- * Get the translation vector component of this transformation matrix.
908
- * @returns The translation.
897
+ * Scale this matrix by the given vector.
898
+ * @param vector - The scaling vector.
899
+ * @returns The scaled matrix.
909
900
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
910
901
  */
911
- getTranslation(): Vector3;
902
+ scale(vector: Readonly<Vector3Like>): Matrix4;
912
903
  /**
913
904
  * Set the translation vector component of this transformation matrix.
914
905
  * @param translation - The translation vector.
915
906
  * @returns The transformation matrix.
916
907
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
917
908
  */
918
- setTranslation(translation: Vector3Like): Matrix4;
909
+ setTranslation(translation: Readonly<Vector3Like>): Matrix4;
919
910
  /**
920
- * Get the scaling vector component of this transformation matrix.
921
- * @returns The scaling.
911
+ * Subtract another matrix from this one.
912
+ * @param matrix - The other matrix.
913
+ * @returns The difference between the matrices.
914
+ * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
915
+ */
916
+ subtract(matrix: Readonly<Matrix4Like>): Matrix4;
917
+ /**
918
+ * Translate this matrix by the given vector.
919
+ * @param vector - The translation vector.
920
+ * @returns The translated matrix.
922
921
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
923
922
  */
924
- getScaling(): Vector3;
923
+ translate(vector: Readonly<Vector3Like>): Matrix4;
925
924
  /**
926
- * Get the scaling vector component of this transformation matrix.
927
- * @returns The rotation.
928
- * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
925
+ * Transpose this matrix.
926
+ * @returns The transpose of this matrix.
927
+ * @see {@link https://en.wikipedia.org/wiki/Transpose | Transpose}
929
928
  */
930
- getRotation(): Quaternion;
929
+ transpose(): Matrix4;
931
930
  }
932
931
  //# sourceMappingURL=Matrix4.d.ts.map