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