@lakuna/umath 3.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 (63) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/linalg/DualQuaternion.d.ts +46 -46
  5. package/dist/linalg/DualQuaternion.d.ts.map +1 -1
  6. package/dist/linalg/DualQuaternion.js.map +1 -1
  7. package/dist/linalg/Matrix.d.ts +7 -7
  8. package/dist/linalg/Matrix.d.ts.map +1 -1
  9. package/dist/linalg/Matrix2.d.ts +25 -25
  10. package/dist/linalg/Matrix2.d.ts.map +1 -1
  11. package/dist/linalg/Matrix2.js.map +1 -1
  12. package/dist/linalg/Matrix3.d.ts +35 -35
  13. package/dist/linalg/Matrix3.d.ts.map +1 -1
  14. package/dist/linalg/Matrix3.js.map +1 -1
  15. package/dist/linalg/Matrix4.d.ts +56 -56
  16. package/dist/linalg/Matrix4.d.ts.map +1 -1
  17. package/dist/linalg/Matrix4.js.map +1 -1
  18. package/dist/linalg/Quaternion.d.ts +44 -43
  19. package/dist/linalg/Quaternion.d.ts.map +1 -1
  20. package/dist/linalg/Quaternion.js.map +1 -1
  21. package/dist/linalg/SlowMatrix.d.ts +8 -8
  22. package/dist/linalg/SlowMatrix.d.ts.map +1 -1
  23. package/dist/linalg/SlowMatrix.js.map +1 -1
  24. package/dist/linalg/SlowSquareMatrix.d.ts +1 -1
  25. package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
  26. package/dist/linalg/SlowSquareMatrix.js.map +1 -1
  27. package/dist/linalg/SlowVector.d.ts +15 -15
  28. package/dist/linalg/SlowVector.d.ts.map +1 -1
  29. package/dist/linalg/SlowVector.js.map +1 -1
  30. package/dist/linalg/Vector.d.ts +14 -14
  31. package/dist/linalg/Vector.d.ts.map +1 -1
  32. package/dist/linalg/Vector2.d.ts +51 -51
  33. package/dist/linalg/Vector2.d.ts.map +1 -1
  34. package/dist/linalg/Vector2.js.map +1 -1
  35. package/dist/linalg/Vector3.d.ts +60 -60
  36. package/dist/linalg/Vector3.d.ts.map +1 -1
  37. package/dist/linalg/Vector3.js.map +1 -1
  38. package/dist/linalg/Vector4.d.ts +45 -45
  39. package/dist/linalg/Vector4.d.ts.map +1 -1
  40. package/dist/linalg/Vector4.js.map +1 -1
  41. package/dist/types/AxisAngle.d.ts +10 -0
  42. package/dist/types/AxisAngle.d.ts.map +1 -1
  43. package/dist/utility/BigNumber.d.ts +5 -5
  44. package/dist/utility/BigNumber.d.ts.map +1 -1
  45. package/dist/utility/BigNumber.js +13 -6
  46. package/dist/utility/BigNumber.js.map +1 -1
  47. package/package.json +4 -5
  48. package/src/index.ts +4 -1
  49. package/src/linalg/DualQuaternion.ts +69 -58
  50. package/src/linalg/Matrix.ts +10 -7
  51. package/src/linalg/Matrix2.ts +43 -32
  52. package/src/linalg/Matrix3.ts +53 -41
  53. package/src/linalg/Matrix4.ts +98 -84
  54. package/src/linalg/Quaternion.ts +75 -60
  55. package/src/linalg/SlowMatrix.ts +12 -9
  56. package/src/linalg/SlowSquareMatrix.ts +1 -1
  57. package/src/linalg/SlowVector.ts +16 -16
  58. package/src/linalg/Vector.ts +14 -14
  59. package/src/linalg/Vector2.ts +104 -76
  60. package/src/linalg/Vector3.ts +125 -92
  61. package/src/linalg/Vector4.ts +93 -62
  62. package/src/types/AxisAngle.ts +12 -0
  63. package/src/utility/BigNumber.ts +22 -11
@@ -168,7 +168,7 @@ export const fromValues = <T extends Matrix4Like>(
168
168
  * @public
169
169
  */
170
170
  export const fromTranslation = <T extends Matrix4Like>(
171
- vector: Vector3Like,
171
+ vector: Readonly<Vector3Like>,
172
172
  out: T
173
173
  ): T =>
174
174
  fromValues(
@@ -200,7 +200,7 @@ export const fromTranslation = <T extends Matrix4Like>(
200
200
  * @public
201
201
  */
202
202
  export const fromScaling = <T extends Matrix4Like>(
203
- vector: Vector3Like,
203
+ vector: Readonly<Vector3Like>,
204
204
  out: T
205
205
  ): T =>
206
206
  fromValues(
@@ -244,7 +244,7 @@ export const identity = <T extends Matrix4Like>(out: T): T =>
244
244
  */
245
245
  export const fromRotation = <T extends Matrix4Like>(
246
246
  radians: number,
247
- axis: Vector3Like,
247
+ axis: Readonly<Vector3Like>,
248
248
  out: T
249
249
  ): T => {
250
250
  let x = axis[0];
@@ -355,8 +355,8 @@ export const fromZRotation = <T extends Matrix4Like>(
355
355
  * @public
356
356
  */
357
357
  export const fromRotationTranslation = <T extends Matrix4Like>(
358
- rotation: QuaternionLike,
359
- translation: Vector3Like,
358
+ rotation: Readonly<QuaternionLike>,
359
+ translation: Readonly<Vector3Like>,
360
360
  out: T
361
361
  ): T => {
362
362
  const x = rotation[0];
@@ -411,9 +411,9 @@ export const fromRotationTranslation = <T extends Matrix4Like>(
411
411
  * @public
412
412
  */
413
413
  export const fromRotationTranslationScale = <T extends Matrix4Like>(
414
- rotation: QuaternionLike,
415
- translation: Vector3Like,
416
- scaling: Vector3Like,
414
+ rotation: Readonly<QuaternionLike>,
415
+ translation: Readonly<Vector3Like>,
416
+ scaling: Readonly<Vector3Like>,
417
417
  out: T
418
418
  ): T => {
419
419
  const x = rotation[0];
@@ -473,10 +473,10 @@ export const fromRotationTranslationScale = <T extends Matrix4Like>(
473
473
  * @public
474
474
  */
475
475
  export const fromRotationTranslationScaleOrigin = <T extends Matrix4Like>(
476
- rotation: QuaternionLike,
477
- translation: Vector3Like,
478
- scaling: Vector3Like,
479
- origin: Vector3Like,
476
+ rotation: Readonly<QuaternionLike>,
477
+ translation: Readonly<Vector3Like>,
478
+ scaling: Readonly<Vector3Like>,
479
+ origin: Readonly<Vector3Like>,
480
480
  out: T
481
481
  ): T => {
482
482
  const x = rotation[0];
@@ -545,7 +545,7 @@ export const fromRotationTranslationScaleOrigin = <T extends Matrix4Like>(
545
545
  * @public
546
546
  */
547
547
  export const fromQuaternion = <T extends Matrix4Like>(
548
- quaternion: QuaternionLike,
548
+ quaternion: Readonly<QuaternionLike>,
549
549
  out: T
550
550
  ): T => {
551
551
  const x = quaternion[0];
@@ -602,7 +602,7 @@ const iv3 = createVector3Like();
602
602
  * @public
603
603
  */
604
604
  export const fromDualQuaternion = <T extends Matrix4Like>(
605
- quaternion: DualQuaternionLike,
605
+ quaternion: Readonly<DualQuaternionLike>,
606
606
  out: T
607
607
  ): T => {
608
608
  const bx = -quaternion[0];
@@ -796,7 +796,7 @@ export const perspectiveGpu = <T extends Matrix4Like>(
796
796
  * @public
797
797
  */
798
798
  export const perspectiveFromFieldOfView = <T extends Matrix4Like>(
799
- fov: FieldOfView,
799
+ fov: Readonly<FieldOfView>,
800
800
  near: number,
801
801
  far: number,
802
802
  out: T
@@ -937,9 +937,9 @@ export const orthoGpu = <T extends Matrix4Like>(
937
937
  * @public
938
938
  */
939
939
  export const lookAt = <T extends Matrix4Like>(
940
- eye: Vector3Like,
941
- center: Vector3Like,
942
- up: Vector3Like,
940
+ eye: Readonly<Vector3Like>,
941
+ center: Readonly<Vector3Like>,
942
+ up: Readonly<Vector3Like>,
943
943
  out: T
944
944
  ): T => {
945
945
  const eyex = eye[0];
@@ -1028,9 +1028,9 @@ export const lookAt = <T extends Matrix4Like>(
1028
1028
  * @public
1029
1029
  */
1030
1030
  export const targetTo = <T extends Matrix4Like>(
1031
- eye: Vector3Like,
1032
- target: Vector3Like,
1033
- up: Vector3Like,
1031
+ eye: Readonly<Vector3Like>,
1032
+ target: Readonly<Vector3Like>,
1033
+ up: Readonly<Vector3Like>,
1034
1034
  out: T
1035
1035
  ): T => {
1036
1036
  const eyex = eye[0];
@@ -1094,8 +1094,8 @@ export const targetTo = <T extends Matrix4Like>(
1094
1094
  * @public
1095
1095
  */
1096
1096
  export const add = <T extends Matrix4Like>(
1097
- a: Matrix4Like,
1098
- b: Matrix4Like,
1097
+ a: Readonly<Matrix4Like>,
1098
+ b: Readonly<Matrix4Like>,
1099
1099
  out: T
1100
1100
  ): T =>
1101
1101
  fromValues(
@@ -1125,7 +1125,10 @@ export const add = <T extends Matrix4Like>(
1125
1125
  * @returns Whether or not the matrices are equivalent.
1126
1126
  * @public
1127
1127
  */
1128
- export const equals = (a: Matrix4Like, b: Matrix4Like): boolean =>
1128
+ export const equals = (
1129
+ a: Readonly<Matrix4Like>,
1130
+ b: Readonly<Matrix4Like>
1131
+ ): boolean =>
1129
1132
  approxRelative(a[0], b[0]) &&
1130
1133
  approxRelative(a[1], b[1]) &&
1131
1134
  approxRelative(a[2], b[2]) &&
@@ -1150,7 +1153,10 @@ export const equals = (a: Matrix4Like, b: Matrix4Like): boolean =>
1150
1153
  * @returns Whether the matrices are equivalent.
1151
1154
  * @public
1152
1155
  */
1153
- export const exactEquals = (a: Matrix4Like, b: Matrix4Like): boolean =>
1156
+ export const exactEquals = (
1157
+ a: Readonly<Matrix4Like>,
1158
+ b: Readonly<Matrix4Like>
1159
+ ): boolean =>
1154
1160
  a[0] === b[0] &&
1155
1161
  a[1] === b[1] &&
1156
1162
  a[2] === b[2] &&
@@ -1177,7 +1183,7 @@ export const exactEquals = (a: Matrix4Like, b: Matrix4Like): boolean =>
1177
1183
  * @public
1178
1184
  */
1179
1185
  export const adjoint = <T extends Matrix4Like>(
1180
- matrix: Matrix4Like,
1186
+ matrix: Readonly<Matrix4Like>,
1181
1187
  out: T
1182
1188
  ): T => {
1183
1189
  const a00 = matrix[0];
@@ -1238,7 +1244,10 @@ export const adjoint = <T extends Matrix4Like>(
1238
1244
  * @returns This matrix.
1239
1245
  * @public
1240
1246
  */
1241
- export const copy = <T extends Matrix4Like>(matrix: Matrix4Like, out: T): T =>
1247
+ export const copy = <T extends Matrix4Like>(
1248
+ matrix: Readonly<Matrix4Like>,
1249
+ out: T
1250
+ ): T =>
1242
1251
  fromValues(
1243
1252
  matrix[0],
1244
1253
  matrix[1],
@@ -1266,7 +1275,7 @@ export const copy = <T extends Matrix4Like>(matrix: Matrix4Like, out: T): T =>
1266
1275
  * @see {@link https://en.wikipedia.org/wiki/Matrix_norm | Matrix norm}
1267
1276
  * @public
1268
1277
  */
1269
- export const frob = (matrix: Matrix4Like): number =>
1278
+ export const frob = (matrix: Readonly<Matrix4Like>): number =>
1270
1279
  Math.hypot(
1271
1280
  matrix[0],
1272
1281
  matrix[1],
@@ -1296,8 +1305,8 @@ export const frob = (matrix: Matrix4Like): number =>
1296
1305
  * @public
1297
1306
  */
1298
1307
  export const multiply = <T extends Matrix4Like>(
1299
- a: Matrix4Like,
1300
- b: Matrix4Like,
1308
+ a: Readonly<Matrix4Like>,
1309
+ b: Readonly<Matrix4Like>,
1301
1310
  out: T
1302
1311
  ): T => {
1303
1312
  const a00 = a[0];
@@ -1365,7 +1374,7 @@ export const multiply = <T extends Matrix4Like>(
1365
1374
  * @public
1366
1375
  */
1367
1376
  export const multiplyScalar = <T extends Matrix4Like>(
1368
- matrix: Matrix4Like,
1377
+ matrix: Readonly<Matrix4Like>,
1369
1378
  scalar: number,
1370
1379
  out: T
1371
1380
  ): T =>
@@ -1401,8 +1410,8 @@ export const multiplyScalar = <T extends Matrix4Like>(
1401
1410
  * @public
1402
1411
  */
1403
1412
  export const multiplyScalarAndAdd = <T extends Matrix4Like>(
1404
- a: Matrix4Like,
1405
- b: Matrix4Like,
1413
+ a: Readonly<Matrix4Like>,
1414
+ b: Readonly<Matrix4Like>,
1406
1415
  scalar: number,
1407
1416
  out: T
1408
1417
  ): T =>
@@ -1436,8 +1445,8 @@ export const multiplyScalarAndAdd = <T extends Matrix4Like>(
1436
1445
  * @public
1437
1446
  */
1438
1447
  export const subtract = <T extends Matrix4Like>(
1439
- a: Matrix4Like,
1440
- b: Matrix4Like,
1448
+ a: Readonly<Matrix4Like>,
1449
+ b: Readonly<Matrix4Like>,
1441
1450
  out: T
1442
1451
  ): T =>
1443
1452
  fromValues(
@@ -1469,7 +1478,7 @@ export const subtract = <T extends Matrix4Like>(
1469
1478
  * @public
1470
1479
  */
1471
1480
  export const transpose = <T extends Matrix4Like>(
1472
- matrix: Matrix4Like,
1481
+ matrix: Readonly<Matrix4Like>,
1473
1482
  out: T
1474
1483
  ): T => {
1475
1484
  if (out === matrix) {
@@ -1522,7 +1531,7 @@ export const transpose = <T extends Matrix4Like>(
1522
1531
  * @see {@link https://en.wikipedia.org/wiki/Determinant | Determinant}
1523
1532
  * @public
1524
1533
  */
1525
- export const determinant = (matrix: Matrix4Like): number => {
1534
+ export const determinant = (matrix: Readonly<Matrix4Like>): number => {
1526
1535
  const a00 = matrix[0];
1527
1536
  const a01 = matrix[1];
1528
1537
  const a02 = matrix[2];
@@ -1560,7 +1569,7 @@ export const determinant = (matrix: Matrix4Like): number => {
1560
1569
  * @public
1561
1570
  */
1562
1571
  export const invert = <T extends Matrix4Like>(
1563
- matrix: Matrix4Like,
1572
+ matrix: Readonly<Matrix4Like>,
1564
1573
  out: T
1565
1574
  ): T => {
1566
1575
  const a00 = matrix[0];
@@ -1631,8 +1640,8 @@ export const invert = <T extends Matrix4Like>(
1631
1640
  * @public
1632
1641
  */
1633
1642
  export const scale = <T extends Matrix4Like>(
1634
- matrix: Matrix4Like,
1635
- vector: Vector3Like,
1643
+ matrix: Readonly<Matrix4Like>,
1644
+ vector: Readonly<Vector3Like>,
1636
1645
  out: T
1637
1646
  ): T => {
1638
1647
  const x = vector[0];
@@ -1670,8 +1679,8 @@ export const scale = <T extends Matrix4Like>(
1670
1679
  * @public
1671
1680
  */
1672
1681
  export const translate = <T extends Matrix4Like>(
1673
- matrix: Matrix4Like,
1674
- vector: Vector3Like,
1682
+ matrix: Readonly<Matrix4Like>,
1683
+ vector: Readonly<Vector3Like>,
1675
1684
  out: T
1676
1685
  ): T => {
1677
1686
  const x = vector[0];
@@ -1731,9 +1740,9 @@ export const translate = <T extends Matrix4Like>(
1731
1740
  * @public
1732
1741
  */
1733
1742
  export const rotate = <T extends Matrix4Like>(
1734
- matrix: Matrix4Like,
1743
+ matrix: Readonly<Matrix4Like>,
1735
1744
  radians: number,
1736
- axis: Vector3Like,
1745
+ axis: Readonly<Vector3Like>,
1737
1746
  out: T
1738
1747
  ): T => {
1739
1748
  let x = axis[0];
@@ -1818,7 +1827,7 @@ export const rotate = <T extends Matrix4Like>(
1818
1827
  * @public
1819
1828
  */
1820
1829
  export const rotateX = <T extends Matrix4Like>(
1821
- matrix: Matrix4Like,
1830
+ matrix: Readonly<Matrix4Like>,
1822
1831
  r: number,
1823
1832
  out: T
1824
1833
  ): T => {
@@ -1866,7 +1875,7 @@ export const rotateX = <T extends Matrix4Like>(
1866
1875
  * @public
1867
1876
  */
1868
1877
  export const rotateY = <T extends Matrix4Like>(
1869
- matrix: Matrix4Like,
1878
+ matrix: Readonly<Matrix4Like>,
1870
1879
  r: number,
1871
1880
  out: T
1872
1881
  ): T => {
@@ -1914,7 +1923,7 @@ export const rotateY = <T extends Matrix4Like>(
1914
1923
  * @public
1915
1924
  */
1916
1925
  export const rotateZ = <T extends Matrix4Like>(
1917
- matrix: Matrix4Like,
1926
+ matrix: Readonly<Matrix4Like>,
1918
1927
  r: number,
1919
1928
  out: T
1920
1929
  ): T => {
@@ -1961,7 +1970,7 @@ export const rotateZ = <T extends Matrix4Like>(
1961
1970
  * @public
1962
1971
  */
1963
1972
  export const getTranslation = <T extends Vector3Like>(
1964
- matrix: Matrix4Like,
1973
+ matrix: Readonly<Matrix4Like>,
1965
1974
  out: T
1966
1975
  ): T => vector3FromValues(matrix[12], matrix[13], matrix[14], out);
1967
1976
 
@@ -1975,8 +1984,8 @@ export const getTranslation = <T extends Vector3Like>(
1975
1984
  * @public
1976
1985
  */
1977
1986
  export const setTranslation = <T extends Matrix4Like>(
1978
- matrix: Matrix4Like,
1979
- translation: Vector3Like,
1987
+ matrix: Readonly<Matrix4Like>,
1988
+ translation: Readonly<Vector3Like>,
1980
1989
  out: T
1981
1990
  ): T => {
1982
1991
  if (out !== matrix) {
@@ -2010,7 +2019,7 @@ export const setTranslation = <T extends Matrix4Like>(
2010
2019
  * @public
2011
2020
  */
2012
2021
  export const getScaling = <T extends Vector3Like>(
2013
- matrix: Matrix4Like,
2022
+ matrix: Readonly<Matrix4Like>,
2014
2023
  out: T
2015
2024
  ): T =>
2016
2025
  vector3FromValues(
@@ -2029,7 +2038,7 @@ export const getScaling = <T extends Vector3Like>(
2029
2038
  * @public
2030
2039
  */
2031
2040
  export const getRotation = <T extends QuaternionLike>(
2032
- matrix: Matrix4Like,
2041
+ matrix: Readonly<Matrix4Like>,
2033
2042
  out: T
2034
2043
  ): T => {
2035
2044
  getScaling(matrix, iv3);
@@ -2238,7 +2247,9 @@ export default class Matrix4
2238
2247
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
2239
2248
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2240
2249
  */
2241
- public static fromDualQuaternion(quaternion: DualQuaternionLike): Matrix4 {
2250
+ public static fromDualQuaternion(
2251
+ quaternion: Readonly<DualQuaternionLike>
2252
+ ): Matrix4 {
2242
2253
  return fromDualQuaternion(quaternion, new Matrix4());
2243
2254
  }
2244
2255
 
@@ -2249,7 +2260,7 @@ export default class Matrix4
2249
2260
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
2250
2261
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2251
2262
  */
2252
- public static fromQuaternion(quaternion: QuaternionLike): Matrix4 {
2263
+ public static fromQuaternion(quaternion: Readonly<QuaternionLike>): Matrix4 {
2253
2264
  return fromQuaternion(quaternion, new Matrix4());
2254
2265
  }
2255
2266
 
@@ -2260,7 +2271,7 @@ export default class Matrix4
2260
2271
  * @returns The transformation matrix.
2261
2272
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
2262
2273
  */
2263
- public static fromRotation(r: number, axis: Vector3Like): Matrix4 {
2274
+ public static fromRotation(r: number, axis: Readonly<Vector3Like>): Matrix4 {
2264
2275
  return fromRotation(r, axis, new Matrix4());
2265
2276
  }
2266
2277
 
@@ -2273,8 +2284,8 @@ export default class Matrix4
2273
2284
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2274
2285
  */
2275
2286
  public static fromRotationTranslation(
2276
- rotation: QuaternionLike,
2277
- translation: Vector3Like
2287
+ rotation: Readonly<QuaternionLike>,
2288
+ translation: Readonly<Vector3Like>
2278
2289
  ): Matrix4 {
2279
2290
  return fromRotationTranslation(rotation, translation, new Matrix4());
2280
2291
  }
@@ -2289,9 +2300,9 @@ export default class Matrix4
2289
2300
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2290
2301
  */
2291
2302
  public static fromRotationTranslationScale(
2292
- rotation: QuaternionLike,
2293
- translation: Vector3Like,
2294
- scaling: Vector3Like
2303
+ rotation: Readonly<QuaternionLike>,
2304
+ translation: Readonly<Vector3Like>,
2305
+ scaling: Readonly<Vector3Like>
2295
2306
  ): Matrix4 {
2296
2307
  return fromRotationTranslationScale(
2297
2308
  rotation,
@@ -2312,10 +2323,10 @@ export default class Matrix4
2312
2323
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2313
2324
  */
2314
2325
  public static fromRotationTranslationScaleOrigin(
2315
- rotation: QuaternionLike,
2316
- translation: Vector3Like,
2317
- scaling: Vector3Like,
2318
- origin: Vector3Like
2326
+ rotation: Readonly<QuaternionLike>,
2327
+ translation: Readonly<Vector3Like>,
2328
+ scaling: Readonly<Vector3Like>,
2329
+ origin: Readonly<Vector3Like>
2319
2330
  ): Matrix4 {
2320
2331
  return fromRotationTranslationScaleOrigin(
2321
2332
  rotation,
@@ -2332,7 +2343,7 @@ export default class Matrix4
2332
2343
  * @returns The transformation matrix.
2333
2344
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2334
2345
  */
2335
- public static fromScaling(vector: Vector3Like): Matrix4 {
2346
+ public static fromScaling(vector: Readonly<Vector3Like>): Matrix4 {
2336
2347
  return fromScaling(vector, new Matrix4());
2337
2348
  }
2338
2349
 
@@ -2342,7 +2353,7 @@ export default class Matrix4
2342
2353
  * @returns The transformation matrix.
2343
2354
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2344
2355
  */
2345
- public static fromTranslation(vector: Vector3Like): Matrix4 {
2356
+ public static fromTranslation(vector: Readonly<Vector3Like>): Matrix4 {
2346
2357
  return fromTranslation(vector, new Matrix4());
2347
2358
  }
2348
2359
 
@@ -2470,9 +2481,9 @@ export default class Matrix4
2470
2481
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2471
2482
  */
2472
2483
  public static lookAt(
2473
- eye: Vector3Like,
2474
- center: Vector3Like,
2475
- up: Vector3Like = [0, 1, 0]
2484
+ eye: Readonly<Vector3Like>,
2485
+ center: Readonly<Vector3Like>,
2486
+ up: Readonly<Vector3Like> = [0, 1, 0]
2476
2487
  ): Matrix4 {
2477
2488
  return lookAt(eye, center, up, new Matrix4());
2478
2489
  }
@@ -2553,7 +2564,7 @@ export default class Matrix4
2553
2564
  * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API | WebXR API}
2554
2565
  */
2555
2566
  public static perspectiveFromFieldOfView(
2556
- fov: FieldOfView,
2567
+ fov: Readonly<FieldOfView>,
2557
2568
  near: number,
2558
2569
  far: number
2559
2570
  ): Matrix4 {
@@ -2588,9 +2599,9 @@ export default class Matrix4
2588
2599
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2589
2600
  */
2590
2601
  public static targetTo(
2591
- eye: Vector3Like,
2592
- target: Vector3Like,
2593
- up: Vector3Like = [0, 1, 0]
2602
+ eye: Readonly<Vector3Like>,
2603
+ target: Readonly<Vector3Like>,
2604
+ up: Readonly<Vector3Like> = [0, 1, 0]
2594
2605
  ): Matrix4 {
2595
2606
  return targetTo(eye, target, up, new Matrix4());
2596
2607
  }
@@ -2601,7 +2612,7 @@ export default class Matrix4
2601
2612
  * @returns The sum of the matrices.
2602
2613
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
2603
2614
  */
2604
- public add(matrix: Matrix4Like): Matrix4 {
2615
+ public add(matrix: Readonly<Matrix4Like>): Matrix4 {
2605
2616
  return add(this, matrix, new Matrix4());
2606
2617
  }
2607
2618
 
@@ -2627,7 +2638,7 @@ export default class Matrix4
2627
2638
  * @param matrix - The matrix to copy.
2628
2639
  * @returns This matrix.
2629
2640
  */
2630
- public copy(matrix: Matrix4Like): this {
2641
+ public copy(matrix: Readonly<Matrix4Like>): this {
2631
2642
  return copy(matrix, this);
2632
2643
  }
2633
2644
 
@@ -2636,7 +2647,7 @@ export default class Matrix4
2636
2647
  * @param matrix - The other matrix.
2637
2648
  * @returns Whether or not the matrices are equivalent.
2638
2649
  */
2639
- public equals(matrix: Matrix4Like): boolean {
2650
+ public equals(matrix: Readonly<Matrix4Like>): boolean {
2640
2651
  return equals(this, matrix);
2641
2652
  }
2642
2653
 
@@ -2645,7 +2656,7 @@ export default class Matrix4
2645
2656
  * @param matrix - The other matrix.
2646
2657
  * @returns Whether or not the matrices are equivalent.
2647
2658
  */
2648
- public exactEquals(matrix: Matrix4Like): boolean {
2659
+ public exactEquals(matrix: Readonly<Matrix4Like>): boolean {
2649
2660
  return exactEquals(this, matrix);
2650
2661
  }
2651
2662
 
@@ -2673,7 +2684,7 @@ export default class Matrix4
2673
2684
  * @returns The product of the matrices.
2674
2685
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
2675
2686
  */
2676
- public multiply(matrix: Matrix4Like): Matrix4 {
2687
+ public multiply(matrix: Readonly<Matrix4Like>): Matrix4 {
2677
2688
  return multiply(this, matrix, new Matrix4());
2678
2689
  }
2679
2690
 
@@ -2695,7 +2706,10 @@ export default class Matrix4
2695
2706
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
2696
2707
  * @see {@link https://en.wikipedia.org/wiki/Matrix_multiplication | Matrix multiplication}
2697
2708
  */
2698
- public multiplyScalarAndAdd(matrix: Matrix4Like, scalar: number): Matrix4 {
2709
+ public multiplyScalarAndAdd(
2710
+ matrix: Readonly<Matrix4Like>,
2711
+ scalar: number
2712
+ ): Matrix4 {
2699
2713
  return multiplyScalarAndAdd(this, matrix, scalar, new Matrix4());
2700
2714
  }
2701
2715
 
@@ -2706,7 +2720,7 @@ export default class Matrix4
2706
2720
  * @returns The rotated matrix.
2707
2721
  * @see {@link https://en.wikipedia.org/wiki/Rotation_matrix | Rotation matrix}
2708
2722
  */
2709
- public rotate(r: number, axis: Vector3Like): Matrix4 {
2723
+ public rotate(r: number, axis: Readonly<Vector3Like>): Matrix4 {
2710
2724
  return rotate(this, r, axis, new Matrix4());
2711
2725
  }
2712
2726
 
@@ -2746,7 +2760,7 @@ export default class Matrix4
2746
2760
  * @returns The scaled matrix.
2747
2761
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2748
2762
  */
2749
- public scale(vector: Vector3Like): Matrix4 {
2763
+ public scale(vector: Readonly<Vector3Like>): Matrix4 {
2750
2764
  return scale(this, vector, new Matrix4());
2751
2765
  }
2752
2766
 
@@ -2756,7 +2770,7 @@ export default class Matrix4
2756
2770
  * @returns The transformation matrix.
2757
2771
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2758
2772
  */
2759
- public setTranslation(translation: Vector3Like): Matrix4 {
2773
+ public setTranslation(translation: Readonly<Vector3Like>): Matrix4 {
2760
2774
  return setTranslation(this, translation, new Matrix4());
2761
2775
  }
2762
2776
 
@@ -2766,7 +2780,7 @@ export default class Matrix4
2766
2780
  * @returns The difference between the matrices.
2767
2781
  * @see {@link https://en.wikipedia.org/wiki/Matrix_addition | Matrix addition}
2768
2782
  */
2769
- public subtract(matrix: Matrix4Like): Matrix4 {
2783
+ public subtract(matrix: Readonly<Matrix4Like>): Matrix4 {
2770
2784
  return subtract(this, matrix, new Matrix4());
2771
2785
  }
2772
2786
 
@@ -2776,7 +2790,7 @@ export default class Matrix4
2776
2790
  * @returns The translated matrix.
2777
2791
  * @see {@link https://en.wikipedia.org/wiki/Transformation_matrix | Transformation matrix}
2778
2792
  */
2779
- public translate(vector: Vector3Like): Matrix4 {
2793
+ public translate(vector: Readonly<Vector3Like>): Matrix4 {
2780
2794
  return translate(this, vector, new Matrix4());
2781
2795
  }
2782
2796