@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.
Files changed (178) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +232 -16
  3. package/dist/_brand.d.ts +14 -0
  4. package/dist/_brand.d.ts.map +1 -0
  5. package/dist/_brand.js +2 -0
  6. package/dist/_brand.js.map +1 -0
  7. package/dist/_invert.d.ts +214 -0
  8. package/dist/_invert.d.ts.map +1 -0
  9. package/dist/_invert.js +884 -0
  10. package/dist/_invert.js.map +1 -0
  11. package/dist/_slerp.d.ts +29 -0
  12. package/dist/_slerp.d.ts.map +1 -1
  13. package/dist/_slerp.js +103 -0
  14. package/dist/_slerp.js.map +1 -1
  15. package/dist/_strided-range.d.ts +23 -0
  16. package/dist/_strided-range.d.ts.map +1 -0
  17. package/dist/_strided-range.js +75 -0
  18. package/dist/_strided-range.js.map +1 -0
  19. package/dist/_trs.d.ts +38 -0
  20. package/dist/_trs.d.ts.map +1 -0
  21. package/dist/_trs.js +132 -0
  22. package/dist/_trs.js.map +1 -0
  23. package/dist/affine2-array.d.ts +53 -0
  24. package/dist/affine2-array.d.ts.map +1 -0
  25. package/dist/affine2-array.js +107 -0
  26. package/dist/affine2-array.js.map +1 -0
  27. package/dist/affine2-componentwise.d.ts +28 -0
  28. package/dist/affine2-componentwise.d.ts.map +1 -0
  29. package/dist/affine2-componentwise.js +66 -0
  30. package/dist/affine2-componentwise.js.map +1 -0
  31. package/dist/affine2.d.ts +156 -0
  32. package/dist/affine2.d.ts.map +1 -0
  33. package/dist/affine2.js +437 -0
  34. package/dist/affine2.js.map +1 -0
  35. package/dist/affine3-array.d.ts +53 -0
  36. package/dist/affine3-array.d.ts.map +1 -0
  37. package/dist/affine3-array.js +137 -0
  38. package/dist/affine3-array.js.map +1 -0
  39. package/dist/affine3-componentwise.d.ts +32 -0
  40. package/dist/affine3-componentwise.d.ts.map +1 -0
  41. package/dist/affine3-componentwise.js +100 -0
  42. package/dist/affine3-componentwise.js.map +1 -0
  43. package/dist/affine3.d.ts +205 -0
  44. package/dist/affine3.d.ts.map +1 -0
  45. package/dist/affine3.js +792 -0
  46. package/dist/affine3.js.map +1 -0
  47. package/dist/checked/index.d.ts +35 -0
  48. package/dist/checked/index.d.ts.map +1 -0
  49. package/dist/checked/index.js +58 -0
  50. package/dist/checked/index.js.map +1 -0
  51. package/dist/euler.d.ts +65 -0
  52. package/dist/euler.d.ts.map +1 -0
  53. package/dist/euler.js +217 -0
  54. package/dist/euler.js.map +1 -0
  55. package/dist/index.d.ts +29 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +29 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/kl-activations.d.ts.map +1 -1
  60. package/dist/kl-activations.js +4 -3
  61. package/dist/kl-activations.js.map +1 -1
  62. package/dist/mat2x2-array.d.ts +36 -0
  63. package/dist/mat2x2-array.d.ts.map +1 -0
  64. package/dist/mat2x2-array.js +71 -0
  65. package/dist/mat2x2-array.js.map +1 -0
  66. package/dist/mat2x2-componentwise.d.ts +86 -0
  67. package/dist/mat2x2-componentwise.d.ts.map +1 -0
  68. package/dist/mat2x2-componentwise.js +199 -0
  69. package/dist/mat2x2-componentwise.js.map +1 -0
  70. package/dist/mat2x2.d.ts +79 -25
  71. package/dist/mat2x2.d.ts.map +1 -1
  72. package/dist/mat2x2.js +192 -93
  73. package/dist/mat2x2.js.map +1 -1
  74. package/dist/mat3x3-array.d.ts +36 -0
  75. package/dist/mat3x3-array.d.ts.map +1 -0
  76. package/dist/mat3x3-array.js +91 -0
  77. package/dist/mat3x3-array.js.map +1 -0
  78. package/dist/mat3x3-componentwise.d.ts +86 -0
  79. package/dist/mat3x3-componentwise.d.ts.map +1 -0
  80. package/dist/mat3x3-componentwise.js +299 -0
  81. package/dist/mat3x3-componentwise.js.map +1 -0
  82. package/dist/mat3x3.d.ts +153 -48
  83. package/dist/mat3x3.d.ts.map +1 -1
  84. package/dist/mat3x3.js +470 -192
  85. package/dist/mat3x3.js.map +1 -1
  86. package/dist/mat4x4-array.d.ts +46 -0
  87. package/dist/mat4x4-array.d.ts.map +1 -0
  88. package/dist/mat4x4-array.js +133 -0
  89. package/dist/mat4x4-array.js.map +1 -0
  90. package/dist/mat4x4-componentwise.d.ts +87 -0
  91. package/dist/mat4x4-componentwise.d.ts.map +1 -0
  92. package/dist/mat4x4-componentwise.js +434 -0
  93. package/dist/mat4x4-componentwise.js.map +1 -0
  94. package/dist/mat4x4.d.ts +221 -67
  95. package/dist/mat4x4.d.ts.map +1 -1
  96. package/dist/mat4x4.js +972 -334
  97. package/dist/mat4x4.js.map +1 -1
  98. package/dist/projection.d.ts +113 -0
  99. package/dist/projection.d.ts.map +1 -0
  100. package/dist/projection.js +418 -0
  101. package/dist/projection.js.map +1 -0
  102. package/dist/quaternion-array.d.ts +47 -0
  103. package/dist/quaternion-array.d.ts.map +1 -0
  104. package/dist/quaternion-array.js +86 -0
  105. package/dist/quaternion-array.js.map +1 -0
  106. package/dist/quaternion.d.ts +106 -22
  107. package/dist/quaternion.d.ts.map +1 -1
  108. package/dist/quaternion.js +253 -182
  109. package/dist/quaternion.js.map +1 -1
  110. package/dist/transform.d.ts +220 -0
  111. package/dist/transform.d.ts.map +1 -0
  112. package/dist/transform.js +412 -0
  113. package/dist/transform.js.map +1 -0
  114. package/dist/tridiagonal.d.ts +52 -0
  115. package/dist/tridiagonal.d.ts.map +1 -0
  116. package/dist/tridiagonal.js +90 -0
  117. package/dist/tridiagonal.js.map +1 -0
  118. package/dist/upload.d.ts +55 -0
  119. package/dist/upload.d.ts.map +1 -0
  120. package/dist/upload.js +129 -0
  121. package/dist/upload.js.map +1 -0
  122. package/dist/vec2-array-componentwise.d.ts +207 -0
  123. package/dist/vec2-array-componentwise.d.ts.map +1 -0
  124. package/dist/vec2-array-componentwise.js +472 -0
  125. package/dist/vec2-array-componentwise.js.map +1 -0
  126. package/dist/vec2-array.d.ts +53 -0
  127. package/dist/vec2-array.d.ts.map +1 -0
  128. package/dist/vec2-array.js +123 -0
  129. package/dist/vec2-array.js.map +1 -0
  130. package/dist/vec2-componentwise.d.ts +311 -0
  131. package/dist/vec2-componentwise.d.ts.map +1 -0
  132. package/dist/vec2-componentwise.js +542 -0
  133. package/dist/vec2-componentwise.js.map +1 -0
  134. package/dist/vec2.d.ts +97 -82
  135. package/dist/vec2.d.ts.map +1 -1
  136. package/dist/vec2.js +121 -216
  137. package/dist/vec2.js.map +1 -1
  138. package/dist/vec3-array-componentwise.d.ts +207 -0
  139. package/dist/vec3-array-componentwise.d.ts.map +1 -0
  140. package/dist/vec3-array-componentwise.js +510 -0
  141. package/dist/vec3-array-componentwise.js.map +1 -0
  142. package/dist/vec3-array.d.ts +102 -0
  143. package/dist/vec3-array.d.ts.map +1 -0
  144. package/dist/vec3-array.js +299 -0
  145. package/dist/vec3-array.js.map +1 -0
  146. package/dist/vec3-componentwise.d.ts +310 -0
  147. package/dist/vec3-componentwise.d.ts.map +1 -0
  148. package/dist/vec3-componentwise.js +594 -0
  149. package/dist/vec3-componentwise.js.map +1 -0
  150. package/dist/vec3.d.ts +177 -87
  151. package/dist/vec3.d.ts.map +1 -1
  152. package/dist/vec3.js +391 -272
  153. package/dist/vec3.js.map +1 -1
  154. package/dist/vec4-array-componentwise.d.ts +198 -0
  155. package/dist/vec4-array-componentwise.d.ts.map +1 -0
  156. package/dist/vec4-array-componentwise.js +521 -0
  157. package/dist/vec4-array-componentwise.js.map +1 -0
  158. package/dist/vec4-array.d.ts +12 -0
  159. package/dist/vec4-array.d.ts.map +1 -0
  160. package/dist/vec4-array.js +43 -0
  161. package/dist/vec4-array.js.map +1 -0
  162. package/dist/vec4-componentwise.d.ts +299 -0
  163. package/dist/vec4-componentwise.d.ts.map +1 -0
  164. package/dist/vec4-componentwise.js +637 -0
  165. package/dist/vec4-componentwise.js.map +1 -0
  166. package/dist/vec4.d.ts +59 -53
  167. package/dist/vec4.d.ts.map +1 -1
  168. package/dist/vec4.js +74 -249
  169. package/dist/vec4.js.map +1 -1
  170. package/dist/view-basis.d.ts +15 -0
  171. package/dist/view-basis.d.ts.map +1 -0
  172. package/dist/view-basis.js +29 -0
  173. package/dist/view-basis.js.map +1 -0
  174. package/dist/viewport.d.ts +114 -0
  175. package/dist/viewport.d.ts.map +1 -0
  176. package/dist/viewport.js +250 -0
  177. package/dist/viewport.js.map +1 -0
  178. package/package.json +19 -9
package/dist/mat4x4.d.ts CHANGED
@@ -1,70 +1,224 @@
1
- import { type IsCloseToOptions } from "@ac-kit/core";
2
- import { Quaternion } from "./quaternion.js";
3
- import { Vec3 } from "./vec3.js";
4
- import { Vec4 } from "./vec4.js";
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
- number,
8
- number,
9
- number,
10
- number
11
- ],
12
- [
13
- number,
14
- number,
15
- number,
16
- number
17
- ],
18
- [
19
- number,
20
- number,
21
- number,
22
- number
23
- ],
24
- [
25
- number,
26
- number,
27
- number,
28
- number
29
- ]
30
- ];
31
- export declare const MAT4X4_ZERO: [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
32
- export declare const MAT4X4_IDENTITY: [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
33
- export declare function mat4x4Add(a: Mat4x4, b: Mat4x4): Mat4x4;
34
- /**
35
- * Composes a 4×4 transformation matrix from translation, rotation (quaternion),
36
- * and scale. Equivalent to T × R × S.
37
- */
38
- export declare function mat4x4Compose(translation: Vec3, rotation: Quaternion, scale: Vec3): Mat4x4;
39
- export declare function mat4x4Determinant(m: Mat4x4): number;
40
- /** Exact element-wise equality. See {@link mat4x4IsClose} for a tolerant test. */
41
- export declare function mat4x4Equals(a: Mat4x4, b: Mat4x4): boolean;
42
- /**
43
- * Element-wise approximate equality.
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
- * Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
46
- * and never a basis for ordering — use {@link mat4x4Equals} there.
47
- */
48
- export declare function mat4x4IsClose(a: Mat4x4, b: Mat4x4, tolerance: IsCloseToOptions): boolean;
49
- /**
50
- * Creates a 4×4 matrix from a quaternion (pure rotation, no translation or
51
- * scale).
52
- */
53
- export declare function mat4x4FromQuaternion(q: Quaternion): Mat4x4;
54
- /** Creates a 4×4 rotation matrix around the X axis (right-hand rule). */
55
- export declare function mat4x4FromRotationX(angle: number): Mat4x4;
56
- /** Creates a 4×4 rotation matrix around the Y axis (right-hand rule). */
57
- export declare function mat4x4FromRotationY(angle: number): Mat4x4;
58
- /** Creates a 4×4 rotation matrix around the Z axis (right-hand rule). */
59
- export declare function mat4x4FromRotationZ(angle: number): Mat4x4;
60
- export declare function mat4x4FromScale(v: Vec3): Mat4x4;
61
- export declare function mat4x4FromTranslation(v: Vec3): Mat4x4;
62
- export declare function mat4x4Invert(m: Mat4x4): Mat4x4;
63
- export declare function mat4x4Multiply(a: Mat4x4, b: Mat4x4): Mat4x4;
64
- export declare function mat4x4MultiplyCols(matrix: Mat4x4, v: Vec4): Mat4x4;
65
- export declare function mat4x4MultiplyRows(matrix: Mat4x4, v: Vec4): Mat4x4;
66
- export declare function mat4x4MultiplyScalar(matrix: Mat4x4, scalar: number): Mat4x4;
67
- export declare function mat4x4Negate(matrix: Mat4x4): Mat4x4;
68
- export declare function mat4x4Sub(a: Mat4x4, b: Mat4x4): Mat4x4;
69
- export declare function mat4x4Transpose(matrix: Mat4x4): Mat4x4;
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
@@ -1 +1 @@
1
- {"version":3,"file":"mat4x4.d.ts","sourceRoot":"","sources":["../src/mat4x4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,MAAM,MAAM,GAAG;IACpB;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;IAChC;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;IAChC;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;IAChC;QAAC,MAAM;QAAE,MAAM;QAAE,MAAM;QAAE,MAAM;KAAC;CAChC,CAAC;AAEF,eAAO,MAAM,WAAW,0DAKG,CAAC;AAC5B,eAAO,MAAM,eAAe,0DAKD,CAAC;AAE5B,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA2BtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,WAAW,EAAE,IAAI,EACjB,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,IAAI,GACT,MAAM,CASR;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBnD;AAED,kFAAkF;AA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