@pawells/math-extended 1.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.
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/build/angles.d.ts +31 -0
- package/build/angles.d.ts.map +1 -0
- package/build/angles.js +85 -0
- package/build/angles.js.map +1 -0
- package/build/angles.spec.d.ts +2 -0
- package/build/angles.spec.d.ts.map +1 -0
- package/build/angles.spec.js +147 -0
- package/build/angles.spec.js.map +1 -0
- package/build/clamp.d.ts +17 -0
- package/build/clamp.d.ts.map +1 -0
- package/build/clamp.js +19 -0
- package/build/clamp.js.map +1 -0
- package/build/clamp.spec.d.ts +2 -0
- package/build/clamp.spec.d.ts.map +1 -0
- package/build/clamp.spec.js +19 -0
- package/build/clamp.spec.js.map +1 -0
- package/build/documentation-validation.spec.d.ts +11 -0
- package/build/documentation-validation.spec.d.ts.map +1 -0
- package/build/documentation-validation.spec.js +401 -0
- package/build/documentation-validation.spec.js.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +8 -0
- package/build/index.js.map +1 -0
- package/build/interpolation.d.ts +175 -0
- package/build/interpolation.d.ts.map +1 -0
- package/build/interpolation.js +369 -0
- package/build/interpolation.js.map +1 -0
- package/build/interpolation.spec.d.ts +2 -0
- package/build/interpolation.spec.d.ts.map +1 -0
- package/build/interpolation.spec.js +480 -0
- package/build/interpolation.spec.js.map +1 -0
- package/build/matrices/arithmetic.d.ts +411 -0
- package/build/matrices/arithmetic.d.ts.map +1 -0
- package/build/matrices/arithmetic.js +954 -0
- package/build/matrices/arithmetic.js.map +1 -0
- package/build/matrices/arithmetic.spec.d.ts +2 -0
- package/build/matrices/arithmetic.spec.d.ts.map +1 -0
- package/build/matrices/arithmetic.spec.js +915 -0
- package/build/matrices/arithmetic.spec.js.map +1 -0
- package/build/matrices/asserts.d.ts +306 -0
- package/build/matrices/asserts.d.ts.map +1 -0
- package/build/matrices/asserts.js +396 -0
- package/build/matrices/asserts.js.map +1 -0
- package/build/matrices/asserts.spec.d.ts +2 -0
- package/build/matrices/asserts.spec.d.ts.map +1 -0
- package/build/matrices/asserts.spec.js +565 -0
- package/build/matrices/asserts.spec.js.map +1 -0
- package/build/matrices/core.d.ts +168 -0
- package/build/matrices/core.d.ts.map +1 -0
- package/build/matrices/core.js +457 -0
- package/build/matrices/core.js.map +1 -0
- package/build/matrices/core.spec.d.ts +2 -0
- package/build/matrices/core.spec.d.ts.map +1 -0
- package/build/matrices/core.spec.js +634 -0
- package/build/matrices/core.spec.js.map +1 -0
- package/build/matrices/decompositions.d.ts +326 -0
- package/build/matrices/decompositions.d.ts.map +1 -0
- package/build/matrices/decompositions.js +816 -0
- package/build/matrices/decompositions.js.map +1 -0
- package/build/matrices/decompositions.spec.d.ts +2 -0
- package/build/matrices/decompositions.spec.d.ts.map +1 -0
- package/build/matrices/decompositions.spec.js +195 -0
- package/build/matrices/decompositions.spec.js.map +1 -0
- package/build/matrices/index.d.ts +9 -0
- package/build/matrices/index.d.ts.map +1 -0
- package/build/matrices/index.js +9 -0
- package/build/matrices/index.js.map +1 -0
- package/build/matrices/linear-algebra.d.ts +64 -0
- package/build/matrices/linear-algebra.d.ts.map +1 -0
- package/build/matrices/linear-algebra.js +253 -0
- package/build/matrices/linear-algebra.js.map +1 -0
- package/build/matrices/linear-algebra.spec.d.ts +2 -0
- package/build/matrices/linear-algebra.spec.d.ts.map +1 -0
- package/build/matrices/linear-algebra.spec.js +355 -0
- package/build/matrices/linear-algebra.spec.js.map +1 -0
- package/build/matrices/normalization.d.ts +62 -0
- package/build/matrices/normalization.d.ts.map +1 -0
- package/build/matrices/normalization.js +167 -0
- package/build/matrices/normalization.js.map +1 -0
- package/build/matrices/normalization.spec.d.ts +2 -0
- package/build/matrices/normalization.spec.d.ts.map +1 -0
- package/build/matrices/normalization.spec.js +335 -0
- package/build/matrices/normalization.spec.js.map +1 -0
- package/build/matrices/transformations.d.ts +484 -0
- package/build/matrices/transformations.d.ts.map +1 -0
- package/build/matrices/transformations.js +592 -0
- package/build/matrices/transformations.js.map +1 -0
- package/build/matrices/transformations.spec.d.ts +2 -0
- package/build/matrices/transformations.spec.d.ts.map +1 -0
- package/build/matrices/transformations.spec.js +755 -0
- package/build/matrices/transformations.spec.js.map +1 -0
- package/build/matrices/types.d.ts +134 -0
- package/build/matrices/types.d.ts.map +1 -0
- package/build/matrices/types.js +6 -0
- package/build/matrices/types.js.map +1 -0
- package/build/quaternions/asserts.d.ts +77 -0
- package/build/quaternions/asserts.d.ts.map +1 -0
- package/build/quaternions/asserts.js +175 -0
- package/build/quaternions/asserts.js.map +1 -0
- package/build/quaternions/asserts.spec.d.ts +2 -0
- package/build/quaternions/asserts.spec.d.ts.map +1 -0
- package/build/quaternions/asserts.spec.js +320 -0
- package/build/quaternions/asserts.spec.js.map +1 -0
- package/build/quaternions/conversions.d.ts +73 -0
- package/build/quaternions/conversions.d.ts.map +1 -0
- package/build/quaternions/conversions.js +179 -0
- package/build/quaternions/conversions.js.map +1 -0
- package/build/quaternions/conversions.spec.d.ts +2 -0
- package/build/quaternions/conversions.spec.d.ts.map +1 -0
- package/build/quaternions/conversions.spec.js +344 -0
- package/build/quaternions/conversions.spec.js.map +1 -0
- package/build/quaternions/core.d.ts +203 -0
- package/build/quaternions/core.d.ts.map +1 -0
- package/build/quaternions/core.js +374 -0
- package/build/quaternions/core.js.map +1 -0
- package/build/quaternions/core.spec.d.ts +2 -0
- package/build/quaternions/core.spec.d.ts.map +1 -0
- package/build/quaternions/core.spec.js +294 -0
- package/build/quaternions/core.spec.js.map +1 -0
- package/build/quaternions/index.d.ts +7 -0
- package/build/quaternions/index.d.ts.map +1 -0
- package/build/quaternions/index.js +7 -0
- package/build/quaternions/index.js.map +1 -0
- package/build/quaternions/interpolation.d.ts +54 -0
- package/build/quaternions/interpolation.d.ts.map +1 -0
- package/build/quaternions/interpolation.js +201 -0
- package/build/quaternions/interpolation.js.map +1 -0
- package/build/quaternions/interpolation.spec.d.ts +2 -0
- package/build/quaternions/interpolation.spec.d.ts.map +1 -0
- package/build/quaternions/interpolation.spec.js +64 -0
- package/build/quaternions/interpolation.spec.js.map +1 -0
- package/build/quaternions/predefined.d.ts +36 -0
- package/build/quaternions/predefined.d.ts.map +1 -0
- package/build/quaternions/predefined.js +42 -0
- package/build/quaternions/predefined.js.map +1 -0
- package/build/quaternions/predefined.spec.d.ts +2 -0
- package/build/quaternions/predefined.spec.d.ts.map +1 -0
- package/build/quaternions/predefined.spec.js +35 -0
- package/build/quaternions/predefined.spec.js.map +1 -0
- package/build/quaternions/types.d.ts +55 -0
- package/build/quaternions/types.d.ts.map +1 -0
- package/build/quaternions/types.js +7 -0
- package/build/quaternions/types.js.map +1 -0
- package/build/random.d.ts +66 -0
- package/build/random.d.ts.map +1 -0
- package/build/random.js +115 -0
- package/build/random.js.map +1 -0
- package/build/random.spec.d.ts +2 -0
- package/build/random.spec.d.ts.map +1 -0
- package/build/random.spec.js +267 -0
- package/build/random.spec.js.map +1 -0
- package/build/vectors/asserts.d.ts +182 -0
- package/build/vectors/asserts.d.ts.map +1 -0
- package/build/vectors/asserts.js +285 -0
- package/build/vectors/asserts.js.map +1 -0
- package/build/vectors/asserts.spec.d.ts +2 -0
- package/build/vectors/asserts.spec.d.ts.map +1 -0
- package/build/vectors/asserts.spec.js +260 -0
- package/build/vectors/asserts.spec.js.map +1 -0
- package/build/vectors/core.d.ts +507 -0
- package/build/vectors/core.d.ts.map +1 -0
- package/build/vectors/core.js +825 -0
- package/build/vectors/core.js.map +1 -0
- package/build/vectors/core.spec.d.ts +2 -0
- package/build/vectors/core.spec.d.ts.map +1 -0
- package/build/vectors/core.spec.js +343 -0
- package/build/vectors/core.spec.js.map +1 -0
- package/build/vectors/index.d.ts +6 -0
- package/build/vectors/index.d.ts.map +1 -0
- package/build/vectors/index.js +6 -0
- package/build/vectors/index.js.map +1 -0
- package/build/vectors/interpolation.d.ts +404 -0
- package/build/vectors/interpolation.d.ts.map +1 -0
- package/build/vectors/interpolation.js +585 -0
- package/build/vectors/interpolation.js.map +1 -0
- package/build/vectors/interpolation.spec.d.ts +2 -0
- package/build/vectors/interpolation.spec.d.ts.map +1 -0
- package/build/vectors/interpolation.spec.js +378 -0
- package/build/vectors/interpolation.spec.js.map +1 -0
- package/build/vectors/predefined.d.ts +191 -0
- package/build/vectors/predefined.d.ts.map +1 -0
- package/build/vectors/predefined.js +191 -0
- package/build/vectors/predefined.js.map +1 -0
- package/build/vectors/predefined.spec.d.ts +2 -0
- package/build/vectors/predefined.spec.d.ts.map +1 -0
- package/build/vectors/predefined.spec.js +333 -0
- package/build/vectors/predefined.spec.js.map +1 -0
- package/build/vectors/types.d.ts +62 -0
- package/build/vectors/types.d.ts.map +1 -0
- package/build/vectors/types.js +6 -0
- package/build/vectors/types.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Matrix transformation functions for 2D and 3D operations.
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive transformation matrix creation and application functions
|
|
5
|
+
* for computer graphics, game development, and mathematical applications. It includes:
|
|
6
|
+
*
|
|
7
|
+
* - Rotation matrices (2D and 3D with Euler angles)
|
|
8
|
+
* - Scale transformation matrices (uniform and non-uniform)
|
|
9
|
+
* - Translation matrices for positional transformations
|
|
10
|
+
* - Vector transformation utilities with homogeneous coordinate support
|
|
11
|
+
* - View and projection matrices for 3D rendering pipelines
|
|
12
|
+
*
|
|
13
|
+
* All matrices use homogeneous coordinates for consistent transformation composition.
|
|
14
|
+
* 2D transformations use 3x3 matrices, 3D transformations use 4x4 matrices.
|
|
15
|
+
*
|
|
16
|
+
* @author JTV Development Team
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
import { AssertNumber, AssertNotEquals } from '@pawells/typescript-common';
|
|
20
|
+
import { MatrixCreate } from './core.js';
|
|
21
|
+
import { MatrixMultiply } from './arithmetic.js';
|
|
22
|
+
import { AssertMatrix3, AssertMatrix4 } from './asserts.js';
|
|
23
|
+
import { AssertVector2, AssertVector3, AssertVector4 } from '../vectors/asserts.js';
|
|
24
|
+
import { VectorSubtract, VectorNormalize, Vector3Cross } from '../vectors/core.js';
|
|
25
|
+
const DEGREES_PER_HALF_REVOLUTION = 180;
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// 2D ROTATION TRANSFORMATIONS
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Creates a 2D rotation matrix for rotating points around the origin.
|
|
31
|
+
*
|
|
32
|
+
* The matrix rotates points counterclockwise for positive angles in a standard
|
|
33
|
+
* right-handed coordinate system. Uses homogeneous coordinates for composition
|
|
34
|
+
* with other 2D transformations.
|
|
35
|
+
*
|
|
36
|
+
* Matrix structure:
|
|
37
|
+
* ```
|
|
38
|
+
* [cos(θ) -sin(θ) 0]
|
|
39
|
+
* [sin(θ) cos(θ) 0]
|
|
40
|
+
* [ 0 0 1]
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @param radians - Rotation angle in radians (positive = counterclockwise)
|
|
44
|
+
* @returns {IMatrix3} A 3x3 rotation matrix for 2D transformations
|
|
45
|
+
*
|
|
46
|
+
* @throws {Error} If radians is not a finite number
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // 90-degree counterclockwise rotation
|
|
51
|
+
* const matrix = MatrixRotation2D(Math.PI / 2);
|
|
52
|
+
*
|
|
53
|
+
* // 45-degree clockwise rotation
|
|
54
|
+
* const clockwise = MatrixRotation2D(-Math.PI / 4);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export function MatrixRotation2D(radians) {
|
|
58
|
+
AssertNumber(radians, { finite: true }, { message: 'Rotation angle must be a number' });
|
|
59
|
+
const cos = Math.cos(radians);
|
|
60
|
+
const sin = Math.sin(radians);
|
|
61
|
+
return [
|
|
62
|
+
[cos, -sin, 0], // [cos(θ), -sin(θ), 0]
|
|
63
|
+
[sin, cos, 0], // [sin(θ), cos(θ), 0]
|
|
64
|
+
[0, 0, 1], // [ 0, 0, 1]
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// 3D ROTATION TRANSFORMATIONS
|
|
69
|
+
// ============================================================================
|
|
70
|
+
/**
|
|
71
|
+
* Creates a 3D roll rotation matrix (rotation around the X-axis).
|
|
72
|
+
*
|
|
73
|
+
* Roll represents banking motion in aviation terminology. Positive angles
|
|
74
|
+
* follow the right-hand rule: curl fingers from Y toward Z, thumb points
|
|
75
|
+
* in positive X direction.
|
|
76
|
+
*
|
|
77
|
+
* Matrix structure:
|
|
78
|
+
* ```
|
|
79
|
+
* [1 0 0 0]
|
|
80
|
+
* [0 cos(θ) -sin(θ) 0]
|
|
81
|
+
* [0 sin(θ) cos(θ) 0]
|
|
82
|
+
* [0 0 0 1]
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @param radians - Roll angle in radians (positive = right-hand rule around X-axis)
|
|
86
|
+
* @returns {IMatrix4} A 4x4 roll rotation matrix
|
|
87
|
+
*
|
|
88
|
+
* @throws {Error} If radians is not a finite number
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // 45-degree roll (banking left in aviation)
|
|
93
|
+
* const rollMatrix = MatrixRotation3DRoll(Math.PI / 4);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export function MatrixRotation3DRoll(radians) {
|
|
97
|
+
AssertNumber(radians, { finite: true }, { message: 'Rotation angle must be a number' });
|
|
98
|
+
const cos = Math.cos(radians);
|
|
99
|
+
const sin = Math.sin(radians);
|
|
100
|
+
return [
|
|
101
|
+
[1, 0, 0, 0], // [1, 0, 0, 0]
|
|
102
|
+
[0, cos, -sin, 0], // [0, cos(θ), -sin(θ), 0]
|
|
103
|
+
[0, sin, cos, 0], // [0, sin(θ), cos(θ), 0]
|
|
104
|
+
[0, 0, 0, 1], // [0, 0, 0, 1]
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a 3D pitch rotation matrix (rotation around the Y-axis).
|
|
109
|
+
*
|
|
110
|
+
* Pitch represents elevation motion in aviation terminology. Positive angles
|
|
111
|
+
* follow the right-hand rule: curl fingers from Z toward X, thumb points
|
|
112
|
+
* in positive Y direction.
|
|
113
|
+
*
|
|
114
|
+
* Matrix structure:
|
|
115
|
+
* ```
|
|
116
|
+
* [ cos(θ) 0 sin(θ) 0]
|
|
117
|
+
* [ 0 1 0 0]
|
|
118
|
+
* [-sin(θ) 0 cos(θ) 0]
|
|
119
|
+
* [ 0 0 0 1]
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @param radians - Pitch angle in radians (positive = nose up in aviation)
|
|
123
|
+
* @returns {IMatrix4} A 4x4 pitch rotation matrix
|
|
124
|
+
*
|
|
125
|
+
* @throws {Error} If radians is not a finite number
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* // 30-degree pitch up
|
|
130
|
+
* const pitchMatrix = MatrixRotation3DPitch(Math.PI / 6);
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export function MatrixRotation3DPitch(radians) {
|
|
134
|
+
AssertNumber(radians, { finite: true }, { message: 'Rotation angle must be a number' });
|
|
135
|
+
const cos = Math.cos(radians);
|
|
136
|
+
const sin = Math.sin(radians);
|
|
137
|
+
return [
|
|
138
|
+
[cos, 0, sin, 0], // [ cos(θ), 0, sin(θ), 0]
|
|
139
|
+
[0, 1, 0, 0], // [ 0, 1, 0, 0]
|
|
140
|
+
[-sin, 0, cos, 0], // [-sin(θ), 0, cos(θ), 0]
|
|
141
|
+
[0, 0, 0, 1], // [ 0, 0, 0, 1]
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Creates a 3D yaw rotation matrix (rotation around the Z-axis).
|
|
146
|
+
*
|
|
147
|
+
* Yaw represents heading motion in aviation terminology. Positive angles
|
|
148
|
+
* follow the right-hand rule: curl fingers from X toward Y, thumb points
|
|
149
|
+
* in positive Z direction.
|
|
150
|
+
*
|
|
151
|
+
* Matrix structure:
|
|
152
|
+
* ```
|
|
153
|
+
* [cos(θ) -sin(θ) 0 0]
|
|
154
|
+
* [sin(θ) cos(θ) 0 0]
|
|
155
|
+
* [ 0 0 1 0]
|
|
156
|
+
* [ 0 0 0 1]
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @param radians - Yaw angle in radians (positive = turn left in aviation)
|
|
160
|
+
* @returns {IMatrix4} A 4x4 yaw rotation matrix
|
|
161
|
+
*
|
|
162
|
+
* @throws {Error} If radians is not a finite number
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* // 60-degree yaw left
|
|
167
|
+
* const yawMatrix = MatrixRotation3DYaw(Math.PI / 3);
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export function MatrixRotation3DYaw(radians) {
|
|
171
|
+
AssertNumber(radians, { finite: true }, { message: 'Rotation angle must be a number' });
|
|
172
|
+
const cos = Math.cos(radians);
|
|
173
|
+
const sin = Math.sin(radians);
|
|
174
|
+
return [
|
|
175
|
+
[cos, -sin, 0, 0], // [cos(θ), -sin(θ), 0, 0]
|
|
176
|
+
[sin, cos, 0, 0], // [sin(θ), cos(θ), 0, 0]
|
|
177
|
+
[0, 0, 1, 0], // [ 0, 0, 1, 0]
|
|
178
|
+
[0, 0, 0, 1], // [ 0, 0, 0, 1]
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
export function MatrixRotation3D(rollOrVector, pitch, yaw) {
|
|
182
|
+
if (typeof rollOrVector === 'number') {
|
|
183
|
+
// Called with individual parameters
|
|
184
|
+
AssertNumber(rollOrVector, { finite: true }, { message: 'Roll angle must be a number' });
|
|
185
|
+
AssertNumber(pitch, { finite: true }, { message: 'Pitch angle must be a number' });
|
|
186
|
+
AssertNumber(yaw, { finite: true }, { message: 'Yaw angle must be a number' });
|
|
187
|
+
const rollMatrix = MatrixRotation3DRoll(rollOrVector);
|
|
188
|
+
const pitchMatrix = MatrixRotation3DPitch(pitch);
|
|
189
|
+
const yawMatrix = MatrixRotation3DYaw(yaw);
|
|
190
|
+
// Apply rotations in order: Roll → Pitch → Yaw
|
|
191
|
+
// Note: Matrix multiplication is applied right to left
|
|
192
|
+
const pitchRoll = MatrixMultiply(pitchMatrix, rollMatrix);
|
|
193
|
+
const result = MatrixMultiply(yawMatrix, pitchRoll);
|
|
194
|
+
AssertMatrix4(result);
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
// Called with vector parameter
|
|
198
|
+
AssertVector3(rollOrVector);
|
|
199
|
+
return MatrixRotation3D(rollOrVector[0], rollOrVector[1], rollOrVector[2]);
|
|
200
|
+
}
|
|
201
|
+
export function MatrixRotation3DEulerAngles(rollOrVector, pitch, yaw) {
|
|
202
|
+
if (typeof rollOrVector === 'number') {
|
|
203
|
+
AssertNumber(rollOrVector, { finite: true }, { message: 'Roll angle must be a number' });
|
|
204
|
+
AssertNumber(pitch, { finite: true }, { message: 'Pitch angle must be a number' });
|
|
205
|
+
AssertNumber(yaw, { finite: true }, { message: 'Yaw angle must be a number' });
|
|
206
|
+
// Convert degrees to radians
|
|
207
|
+
const rollRad = (rollOrVector * Math.PI) / DEGREES_PER_HALF_REVOLUTION;
|
|
208
|
+
const pitchRad = (pitch * Math.PI) / DEGREES_PER_HALF_REVOLUTION;
|
|
209
|
+
const yawRad = (yaw * Math.PI) / DEGREES_PER_HALF_REVOLUTION;
|
|
210
|
+
return MatrixRotation3D(rollRad, pitchRad, yawRad);
|
|
211
|
+
}
|
|
212
|
+
AssertVector3(rollOrVector);
|
|
213
|
+
return MatrixRotation3D((rollOrVector[0] * Math.PI) / DEGREES_PER_HALF_REVOLUTION, (rollOrVector[1] * Math.PI) / DEGREES_PER_HALF_REVOLUTION, (rollOrVector[2] * Math.PI) / DEGREES_PER_HALF_REVOLUTION);
|
|
214
|
+
}
|
|
215
|
+
export function MatrixScale2D(scaleOrX, y) {
|
|
216
|
+
if (typeof scaleOrX === 'number') {
|
|
217
|
+
if (y === undefined) {
|
|
218
|
+
// Uniform scaling - single scale factor for both axes
|
|
219
|
+
AssertNumber(scaleOrX, { finite: true }, { message: 'Scale factor must be a finite number' });
|
|
220
|
+
return [
|
|
221
|
+
[scaleOrX, 0, 0],
|
|
222
|
+
[0, scaleOrX, 0],
|
|
223
|
+
[0, 0, 1],
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
// Independent scaling - separate scale factors for X and Y axes
|
|
227
|
+
AssertNumber(scaleOrX, { finite: true }, { message: 'X scale factor must be a finite number' });
|
|
228
|
+
AssertNumber(y, { finite: true }, { message: 'Y scale factor must be a finite number' });
|
|
229
|
+
return [
|
|
230
|
+
[scaleOrX, 0, 0],
|
|
231
|
+
[0, y, 0],
|
|
232
|
+
[0, 0, 1],
|
|
233
|
+
];
|
|
234
|
+
}
|
|
235
|
+
// Vector scaling - scale factors provided as a 2D vector
|
|
236
|
+
AssertVector2(scaleOrX);
|
|
237
|
+
return [
|
|
238
|
+
[scaleOrX[0], 0, 0],
|
|
239
|
+
[0, scaleOrX[1], 0],
|
|
240
|
+
[0, 0, 1],
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
export function MatrixScale3D(scaleOrX, y, z) {
|
|
244
|
+
if (typeof scaleOrX === 'number') {
|
|
245
|
+
if (y === undefined && z === undefined) {
|
|
246
|
+
// Uniform scaling - single scale factor for all axes
|
|
247
|
+
AssertNumber(scaleOrX, { finite: true }, { message: 'Scale factor must be a finite number' });
|
|
248
|
+
return [
|
|
249
|
+
[scaleOrX, 0, 0, 0],
|
|
250
|
+
[0, scaleOrX, 0, 0],
|
|
251
|
+
[0, 0, scaleOrX, 0],
|
|
252
|
+
[0, 0, 0, 1],
|
|
253
|
+
];
|
|
254
|
+
}
|
|
255
|
+
// Independent scaling - separate scale factors for X, Y, and Z axes
|
|
256
|
+
AssertNumber(scaleOrX, { finite: true }, { message: 'X scale factor must be a finite number' });
|
|
257
|
+
AssertNumber(y, { finite: true }, { message: 'Y scale factor must be a finite number' });
|
|
258
|
+
AssertNumber(z, { finite: true }, { message: 'Z scale factor must be a finite number' });
|
|
259
|
+
return [
|
|
260
|
+
[scaleOrX, 0, 0, 0],
|
|
261
|
+
[0, y, 0, 0],
|
|
262
|
+
[0, 0, z, 0],
|
|
263
|
+
[0, 0, 0, 1],
|
|
264
|
+
];
|
|
265
|
+
}
|
|
266
|
+
// Vector scaling - scale factors provided as a 3D vector
|
|
267
|
+
AssertVector3(scaleOrX);
|
|
268
|
+
return [
|
|
269
|
+
[scaleOrX[0], 0, 0, 0],
|
|
270
|
+
[0, scaleOrX[1], 0, 0],
|
|
271
|
+
[0, 0, scaleOrX[2], 0],
|
|
272
|
+
[0, 0, 0, 1],
|
|
273
|
+
];
|
|
274
|
+
}
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// TRANSLATION TRANSFORMATIONS
|
|
277
|
+
// ============================================================================
|
|
278
|
+
/**
|
|
279
|
+
* Creates a 2D translation transformation matrix.
|
|
280
|
+
*
|
|
281
|
+
* Moves 2D points by the specified offset distances. Uses homogeneous
|
|
282
|
+
* coordinates to enable composition with other 2D transformations.
|
|
283
|
+
*
|
|
284
|
+
* Matrix structure:
|
|
285
|
+
* ```
|
|
286
|
+
* [1 0 tx]
|
|
287
|
+
* [0 1 ty]
|
|
288
|
+
* [0 0 1]
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @param v - Translation vector [x, y] containing offset distances
|
|
292
|
+
* @returns {IMatrix3} A 3x3 translation transformation matrix
|
|
293
|
+
*
|
|
294
|
+
* @throws {Error} If the input is not a valid 2D vector
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* // Move 10 units right, 5 units up
|
|
299
|
+
* const translation = MatrixTranslation2D(10, 5);
|
|
300
|
+
*
|
|
301
|
+
* // Using vector input
|
|
302
|
+
* const offset: TVector2 = [10, 5];
|
|
303
|
+
* const translation2 = MatrixTranslation2D(...offset);
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
export function MatrixTranslation2D(...v) {
|
|
307
|
+
// Called with vector parameter using spread syntax
|
|
308
|
+
AssertVector2(v);
|
|
309
|
+
return [
|
|
310
|
+
[1, 0, v[0]], // [1, 0, tx]
|
|
311
|
+
[0, 1, v[1]], // [0, 1, ty]
|
|
312
|
+
[0, 0, 1], // [0, 0, 1]
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
export function MatrixTranslation3D(translationOrX, y, z) {
|
|
316
|
+
if (typeof translationOrX === 'number') {
|
|
317
|
+
if (y === undefined && z === undefined) {
|
|
318
|
+
// Uniform translation - same distance along all axes
|
|
319
|
+
AssertNumber(translationOrX, { finite: true }, { message: 'Translation distance must be a finite number' });
|
|
320
|
+
return [
|
|
321
|
+
[1, 0, 0, translationOrX],
|
|
322
|
+
[0, 1, 0, translationOrX],
|
|
323
|
+
[0, 0, 1, translationOrX],
|
|
324
|
+
[0, 0, 0, 1],
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
// Independent translation - separate distances for X, Y, and Z axes
|
|
328
|
+
AssertNumber(translationOrX, { finite: true }, { message: 'X translation distance must be a finite number' });
|
|
329
|
+
AssertNumber(y, { finite: true }, { message: 'Y translation distance must be a finite number' });
|
|
330
|
+
AssertNumber(z, { finite: true }, { message: 'Z translation distance must be a finite number' });
|
|
331
|
+
return [
|
|
332
|
+
[1, 0, 0, translationOrX], // [1, 0, 0, tx]
|
|
333
|
+
[0, 1, 0, y], // [0, 1, 0, ty]
|
|
334
|
+
[0, 0, 1, z], // [0, 0, 1, tz]
|
|
335
|
+
[0, 0, 0, 1], // [0, 0, 0, 1]
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
// Vector translation - translation distances provided as a 3D vector
|
|
339
|
+
AssertVector3(translationOrX);
|
|
340
|
+
return [
|
|
341
|
+
[1, 0, 0, translationOrX[0]], // [1, 0, 0, tx]
|
|
342
|
+
[0, 1, 0, translationOrX[1]], // [0, 1, 0, ty]
|
|
343
|
+
[0, 0, 1, translationOrX[2]], // [0, 0, 1, tz]
|
|
344
|
+
[0, 0, 0, 1], // [0, 0, 0, 1]
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
// ============================================================================
|
|
348
|
+
// VECTOR TRANSFORMATION FUNCTIONS
|
|
349
|
+
// ============================================================================
|
|
350
|
+
/**
|
|
351
|
+
* Transforms a 2D vector using a 3x3 transformation matrix with homogeneous coordinates.
|
|
352
|
+
*
|
|
353
|
+
* This function applies a transformation matrix to a 2D vector by:
|
|
354
|
+
* 1. Converting the 2D vector to homogeneous coordinates (adding w=1)
|
|
355
|
+
* 2. Performing matrix-vector multiplication
|
|
356
|
+
* 3. Converting back to 2D by dividing by the homogeneous w component
|
|
357
|
+
*
|
|
358
|
+
* This approach enables composition of multiple transformations and supports
|
|
359
|
+
* affine transformations including translation, rotation, scaling, and shearing.
|
|
360
|
+
*
|
|
361
|
+
* @param vector - The 2D vector to transform [x, y]
|
|
362
|
+
* @param matrix - A 3x3 transformation matrix to apply
|
|
363
|
+
* @returns {TVector2} The transformed 2D vector
|
|
364
|
+
*
|
|
365
|
+
* @throws {Error} If the homogeneous w component is near zero (degenerate transformation)
|
|
366
|
+
* @throws {Error} If inputs are not valid vector/matrix types
|
|
367
|
+
*
|
|
368
|
+
* @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
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
export function MatrixTransform2D(vector, matrix) {
|
|
384
|
+
AssertVector2(vector);
|
|
385
|
+
AssertMatrix3(matrix);
|
|
386
|
+
// Convert to homogeneous coordinates (add w=1)
|
|
387
|
+
const homogeneous = [vector[0], vector[1], 1];
|
|
388
|
+
// Perform matrix-vector multiplication: result = matrix × homogeneous
|
|
389
|
+
const result = [
|
|
390
|
+
(matrix[0][0] * homogeneous[0]) + (matrix[0][1] * homogeneous[1]) + (matrix[0][2] * homogeneous[2]), // x'
|
|
391
|
+
(matrix[1][0] * homogeneous[0]) + (matrix[1][1] * homogeneous[1]) + (matrix[1][2] * homogeneous[2]), // y'
|
|
392
|
+
(matrix[2][0] * homogeneous[0]) + (matrix[2][1] * homogeneous[1]) + (matrix[2][2] * homogeneous[2]), // w'
|
|
393
|
+
];
|
|
394
|
+
// Ensure w component is not near zero (would indicate degenerate transformation)
|
|
395
|
+
AssertNumber(Math.abs(result[2]), { gte: 1e-10 }, { message: '2D transformation w component near zero' });
|
|
396
|
+
// Convert back from homogeneous coordinates by dividing by w
|
|
397
|
+
return [result[0] / result[2], result[1] / result[2]];
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Transforms a 3D vector using a 4x4 transformation matrix with homogeneous coordinates.
|
|
401
|
+
* Converts to homogeneous coordinates, applies transformation, then converts back to 3D.
|
|
402
|
+
*
|
|
403
|
+
* @param transform - A 4x4 transformation matrix.
|
|
404
|
+
* @param vector - The 3D vector to transform.
|
|
405
|
+
* @returns {TVector3} The transformed 3D vector.
|
|
406
|
+
*
|
|
407
|
+
* @throws {Error} If the w component is near zero (degenerate transformation).
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const rotationMatrix = Matrix_Transformation_Rotation3D_Yaw(Math.PI / 4);
|
|
412
|
+
* const point = [1, 0, 0];
|
|
413
|
+
* const rotatedPoint = Matrix_Transformation3D(rotationMatrix, point);
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
export function MatrixTransform3D(vector, transform) {
|
|
417
|
+
AssertMatrix4(transform);
|
|
418
|
+
AssertVector3(vector);
|
|
419
|
+
// Convert to homogeneous coordinates (add w=1)
|
|
420
|
+
const homogeneous = [vector[0], vector[1], vector[2], 1];
|
|
421
|
+
AssertVector4(homogeneous);
|
|
422
|
+
// Perform matrix-vector multiplication
|
|
423
|
+
const result = [
|
|
424
|
+
(transform[0][0] * homogeneous[0]) + (transform[0][1] * homogeneous[1]) + (transform[0][2] * homogeneous[2]) + (transform[0][3] * homogeneous[3]),
|
|
425
|
+
(transform[1][0] * homogeneous[0]) + (transform[1][1] * homogeneous[1]) + (transform[1][2] * homogeneous[2]) + (transform[1][3] * homogeneous[3]),
|
|
426
|
+
(transform[2][0] * homogeneous[0]) + (transform[2][1] * homogeneous[1]) + (transform[2][2] * homogeneous[2]) + (transform[2][3] * homogeneous[3]),
|
|
427
|
+
(transform[3][0] * homogeneous[0]) + (transform[3][1] * homogeneous[1]) + (transform[3][2] * homogeneous[2]) + (transform[3][3] * homogeneous[3]),
|
|
428
|
+
];
|
|
429
|
+
// Ensure w component is not near zero (would indicate degenerate transformation)
|
|
430
|
+
AssertNumber(Math.abs(result[3]), { gte: 1e-10 }, { message: '3D transformation w component near zero' });
|
|
431
|
+
// Convert back from homogeneous coordinates by dividing by w
|
|
432
|
+
return [result[0] / result[3], result[1] / result[3], result[2] / result[3]];
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Transforms a 3D direction vector using a 3x3 matrix, ignoring translation components.
|
|
436
|
+
* Designed for direction vectors (normals, velocities) where translation should not apply.
|
|
437
|
+
*
|
|
438
|
+
* @param matrix - A 3x3 transformation matrix (rotation and/or scale only).
|
|
439
|
+
* @param direction - The 3D direction vector to transform.
|
|
440
|
+
* @returns {TVector3} The transformed direction vector.
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* const rotationMatrix = Matrix_Transformation_Rotation3D_Yaw(Math.PI / 4);
|
|
445
|
+
* const normal = [0, 0, 1];
|
|
446
|
+
* const rotatedNormal = Matrix_Transformation_Direction3D(rotationMatrix, normal);
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
export function MatrixDirection3D(direction, matrix) {
|
|
450
|
+
AssertMatrix3(matrix);
|
|
451
|
+
AssertVector3(direction);
|
|
452
|
+
// Direct 3x3 matrix multiplication (no homogeneous coordinates needed)
|
|
453
|
+
return [
|
|
454
|
+
(matrix[0][0] * direction[0]) + (matrix[0][1] * direction[1]) + (matrix[0][2] * direction[2]),
|
|
455
|
+
(matrix[1][0] * direction[0]) + (matrix[1][1] * direction[1]) + (matrix[1][2] * direction[2]),
|
|
456
|
+
(matrix[2][0] * direction[0]) + (matrix[2][1] * direction[1]) + (matrix[2][2] * direction[2]),
|
|
457
|
+
];
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Creates a view matrix for positioning and orienting a 3D camera.
|
|
461
|
+
* Transforms world coordinates to camera coordinates using the "look-at" approach.
|
|
462
|
+
*
|
|
463
|
+
* @param eye - Camera position in world coordinates.
|
|
464
|
+
* @param target - Point the camera is looking at.
|
|
465
|
+
* @param up - Up direction vector (usually [0, 1, 0]).
|
|
466
|
+
* @returns {IMatrix4} A 4x4 view transformation matrix.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* const viewMatrix = Matrix_Transformation_View(
|
|
471
|
+
* [10, 5, 10], // Camera position
|
|
472
|
+
* [0, 0, 0], // Looking at origin
|
|
473
|
+
* [0, 1, 0] // Y-axis is up
|
|
474
|
+
* );
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
export function MatrixView(eye, target, up) {
|
|
478
|
+
AssertVector3(eye);
|
|
479
|
+
AssertVector3(target);
|
|
480
|
+
AssertVector3(up);
|
|
481
|
+
// Calculate the forward vector (direction from eye to target)
|
|
482
|
+
const forward = VectorSubtract(target, eye);
|
|
483
|
+
const normalizedForward = VectorNormalize(forward);
|
|
484
|
+
// Calculate orthogonal right and up vectors using cross products
|
|
485
|
+
const normalizedUp = VectorNormalize(up);
|
|
486
|
+
const right = Vector3Cross(normalizedForward, normalizedUp);
|
|
487
|
+
const normalizedRight = VectorNormalize(right);
|
|
488
|
+
// Recalculate up vector to ensure perfect orthogonality
|
|
489
|
+
const orthogonalUp = Vector3Cross(normalizedRight, normalizedForward);
|
|
490
|
+
// Create rotation part of view matrix (camera orientation)
|
|
491
|
+
// Note: forward is negated because we want to look down negative Z in view space
|
|
492
|
+
const rotation = [
|
|
493
|
+
[normalizedRight[0], normalizedRight[1], normalizedRight[2], 0],
|
|
494
|
+
[orthogonalUp[0], orthogonalUp[1], orthogonalUp[2], 0],
|
|
495
|
+
[-normalizedForward[0], -normalizedForward[1], -normalizedForward[2], 0],
|
|
496
|
+
[0, 0, 0, 1],
|
|
497
|
+
];
|
|
498
|
+
// Create translation part (move camera to origin)
|
|
499
|
+
const translation = MatrixTranslation3D(-eye[0], -eye[1], -eye[2]);
|
|
500
|
+
// Combine transformations: View = Rotation * Translation
|
|
501
|
+
const result = MatrixMultiply(rotation, translation);
|
|
502
|
+
AssertMatrix4(result);
|
|
503
|
+
return result;
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Creates a perspective projection matrix for 3D rendering.
|
|
507
|
+
* Transforms 3D view coordinates to normalized device coordinates with perspective effect.
|
|
508
|
+
*
|
|
509
|
+
* @param fovY - Vertical field of view angle in radians.
|
|
510
|
+
* @param aspect - Aspect ratio of the viewport (width/height).
|
|
511
|
+
* @param near - Distance to near clipping plane (must be positive).
|
|
512
|
+
* @param far - Distance to far clipping plane (must be > near).
|
|
513
|
+
* @returns {IMatrix4} A 4x4 perspective projection matrix.
|
|
514
|
+
*
|
|
515
|
+
* @throws {Error} If parameters are invalid.
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* ```typescript
|
|
519
|
+
* const perspectiveMatrix = Matrix_Transformation_Perspective(
|
|
520
|
+
* Math.PI / 4, // 45-degree field of view
|
|
521
|
+
* 16 / 9, // Widescreen aspect ratio
|
|
522
|
+
* 0.1, // Near plane
|
|
523
|
+
* 1000 // Far plane
|
|
524
|
+
* );
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
export function MatrixPerspective(fovY, aspect, near, far) {
|
|
528
|
+
AssertNumber(near, { gt: 0 }, { message: 'Near clipping plane must be greater than 0' });
|
|
529
|
+
AssertNumber(far, { gt: 0 }, { message: 'Far clipping plane must be greater than 0' });
|
|
530
|
+
AssertNumber(near, { lt: far }, { message: 'Near clipping plane must be less than far clipping plane' });
|
|
531
|
+
AssertNumber(aspect, { gt: 0 }, { message: 'Aspect ratio must be greater than 0' });
|
|
532
|
+
const tanHalfFovY = Math.tan(fovY / 2);
|
|
533
|
+
const result = MatrixCreate(4, 4);
|
|
534
|
+
AssertMatrix4(result);
|
|
535
|
+
// Initialize perspective projection matrix
|
|
536
|
+
// The matrix maps view space to clip space with perspective division
|
|
537
|
+
if (result[0] && result[1] && result[2] && result[3]) {
|
|
538
|
+
result[0][0] = 1 / (aspect * tanHalfFovY); // X scaling based on aspect ratio and FOV
|
|
539
|
+
result[1][1] = 1 / tanHalfFovY; // Y scaling based on FOV
|
|
540
|
+
result[2][2] = -(far + near) / (far - near); // Z mapping for depth buffer
|
|
541
|
+
result[2][3] = -(2 * far * near) / (far - near); // Z translation for depth buffer
|
|
542
|
+
result[3][2] = -1; // Perspective division trigger
|
|
543
|
+
result[3][3] = 0; // Clear diagonal element
|
|
544
|
+
}
|
|
545
|
+
return result;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Creates an orthographic projection matrix for 3D rendering.
|
|
549
|
+
* Maps a rectangular box to the unit cube [-1, 1]³ without perspective distortion.
|
|
550
|
+
*
|
|
551
|
+
* @param left - Left boundary of the orthographic volume.
|
|
552
|
+
* @param right - Right boundary of the orthographic volume.
|
|
553
|
+
* @param bottom - Bottom boundary of the orthographic volume.
|
|
554
|
+
* @param top - Top boundary of the orthographic volume.
|
|
555
|
+
* @param near - Near clipping plane distance.
|
|
556
|
+
* @param far - Far clipping plane distance.
|
|
557
|
+
* @returns {IMatrix4} A 4x4 orthographic projection matrix.
|
|
558
|
+
*
|
|
559
|
+
* @throws {Error} If any opposing boundaries are equal.
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```typescript
|
|
563
|
+
* const orthoMatrix = Matrix_Transformation_Orthographic(
|
|
564
|
+
* -10, 10, // Left/Right: 20 units wide
|
|
565
|
+
* -7.5, 7.5, // Bottom/Top: 15 units tall
|
|
566
|
+
* -100, 100 // Near/Far: 200 units deep
|
|
567
|
+
* );
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
export function MatrixOrthographic(left, right, bottom, top, near, far) {
|
|
571
|
+
AssertNotEquals(left, right, { message: 'Left and right bounds must not be equal' });
|
|
572
|
+
AssertNotEquals(bottom, top, { message: 'Bottom and top bounds must not be equal' });
|
|
573
|
+
AssertNotEquals(near, far, { message: 'Near and far clipping planes must not be equal' });
|
|
574
|
+
const result = MatrixCreate(4, 4);
|
|
575
|
+
AssertMatrix4(result);
|
|
576
|
+
// Initialize orthographic projection matrix
|
|
577
|
+
// The matrix performs scaling and translation to map the orthographic volume to [-1, 1]³
|
|
578
|
+
if (result[0] && result[1] && result[2] && result[3]) {
|
|
579
|
+
// Scale factors to normalize each axis to [-1, 1] range
|
|
580
|
+
result[0][0] = 2 / (right - left); // X scaling
|
|
581
|
+
result[1][1] = 2 / (top - bottom); // Y scaling
|
|
582
|
+
result[2][2] = -2 / (far - near); // Z scaling (negated for right-handed system)
|
|
583
|
+
// Translation to center the projection volume at origin
|
|
584
|
+
result[0][3] = -(right + left) / (right - left); // X translation
|
|
585
|
+
result[1][3] = -(top + bottom) / (top - bottom); // Y translation
|
|
586
|
+
result[2][3] = -(far + near) / (far - near); // Z translation
|
|
587
|
+
// Homogeneous coordinate (no perspective division needed)
|
|
588
|
+
result[3][3] = 1;
|
|
589
|
+
}
|
|
590
|
+
return result;
|
|
591
|
+
}
|
|
592
|
+
//# sourceMappingURL=transformations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformations.js","sourceRoot":"","sources":["../../src/matrices/transformations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnF,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAExC,+EAA+E;AAC/E,8BAA8B;AAC9B,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC/C,YAAY,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC,CAAC;IAExF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IA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