@ac-kit/math-linear 0.2.1 → 0.4.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.
- package/CHANGELOG.md +337 -0
- package/README.md +232 -16
- package/dist/_brand.d.ts +14 -0
- package/dist/_brand.d.ts.map +1 -0
- package/dist/_brand.js +2 -0
- package/dist/_brand.js.map +1 -0
- package/dist/_invert.d.ts +214 -0
- package/dist/_invert.d.ts.map +1 -0
- package/dist/_invert.js +884 -0
- package/dist/_invert.js.map +1 -0
- package/dist/_slerp.d.ts +29 -0
- package/dist/_slerp.d.ts.map +1 -1
- package/dist/_slerp.js +103 -0
- package/dist/_slerp.js.map +1 -1
- package/dist/_strided-range.d.ts +23 -0
- package/dist/_strided-range.d.ts.map +1 -0
- package/dist/_strided-range.js +75 -0
- package/dist/_strided-range.js.map +1 -0
- package/dist/_trs.d.ts +38 -0
- package/dist/_trs.d.ts.map +1 -0
- package/dist/_trs.js +132 -0
- package/dist/_trs.js.map +1 -0
- package/dist/affine2-array.d.ts +53 -0
- package/dist/affine2-array.d.ts.map +1 -0
- package/dist/affine2-array.js +107 -0
- package/dist/affine2-array.js.map +1 -0
- package/dist/affine2-componentwise.d.ts +28 -0
- package/dist/affine2-componentwise.d.ts.map +1 -0
- package/dist/affine2-componentwise.js +66 -0
- package/dist/affine2-componentwise.js.map +1 -0
- package/dist/affine2.d.ts +156 -0
- package/dist/affine2.d.ts.map +1 -0
- package/dist/affine2.js +437 -0
- package/dist/affine2.js.map +1 -0
- package/dist/affine3-array.d.ts +53 -0
- package/dist/affine3-array.d.ts.map +1 -0
- package/dist/affine3-array.js +137 -0
- package/dist/affine3-array.js.map +1 -0
- package/dist/affine3-componentwise.d.ts +32 -0
- package/dist/affine3-componentwise.d.ts.map +1 -0
- package/dist/affine3-componentwise.js +100 -0
- package/dist/affine3-componentwise.js.map +1 -0
- package/dist/affine3.d.ts +205 -0
- package/dist/affine3.d.ts.map +1 -0
- package/dist/affine3.js +792 -0
- package/dist/affine3.js.map +1 -0
- package/dist/checked/index.d.ts +35 -0
- package/dist/checked/index.d.ts.map +1 -0
- package/dist/checked/index.js +58 -0
- package/dist/checked/index.js.map +1 -0
- package/dist/euler.d.ts +65 -0
- package/dist/euler.d.ts.map +1 -0
- package/dist/euler.js +217 -0
- package/dist/euler.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/kl-activations.d.ts.map +1 -1
- package/dist/kl-activations.js +4 -3
- package/dist/kl-activations.js.map +1 -1
- package/dist/mat2x2-array.d.ts +36 -0
- package/dist/mat2x2-array.d.ts.map +1 -0
- package/dist/mat2x2-array.js +71 -0
- package/dist/mat2x2-array.js.map +1 -0
- package/dist/mat2x2-componentwise.d.ts +86 -0
- package/dist/mat2x2-componentwise.d.ts.map +1 -0
- package/dist/mat2x2-componentwise.js +199 -0
- package/dist/mat2x2-componentwise.js.map +1 -0
- package/dist/mat2x2.d.ts +79 -25
- package/dist/mat2x2.d.ts.map +1 -1
- package/dist/mat2x2.js +192 -93
- package/dist/mat2x2.js.map +1 -1
- package/dist/mat3x3-array.d.ts +36 -0
- package/dist/mat3x3-array.d.ts.map +1 -0
- package/dist/mat3x3-array.js +91 -0
- package/dist/mat3x3-array.js.map +1 -0
- package/dist/mat3x3-componentwise.d.ts +86 -0
- package/dist/mat3x3-componentwise.d.ts.map +1 -0
- package/dist/mat3x3-componentwise.js +299 -0
- package/dist/mat3x3-componentwise.js.map +1 -0
- package/dist/mat3x3.d.ts +153 -48
- package/dist/mat3x3.d.ts.map +1 -1
- package/dist/mat3x3.js +470 -192
- package/dist/mat3x3.js.map +1 -1
- package/dist/mat4x4-array.d.ts +46 -0
- package/dist/mat4x4-array.d.ts.map +1 -0
- package/dist/mat4x4-array.js +133 -0
- package/dist/mat4x4-array.js.map +1 -0
- package/dist/mat4x4-componentwise.d.ts +87 -0
- package/dist/mat4x4-componentwise.d.ts.map +1 -0
- package/dist/mat4x4-componentwise.js +434 -0
- package/dist/mat4x4-componentwise.js.map +1 -0
- package/dist/mat4x4.d.ts +221 -67
- package/dist/mat4x4.d.ts.map +1 -1
- package/dist/mat4x4.js +972 -334
- package/dist/mat4x4.js.map +1 -1
- package/dist/projection.d.ts +113 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +418 -0
- package/dist/projection.js.map +1 -0
- package/dist/quaternion-array.d.ts +47 -0
- package/dist/quaternion-array.d.ts.map +1 -0
- package/dist/quaternion-array.js +86 -0
- package/dist/quaternion-array.js.map +1 -0
- package/dist/quaternion.d.ts +106 -22
- package/dist/quaternion.d.ts.map +1 -1
- package/dist/quaternion.js +253 -182
- package/dist/quaternion.js.map +1 -1
- package/dist/transform.d.ts +220 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +412 -0
- package/dist/transform.js.map +1 -0
- package/dist/tridiagonal.d.ts +52 -0
- package/dist/tridiagonal.d.ts.map +1 -0
- package/dist/tridiagonal.js +90 -0
- package/dist/tridiagonal.js.map +1 -0
- package/dist/upload.d.ts +55 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +129 -0
- package/dist/upload.js.map +1 -0
- package/dist/vec2-array-componentwise.d.ts +207 -0
- package/dist/vec2-array-componentwise.d.ts.map +1 -0
- package/dist/vec2-array-componentwise.js +472 -0
- package/dist/vec2-array-componentwise.js.map +1 -0
- package/dist/vec2-array.d.ts +53 -0
- package/dist/vec2-array.d.ts.map +1 -0
- package/dist/vec2-array.js +123 -0
- package/dist/vec2-array.js.map +1 -0
- package/dist/vec2-componentwise.d.ts +311 -0
- package/dist/vec2-componentwise.d.ts.map +1 -0
- package/dist/vec2-componentwise.js +542 -0
- package/dist/vec2-componentwise.js.map +1 -0
- package/dist/vec2.d.ts +97 -82
- package/dist/vec2.d.ts.map +1 -1
- package/dist/vec2.js +121 -216
- package/dist/vec2.js.map +1 -1
- package/dist/vec3-array-componentwise.d.ts +207 -0
- package/dist/vec3-array-componentwise.d.ts.map +1 -0
- package/dist/vec3-array-componentwise.js +510 -0
- package/dist/vec3-array-componentwise.js.map +1 -0
- package/dist/vec3-array.d.ts +102 -0
- package/dist/vec3-array.d.ts.map +1 -0
- package/dist/vec3-array.js +299 -0
- package/dist/vec3-array.js.map +1 -0
- package/dist/vec3-componentwise.d.ts +310 -0
- package/dist/vec3-componentwise.d.ts.map +1 -0
- package/dist/vec3-componentwise.js +594 -0
- package/dist/vec3-componentwise.js.map +1 -0
- package/dist/vec3.d.ts +177 -87
- package/dist/vec3.d.ts.map +1 -1
- package/dist/vec3.js +391 -272
- package/dist/vec3.js.map +1 -1
- package/dist/vec4-array-componentwise.d.ts +198 -0
- package/dist/vec4-array-componentwise.d.ts.map +1 -0
- package/dist/vec4-array-componentwise.js +521 -0
- package/dist/vec4-array-componentwise.js.map +1 -0
- package/dist/vec4-array.d.ts +12 -0
- package/dist/vec4-array.d.ts.map +1 -0
- package/dist/vec4-array.js +43 -0
- package/dist/vec4-array.js.map +1 -0
- package/dist/vec4-componentwise.d.ts +299 -0
- package/dist/vec4-componentwise.d.ts.map +1 -0
- package/dist/vec4-componentwise.js +637 -0
- package/dist/vec4-componentwise.js.map +1 -0
- package/dist/vec4.d.ts +59 -53
- package/dist/vec4.d.ts.map +1 -1
- package/dist/vec4.js +74 -249
- package/dist/vec4.js.map +1 -1
- package/dist/view-basis.d.ts +15 -0
- package/dist/view-basis.d.ts.map +1 -0
- package/dist/view-basis.js +29 -0
- package/dist/view-basis.js.map +1 -0
- package/dist/viewport.d.ts +114 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.js +250 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +19 -9
package/dist/mat4x4.d.ts
CHANGED
|
@@ -1,70 +1,224 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Quaternion, ReadonlyQuaternion } from "@ac-kit/math-complex";
|
|
2
|
+
import type { Brand_ } from "./_brand.js";
|
|
3
|
+
import type { ReadonlyAffine2 } from "./affine2.js";
|
|
4
|
+
import type { ReadonlyAffine3 } from "./affine3.js";
|
|
5
|
+
import type { ReadonlyMat3x3 } from "./mat3x3.js";
|
|
6
|
+
import type { ReadonlyVec3, Vec3 } from "./vec3.js";
|
|
7
|
+
import type { ReadonlyVec4, Vec4 } from "./vec4.js";
|
|
8
|
+
/**
|
|
9
|
+
* A 4 × 4 matrix, stored flat and column-major, `[m00, m10, m20, m30, m01, …,
|
|
10
|
+
* m33]`: entry (row `r`, column `c`) is at index `4c + r`, so the translation
|
|
11
|
+
* of an affine matrix sits at 12, 13 and 14, as WebGL, WebGPU, WGSL, glTF and
|
|
12
|
+
* `DOMMatrix` lay matrices out. A plain array of sixteen binary64 numbers
|
|
13
|
+
* carrying a type-level brand. Operations treat vectors as columns, so
|
|
14
|
+
* `mat4x4Multiply(out, a, b)` is `a · b` and applies `b` first.
|
|
15
|
+
*
|
|
16
|
+
* Only {@link mat4x4Create}, {@link mat4x4Of}, {@link mat4x4OfRows},
|
|
17
|
+
* {@link mat4x4Clone}, {@link mat4x4FromArray} and the functions that write an
|
|
18
|
+
* `out` make one; see {@link Vec3} for the rules that bind callers who bypass
|
|
19
|
+
* the types.
|
|
20
|
+
*/
|
|
5
21
|
export type Mat4x4 = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
22
|
+
m00: number,
|
|
23
|
+
m10: number,
|
|
24
|
+
m20: number,
|
|
25
|
+
m30: number,
|
|
26
|
+
m01: number,
|
|
27
|
+
m11: number,
|
|
28
|
+
m21: number,
|
|
29
|
+
m31: number,
|
|
30
|
+
m02: number,
|
|
31
|
+
m12: number,
|
|
32
|
+
m22: number,
|
|
33
|
+
m32: number,
|
|
34
|
+
m03: number,
|
|
35
|
+
m13: number,
|
|
36
|
+
m23: number,
|
|
37
|
+
m33: number
|
|
38
|
+
] & Brand_<"Mat4x4">;
|
|
39
|
+
/** A {@link Mat4x4} that is only read. */
|
|
40
|
+
export type ReadonlyMat4x4 = readonly [
|
|
41
|
+
m00: number,
|
|
42
|
+
m10: number,
|
|
43
|
+
m20: number,
|
|
44
|
+
m30: number,
|
|
45
|
+
m01: number,
|
|
46
|
+
m11: number,
|
|
47
|
+
m21: number,
|
|
48
|
+
m31: number,
|
|
49
|
+
m02: number,
|
|
50
|
+
m12: number,
|
|
51
|
+
m22: number,
|
|
52
|
+
m32: number,
|
|
53
|
+
m03: number,
|
|
54
|
+
m13: number,
|
|
55
|
+
m23: number,
|
|
56
|
+
m33: number
|
|
57
|
+
] & Brand_<"Mat4x4">;
|
|
58
|
+
/**
|
|
59
|
+
* Writes the product `a · b` into `out`: `b` is applied first. Not commutative.
|
|
60
|
+
* Plain arithmetic, straight-line: each entry is within four roundings of the
|
|
61
|
+
* exact value relative to the sum of the absolute values of its terms, so it
|
|
62
|
+
* can lose every digit where the terms cancel (see
|
|
63
|
+
* {@link mat4x4MultiplyPrecise}). `out` may be `a` or `b`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function mat4x4Multiply(out: Mat4x4, a: ReadonlyMat4x4, b: ReadonlyMat4x4): Mat4x4;
|
|
66
|
+
/**
|
|
67
|
+
* {@link mat4x4Multiply} with each entry a compensated dot product, as accurate
|
|
68
|
+
* as one in doubled precision rounded once. About ten times the cost. `out` may
|
|
69
|
+
* be `a` or `b`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function mat4x4MultiplyPrecise(out: Mat4x4, a: ReadonlyMat4x4, b: ReadonlyMat4x4): Mat4x4;
|
|
72
|
+
/**
|
|
73
|
+
* Writes `m · diag(v)` into `out`: column `c` of `m` multiplied by `v[c]`.
|
|
74
|
+
* `out` may be `m`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function mat4x4ScaleColumns(out: Mat4x4, m: ReadonlyMat4x4, v: ReadonlyVec4): Mat4x4;
|
|
77
|
+
/**
|
|
78
|
+
* Writes `diag(v) · m` into `out`: row `r` of `m` multiplied by `v[r]`. `out`
|
|
79
|
+
* may be `m`.
|
|
80
|
+
*/
|
|
81
|
+
export declare function mat4x4ScaleRows(out: Mat4x4, m: ReadonlyMat4x4, v: ReadonlyVec4): Mat4x4;
|
|
82
|
+
/** Writes the transpose of `m` into `out`. `out` may be `m`. */
|
|
83
|
+
export declare function mat4x4Transpose(out: Mat4x4, m: ReadonlyMat4x4): Mat4x4;
|
|
84
|
+
/**
|
|
85
|
+
* The determinant, from the six 2 × 2 minors of the first two columns and of
|
|
86
|
+
* the last two, in plain arithmetic: the signed volume scale of the
|
|
87
|
+
* transformation.
|
|
88
|
+
*/
|
|
89
|
+
export declare function mat4x4Determinant(m: ReadonlyMat4x4): number;
|
|
90
|
+
/**
|
|
91
|
+
* Writes the inverse of `m` into `out` and returns `true`. When `m` has no
|
|
92
|
+
* inverse a binary64 number can hold (it is singular, an entry is not finite,
|
|
93
|
+
* or an entry of the inverse overflows) `out` is filled with `NaN` and the
|
|
94
|
+
* result is `false`: `true` always comes with a finite `out`, never a stale or
|
|
95
|
+
* partial matrix, and nothing throws. Whatever its determinant, a matrix whose
|
|
96
|
+
* inverse fits is inverted (`diag(1e-80)` gives `diag(1e80)`, `diag(1e200,
|
|
97
|
+
* 1e200, 1e200, 1e-200)` gives `diag(1e-200, 1e-200, 1e-200, 1e200)`, and `[[1,
|
|
98
|
+
* 1, 0, 0], [1, 1, 2^-600, 0], [0, 2^-600, 1, 1], [0, 0, 1, 1]]`, of
|
|
99
|
+
* determinant `-2^-1200`, has an inverse of entries ±2^600).
|
|
100
|
+
*
|
|
101
|
+
* Plain arithmetic first: the sixteen cofactors share eighteen 2 × 2 minors,
|
|
102
|
+
* and the determinant is the first row of the matrix against its cofactors.
|
|
103
|
+
* When that determinant or an entry of the inverse leaves the range, or a
|
|
104
|
+
* forward error bound of the expansion (Higham, "Accuracy and Stability of
|
|
105
|
+
* Numerical Algorithms", §3.1) does not keep the determinant within `2^-41` of
|
|
106
|
+
* itself and the cofactors within `2^-43` of the largest of them (a matrix
|
|
107
|
+
* nearly singular, or whose cofactors cancel to a rounding residue), unless the
|
|
108
|
+
* expansion rounded nowhere, the rows and columns are scaled by powers of two
|
|
109
|
+
* so the largest entry of each is in `[1, 2)`, exactly, and the scaled matrix
|
|
110
|
+
* is inverted by its cofactors under the same bound or else by LU factorisation
|
|
111
|
+
* with partial pivoting (Golub and Van Loan, §3.4), backward stable; the
|
|
112
|
+
* scaling is undone on the inverse. An elimination without rounding proves the
|
|
113
|
+
* matrix singular or invertible; one that rounds is settled in exact
|
|
114
|
+
* arithmetic, as is an inverse whose scaled-back entries overflow or come
|
|
115
|
+
* within their error bound of the overflow threshold, and a matrix whose
|
|
116
|
+
* scaling rounds an entry (one more than about `2^1074` below the largest of
|
|
117
|
+
* its column once its row is scaled, `2^-200` in `[[2^900, 2^900, 0, 0],
|
|
118
|
+
* [2^900, 2^900, 2^-200, 0], [0, 2^900, 2^900, 0], [0, 0, 0, 1]]`). So `false`
|
|
119
|
+
* is never a rounding artefact: `m` is singular, an entry is not finite, or an
|
|
120
|
+
* entry of its inverse, rounded once, is beyond `Number.MAX_VALUE`. `true`
|
|
121
|
+
* comes with an inverse backward stable for `m` with its rows and columns so
|
|
122
|
+
* scaled (a normwise backward error of about `2^-40`), whose entries far below
|
|
123
|
+
* the largest of that scaled inverse may carry no correct digit, as in any
|
|
124
|
+
* elimination. Allocates nothing unless the exact settlement runs: for a matrix
|
|
125
|
+
* of condition number beyond about `2^52`, an inverse that overflows, or an
|
|
126
|
+
* entry the scaling rounds. `out` may be `m`.
|
|
127
|
+
*/
|
|
128
|
+
export declare function mat4x4Invert(out: Mat4x4, m: ReadonlyMat4x4): boolean;
|
|
129
|
+
/** Writes the translation by `translation` into `out`. */
|
|
130
|
+
export declare function mat4x4FromTranslation(out: Mat4x4, translation: ReadonlyVec3): Mat4x4;
|
|
131
|
+
/** Writes the scale `diag(scale, 1)` into `out`. */
|
|
132
|
+
export declare function mat4x4FromScale(out: Mat4x4, scale: ReadonlyVec3): Mat4x4;
|
|
133
|
+
/**
|
|
134
|
+
* Writes the rotation by `angle` radians about the x axis (right-hand rule)
|
|
135
|
+
* into `out`.
|
|
136
|
+
*/
|
|
137
|
+
export declare function mat4x4FromRotationX(out: Mat4x4, angle: number): Mat4x4;
|
|
138
|
+
/**
|
|
139
|
+
* Writes the rotation by `angle` radians about the y axis (right-hand rule)
|
|
140
|
+
* into `out`.
|
|
141
|
+
*/
|
|
142
|
+
export declare function mat4x4FromRotationY(out: Mat4x4, angle: number): Mat4x4;
|
|
143
|
+
/**
|
|
144
|
+
* Writes the rotation by `angle` radians about the z axis (right-hand rule)
|
|
145
|
+
* into `out`.
|
|
146
|
+
*/
|
|
147
|
+
export declare function mat4x4FromRotationZ(out: Mat4x4, angle: number): Mat4x4;
|
|
148
|
+
/**
|
|
149
|
+
* Writes the rotation of the unit quaternion `q` into `out`, no translation and
|
|
150
|
+
* no scale. `q` must be unit length; it is not normalised here.
|
|
151
|
+
*/
|
|
152
|
+
export declare function mat4x4FromQuaternion(out: Mat4x4, q: ReadonlyQuaternion): Mat4x4;
|
|
153
|
+
/**
|
|
154
|
+
* Writes the transform that scales, then rotates, then translates into `out`:
|
|
155
|
+
* `T · R · S`, with `rotation` a unit quaternion (not normalised here).
|
|
156
|
+
*/
|
|
157
|
+
export declare function mat4x4Compose(out: Mat4x4, translation: ReadonlyVec3, rotation: ReadonlyQuaternion, scale: ReadonlyVec3): Mat4x4;
|
|
158
|
+
/**
|
|
159
|
+
* Writes the rotation by `angle` radians about the unit vector `axis`
|
|
160
|
+
* (right-hand rule, Rodrigues' formula) into `out`, no translation. `axis` is
|
|
161
|
+
* not normalised here: for any other length the matrix is not a rotation.
|
|
162
|
+
*/
|
|
163
|
+
export declare function mat4x4FromAxisAngle(out: Mat4x4, axis: ReadonlyVec3, angle: number): Mat4x4;
|
|
164
|
+
/**
|
|
165
|
+
* Writes the 3 × 3 matrix `m` as the upper-left block of a 4 × 4 matrix whose
|
|
166
|
+
* last row and column are those of the identity into `out`.
|
|
167
|
+
*/
|
|
168
|
+
export declare function mat4x4FromMat3x3(out: Mat4x4, m: ReadonlyMat3x3): Mat4x4;
|
|
169
|
+
/**
|
|
170
|
+
* Writes the 3D affine `transform` as a 4 × 4 matrix into `out`: the bottom
|
|
171
|
+
* row, which an {@link Affine3} does not store, is `0, 0, 0, 1`.
|
|
172
|
+
*/
|
|
173
|
+
export declare function mat4x4FromAffine3(out: Mat4x4, transform: ReadonlyAffine3): Mat4x4;
|
|
174
|
+
/**
|
|
175
|
+
* Writes the 2D affine `transform` as a 4 × 4 matrix that acts on `x` and `y`
|
|
176
|
+
* and passes `z` and `w` through into `out`: a 2D view as the `viewProjection`
|
|
177
|
+
* of a 3D pipeline, the depth untouched.
|
|
178
|
+
*/
|
|
179
|
+
export declare function mat4x4FromAffine2(out: Mat4x4, transform: ReadonlyAffine2): Mat4x4;
|
|
180
|
+
/**
|
|
181
|
+
* Splits `m` into the translation, rotation and scale that {@link mat4x4Compose}
|
|
182
|
+
* builds it from: the translation is the last column, the scale is the length
|
|
183
|
+
* of each of the first three, and the rotation is the unit quaternion of those
|
|
184
|
+
* columns divided by it. A reflection (negative determinant) puts its sign in
|
|
185
|
+
* the x scale, so the rotation is proper.
|
|
44
186
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export declare function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export declare function
|
|
187
|
+
* Returns `false` when there is no such split: a column of zero length or not
|
|
188
|
+
* finite, two columns further from perpendicular than about `1e-6` in cosine (a
|
|
189
|
+
* shear), a bottom row other than `0, 0, 0, 1` (a projection), or a translation
|
|
190
|
+
* that is not finite. The three outputs then hold `NaN`, never a stale or
|
|
191
|
+
* partial result, and nothing throws.
|
|
192
|
+
*/
|
|
193
|
+
export declare function mat4x4Decompose(outTranslation: Vec3, outRotation: Quaternion, outScale: Vec3, m: ReadonlyMat4x4): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Writes the product `m · transform` into `out`, the 3D affine `transform`
|
|
196
|
+
* taken as the 4 × 4 matrix with a bottom row `0, 0, 0, 1`: a projection times
|
|
197
|
+
* a view times an affine model, in plain arithmetic and straight-line. `out`
|
|
198
|
+
* may be `m`.
|
|
199
|
+
*/
|
|
200
|
+
export declare function mat4x4MultiplyAffine3(out: Mat4x4, m: ReadonlyMat4x4, transform: ReadonlyAffine3): Mat4x4;
|
|
201
|
+
/**
|
|
202
|
+
* Writes the product `m · T(translation)` into `out`: `m` with a translation
|
|
203
|
+
* applied first, in its own local space, which is how a renderer folds its
|
|
204
|
+
* origin into a matrix. Only the last column changes. `out` may be `m`.
|
|
205
|
+
*/
|
|
206
|
+
export declare function mat4x4Translate(out: Mat4x4, m: ReadonlyMat4x4, translation: ReadonlyVec3): Mat4x4;
|
|
207
|
+
/**
|
|
208
|
+
* Writes the last column of `m` without its bottom entry, the translation of an
|
|
209
|
+
* affine matrix, into `out`.
|
|
210
|
+
*/
|
|
211
|
+
export declare function mat4x4GetTranslation(out: Vec3, m: ReadonlyMat4x4): Vec3;
|
|
212
|
+
/**
|
|
213
|
+
* Writes the length of each of the first three columns of `m`, the scale of a
|
|
214
|
+
* matrix with no shear (the sign of a reflection is not recovered: see
|
|
215
|
+
* {@link mat4x4Decompose}), into `out`. Plain arithmetic: right between about
|
|
216
|
+
* `1e-150` and `1e150`.
|
|
217
|
+
*/
|
|
218
|
+
export declare function mat4x4GetScale(out: Vec3, m: ReadonlyMat4x4): Vec3;
|
|
219
|
+
/**
|
|
220
|
+
* Writes column `column` of `m`, 0 to 3, into `out`; any other `column` gives
|
|
221
|
+
* `NaN` throughout, never `undefined`.
|
|
222
|
+
*/
|
|
223
|
+
export declare function mat4x4GetColumn(out: Vec4, m: ReadonlyMat4x4, column: number): Vec4;
|
|
70
224
|
//# sourceMappingURL=mat4x4.d.ts.map
|
package/dist/mat4x4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mat4x4.d.ts","sourceRoot":"","sources":["../src/mat4x4.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mat4x4.d.ts","sourceRoot":"","sources":["../src/mat4x4.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAW1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;;;;;;;;;GAY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