aether-physics 0.0.0-stage → 0.1.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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Fixed-timestep simulation clock with an accumulator.
3
+ *
4
+ * @see https://gafferongames.com/post/fix_your_timestep/
5
+ */
6
+ export interface FrameResult {
7
+ /** Number of steps run. */
8
+ steps: number;
9
+ /** Interpolation factor in [0, 1) between the previous and current state. 1 while paused. */
10
+ alpha: number;
11
+ /** Whether accumulated time was discarded after reaching `maxStepsPerFrame`. */
12
+ droppedTime: boolean;
13
+ }
14
+ export declare class FixedStepLoop {
15
+ #private;
16
+ /** Simulation speed relative to real time. */
17
+ timeScale: number;
18
+ paused: boolean;
19
+ maxStepsPerFrame: number;
20
+ constructor(hz?: number);
21
+ /** Seconds per physics step. */
22
+ get dt(): number;
23
+ get hz(): number;
24
+ set hz(value: number);
25
+ /** Simulated time in seconds since the last reset. */
26
+ get simTime(): number;
27
+ /** Queues one step for the next `advance` call, regardless of `paused`. */
28
+ stepOnce(): void;
29
+ reset(): void;
30
+ /**
31
+ * Advances the clock and runs `step` once per elapsed timestep.
32
+ *
33
+ * @param nowMs - Current timestamp in milliseconds.
34
+ * @param step - Called with the fixed timestep in seconds.
35
+ */
36
+ advance(nowMs: number, step: (dt: number) => void): FrameResult;
37
+ }
@@ -0,0 +1,4 @@
1
+ export { FixedStepLoop } from './engine/loop.js';
2
+ export type { FrameResult } from './engine/loop.js';
3
+ export { EPSILON, approxEqual, clamp, Vec3, Mat3x3, Mat3x4, Quaternion } from './math/index.js';
4
+ export type { QuatLike, Vec3Like } from './math/index.js';
@@ -0,0 +1,270 @@
1
+ import type { QuatLike, Vec3Like } from "../types.js";
2
+ import { Vec3 } from "./vec3.js";
3
+ /**
4
+ * A 3×3 matrix for linear transforms (rotation, scale, shear, reflection) and other 3×3
5
+ * quantities such as inertia tensors.
6
+ *
7
+ * Conventions:
8
+ *
9
+ * - **Row-major storage.** Element (row `r`, column `c`) is `elements[r * 3 + c]`, and the
10
+ * constructor takes arguments in reading order, so source code looks like the matrix on paper.
11
+ * - **Column vectors.** Vectors are transformed as `M · v`. In a product `A · B`, `B` is
12
+ * applied first, then `A`.
13
+ * - **Columns are basis axes.** For a rotation from a child frame into its parent, column `i` is
14
+ * the child's `i`-th axis expressed in the parent frame. For a rigid body's orientation the
15
+ * columns are the body's X, Y and Z axes in world space.
16
+ * - **Right-hand rule.** A positive angle turns counter-clockwise when looking from the tip of
17
+ * the rotation axis back toward the origin.
18
+ * - **Mutation and output.** Methods that modify this matrix do it in place and return `this`
19
+ * for chaining. Methods that produce a vector write to an optional `out`, allocating one if
20
+ * it is omitted. Inputs may alias `this` or `out`.
21
+ * - **`Orthonormal` variants.** Methods with `Orthonormal` in the name, and
22
+ * `transformInverseVec3`, assume a pure rotation (or reflection) and use the transpose as the
23
+ * inverse. Their results are undefined if the matrix contains scale or shear.
24
+ *
25
+ * The layout differs from Three.js: `THREE.Matrix3.elements` is column-major. Do not copy
26
+ * `elements` arrays between the two directly.
27
+ */
28
+ export declare class Mat3x3 {
29
+ /** The nine elements in row-major order: `[m00, m01, m02, m10, m11, m12, m20, m21, m22]`. */
30
+ readonly elements: Float64Array;
31
+ /**
32
+ * Creates a matrix from its elements in row-major (reading) order. Defaults to the identity.
33
+ */
34
+ constructor(m00?: number, m01?: number, m02?: number, m10?: number, m11?: number, m12?: number, m20?: number, m21?: number, m22?: number);
35
+ /**
36
+ * Sets this matrix to the identity, which leaves every vector unchanged.
37
+ */
38
+ identity(): this;
39
+ /**
40
+ * Copies the elements of `m` into this matrix.
41
+ *
42
+ * @param m Source matrix.
43
+ */
44
+ copy(m: Mat3x3): this;
45
+ /**
46
+ * Returns a new matrix with the same elements as this one.
47
+ */
48
+ clone(): Mat3x3;
49
+ /**
50
+ * Sets this matrix to a diagonal matrix with `a`, `b` and `c` on the diagonal and zeros
51
+ * elsewhere.
52
+ *
53
+ * Overwrites the current contents. Used for axis-aligned scaling and for the inertia tensor
54
+ * of a shape aligned with its principal axes.
55
+ *
56
+ * @param a Element (0, 0).
57
+ * @param b Element (1, 1).
58
+ * @param c Element (2, 2).
59
+ */
60
+ setDiagonal(a: number, b: number, c: number): this;
61
+ /**
62
+ * Sets this matrix to a scaling matrix that stretches each axis by its own factor.
63
+ *
64
+ * Pass a single factor for uniform scaling: `setScale(2)` scales every axis by 2.
65
+ * Overwrites the current contents rather than scaling them.
66
+ *
67
+ * @param x Scale factor along the X axis.
68
+ * @param y Scale factor along the Y axis. Defaults to `x`.
69
+ * @param z Scale factor along the Z axis. Defaults to `x`.
70
+ */
71
+ setScale(x: number, y?: number, z?: number): this;
72
+ /**
73
+ * Sets this matrix to a scale by factor `k` along an arbitrary `axis` through the origin.
74
+ *
75
+ * Components parallel to `axis` are multiplied by `k`; components perpendicular to it
76
+ * are left unchanged. The result is `I + (k - 1) · axis · axisᵀ`, which is symmetric.
77
+ * With a cardinal axis this matches `setScale` with `k` on that axis and 1 elsewhere.
78
+ * `k = -1` reflects across the plane perpendicular to `axis`, and `k = 0` projects onto it.
79
+ *
80
+ * `axis` must be a unit vector. It is not normalized here, to keep this cheap on hot
81
+ * paths. A non-unit axis scales by `1 + (k - 1)·|axis|²` instead of `k`. Call
82
+ * `normalize()` on the axis first if it is not already unit length.
83
+ *
84
+ * @param axis Unit-length scaling axis. Its sign does not matter.
85
+ * @param k Scale factor along `axis`.
86
+ */
87
+ setScaleAlongAxis(axis: Vec3Like, k: number): this;
88
+ /**
89
+ * Sets this matrix to a reflection across the plane perpendicular to `normal`.
90
+ *
91
+ * Components along `normal` are negated; components in the plane are left unchanged.
92
+ * The result is `I - 2 · normal · normalᵀ`: symmetric, orthogonal, its own inverse, with
93
+ * determinant -1. Equivalent to `setScaleAlongAxis(normal, -1)`. With a cardinal axis
94
+ * this negates that one coordinate, e.g. `(1, 0, 0)` mirrors across the YZ plane.
95
+ *
96
+ * `normal` must be a unit vector. It is not normalized here, to keep this cheap on hot
97
+ * paths. A non-unit normal does not produce a reflection. Call `normalize()` on it first
98
+ * if it is not already unit length.
99
+ *
100
+ * @param normal Unit-length normal of the mirror plane. Its sign does not matter.
101
+ */
102
+ setReflection(normal: Vec3Like): this;
103
+ /**
104
+ * Sets this matrix to a shear: each coordinate is offset in proportion to the
105
+ * others.
106
+ *
107
+ * Factor `ab` is how far coordinate `a` moves per unit of coordinate `b`, and is stored
108
+ * in the matching off-diagonal element (`xy` → `m01`):
109
+ *
110
+ * ```
111
+ * x' = x + xy·y + xz·z
112
+ * y' = y + yx·x + yz·z
113
+ * z' = z + zx·x + zy·y
114
+ * ```
115
+ *
116
+ * Omitted factors default to 0, so `setShear(2)` shears X by Y only, and no arguments
117
+ * gives the identity. Shearing a coordinate by one or both of the others is volume
118
+ * preserving (determinant 1). Combining shears in both directions between a pair, such as
119
+ * `xy` with `yx`, is not: the determinant is
120
+ * `1 - xy·yx - xz·zx - yz·zy + xy·yz·zx + xz·zy·yx`.
121
+ *
122
+ * @param xy Shift of X per unit of Y.
123
+ * @param xz Shift of X per unit of Z.
124
+ * @param yx Shift of Y per unit of X.
125
+ * @param yz Shift of Y per unit of Z.
126
+ * @param zx Shift of Z per unit of X.
127
+ * @param zy Shift of Z per unit of Y.
128
+ */
129
+ setShear(xy?: number, xz?: number, yx?: number, yz?: number, zx?: number, zy?: number): this;
130
+ /**
131
+ * Multiplies every element of this matrix by the scalar `k`, in place.
132
+ *
133
+ * Unlike `setScale`, this keeps the current contents and scales them.
134
+ *
135
+ * @param k Scalar to multiply by.
136
+ */
137
+ multiplyScalar(k: number): this;
138
+ /**
139
+ * Post-multiplies this matrix by `m`: `this = this · m`.
140
+ *
141
+ * Under the column-vector convention, the result applies `m` first, then this.
142
+ *
143
+ * @param m Right-hand operand. May be `this`.
144
+ */
145
+ multiply(m: Mat3x3): this;
146
+ /**
147
+ * Pre-multiplies this matrix by `m`: `this = m · this`.
148
+ *
149
+ * Under the column-vector convention, the result applies this first, then `m`.
150
+ *
151
+ * @param m Left-hand operand. May be `this`.
152
+ */
153
+ premultiply(m: Mat3x3): this;
154
+ /**
155
+ * Sets this matrix to `a · b`.
156
+ *
157
+ * @param a Left-hand operand. May be `this`.
158
+ * @param b Right-hand operand. May be `this`.
159
+ */
160
+ multiplyMatrices(a: Mat3x3, b: Mat3x3): this;
161
+ /**
162
+ * Transposes this matrix in place, swapping rows and columns: element (r, c) becomes
163
+ * element (c, r).
164
+ *
165
+ * For an orthonormal matrix the transpose is the inverse.
166
+ */
167
+ transpose(): this;
168
+ /**
169
+ * Returns the determinant: the factor by which this matrix scales volumes.
170
+ *
171
+ * Zero means the matrix is singular and has no inverse. A negative value means it includes
172
+ * a reflection. Rotations have determinant 1.
173
+ */
174
+ determinant(): number;
175
+ /**
176
+ * Sets this matrix to the inverse of `m`, or to zero if `m` is singular.
177
+ *
178
+ * @param m Matrix to invert. May be `this`.
179
+ */
180
+ setInverse(m: Mat3x3): this;
181
+ /**
182
+ * Inverts this matrix in place, or sets it to zero if it is singular.
183
+ */
184
+ inverse(): this;
185
+ /**
186
+ * Sets this matrix to the inverse of `m`, assuming `m` is orthonormal.
187
+ *
188
+ * Computes `mᵀ`, which equals `m⁻¹` for any orthonormal matrix: rotations, reflections
189
+ * and their products. The result is undefined if `m` contains scale or shear.
190
+ *
191
+ * @param m Matrix to invert. May be `this`.
192
+ */
193
+ setInverseOrthonormal(m: Mat3x3): this;
194
+ /**
195
+ * Inverts this matrix in place, assuming it is orthonormal.
196
+ */
197
+ inverseOrthonormal(): this;
198
+ /**
199
+ * Computes `this · v` and writes it to `out`.
200
+ *
201
+ * @param v Vector to transform.
202
+ * @param out Destination. Allocated if omitted. May be `v`.
203
+ */
204
+ transformVec3(v: Vec3Like, out?: Vec3): Vec3;
205
+ /**
206
+ * Computes `thisᵀ · v`, the inverse transform of `v`, without building the inverse.
207
+ *
208
+ * Assumes this matrix is orthonormal.
209
+ *
210
+ * @param v Vector to transform.
211
+ * @param out Destination. Allocated if omitted. May be `v`.
212
+ */
213
+ transformInverseVec3(v: Vec3Like, out?: Vec3): Vec3;
214
+ /**
215
+ * Sets this matrix to a rotation of `theta` radians about the X axis.
216
+ *
217
+ * Positive angles turn counter-clockwise when looking from +X back toward the origin,
218
+ * so a quarter turn carries the Y axis onto the Z axis.
219
+ *
220
+ * @param theta Angle in radians.
221
+ */
222
+ setRotationX(theta: number): this;
223
+ /**
224
+ * Sets this matrix to a rotation of `theta` radians about the Y axis.
225
+ *
226
+ * Positive angles turn counter-clockwise when looking from +Y back toward the origin,
227
+ * so a quarter turn carries the Z axis onto the X axis.
228
+ *
229
+ * @param theta Angle in radians.
230
+ */
231
+ setRotationY(theta: number): this;
232
+ /**
233
+ * Sets this matrix to a rotation of `theta` radians about the Z axis.
234
+ *
235
+ * Positive angles turn counter-clockwise when looking from +Z back toward the origin,
236
+ * so a quarter turn carries the X axis onto the Y axis.
237
+ *
238
+ * @param theta Angle in radians.
239
+ */
240
+ setRotationZ(theta: number): this;
241
+ /**
242
+ * Sets this matrix to a rotation of `angle` radians about an arbitrary `axis`.
243
+ *
244
+ * Positive angles turn counter-clockwise when looking from the tip of `axis` back toward
245
+ * the origin. With a cardinal axis this matches `setRotationX`, `setRotationY` or
246
+ * `setRotationZ`.
247
+ *
248
+ * `axis` must be a unit vector. It is not normalized here, to keep this cheap on hot
249
+ * paths. A non-unit axis generally produces a matrix that is not a rotation: it
250
+ * distorts lengths and angles. Call `normalize()` on the axis first if it is not
251
+ * already unit length.
252
+ *
253
+ * @param axis Unit-length rotation axis.
254
+ * @param angle Angle in radians.
255
+ */
256
+ setFromAxisAngle(axis: Vec3Like, angle: number): this;
257
+ /**
258
+ * Sets this matrix to the rotation represented by the quaternion `q`, so that
259
+ * `transformVec3(v)` equals `q.rotateVec3(v)`.
260
+ *
261
+ * The columns are the images of the X, Y and Z axes under `q`. `q` and `−q` give the same
262
+ * matrix.
263
+ *
264
+ * `q` must be unit length. It is not normalized here, to keep this cheap on hot paths. A
265
+ * non-unit `q` generally produces a matrix that is not a rotation.
266
+ *
267
+ * @param q Unit quaternion.
268
+ */
269
+ setFromQuaternion(q: QuatLike): this;
270
+ }
@@ -0,0 +1,338 @@
1
+ import type { QuatLike, Vec3Like } from "../types.js";
2
+ import { Mat3x3 } from "./mat3x3.js";
3
+ import { Vec3 } from "./vec3.js";
4
+ /**
5
+ * A 3×4 affine transform: a 3×3 linear part `A` with a translation column `t`.
6
+ *
7
+ * Behaves as a 4×4 matrix whose implicit bottom row is `[0, 0, 0, 1]`, mapping a point
8
+ * `p ↦ A·p + t`: the linear part is applied first, then the translation. Typically it holds a
9
+ * rigid transform from a child frame into its parent, such as a body's local-to-world transform.
10
+ *
11
+ * Conventions:
12
+ *
13
+ * - **Row-major storage.** Element (row `r`, column `c`) is `elements[r * 4 + c]`, and the
14
+ * constructor takes arguments in reading order. The translation is at indices 3, 7 and 11.
15
+ * - **Column vectors.** Vectors are transformed as `M · v`. In a product `A · B`, `B` is
16
+ * applied first, then `A`.
17
+ * - **Columns are the child frame.** For a rigid transform, columns 0–2 are the child's X, Y and
18
+ * Z axes in the parent frame, and column 3 is the child's origin in the parent frame.
19
+ * - **Points and directions.** `transformPoint` applies the translation; `transformDirection`
20
+ * applies only the linear part. Use directions for normals, velocities and axes.
21
+ * - **Right-hand rule.** A positive angle turns counter-clockwise when looking from the tip of
22
+ * the rotation axis back toward the origin.
23
+ * - **Mutation and output.** Methods that modify this transform do it in place and return
24
+ * `this` for chaining. Methods that produce a vector write to an optional `out`, allocating
25
+ * one if it is omitted. Inputs may alias `this` or `out`.
26
+ * - **`Orthonormal` and `transformInverse*` methods.** These assume the linear part is a pure
27
+ * rotation (or reflection) and use its transpose as the inverse. Their results are undefined
28
+ * if the linear part contains scale or shear.
29
+ *
30
+ * Three.js has no 3×4 type, and `THREE.Matrix4.elements` is column-major. Build Three.js
31
+ * transforms from a position and a quaternion instead of copying `elements`.
32
+ */
33
+ export declare class Mat3x4 {
34
+ /**
35
+ * The twelve elements in row-major order:
36
+ * `[m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23]`.
37
+ */
38
+ readonly elements: Float64Array;
39
+ /**
40
+ * Creates a transform from its elements in row-major (reading) order. Defaults to the
41
+ * identity.
42
+ */
43
+ constructor(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number);
44
+ /**
45
+ * Sets this transform to the identity: no rotation, scale or translation.
46
+ */
47
+ identity(): this;
48
+ /**
49
+ * Copies the elements of `m` into this transform.
50
+ *
51
+ * @param m Source transform.
52
+ */
53
+ copy(m: Mat3x4): this;
54
+ /**
55
+ * Returns a new transform with the same elements as this one.
56
+ */
57
+ clone(): Mat3x4;
58
+ /**
59
+ * Sets this transform from a 3×3 linear part `m` and a translation `t`: `p ↦ m·p + t`.
60
+ *
61
+ * @param m Linear part.
62
+ * @param t Translation. Defaults to zero.
63
+ */
64
+ setFromMat3x3(m: Mat3x3, t?: Vec3Like): this;
65
+ /**
66
+ * Copies the 3×3 linear part of this transform into `out`, dropping the translation.
67
+ *
68
+ * @param out Destination. Allocated if omitted.
69
+ */
70
+ getMat3x3(out?: Mat3x3): Mat3x3;
71
+ /**
72
+ * Sets this transform to a pure translation by `(x, y, z)`.
73
+ *
74
+ * Overwrites the current contents: the linear part becomes the identity.
75
+ *
76
+ * @param x Translation along the X axis.
77
+ * @param y Translation along the Y axis.
78
+ * @param z Translation along the Z axis.
79
+ */
80
+ setTranslation(x: number, y: number, z: number): this;
81
+ /**
82
+ * Copies the translation column of this transform into `out`.
83
+ *
84
+ * This is where the transform sends the origin.
85
+ *
86
+ * @param out Destination. Allocated if omitted.
87
+ */
88
+ getTranslation(out?: Vec3): Vec3;
89
+ /**
90
+ * Copies column `index` of this transform into `out`.
91
+ *
92
+ * For a rigid transform, columns 0–2 are the child frame's X, Y and Z axes in the parent
93
+ * frame, and column 3 is its origin, the same as `getTranslation`.
94
+ *
95
+ * @param index Column to read: 0, 1 or 2 for an axis, 3 for the translation.
96
+ * @param out Destination. Allocated if omitted.
97
+ */
98
+ getAxis(index: 0 | 1 | 2 | 3, out?: Vec3): Vec3;
99
+ /**
100
+ * Sets this transform to the rigid transform that rotates by `q` and then translates by
101
+ * `p`: `x ↦ q·x·q* + p`.
102
+ *
103
+ * For a rigid body, `p` is its position and `q` its orientation, giving the body-to-world
104
+ * transform. The linear part matches `Mat3x3.setFromQuaternion(q)`.
105
+ *
106
+ * `q` must be unit length. It is not normalized here, to keep this cheap on hot paths.
107
+ *
108
+ * @param p Translation, the child frame's origin in the parent frame.
109
+ * @param q Unit quaternion for the rotation.
110
+ */
111
+ setFromPositionQuaternion(p: Vec3Like, q: QuatLike): this;
112
+ /**
113
+ * Sets this transform to a scaling about the origin that stretches each axis by its own
114
+ * factor.
115
+ *
116
+ * Pass a single factor for uniform scaling: `setScale(2)` scales every axis by 2.
117
+ * Overwrites the current contents rather than scaling them, and clears the translation.
118
+ *
119
+ * @param x Scale factor along the X axis.
120
+ * @param y Scale factor along the Y axis. Defaults to `x`.
121
+ * @param z Scale factor along the Z axis. Defaults to `x`.
122
+ */
123
+ setScale(x: number, y?: number, z?: number): this;
124
+ /**
125
+ * Sets this transform to a scale by factor `k` along an arbitrary `axis` through the origin.
126
+ *
127
+ * Components parallel to `axis` are multiplied by `k`; components perpendicular to it
128
+ * are left unchanged. The linear part is `I + (k - 1) · axis · axisᵀ`, which is symmetric.
129
+ * With a cardinal axis this matches `setScale` with `k` on that axis and 1 elsewhere.
130
+ * `k = -1` reflects across the plane perpendicular to `axis`, and `k = 0` projects onto it.
131
+ *
132
+ * `axis` must be a unit vector. It is not normalized here, to keep this cheap on hot
133
+ * paths. A non-unit axis scales by `1 + (k - 1)·|axis|²` instead of `k`. Call
134
+ * `normalize()` on the axis first if it is not already unit length.
135
+ *
136
+ * Clears the translation.
137
+ *
138
+ * @param axis Unit-length scaling axis. Its sign does not matter.
139
+ * @param k Scale factor along `axis`.
140
+ */
141
+ setScaleAlongAxis(axis: Vec3Like, k: number): this;
142
+ /**
143
+ * Sets this transform to a reflection across the plane through the origin perpendicular
144
+ * to `normal`.
145
+ *
146
+ * Components along `normal` are negated; components in the plane are left unchanged.
147
+ * The result is `I - 2 · normal · normalᵀ`: symmetric, orthogonal, its own inverse, with
148
+ * determinant -1. Equivalent to `setScaleAlongAxis(normal, -1)`. With a cardinal axis
149
+ * this negates that one coordinate, e.g. `(1, 0, 0)` mirrors across the YZ plane.
150
+ *
151
+ * `normal` must be a unit vector. It is not normalized here, to keep this cheap on hot
152
+ * paths. A non-unit normal does not produce a reflection. Call `normalize()` on it first
153
+ * if it is not already unit length.
154
+ *
155
+ * Clears the translation.
156
+ *
157
+ * @param normal Unit-length normal of the mirror plane. Its sign does not matter.
158
+ */
159
+ setReflection(normal: Vec3Like): this;
160
+ /**
161
+ * Sets this transform to a shear about the origin: each coordinate is offset in proportion to the
162
+ * others.
163
+ *
164
+ * Factor `ab` is how far coordinate `a` moves per unit of coordinate `b`, and is stored
165
+ * in the matching off-diagonal element (`xy` → `m01`):
166
+ *
167
+ * ```
168
+ * x' = x + xy·y + xz·z
169
+ * y' = y + yx·x + yz·z
170
+ * z' = z + zx·x + zy·y
171
+ * ```
172
+ *
173
+ * Omitted factors default to 0, so `setShear(2)` shears X by Y only, and no arguments
174
+ * gives the identity. Shearing a coordinate by one or both of the others is volume
175
+ * preserving (determinant 1). Combining shears in both directions between a pair, such as
176
+ * `xy` with `yx`, is not: the determinant is
177
+ * `1 - xy·yx - xz·zx - yz·zy + xy·yz·zx + xz·zy·yx`.
178
+ *
179
+ * Clears the translation.
180
+ *
181
+ * @param xy Shift of X per unit of Y.
182
+ * @param xz Shift of X per unit of Z.
183
+ * @param yx Shift of Y per unit of X.
184
+ * @param yz Shift of Y per unit of Z.
185
+ * @param zx Shift of Z per unit of X.
186
+ * @param zy Shift of Z per unit of Y.
187
+ */
188
+ setShear(xy?: number, xz?: number, yx?: number, yz?: number, zx?: number, zy?: number): this;
189
+ /**
190
+ * Multiplies every element of this transform by the scalar `k`, in place, including
191
+ * the translation.
192
+ *
193
+ * Unlike `setScale`, this keeps the current contents and scales them. Equivalent to
194
+ * scaling the result of every `transformPoint` by `k`.
195
+ *
196
+ * @param k Scalar to multiply by.
197
+ */
198
+ multiplyScalar(k: number): this;
199
+ /**
200
+ * Post-multiplies this transform by `m`: `this = this · m`.
201
+ *
202
+ * Under the column-vector convention, the result applies `m` first, then this.
203
+ *
204
+ * @param m Right-hand operand. May be `this`.
205
+ */
206
+ multiply(m: Mat3x4): this;
207
+ /**
208
+ * Pre-multiplies this transform by `m`: `this = m · this`.
209
+ *
210
+ * Under the column-vector convention, the result applies this first, then `m`.
211
+ *
212
+ * @param m Left-hand operand. May be `this`.
213
+ */
214
+ premultiply(m: Mat3x4): this;
215
+ /**
216
+ * Sets this transform to `a · b`.
217
+ *
218
+ * @param a Left-hand operand. May be `this`.
219
+ * @param b Right-hand operand. May be `this`.
220
+ */
221
+ multiplyMatrices(a: Mat3x4, b: Mat3x4): this;
222
+ /**
223
+ * Transposes the 3×3 linear part in place. The translation column is unchanged.
224
+ *
225
+ * The full 3×4 transpose is 4×3 and has no in-place equivalent.
226
+ */
227
+ transposeLinear(): this;
228
+ /**
229
+ * Determinant of the 3×3 linear part, which equals that of the full 4×4 transform.
230
+ */
231
+ determinant(): number;
232
+ /**
233
+ * Sets this transform to the inverse of `m`, or to zero if `m` is singular.
234
+ *
235
+ * @param m Transform to invert. May be `this`.
236
+ */
237
+ setInverse(m: Mat3x4): this;
238
+ /**
239
+ * Inverts this transform in place, or sets it to zero if it is singular.
240
+ */
241
+ inverse(): this;
242
+ /**
243
+ * Sets this transform to the inverse of `r`, assuming its 3×3 part is orthonormal.
244
+ *
245
+ * Computes `[Rᵀ | −Rᵀt]`. The result is undefined if `r` contains scale or shear.
246
+ *
247
+ * @param r Transform to invert. May be `this`.
248
+ */
249
+ setInverseOrthonormal(r: Mat3x4): this;
250
+ /**
251
+ * Inverts this transform in place, assuming its 3×3 part is orthonormal.
252
+ */
253
+ inverseOrthonormal(): this;
254
+ /**
255
+ * Transforms a point: `R·p + t`.
256
+ *
257
+ * @param p Point to transform.
258
+ * @param out Destination. Allocated if omitted. May be `p`.
259
+ */
260
+ transformPoint(p: Vec3Like, out?: Vec3): Vec3;
261
+ /**
262
+ * Transforms a direction by the 3×3 part only: `R·d`. Translation is ignored.
263
+ *
264
+ * @param d Direction to transform.
265
+ * @param out Destination. Allocated if omitted. May be `d`.
266
+ */
267
+ transformDirection(d: Vec3Like, out?: Vec3): Vec3;
268
+ /**
269
+ * Applies the inverse transform to a point, `Rᵀ·(p − t)`, without building the inverse.
270
+ *
271
+ * Assumes the 3×3 part is orthonormal.
272
+ *
273
+ * @param p Point to transform.
274
+ * @param out Destination. Allocated if omitted. May be `p`.
275
+ */
276
+ transformInversePoint(p: Vec3Like, out?: Vec3): Vec3;
277
+ /**
278
+ * Applies the inverse of the 3×3 part to a direction, `Rᵀ·d`, without building the inverse.
279
+ *
280
+ * Assumes the 3×3 part is orthonormal.
281
+ *
282
+ * @param d Direction to transform.
283
+ * @param out Destination. Allocated if omitted. May be `d`.
284
+ */
285
+ transformInverseDirection(d: Vec3Like, out?: Vec3): Vec3;
286
+ /**
287
+ * Sets this transform to a rotation of `theta` radians about the X axis.
288
+ *
289
+ * Positive angles turn counter-clockwise when looking from +X back toward the origin,
290
+ * so a quarter turn carries the Y axis onto the Z axis.
291
+ *
292
+ * Clears the translation.
293
+ *
294
+ * @param theta Angle in radians.
295
+ */
296
+ setRotationX(theta: number): this;
297
+ /**
298
+ * Sets this transform to a rotation of `theta` radians about the Y axis.
299
+ *
300
+ * Positive angles turn counter-clockwise when looking from +Y back toward the origin,
301
+ * so a quarter turn carries the Z axis onto the X axis.
302
+ *
303
+ * Clears the translation.
304
+ *
305
+ * @param theta Angle in radians.
306
+ */
307
+ setRotationY(theta: number): this;
308
+ /**
309
+ * Sets this transform to a rotation of `theta` radians about the Z axis.
310
+ *
311
+ * Positive angles turn counter-clockwise when looking from +Z back toward the origin,
312
+ * so a quarter turn carries the X axis onto the Y axis.
313
+ *
314
+ * Clears the translation.
315
+ *
316
+ * @param theta Angle in radians.
317
+ */
318
+ setRotationZ(theta: number): this;
319
+ /**
320
+ * Sets this transform to a rotation of `angle` radians about an arbitrary `axis`
321
+ * through the origin.
322
+ *
323
+ * Positive angles turn counter-clockwise when looking from the tip of `axis` back toward
324
+ * the origin. With a cardinal axis this matches `setRotationX`, `setRotationY` or
325
+ * `setRotationZ`.
326
+ *
327
+ * `axis` must be a unit vector. It is not normalized here, to keep this cheap on hot
328
+ * paths. A non-unit axis generally produces a matrix that is not a rotation: it
329
+ * distorts lengths and angles. Call `normalize()` on the axis first if it is not
330
+ * already unit length.
331
+ *
332
+ * Clears the translation.
333
+ *
334
+ * @param axis Unit-length rotation axis.
335
+ * @param angle Angle in radians.
336
+ */
337
+ setFromAxisAngle(axis: Vec3Like, angle: number): this;
338
+ }