@pawells/math-extended 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/build/angles.d.ts +28 -18
  2. package/build/angles.d.ts.map +1 -1
  3. package/build/angles.js +28 -18
  4. package/build/angles.js.map +1 -1
  5. package/build/clamp.d.ts +5 -3
  6. package/build/clamp.d.ts.map +1 -1
  7. package/build/clamp.js +5 -3
  8. package/build/clamp.js.map +1 -1
  9. package/build/interpolation.d.ts +158 -96
  10. package/build/interpolation.d.ts.map +1 -1
  11. package/build/interpolation.js +158 -96
  12. package/build/interpolation.js.map +1 -1
  13. package/build/matrices/_exports.d.ts +13 -0
  14. package/build/matrices/_exports.d.ts.map +1 -0
  15. package/build/matrices/_exports.js +13 -0
  16. package/build/matrices/_exports.js.map +1 -0
  17. package/build/matrices/arithmetic.d.ts +170 -181
  18. package/build/matrices/arithmetic.d.ts.map +1 -1
  19. package/build/matrices/arithmetic.js +192 -202
  20. package/build/matrices/arithmetic.js.map +1 -1
  21. package/build/matrices/asserts.d.ts +240 -109
  22. package/build/matrices/asserts.d.ts.map +1 -1
  23. package/build/matrices/asserts.js +287 -87
  24. package/build/matrices/asserts.js.map +1 -1
  25. package/build/matrices/core.d.ts +29 -29
  26. package/build/matrices/core.js +1 -1
  27. package/build/matrices/decompositions.d.ts +102 -104
  28. package/build/matrices/decompositions.d.ts.map +1 -1
  29. package/build/matrices/decompositions.js +87 -89
  30. package/build/matrices/decompositions.js.map +1 -1
  31. package/build/matrices/index.d.ts +3 -2
  32. package/build/matrices/index.d.ts.map +1 -1
  33. package/build/matrices/index.js +5 -2
  34. package/build/matrices/index.js.map +1 -1
  35. package/build/matrices/linear-algebra.d.ts +12 -12
  36. package/build/matrices/linear-algebra.js +4 -4
  37. package/build/matrices/normalization.d.ts +8 -8
  38. package/build/matrices/transformations.d.ts +184 -165
  39. package/build/matrices/transformations.d.ts.map +1 -1
  40. package/build/matrices/transformations.js +99 -80
  41. package/build/matrices/transformations.js.map +1 -1
  42. package/build/matrices/types.d.ts +12 -12
  43. package/build/matrices/types.d.ts.map +1 -1
  44. package/build/quaternions/_exports.d.ts +11 -0
  45. package/build/quaternions/_exports.d.ts.map +1 -0
  46. package/build/quaternions/_exports.js +11 -0
  47. package/build/quaternions/_exports.js.map +1 -0
  48. package/build/quaternions/asserts.d.ts +115 -7
  49. package/build/quaternions/asserts.d.ts.map +1 -1
  50. package/build/quaternions/asserts.js +162 -8
  51. package/build/quaternions/asserts.js.map +1 -1
  52. package/build/quaternions/conversions.d.ts +31 -21
  53. package/build/quaternions/conversions.d.ts.map +1 -1
  54. package/build/quaternions/conversions.js +28 -18
  55. package/build/quaternions/conversions.js.map +1 -1
  56. package/build/quaternions/core.d.ts +67 -39
  57. package/build/quaternions/core.d.ts.map +1 -1
  58. package/build/quaternions/core.js +67 -39
  59. package/build/quaternions/core.js.map +1 -1
  60. package/build/quaternions/index.d.ts +3 -2
  61. package/build/quaternions/index.d.ts.map +1 -1
  62. package/build/quaternions/index.js +5 -2
  63. package/build/quaternions/index.js.map +1 -1
  64. package/build/quaternions/interpolation.d.ts +15 -9
  65. package/build/quaternions/interpolation.d.ts.map +1 -1
  66. package/build/quaternions/interpolation.js +15 -9
  67. package/build/quaternions/interpolation.js.map +1 -1
  68. package/build/quaternions/predefined.d.ts +9 -3
  69. package/build/quaternions/predefined.d.ts.map +1 -1
  70. package/build/quaternions/predefined.js +9 -3
  71. package/build/quaternions/predefined.js.map +1 -1
  72. package/build/quaternions/types.d.ts +3 -3
  73. package/build/vectors/_exports.d.ts +10 -0
  74. package/build/vectors/_exports.d.ts.map +1 -0
  75. package/build/vectors/_exports.js +10 -0
  76. package/build/vectors/_exports.js.map +1 -0
  77. package/build/vectors/asserts.d.ts +153 -49
  78. package/build/vectors/asserts.d.ts.map +1 -1
  79. package/build/vectors/asserts.js +202 -52
  80. package/build/vectors/asserts.js.map +1 -1
  81. package/build/vectors/core.d.ts +216 -137
  82. package/build/vectors/core.d.ts.map +1 -1
  83. package/build/vectors/core.js +212 -149
  84. package/build/vectors/core.js.map +1 -1
  85. package/build/vectors/index.d.ts +1 -0
  86. package/build/vectors/index.d.ts.map +1 -1
  87. package/build/vectors/index.js +3 -0
  88. package/build/vectors/index.js.map +1 -1
  89. package/build/vectors/interpolation.d.ts +39 -27
  90. package/build/vectors/interpolation.d.ts.map +1 -1
  91. package/build/vectors/interpolation.js +39 -27
  92. package/build/vectors/interpolation.js.map +1 -1
  93. package/build/vectors/predefined.d.ts +48 -24
  94. package/build/vectors/predefined.d.ts.map +1 -1
  95. package/build/vectors/predefined.js +38 -18
  96. package/build/vectors/predefined.js.map +1 -1
  97. package/package.json +3 -3
@@ -13,7 +13,7 @@
13
13
  * All matrices use homogeneous coordinates for consistent transformation composition.
14
14
  * 2D transformations use 3x3 matrices, 3D transformations use 4x4 matrices.
15
15
  */
16
- import { IMatrix3, IMatrix4 } from './types.js';
16
+ import { TMatrix3, TMatrix4 } from './types.js';
17
17
  import { TVector2, TVector3 } from '../vectors/types.js';
18
18
  /**
19
19
  * Creates a 2D rotation matrix for rotating points around the origin.
@@ -30,20 +30,21 @@ import { TVector2, TVector3 } from '../vectors/types.js';
30
30
  * ```
31
31
  *
32
32
  * @param radians - Rotation angle in radians (positive = counterclockwise)
33
- * @returns {IMatrix3} A 3x3 rotation matrix for 2D transformations
33
+ * @returns {TMatrix3} A 3x3 rotation matrix for 2D transformations
34
34
  *
35
35
  * @throws {Error} If radians is not a finite number
36
36
  *
37
37
  * @example
38
- * ```typescript
39
- * // 90-degree counterclockwise rotation
40
- * const matrix = MatrixRotation2D(Math.PI / 2);
41
- *
42
- * // 45-degree clockwise rotation
43
- * const clockwise = MatrixRotation2D(-Math.PI / 4);
44
- * ```
38
+ * ```typescript
39
+ * ```typescript
40
+ * // 90-degree counterclockwise rotation
41
+ * const matrix = MatrixRotation2D(Math.PI / 2);
42
+ * // 45-degree clockwise rotation
43
+ * const clockwise = MatrixRotation2D(-Math.PI / 4);
44
+ * ```
45
+ * ```
45
46
  */
46
- export declare function MatrixRotation2D(radians: number): IMatrix3;
47
+ export declare function MatrixRotation2D(radians: number): TMatrix3;
47
48
  /**
48
49
  * Creates a 3D roll rotation matrix (rotation around the X-axis).
49
50
  *
@@ -60,17 +61,19 @@ export declare function MatrixRotation2D(radians: number): IMatrix3;
60
61
  * ```
61
62
  *
62
63
  * @param radians - Roll angle in radians (positive = right-hand rule around X-axis)
63
- * @returns {IMatrix4} A 4x4 roll rotation matrix
64
+ * @returns {TMatrix4} A 4x4 roll rotation matrix
64
65
  *
65
66
  * @throws {Error} If radians is not a finite number
66
67
  *
67
68
  * @example
68
- * ```typescript
69
- * // 45-degree roll (banking left in aviation)
70
- * const rollMatrix = MatrixRotation3DRoll(Math.PI / 4);
71
- * ```
69
+ * ```typescript
70
+ * ```typescript
71
+ * // 45-degree roll (banking left in aviation)
72
+ * const rollMatrix = MatrixRotation3DRoll(Math.PI / 4);
73
+ * ```
74
+ * ```
72
75
  */
73
- export declare function MatrixRotation3DRoll(radians: number): IMatrix4;
76
+ export declare function MatrixRotation3DRoll(radians: number): TMatrix4;
74
77
  /**
75
78
  * Creates a 3D pitch rotation matrix (rotation around the Y-axis).
76
79
  *
@@ -87,17 +90,19 @@ export declare function MatrixRotation3DRoll(radians: number): IMatrix4;
87
90
  * ```
88
91
  *
89
92
  * @param radians - Pitch angle in radians (positive = nose up in aviation)
90
- * @returns {IMatrix4} A 4x4 pitch rotation matrix
93
+ * @returns {TMatrix4} A 4x4 pitch rotation matrix
91
94
  *
92
95
  * @throws {Error} If radians is not a finite number
93
96
  *
94
97
  * @example
95
- * ```typescript
96
- * // 30-degree pitch up
97
- * const pitchMatrix = MatrixRotation3DPitch(Math.PI / 6);
98
- * ```
98
+ * ```typescript
99
+ * ```typescript
100
+ * // 30-degree pitch up
101
+ * const pitchMatrix = MatrixRotation3DPitch(Math.PI / 6);
102
+ * ```
103
+ * ```
99
104
  */
100
- export declare function MatrixRotation3DPitch(radians: number): IMatrix4;
105
+ export declare function MatrixRotation3DPitch(radians: number): TMatrix4;
101
106
  /**
102
107
  * Creates a 3D yaw rotation matrix (rotation around the Z-axis).
103
108
  *
@@ -114,17 +119,19 @@ export declare function MatrixRotation3DPitch(radians: number): IMatrix4;
114
119
  * ```
115
120
  *
116
121
  * @param radians - Yaw angle in radians (positive = turn left in aviation)
117
- * @returns {IMatrix4} A 4x4 yaw rotation matrix
122
+ * @returns {TMatrix4} A 4x4 yaw rotation matrix
118
123
  *
119
124
  * @throws {Error} If radians is not a finite number
120
125
  *
121
126
  * @example
122
- * ```typescript
123
- * // 60-degree yaw left
124
- * const yawMatrix = MatrixRotation3DYaw(Math.PI / 3);
125
- * ```
127
+ * ```typescript
128
+ * ```typescript
129
+ * // 60-degree yaw left
130
+ * const yawMatrix = MatrixRotation3DYaw(Math.PI / 3);
131
+ * ```
132
+ * ```
126
133
  */
127
- export declare function MatrixRotation3DYaw(radians: number): IMatrix4;
134
+ export declare function MatrixRotation3DYaw(radians: number): TMatrix4;
128
135
  /**
129
136
  * Creates a composite 3D rotation matrix from yaw, pitch, and roll components.
130
137
  *
@@ -139,22 +146,23 @@ export declare function MatrixRotation3DYaw(radians: number): IMatrix4;
139
146
  * @param roll - Roll angle in radians (X-axis rotation) or vector [roll, pitch, yaw]
140
147
  * @param pitch - Pitch angle in radians (Y-axis rotation, required if roll is number)
141
148
  * @param yaw - Yaw angle in radians (Z-axis rotation, required if roll is number)
142
- * @returns {IMatrix4} A 4x4 composite rotation matrix
149
+ * @returns {TMatrix4} A 4x4 composite rotation matrix
143
150
  *
144
151
  * @throws {Error} If any angle is not a finite number
145
152
  *
146
153
  * @example
147
- * ```typescript
148
- * // Using individual angles (banking, elevation, heading)
149
- * const rotationMatrix = MatrixRotation3D(0.1, 0.2, 0.3);
150
- *
151
- * // Using vector input
152
- * const eulerAngles: TVector3 = [0.1, 0.2, 0.3];
153
- * const rotationMatrix2 = MatrixRotation3D(eulerAngles);
154
- * ```
154
+ * ```typescript
155
+ * ```typescript
156
+ * // Using individual angles (banking, elevation, heading)
157
+ * const rotationMatrix = MatrixRotation3D(0.1, 0.2, 0.3);
158
+ * // Using vector input
159
+ * const eulerAngles: TVector3 = [0.1, 0.2, 0.3];
160
+ * const rotationMatrix2 = MatrixRotation3D(eulerAngles);
161
+ * ```
162
+ * ```
155
163
  */
156
- export declare function MatrixRotation3D(roll: number, pitch: number, yaw: number): IMatrix4;
157
- export declare function MatrixRotation3D(v: TVector3): IMatrix4;
164
+ export declare function MatrixRotation3D(roll: number, pitch: number, yaw: number): TMatrix4;
165
+ export declare function MatrixRotation3D(v: TVector3): TMatrix4;
158
166
  /**
159
167
  * Creates a composite 3D rotation matrix from Euler angles specified in degrees.
160
168
  *
@@ -167,22 +175,23 @@ export declare function MatrixRotation3D(v: TVector3): IMatrix4;
167
175
  * @param roll - Roll angle in degrees (X-axis rotation) or vector [roll, pitch, yaw]
168
176
  * @param pitch - Pitch angle in degrees (Y-axis rotation, required if roll is number)
169
177
  * @param yaw - Yaw angle in degrees (Z-axis rotation, required if roll is number)
170
- * @returns {IMatrix4} A 4x4 composite rotation matrix
178
+ * @returns {TMatrix4} A 4x4 composite rotation matrix
171
179
  *
172
180
  * @throws {Error} If any angle is not a finite number
173
181
  *
174
182
  * @example
175
- * ```typescript
176
- * // Using individual angles in degrees
177
- * const rotation = MatrixRotation3DEulerAngles(45, 30, 60);
178
- *
179
- * // Using vector input in degrees
180
- * const angles: TVector3 = [45, 30, 60];
181
- * const rotation2 = MatrixRotation3DEulerAngles(angles);
182
- * ```
183
+ * ```typescript
184
+ * ```typescript
185
+ * // Using individual angles in degrees
186
+ * const rotation = MatrixRotation3DEulerAngles(45, 30, 60);
187
+ * // Using vector input in degrees
188
+ * const angles: TVector3 = [45, 30, 60];
189
+ * const rotation2 = MatrixRotation3DEulerAngles(angles);
190
+ * ```
191
+ * ```
183
192
  */
184
- export declare function MatrixRotation3DEulerAngles(roll: number, pitch: number, yaw: number): IMatrix4;
185
- export declare function MatrixRotation3DEulerAngles(v: TVector3): IMatrix4;
193
+ export declare function MatrixRotation3DEulerAngles(roll: number, pitch: number, yaw: number): TMatrix4;
194
+ export declare function MatrixRotation3DEulerAngles(v: TVector3): TMatrix4;
186
195
  /**
187
196
  * Creates a 2D scale transformation matrix with flexible input options.
188
197
  *
@@ -204,29 +213,28 @@ export declare function MatrixRotation3DEulerAngles(v: TVector3): IMatrix4;
204
213
  *
205
214
  * @param scale - Uniform scale factor for both axes, OR X-axis scale factor
206
215
  * @param y - Y-axis scale factor (only for independent scaling)
207
- * @returns {IMatrix3} A 3x3 scale transformation matrix
216
+ * @returns {TMatrix3} A 3x3 scale transformation matrix
208
217
  *
209
218
  * @throws {Error} If any scale factor is not a finite number
210
219
  *
211
220
  * @example
212
- * ```typescript
213
- * // Uniform scaling (double size)
214
- * const uniform = MatrixScale2D(2.0);
215
- *
216
- * // Independent scaling (stretch horizontally, compress vertically)
217
- * const stretch = MatrixScale2D(2.0, 0.5);
218
- *
219
- * // Vector input
220
- * const scaleVector: TVector2 = [1.5, 0.8];
221
- * const vectorScale = MatrixScale2D(scaleVector);
222
- *
223
- * // Flip horizontally
224
- * const flip = MatrixScale2D(-1, 1);
225
- * ```
221
+ * ```typescript
222
+ * ```typescript
223
+ * // Uniform scaling (double size)
224
+ * const uniform = MatrixScale2D(2.0);
225
+ * // Independent scaling (stretch horizontally, compress vertically)
226
+ * const stretch = MatrixScale2D(2.0, 0.5);
227
+ * // Vector input
228
+ * const scaleVector: TVector2 = [1.5, 0.8];
229
+ * const vectorScale = MatrixScale2D(scaleVector);
230
+ * // Flip horizontally
231
+ * const flip = MatrixScale2D(-1, 1);
232
+ * ```
233
+ * ```
226
234
  */
227
- export declare function MatrixScale2D(scale: number): IMatrix3;
228
- export declare function MatrixScale2D(x: number, y: number): IMatrix3;
229
- export declare function MatrixScale2D(v: TVector2): IMatrix3;
235
+ export declare function MatrixScale2D(scale: number): TMatrix3;
236
+ export declare function MatrixScale2D(x: number, y: number): TMatrix3;
237
+ export declare function MatrixScale2D(v: TVector2): TMatrix3;
230
238
  /**
231
239
  * Creates a 3D scale transformation matrix with flexible input options.
232
240
  *
@@ -250,29 +258,28 @@ export declare function MatrixScale2D(v: TVector2): IMatrix3;
250
258
  * @param scale - Uniform scale factor for all axes, OR X-axis scale factor
251
259
  * @param y - Y-axis scale factor (only for independent scaling)
252
260
  * @param z - Z-axis scale factor (only for independent scaling)
253
- * @returns {IMatrix4} A 4x4 scale transformation matrix
261
+ * @returns {TMatrix4} A 4x4 scale transformation matrix
254
262
  *
255
263
  * @throws {Error} If any scale factor is not a finite number
256
264
  *
257
265
  * @example
258
- * ```typescript
259
- * // Uniform scaling (triple size)
260
- * const uniform = MatrixScale3D(3.0);
261
- *
262
- * // Independent scaling (stretch, compress, normal)
263
- * const stretch = MatrixScale3D(2.0, 0.5, 1.0);
264
- *
265
- * // Vector input
266
- * const scaleVector: TVector3 = [1.5, 0.8, 2.0];
267
- * const vectorScale = MatrixScale3D(scaleVector);
268
- *
269
- * // Mirror across XY plane
270
- * const mirror = MatrixScale3D(1, 1, -1);
271
- * ```
266
+ * ```typescript
267
+ * ```typescript
268
+ * // Uniform scaling (triple size)
269
+ * const uniform = MatrixScale3D(3.0);
270
+ * // Independent scaling (stretch, compress, normal)
271
+ * const stretch = MatrixScale3D(2.0, 0.5, 1.0);
272
+ * // Vector input
273
+ * const scaleVector: TVector3 = [1.5, 0.8, 2.0];
274
+ * const vectorScale = MatrixScale3D(scaleVector);
275
+ * // Mirror across XY plane
276
+ * const mirror = MatrixScale3D(1, 1, -1);
277
+ * ```
278
+ * ```
272
279
  */
273
- export declare function MatrixScale3D(scale: number): IMatrix4;
274
- export declare function MatrixScale3D(x: number, y: number, z: number): IMatrix4;
275
- export declare function MatrixScale3D(v: TVector3): IMatrix4;
280
+ export declare function MatrixScale3D(scale: number): TMatrix4;
281
+ export declare function MatrixScale3D(x: number, y: number, z: number): TMatrix4;
282
+ export declare function MatrixScale3D(v: TVector3): TMatrix4;
276
283
  /**
277
284
  * Creates a 2D translation transformation matrix.
278
285
  *
@@ -287,21 +294,22 @@ export declare function MatrixScale3D(v: TVector3): IMatrix4;
287
294
  * ```
288
295
  *
289
296
  * @param v - Translation vector [x, y] containing offset distances
290
- * @returns {IMatrix3} A 3x3 translation transformation matrix
297
+ * @returns {TMatrix3} A 3x3 translation transformation matrix
291
298
  *
292
299
  * @throws {Error} If the input is not a valid 2D vector
293
300
  *
294
301
  * @example
295
- * ```typescript
296
- * // Move 10 units right, 5 units up
297
- * const translation = MatrixTranslation2D(10, 5);
298
- *
299
- * // Using vector input
300
- * const offset: TVector2 = [10, 5];
301
- * const translation2 = MatrixTranslation2D(...offset);
302
- * ```
302
+ * ```typescript
303
+ * ```typescript
304
+ * // Move 10 units right, 5 units up
305
+ * const translation = MatrixTranslation2D(10, 5);
306
+ * // Using vector input
307
+ * const offset: TVector2 = [10, 5];
308
+ * const translation2 = MatrixTranslation2D(...offset);
309
+ * ```
310
+ * ```
303
311
  */
304
- export declare function MatrixTranslation2D(...v: TVector2): IMatrix3;
312
+ export declare function MatrixTranslation2D(...v: TVector2): TMatrix3;
305
313
  /**
306
314
  * Creates a 3D translation transformation matrix with flexible input options.
307
315
  *
@@ -324,26 +332,26 @@ export declare function MatrixTranslation2D(...v: TVector2): IMatrix3;
324
332
  * @param translationOrX - Uniform translation distance for all axes, OR X-axis distance
325
333
  * @param y - Y-axis translation distance (only for independent translation)
326
334
  * @param z - Z-axis translation distance (only for independent translation)
327
- * @returns {IMatrix4} A 4x4 translation transformation matrix
335
+ * @returns {TMatrix4} A 4x4 translation transformation matrix
328
336
  *
329
337
  * @throws {Error} If any translation distance is not a finite number
330
338
  *
331
339
  * @example
332
- * ```typescript
333
- * // Uniform translation (move 5 units in all directions)
334
- * const uniform = MatrixTranslation3D(5.0);
335
- *
336
- * // Independent translation
337
- * const independent = MatrixTranslation3D(10, -5, 3);
338
- *
339
- * // Vector input
340
- * const offset: TVector3 = [10, -5, 3];
341
- * const vectorTranslation = MatrixTranslation3D(...offset);
342
- * ```
340
+ * ```typescript
341
+ * ```typescript
342
+ * // Uniform translation (move 5 units in all directions)
343
+ * const uniform = MatrixTranslation3D(5.0);
344
+ * // Independent translation
345
+ * const independent = MatrixTranslation3D(10, -5, 3);
346
+ * // Vector input
347
+ * const offset: TVector3 = [10, -5, 3];
348
+ * const vectorTranslation = MatrixTranslation3D(...offset);
349
+ * ```
350
+ * ```
343
351
  */
344
- export declare function MatrixTranslation3D(translation: number): IMatrix4;
345
- export declare function MatrixTranslation3D(x: number, y: number, z: number): IMatrix4;
346
- export declare function MatrixTranslation3D(v: TVector3): IMatrix4;
352
+ export declare function MatrixTranslation3D(translation: number): TMatrix4;
353
+ export declare function MatrixTranslation3D(x: number, y: number, z: number): TMatrix4;
354
+ export declare function MatrixTranslation3D(v: TVector3): TMatrix4;
347
355
  /**
348
356
  * Transforms a 2D vector using a 3x3 transformation matrix with homogeneous coordinates.
349
357
  *
@@ -363,21 +371,22 @@ export declare function MatrixTranslation3D(v: TVector3): IMatrix4;
363
371
  * @throws {Error} If inputs are not valid vector/matrix types
364
372
  *
365
373
  * @example
366
- * ```typescript
367
- * // Rotate a point 90 degrees counterclockwise
368
- * const rotationMatrix = MatrixRotation2D(Math.PI / 2);
369
- * const point: TVector2 = [1, 0];
370
- * const rotatedPoint = MatrixTransform2D(point, rotationMatrix);
371
- * // Result: approximately [0, 1]
372
- *
373
- * // Chain multiple transformations
374
- * const scale = MatrixScale2D(2, 2);
375
- * const translate = MatrixTranslation2D(5, 3);
376
- * const combined = MatrixMultiply(translate, scale);
377
- * const transformedPoint = MatrixTransform2D(point, combined);
378
- * ```
374
+ * ```typescript
375
+ * ```typescript
376
+ * // Rotate a point 90 degrees counterclockwise
377
+ * const rotationMatrix = MatrixRotation2D(Math.PI / 2);
378
+ * const point: TVector2 = [1, 0];
379
+ * const rotatedPoint = MatrixTransform2D(point, rotationMatrix);
380
+ * // Result: approximately [0, 1]
381
+ * // Chain multiple transformations
382
+ * const scale = MatrixScale2D(2, 2);
383
+ * const translate = MatrixTranslation2D(5, 3);
384
+ * const combined = MatrixMultiply(translate, scale);
385
+ * const transformedPoint = MatrixTransform2D(point, combined);
386
+ * ```
387
+ * ```
379
388
  */
380
- export declare function MatrixTransform2D(vector: TVector2, matrix: IMatrix3): TVector2;
389
+ export declare function MatrixTransform2D(vector: TVector2, matrix: TMatrix3): TVector2;
381
390
  /**
382
391
  * Transforms a 3D vector using a 4x4 transformation matrix with homogeneous coordinates.
383
392
  * Converts to homogeneous coordinates, applies transformation, then converts back to 3D.
@@ -389,13 +398,15 @@ export declare function MatrixTransform2D(vector: TVector2, matrix: IMatrix3): T
389
398
  * @throws {Error} If the w component is near zero (degenerate transformation).
390
399
  *
391
400
  * @example
392
- * ```typescript
393
- * const rotationMatrix = MatrixRotation3DYaw(Math.PI / 4);
394
- * const point: TVector3 = [1, 0, 0];
395
- * const rotatedPoint = MatrixTransform3D(point, rotationMatrix);
396
- * ```
401
+ * ```typescript
402
+ * ```typescript
403
+ * const rotationMatrix = MatrixRotation3DYaw(Math.PI / 4);
404
+ * const point: TVector3 = [1, 0, 0];
405
+ * const rotatedPoint = MatrixTransform3D(point, rotationMatrix);
406
+ * ```
407
+ * ```
397
408
  */
398
- export declare function MatrixTransform3D(vector: TVector3, transform: IMatrix4): TVector3;
409
+ export declare function MatrixTransform3D(vector: TVector3, transform: TMatrix4): TVector3;
399
410
  /**
400
411
  * Transforms a 3D direction vector using a 3x3 matrix, ignoring translation components.
401
412
  * Designed for direction vectors (normals, velocities) where translation should not apply.
@@ -405,13 +416,15 @@ export declare function MatrixTransform3D(vector: TVector3, transform: IMatrix4)
405
416
  * @returns {TVector3} The transformed direction vector.
406
417
  *
407
418
  * @example
408
- * ```typescript
409
- * const rotationMatrix = MatrixRotation3DYaw(Math.PI / 4);
410
- * const normal: TVector3 = [0, 0, 1];
411
- * const rotatedNormal = MatrixDirection3D(normal, rotationMatrix);
412
- * ```
419
+ * ```typescript
420
+ * ```typescript
421
+ * const rotationMatrix = MatrixRotation3DYaw(Math.PI / 4);
422
+ * const normal: TVector3 = [0, 0, 1];
423
+ * const rotatedNormal = MatrixDirection3D(normal, rotationMatrix);
424
+ * ```
425
+ * ```
413
426
  */
414
- export declare function MatrixDirection3D(direction: TVector3, matrix: IMatrix3): TVector3;
427
+ export declare function MatrixDirection3D(direction: TVector3, matrix: TMatrix3): TVector3;
415
428
  /**
416
429
  * Creates a view matrix for positioning and orienting a 3D camera.
417
430
  * Transforms world coordinates to camera coordinates using the "look-at" approach.
@@ -419,18 +432,20 @@ export declare function MatrixDirection3D(direction: TVector3, matrix: IMatrix3)
419
432
  * @param eye - Camera position in world coordinates.
420
433
  * @param target - Point the camera is looking at.
421
434
  * @param up - Up direction vector (usually [0, 1, 0]).
422
- * @returns {IMatrix4} A 4x4 view transformation matrix.
435
+ * @returns {TMatrix4} A 4x4 view transformation matrix.
423
436
  *
424
437
  * @example
425
- * ```typescript
426
- * const viewMatrix = MatrixView(
427
- * [10, 5, 10], // Camera position
428
- * [0, 0, 0], // Looking at origin
429
- * [0, 1, 0] // Y-axis is up
430
- * );
431
- * ```
438
+ * ```typescript
439
+ * ```typescript
440
+ * const viewMatrix = MatrixView(
441
+ * [10, 5, 10], // Camera position
442
+ * [0, 0, 0], // Looking at origin
443
+ * [0, 1, 0] // Y-axis is up
444
+ * );
445
+ * ```
446
+ * ```
432
447
  */
433
- export declare function MatrixView(eye: TVector3, target: TVector3, up: TVector3): IMatrix4;
448
+ export declare function MatrixView(eye: TVector3, target: TVector3, up: TVector3): TMatrix4;
434
449
  /**
435
450
  * Creates a perspective projection matrix for 3D rendering.
436
451
  * Transforms 3D view coordinates to normalized device coordinates with perspective effect.
@@ -439,21 +454,23 @@ export declare function MatrixView(eye: TVector3, target: TVector3, up: TVector3
439
454
  * @param aspect - Aspect ratio of the viewport (width/height).
440
455
  * @param near - Distance to near clipping plane (must be positive).
441
456
  * @param far - Distance to far clipping plane (must be > near).
442
- * @returns {IMatrix4} A 4x4 perspective projection matrix.
457
+ * @returns {TMatrix4} A 4x4 perspective projection matrix.
443
458
  *
444
459
  * @throws {Error} If parameters are invalid.
445
460
  *
446
461
  * @example
447
- * ```typescript
448
- * const perspectiveMatrix = MatrixPerspective(
449
- * Math.PI / 4, // 45-degree field of view
450
- * 16 / 9, // Widescreen aspect ratio
451
- * 0.1, // Near plane
452
- * 1000 // Far plane
453
- * );
454
- * ```
462
+ * ```typescript
463
+ * ```typescript
464
+ * const perspectiveMatrix = MatrixPerspective(
465
+ * Math.PI / 4, // 45-degree field of view
466
+ * 16 / 9, // Widescreen aspect ratio
467
+ * 0.1, // Near plane
468
+ * 1000 // Far plane
469
+ * );
470
+ * ```
471
+ * ```
455
472
  */
456
- export declare function MatrixPerspective(fovY: number, aspect: number, near: number, far: number): IMatrix4;
473
+ export declare function MatrixPerspective(fovY: number, aspect: number, near: number, far: number): TMatrix4;
457
474
  /**
458
475
  * Creates an orthographic projection matrix for 3D rendering.
459
476
  * Maps a rectangular box to the unit cube [-1, 1]³ without perspective distortion.
@@ -464,18 +481,20 @@ export declare function MatrixPerspective(fovY: number, aspect: number, near: nu
464
481
  * @param top - Top boundary of the orthographic volume.
465
482
  * @param near - Near clipping plane distance.
466
483
  * @param far - Far clipping plane distance.
467
- * @returns {IMatrix4} A 4x4 orthographic projection matrix.
484
+ * @returns {TMatrix4} A 4x4 orthographic projection matrix.
468
485
  *
469
486
  * @throws {Error} If any opposing boundaries are equal.
470
487
  *
471
488
  * @example
472
- * ```typescript
473
- * const orthoMatrix = MatrixOrthographic(
474
- * -10, 10, // Left/Right: 20 units wide
475
- * -7.5, 7.5, // Bottom/Top: 15 units tall
476
- * -100, 100 // Near/Far: 200 units deep
477
- * );
478
- * ```
489
+ * ```typescript
490
+ * ```typescript
491
+ * const orthoMatrix = MatrixOrthographic(
492
+ * -10, 10, // Left/Right: 20 units wide
493
+ * -7.5, 7.5, // Bottom/Top: 15 units tall
494
+ * -100, 100 // Near/Far: 200 units deep
495
+ * );
496
+ * ```
497
+ * ```
479
498
  */
480
- export declare function MatrixOrthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): IMatrix4;
499
+ export declare function MatrixOrthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): TMatrix4;
481
500
  //# sourceMappingURL=transformations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/matrices/transformations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAY,MAAM,qBAAqB,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAU1D;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAW9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAW/D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAW7D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;AAErF,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;AAwBxD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,E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