@lakuna/umath 4.0.5 → 4.0.6

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.
@@ -13,41 +13,34 @@ import SingularMatrixError from "../utility/SingularMatrixError.js";
13
13
  * @public
14
14
  */
15
15
  export interface Matrix3Like extends MatrixLike {
16
+ /* eslint-disable @typescript-eslint/naming-convention */
16
17
  /** The value in the first column and first row. */
17
- // eslint-disable-next-line @typescript-eslint/naming-convention
18
18
  0: number;
19
19
 
20
20
  /** The value in the first column and second row. */
21
- // eslint-disable-next-line @typescript-eslint/naming-convention
22
21
  1: number;
23
22
 
24
23
  /** The value in the first column and third row. */
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
24
  2: number;
27
25
 
28
26
  /** The value in the second column and first row. */
29
- // eslint-disable-next-line @typescript-eslint/naming-convention
30
27
  3: number;
31
28
 
32
29
  /** The value in the second column and second row. */
33
- // eslint-disable-next-line @typescript-eslint/naming-convention
34
30
  4: number;
35
31
 
36
32
  /** The value in the second column and third row. */
37
- // eslint-disable-next-line @typescript-eslint/naming-convention
38
33
  5: number;
39
34
 
40
35
  /** The value in the third column and first row. */
41
- // eslint-disable-next-line @typescript-eslint/naming-convention
42
36
  6: number;
43
37
 
44
38
  /** The value in the third column and second row. */
45
- // eslint-disable-next-line @typescript-eslint/naming-convention
46
39
  7: number;
47
40
 
48
41
  /** The value in the third column and third row. */
49
- // eslint-disable-next-line @typescript-eslint/naming-convention
50
42
  8: number;
43
+ /* eslint-enable @typescript-eslint/naming-convention */
51
44
  }
52
45
 
53
46
  /**
@@ -841,41 +834,34 @@ export default class Matrix3
841
834
  extends Float32Array
842
835
  implements Matrix3Like, SquareMatrix
843
836
  {
837
+ /* eslint-disable @typescript-eslint/naming-convention */
844
838
  /** The value in the first column and first row. */
845
- // eslint-disable-next-line @typescript-eslint/naming-convention
846
839
  public 0: number;
847
840
 
848
841
  /** The value in the first column and second row. */
849
- // eslint-disable-next-line @typescript-eslint/naming-convention
850
842
  public 1: number;
851
843
 
852
844
  /** The value in the first column and third row. */
853
- // eslint-disable-next-line @typescript-eslint/naming-convention
854
845
  public 2: number;
855
846
 
856
847
  /** The value in the second column and first row. */
857
- // eslint-disable-next-line @typescript-eslint/naming-convention
858
848
  public 3: number;
859
849
 
860
850
  /** The value in the second column and second row. */
861
- // eslint-disable-next-line @typescript-eslint/naming-convention
862
851
  public 4: number;
863
852
 
864
853
  /** The value in the second column and third row. */
865
- // eslint-disable-next-line @typescript-eslint/naming-convention
866
854
  public 5: number;
867
855
 
868
856
  /** The value in the third column and first row. */
869
- // eslint-disable-next-line @typescript-eslint/naming-convention
870
857
  public 6: number;
871
858
 
872
859
  /** The value in the third column and second row. */
873
- // eslint-disable-next-line @typescript-eslint/naming-convention
874
860
  public 7: number;
875
861
 
876
862
  /** The value in the third column and third row. */
877
- // eslint-disable-next-line @typescript-eslint/naming-convention
878
863
  public 8: number;
864
+ /* eslint-enable @typescript-eslint/naming-convention */
879
865
 
880
866
  /** The number of rows in this matrix. */
881
867
  public readonly height: 3;
@@ -24,69 +24,55 @@ import Vector3, {
24
24
  * @public
25
25
  */
26
26
  export interface Matrix4Like extends MatrixLike {
27
+ /* eslint-disable @typescript-eslint/naming-convention */
27
28
  /** The value in the first column and first row. */
28
- // eslint-disable-next-line @typescript-eslint/naming-convention
29
29
  0: number;
30
30
 
31
31
  /** The value in the first column and second row. */
32
- // eslint-disable-next-line @typescript-eslint/naming-convention
33
32
  1: number;
34
33
 
35
34
  /** The value in the first column and third row. */
36
- // eslint-disable-next-line @typescript-eslint/naming-convention
37
35
  2: number;
38
36
 
39
37
  /** The value in the first column and fourth row. */
40
- // eslint-disable-next-line @typescript-eslint/naming-convention
41
38
  3: number;
42
39
 
43
40
  /** The value in the second column and first row. */
44
- // eslint-disable-next-line @typescript-eslint/naming-convention
45
41
  4: number;
46
42
 
47
43
  /** The value in the second column and second row. */
48
- // eslint-disable-next-line @typescript-eslint/naming-convention
49
44
  5: number;
50
45
 
51
46
  /** The value in the second column and third row. */
52
- // eslint-disable-next-line @typescript-eslint/naming-convention
53
47
  6: number;
54
48
 
55
49
  /** The value in the second column and fourth row. */
56
- // eslint-disable-next-line @typescript-eslint/naming-convention
57
50
  7: number;
58
51
 
59
52
  /** The value in the third column and first row. */
60
- // eslint-disable-next-line @typescript-eslint/naming-convention
61
53
  8: number;
62
54
 
63
55
  /** The value in the third column and second row. */
64
- // eslint-disable-next-line @typescript-eslint/naming-convention
65
56
  9: number;
66
57
 
67
58
  /** The value in the third column and third row. */
68
- // eslint-disable-next-line @typescript-eslint/naming-convention
69
59
  10: number;
70
60
 
71
61
  /** The value in the third column and fourth row. */
72
- // eslint-disable-next-line @typescript-eslint/naming-convention
73
62
  11: number;
74
63
 
75
64
  /** The value in the fourth column and first row. */
76
- // eslint-disable-next-line @typescript-eslint/naming-convention
77
65
  12: number;
78
66
 
79
67
  /** The value in the fourth column and second row. */
80
- // eslint-disable-next-line @typescript-eslint/naming-convention
81
68
  13: number;
82
69
 
83
70
  /** The value in the fourth column and third row. */
84
- // eslint-disable-next-line @typescript-eslint/naming-convention
85
71
  14: number;
86
72
 
87
73
  /** The value in the fourth column and fourth row. */
88
- // eslint-disable-next-line @typescript-eslint/naming-convention
89
74
  15: number;
75
+ /* eslint-enable @typescript-eslint/naming-convention */
90
76
  }
91
77
 
92
78
  /**
@@ -2116,69 +2102,55 @@ export default class Matrix4
2116
2102
  extends Float32Array
2117
2103
  implements Matrix4Like, SquareMatrix
2118
2104
  {
2105
+ /* eslint-disable @typescript-eslint/naming-convention */
2119
2106
  /** The value in the first column and first row. */
2120
- // eslint-disable-next-line @typescript-eslint/naming-convention
2121
2107
  public 0: number;
2122
2108
 
2123
2109
  /** The value in the first column and second row. */
2124
- // eslint-disable-next-line @typescript-eslint/naming-convention
2125
2110
  public 1: number;
2126
2111
 
2127
2112
  /** The value in the first column and third row. */
2128
- // eslint-disable-next-line @typescript-eslint/naming-convention
2129
2113
  public 2: number;
2130
2114
 
2131
2115
  /** The value in the first column and fourth row. */
2132
- // eslint-disable-next-line @typescript-eslint/naming-convention
2133
2116
  public 3: number;
2134
2117
 
2135
2118
  /** The value in the second column and first row. */
2136
- // eslint-disable-next-line @typescript-eslint/naming-convention
2137
2119
  public 4: number;
2138
2120
 
2139
2121
  /** The value in the second column and second row. */
2140
- // eslint-disable-next-line @typescript-eslint/naming-convention
2141
2122
  public 5: number;
2142
2123
 
2143
2124
  /** The value in the second column and third row. */
2144
- // eslint-disable-next-line @typescript-eslint/naming-convention
2145
2125
  public 6: number;
2146
2126
 
2147
2127
  /** The value in the second column and fourth row. */
2148
- // eslint-disable-next-line @typescript-eslint/naming-convention
2149
2128
  public 7: number;
2150
2129
 
2151
2130
  /** The value in the third column and first row. */
2152
- // eslint-disable-next-line @typescript-eslint/naming-convention
2153
2131
  public 8: number;
2154
2132
 
2155
2133
  /** The value in the third column and second row. */
2156
- // eslint-disable-next-line @typescript-eslint/naming-convention
2157
2134
  public 9: number;
2158
2135
 
2159
2136
  /** The value in the third column and third row. */
2160
- // eslint-disable-next-line @typescript-eslint/naming-convention
2161
2137
  public 10: number;
2162
2138
 
2163
2139
  /** The value in the third column and fourth row. */
2164
- // eslint-disable-next-line @typescript-eslint/naming-convention
2165
2140
  public 11: number;
2166
2141
 
2167
2142
  /** The value in the fourth column and first row. */
2168
- // eslint-disable-next-line @typescript-eslint/naming-convention
2169
2143
  public 12: number;
2170
2144
 
2171
2145
  /** The value in the fourth column and second row. */
2172
- // eslint-disable-next-line @typescript-eslint/naming-convention
2173
2146
  public 13: number;
2174
2147
 
2175
2148
  /** The value in the fourth column and third row. */
2176
- // eslint-disable-next-line @typescript-eslint/naming-convention
2177
2149
  public 14: number;
2178
2150
 
2179
2151
  /** The value in the fourth column and fourth row. */
2180
- // eslint-disable-next-line @typescript-eslint/naming-convention
2181
2152
  public 15: number;
2153
+ /* eslint-enable @typescript-eslint/naming-convention */
2182
2154
 
2183
2155
  /** The number of rows in this matrix. */
2184
2156
  public readonly height: 4;
@@ -33,21 +33,19 @@ import {
33
33
  * @public
34
34
  */
35
35
  export interface QuaternionLike extends Record<number, number> {
36
+ /* eslint-disable @typescript-eslint/naming-convention */
36
37
  /** The first component of this quaternion. */
37
- // eslint-disable-next-line @typescript-eslint/naming-convention
38
38
  0: number;
39
39
 
40
40
  /** The second component of this quaternion. */
41
- // eslint-disable-next-line @typescript-eslint/naming-convention
42
41
  1: number;
43
42
 
44
43
  /** The third component of this quaternion. */
45
- // eslint-disable-next-line @typescript-eslint/naming-convention
46
44
  2: number;
47
45
 
48
46
  /** The fourth component of this quaternion. */
49
- // eslint-disable-next-line @typescript-eslint/naming-convention
50
47
  3: number;
48
+ /* eslint-enable @typescript-eslint/naming-convention */
51
49
  }
52
50
 
53
51
  /**
@@ -229,42 +227,35 @@ export const fromMatrix3 = <T extends QuaternionLike>(
229
227
  return out;
230
228
  }
231
229
 
230
+ /* eslint-disable @typescript-eslint/no-unsafe-type-assertion */
232
231
  let i = 0 as 0 | 1 | 2;
233
232
  if (m4 > m0) {
234
233
  i = 1;
235
234
  }
236
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
237
235
  if (m8 > matrix[(i * 3 + i) as 0 | 4]) {
238
236
  i = 2;
239
237
  }
240
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
241
238
  const j = ((i + 1) % 3) as 0 | 1 | 2;
242
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
243
239
  const k = ((i + 2) % 3) as 0 | 1 | 2;
244
240
 
245
241
  let fRoot: number = Math.sqrt(
246
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
247
242
  matrix[(i * 3 + i) as 0 | 4 | 7] -
248
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
249
243
  matrix[(j * 3 + j) as 0 | 4 | 7] -
250
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
251
244
  matrix[(k * 3 + k) as 0 | 4 | 7] +
252
245
  1
253
246
  );
254
247
  out[i] = fRoot / 2;
255
248
  fRoot = 0.5 / fRoot;
256
249
  out[3] =
257
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
258
250
  (matrix[(j * 3 + k) as 1 | 5 | 6] - matrix[(k * 3 + j) as 2 | 3 | 7]) *
259
251
  fRoot;
260
252
  out[j] =
261
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
262
253
  (matrix[(j * 3 + i) as 2 | 3 | 7] + matrix[(i * 3 + j) as 1 | 5 | 6]) *
263
254
  fRoot;
264
255
  out[k] =
265
- // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
266
256
  (matrix[(k * 3 + i) as 1 | 5 | 6] + matrix[(i * 3 + k) as 2 | 3 | 7]) *
267
257
  fRoot;
258
+ /* eslint-enable @typescript-eslint/no-unsafe-type-assertion */
268
259
  return out;
269
260
  };
270
261
 
@@ -929,10 +920,10 @@ export const slerp = <T extends QuaternionLike>(
929
920
  bw = -bw;
930
921
  }
931
922
 
932
- // eslint-disable-next-line @typescript-eslint/init-declarations
923
+ /* eslint-disable @typescript-eslint/init-declarations */
933
924
  let scale0;
934
- // eslint-disable-next-line @typescript-eslint/init-declarations
935
925
  let scale1;
926
+ /* eslint-enable @typescript-eslint/init-declarations */
936
927
  if (1 - cosom > epsilon) {
937
928
  const omega = Math.acos(cosom);
938
929
  const sinom = Math.sin(omega);
@@ -1098,21 +1089,19 @@ export const fromRotationTo = <T extends QuaternionLike>(
1098
1089
  * @public
1099
1090
  */
1100
1091
  export default class Quaternion extends Float32Array implements QuaternionLike {
1092
+ /* eslint-disable @typescript-eslint/naming-convention */
1101
1093
  /** The first component of this quaternion. */
1102
- // eslint-disable-next-line @typescript-eslint/naming-convention
1103
1094
  public 0: number;
1104
1095
 
1105
1096
  /** The second component of this quaternion. */
1106
- // eslint-disable-next-line @typescript-eslint/naming-convention
1107
1097
  public 1: number;
1108
1098
 
1109
1099
  /** The third component of this quaternion. */
1110
- // eslint-disable-next-line @typescript-eslint/naming-convention
1111
1100
  public 2: number;
1112
1101
 
1113
1102
  /** The fourth component of this quaternion. */
1114
- // eslint-disable-next-line @typescript-eslint/naming-convention
1115
1103
  public 3: number;
1104
+ /* eslint-enable @typescript-eslint/naming-convention */
1116
1105
 
1117
1106
  /** The axis and angle that represent this quaternion. */
1118
1107
  public get axisAngle(): readonly [Readonly<Vector3Like>, number] {
@@ -14,13 +14,13 @@ import Vector3, {
14
14
  * @public
15
15
  */
16
16
  export interface Vector2Like extends VectorLike {
17
+ /* eslint-disable @typescript-eslint/naming-convention */
17
18
  /** The first component of this vector. */
18
- // eslint-disable-next-line @typescript-eslint/naming-convention
19
19
  0: number;
20
20
 
21
21
  /** The second component of this vector. */
22
- // eslint-disable-next-line @typescript-eslint/naming-convention
23
22
  1: number;
23
+ /* eslint-enable @typescript-eslint/naming-convention */
24
24
  }
25
25
 
26
26
  /**
@@ -560,13 +560,13 @@ export default class Vector2
560
560
  extends Float32Array
561
561
  implements Vector, Vector2Like
562
562
  {
563
+ /* eslint-disable @typescript-eslint/naming-convention */
563
564
  /** The first component of this vector. */
564
- // eslint-disable-next-line @typescript-eslint/naming-convention
565
565
  public 0: number;
566
566
 
567
567
  /** The second component of this vector. */
568
- // eslint-disable-next-line @typescript-eslint/naming-convention
569
568
  public 1: number;
569
+ /* eslint-enable @typescript-eslint/naming-convention */
570
570
 
571
571
  /** The magnitude (length) of this vector. */
572
572
  public get magnitude(): number {
@@ -10,17 +10,16 @@ import approxRelative from "../algorithms/approxRelative.js";
10
10
  * @public
11
11
  */
12
12
  export interface Vector3Like extends VectorLike {
13
+ /* eslint-disable @typescript-eslint/naming-convention */
13
14
  /** The first component of this vector. */
14
- // eslint-disable-next-line @typescript-eslint/naming-convention
15
15
  0: number;
16
16
 
17
17
  /** The second component of this vector. */
18
- // eslint-disable-next-line @typescript-eslint/naming-convention
19
18
  1: number;
20
19
 
21
20
  /** The third component of this vector. */
22
- // eslint-disable-next-line @typescript-eslint/naming-convention
23
21
  2: number;
22
+ /* eslint-enable @typescript-eslint/naming-convention */
24
23
  }
25
24
 
26
25
  /**
@@ -814,17 +813,16 @@ export default class Vector3
814
813
  extends Float32Array
815
814
  implements Vector, Vector3Like
816
815
  {
816
+ /* eslint-disable @typescript-eslint/naming-convention */
817
817
  /** The first component of this vector. */
818
- // eslint-disable-next-line @typescript-eslint/naming-convention
819
818
  public 0: number;
820
819
 
821
820
  /** The second component of this vector. */
822
- // eslint-disable-next-line @typescript-eslint/naming-convention
823
821
  public 1: number;
824
822
 
825
823
  /** The third component of this vector. */
826
- // eslint-disable-next-line @typescript-eslint/naming-convention
827
824
  public 2: number;
825
+ /* eslint-enable @typescript-eslint/naming-convention */
828
826
 
829
827
  /** The magnitude (length) of this vector. */
830
828
  public get magnitude(): number {
@@ -9,21 +9,19 @@ import approxRelative from "../algorithms/approxRelative.js";
9
9
  * @public
10
10
  */
11
11
  export interface Vector4Like extends VectorLike {
12
+ /* eslint-disable @typescript-eslint/naming-convention */
12
13
  /** The first component of this vector. */
13
- // eslint-disable-next-line @typescript-eslint/naming-convention
14
14
  0: number;
15
15
 
16
16
  /** The second component of this vector. */
17
- // eslint-disable-next-line @typescript-eslint/naming-convention
18
17
  1: number;
19
18
 
20
19
  /** The third component of this vector. */
21
- // eslint-disable-next-line @typescript-eslint/naming-convention
22
20
  2: number;
23
21
 
24
22
  /** The fourth component of this vector. */
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
23
  3: number;
24
+ /* eslint-enable @typescript-eslint/naming-convention */
27
25
  }
28
26
 
29
27
  /**
@@ -644,21 +642,19 @@ export default class Vector4
644
642
  extends Float32Array
645
643
  implements Vector, Vector4Like
646
644
  {
645
+ /* eslint-disable @typescript-eslint/naming-convention */
647
646
  /** The first component of this vector. */
648
- // eslint-disable-next-line @typescript-eslint/naming-convention
649
647
  public 0: number;
650
648
 
651
649
  /** The second component of this vector. */
652
- // eslint-disable-next-line @typescript-eslint/naming-convention
653
650
  public 1: number;
654
651
 
655
652
  /** The third component of this vector. */
656
- // eslint-disable-next-line @typescript-eslint/naming-convention
657
653
  public 2: number;
658
654
 
659
655
  /** The fourth component of this vector. */
660
- // eslint-disable-next-line @typescript-eslint/naming-convention
661
656
  public 3: number;
657
+ /* eslint-enable @typescript-eslint/naming-convention */
662
658
 
663
659
  /** The magnitude (length) of this vector. */
664
660
  public get magnitude(): number {