@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
@@ -0,0 +1,32 @@
1
+ import { type IsCloseToOptions } from "@ac-kit/core";
2
+ import type { ReadonlyAffine3, Affine3 } from "./affine3.js";
3
+ /**
4
+ * Writes the entries in storage order into `out`: the columns of the matrix one
5
+ * after the other, `m00, m10, m20` being the x axis and `m03, m13, m23` the
6
+ * translation.
7
+ */
8
+ export declare function affine3Set(out: Affine3, m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number, m03: number, m13: number, m23: number): Affine3;
9
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
10
+ export declare function affine3Copy(out: Affine3, a: ReadonlyAffine3): Affine3;
11
+ /**
12
+ * Writes the identity transform `[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]` into
13
+ * `out`.
14
+ */
15
+ export declare function affine3Identity(out: Affine3): Affine3;
16
+ /**
17
+ * Exact entry-wise equality: `−0` equals `+0`, and `NaN` equals nothing, itself
18
+ * included. See {@link affine3IsClose} for a tolerant test.
19
+ */
20
+ export declare function affine3Equals(a: ReadonlyAffine3, b: ReadonlyAffine3): boolean;
21
+ /**
22
+ * Entry-wise approximate equality, each pair compared by `@ac-kit/core`'s
23
+ * `isCloseTo` with `options`: none means exact.
24
+ *
25
+ * Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
26
+ * and never a basis for ordering — use {@link affine3Equals} there. The
27
+ * tolerance is required: a transform carries no units of its own, so only the
28
+ * caller knows what counts as close (and the same tolerance covers a matrix
29
+ * entry and a translation).
30
+ */
31
+ export declare function affine3IsClose(a: ReadonlyAffine3, b: ReadonlyAffine3, options: IsCloseToOptions): boolean;
32
+ //# sourceMappingURL=affine3-componentwise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affine3-componentwise.d.ts","sourceRoot":"","sources":["../src/affine3-componentwise.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACT,OAAO,CAcT;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAcrE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAcrD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAe7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,eAAe,EAClB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAeT"}
@@ -0,0 +1,100 @@
1
+ // Generated from scripts/templates/affine-componentwise.liquid by scripts/generate-componentwise.ts. Do not edit.
2
+ import { isCloseTo } from "@ac-kit/core";
3
+ /**
4
+ * Writes the entries in storage order into `out`: the columns of the matrix one
5
+ * after the other, `m00, m10, m20` being the x axis and `m03, m13, m23` the
6
+ * translation.
7
+ */
8
+ export function affine3Set(out, m00, m10, m20, m01, m11, m21, m02, m12, m22, m03, m13, m23) {
9
+ out[0] = m00;
10
+ out[1] = m10;
11
+ out[2] = m20;
12
+ out[3] = m01;
13
+ out[4] = m11;
14
+ out[5] = m21;
15
+ out[6] = m02;
16
+ out[7] = m12;
17
+ out[8] = m22;
18
+ out[9] = m03;
19
+ out[10] = m13;
20
+ out[11] = m23;
21
+ return out;
22
+ }
23
+ /** Writes a copy of `a` into `out`. `out` may be `a`. */
24
+ export function affine3Copy(out, a) {
25
+ out[0] = a[0];
26
+ out[1] = a[1];
27
+ out[2] = a[2];
28
+ out[3] = a[3];
29
+ out[4] = a[4];
30
+ out[5] = a[5];
31
+ out[6] = a[6];
32
+ out[7] = a[7];
33
+ out[8] = a[8];
34
+ out[9] = a[9];
35
+ out[10] = a[10];
36
+ out[11] = a[11];
37
+ return out;
38
+ }
39
+ /**
40
+ * Writes the identity transform `[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]` into
41
+ * `out`.
42
+ */
43
+ export function affine3Identity(out) {
44
+ out[0] = 1;
45
+ out[1] = 0;
46
+ out[2] = 0;
47
+ out[3] = 0;
48
+ out[4] = 1;
49
+ out[5] = 0;
50
+ out[6] = 0;
51
+ out[7] = 0;
52
+ out[8] = 1;
53
+ out[9] = 0;
54
+ out[10] = 0;
55
+ out[11] = 0;
56
+ return out;
57
+ }
58
+ /**
59
+ * Exact entry-wise equality: `−0` equals `+0`, and `NaN` equals nothing, itself
60
+ * included. See {@link affine3IsClose} for a tolerant test.
61
+ */
62
+ export function affine3Equals(a, b) {
63
+ return (a[0] === b[0] &&
64
+ a[1] === b[1] &&
65
+ a[2] === b[2] &&
66
+ a[3] === b[3] &&
67
+ a[4] === b[4] &&
68
+ a[5] === b[5] &&
69
+ a[6] === b[6] &&
70
+ a[7] === b[7] &&
71
+ a[8] === b[8] &&
72
+ a[9] === b[9] &&
73
+ a[10] === b[10] &&
74
+ a[11] === b[11]);
75
+ }
76
+ /**
77
+ * Entry-wise approximate equality, each pair compared by `@ac-kit/core`'s
78
+ * `isCloseTo` with `options`: none means exact.
79
+ *
80
+ * Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
81
+ * and never a basis for ordering — use {@link affine3Equals} there. The
82
+ * tolerance is required: a transform carries no units of its own, so only the
83
+ * caller knows what counts as close (and the same tolerance covers a matrix
84
+ * entry and a translation).
85
+ */
86
+ export function affine3IsClose(a, b, options) {
87
+ return (isCloseTo(a[0], b[0], options) &&
88
+ isCloseTo(a[1], b[1], options) &&
89
+ isCloseTo(a[2], b[2], options) &&
90
+ isCloseTo(a[3], b[3], options) &&
91
+ isCloseTo(a[4], b[4], options) &&
92
+ isCloseTo(a[5], b[5], options) &&
93
+ isCloseTo(a[6], b[6], options) &&
94
+ isCloseTo(a[7], b[7], options) &&
95
+ isCloseTo(a[8], b[8], options) &&
96
+ isCloseTo(a[9], b[9], options) &&
97
+ isCloseTo(a[10], b[10], options) &&
98
+ isCloseTo(a[11], b[11], options));
99
+ }
100
+ //# sourceMappingURL=affine3-componentwise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affine3-componentwise.js","sourceRoot":"","sources":["../src/affine3-componentwise.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAElH,OAAO,EAAE,SAAS,EAAyB,MAAM,cAAc,CAAC;AAIhE;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACzB,GAAY,EACZ,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW;IAEX,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAA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,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;QAC9B,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;QAChC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAChC,CAAC;AACH,CAAC"}
@@ -0,0 +1,205 @@
1
+ import type { Quaternion, ReadonlyQuaternion } from "@ac-kit/math-complex";
2
+ import type { Brand_ } from "./_brand.js";
3
+ import type { ReadonlyMat3x3 } from "./mat3x3.js";
4
+ import type { ReadonlyMat4x4 } from "./mat4x4.js";
5
+ import type { ReadonlyVec3, Vec3 } from "./vec3.js";
6
+ /**
7
+ * A 3D affine transform: four columns of three, the x axis, the y axis, the z
8
+ * axis and the translation, the 4 × 4 matrix without its bottom row `0, 0, 0,
9
+ * 1` (a WGSL `mat4x3f`), so the translation sits at 9, 10 and 11. A plain array
10
+ * of twelve binary64 numbers carrying a type-level brand; a buffer of them is a
11
+ * `Float64Array` of `count × 12` numbers.
12
+ *
13
+ * Only {@link affine3Create}, {@link affine3Of}, {@link affine3OfRows},
14
+ * {@link affine3Clone}, {@link affine3FromArray} and the functions that write an
15
+ * `out` make one; see {@link Vec3} for the rules that bind callers who bypass
16
+ * the types.
17
+ */
18
+ export type Affine3 = [
19
+ m00: number,
20
+ m10: number,
21
+ m20: number,
22
+ m01: number,
23
+ m11: number,
24
+ m21: number,
25
+ m02: number,
26
+ m12: number,
27
+ m22: number,
28
+ m03: number,
29
+ m13: number,
30
+ m23: number
31
+ ] & Brand_<"Affine3">;
32
+ /** An {@link Affine3} that is only read. */
33
+ export type ReadonlyAffine3 = readonly [
34
+ m00: number,
35
+ m10: number,
36
+ m20: number,
37
+ m01: number,
38
+ m11: number,
39
+ m21: number,
40
+ m02: number,
41
+ m12: number,
42
+ m22: number,
43
+ m03: number,
44
+ m13: number,
45
+ m23: number
46
+ ] & Brand_<"Affine3">;
47
+ /**
48
+ * Creates the identity transform.
49
+ *
50
+ * Allocates; keep it out of hot loops.
51
+ */
52
+ export declare function affine3Create(): Affine3;
53
+ /**
54
+ * Creates the transform with the entries in storage order, the columns one
55
+ * after the other: `m00, m10, m20` is the x axis, `m03, m13, m23` the
56
+ * translation.
57
+ *
58
+ * Allocates; keep it out of hot loops.
59
+ */
60
+ export declare function affine3Of(m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number, m03: number, m13: number, m23: number): Affine3;
61
+ /**
62
+ * Creates the transform from the three rows of its 3 × 4 matrix, written as in
63
+ * a textbook: `m00, m01, m02, m03` is the first row, whose last entry is the x
64
+ * translation.
65
+ *
66
+ * Allocates; keep it out of hot loops.
67
+ */
68
+ export declare function affine3OfRows(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number): Affine3;
69
+ /**
70
+ * Creates a copy of `a`. Like every creator it starts from a clean array.
71
+ *
72
+ * Allocates; keep it out of hot loops.
73
+ */
74
+ export declare function affine3Clone(a: ReadonlyAffine3): Affine3;
75
+ /**
76
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
77
+ * origin): `source[offset … offset + 12)` copied into `out`, each element that
78
+ * is not a number written as `NaN`, an index past the end of `source` too, so
79
+ * `out` never holds a non-number. A cold path. O(1).
80
+ *
81
+ * `source` may be `out` itself: the twelve elements are read before the first
82
+ * write.
83
+ *
84
+ * @param out The transform to fill.
85
+ * @param source The array to read, of any length and any content.
86
+ * @param offset The index of the first entry in `source`.
87
+ * @returns `out`.
88
+ */
89
+ export declare function affine3FromArray(out: Affine3, source: ArrayLike<number>, offset?: number): Affine3;
90
+ /**
91
+ * Whether every entry is a finite number: the check to run after parsing
92
+ * untrusted data or before an upload, as operations never check. An entry that
93
+ * is not a number at all counts as not finite.
94
+ */
95
+ export declare function affine3IsFinite(a: ReadonlyAffine3): boolean;
96
+ /**
97
+ * Writes the composition `a · b` into `out`: `b` is applied first, then `a`.
98
+ * Not commutative. Plain arithmetic, straight-line: the entries of the product
99
+ * of the two 4 × 4 matrices that these stand for, without the bottom row's
100
+ * zeros. `out` may be `a` or `b`.
101
+ */
102
+ export declare function affine3Multiply(out: Affine3, a: ReadonlyAffine3, b: ReadonlyAffine3): Affine3;
103
+ /**
104
+ * The determinant of the linear part: the signed volume scale of the transform,
105
+ * negative for a reflection. Plain arithmetic.
106
+ */
107
+ export declare function affine3Determinant(a: ReadonlyAffine3): number;
108
+ /**
109
+ * Writes the inverse transform of `a` into `out` and returns `true`. When the
110
+ * determinant of the linear part is zero or not finite, or the inverse does not
111
+ * fit in binary64, the transform has no usable inverse: `out` is filled with
112
+ * `NaN` and the result is `false`: `true` always comes with a finite `out`,
113
+ * never a stale or partial transform, and nothing throws. A transform whose
114
+ * linear part has very large or very small entries, whose determinant or
115
+ * cofactors overflow or underflow, is inverted all the same (a uniform scale of
116
+ * `1e-100` gives `1e100`; scales of `2^600`, `2^599` and `2^600` with a
117
+ * translation of `Number.MAX_VALUE` invert too), by inverting the linear part
118
+ * as {@link mat3x3Invert} does and taking the translation from that unscaled
119
+ * inverse. Plain arithmetic (the adjugate over the determinant). Each
120
+ * translation component is `−B · t` for the returned linear part `B` and the
121
+ * translation `t`: in plain arithmetic when a forward error bound keeps it
122
+ * within `2^-41` of itself, and otherwise correctly rounded (`dotExactInto`),
123
+ * however its terms cancel (a linear part whose inverse starts with the row
124
+ * `(1, 1, 1)` and a translation of `(Number.MAX_VALUE, 1, −Number.MAX_VALUE)`
125
+ * give `−1`, not `0`). Whether it overflows is decided on the exact `−A⁻¹ · t`,
126
+ * never on the rounded `B`: a component that a rigorous bound cannot keep from
127
+ * the overflow threshold is settled in exact arithmetic, and is then `−A⁻¹ · t`
128
+ * rounded once (an x scale of `161/256` with an x translation of `161 · 2^1016`
129
+ * is refused, its exact `−2^1024` overflowing where `−B · t` rounds to
130
+ * `−Number.MAX_VALUE`). `out` may be `a`.
131
+ */
132
+ export declare function affine3Invert(out: Affine3, a: ReadonlyAffine3): boolean;
133
+ /** Writes the translation by `translation` into `out`. */
134
+ export declare function affine3FromTranslation(out: Affine3, translation: ReadonlyVec3): Affine3;
135
+ /** Writes the scale `diag(scale)` into `out`. */
136
+ export declare function affine3FromScale(out: Affine3, scale: ReadonlyVec3): Affine3;
137
+ /**
138
+ * Writes the rotation by `angle` radians about the x axis (right-hand rule)
139
+ * into `out`.
140
+ */
141
+ export declare function affine3FromRotationX(out: Affine3, angle: number): Affine3;
142
+ /**
143
+ * Writes the rotation by `angle` radians about the y axis (right-hand rule)
144
+ * into `out`.
145
+ */
146
+ export declare function affine3FromRotationY(out: Affine3, angle: number): Affine3;
147
+ /**
148
+ * Writes the rotation by `angle` radians about the z axis (right-hand rule)
149
+ * into `out`.
150
+ */
151
+ export declare function affine3FromRotationZ(out: Affine3, angle: number): Affine3;
152
+ /**
153
+ * Writes the rotation by `angle` radians about the unit vector `axis`
154
+ * (right-hand rule, Rodrigues' formula) into `out`. `axis` is not normalised
155
+ * here: for any other length the matrix is not a rotation.
156
+ */
157
+ export declare function affine3FromAxisAngle(out: Affine3, axis: ReadonlyVec3, angle: number): Affine3;
158
+ /**
159
+ * Writes the rotation of the unit quaternion `q`, with no translation, into
160
+ * `out`. `q` must be unit length; it is not normalised here.
161
+ */
162
+ export declare function affine3FromQuaternion(out: Affine3, q: ReadonlyQuaternion): Affine3;
163
+ /** Writes the 3 × 3 matrix `m` as a transform with no translation into `out`. */
164
+ export declare function affine3FromMat3x3(out: Affine3, m: ReadonlyMat3x3): Affine3;
165
+ /**
166
+ * Writes the upper three rows of `m` into `out`, dropping its bottom row, which
167
+ * an {@link Affine3} does not store (`0, 0, 0, 1` for an affine matrix). A
168
+ * perspective row is lost.
169
+ */
170
+ export declare function affine3FromMat4x4(out: Affine3, m: ReadonlyMat4x4): Affine3;
171
+ /**
172
+ * Writes the transform that scales, then rotates, then translates into `out`:
173
+ * `T · R · S`, with `rotation` a unit quaternion (not normalised here).
174
+ */
175
+ export declare function affine3Compose(out: Affine3, translation: ReadonlyVec3, rotation: ReadonlyQuaternion, scale: ReadonlyVec3): Affine3;
176
+ /**
177
+ * Splits `a` into the translation, rotation and scale that
178
+ * {@link affine3Compose} builds it from: the translation is the last column, the
179
+ * scale is the length of each of the other three, and the rotation is the unit
180
+ * quaternion of those columns divided by it. A reflection (negative
181
+ * determinant) puts its sign in the x scale, so the rotation is proper.
182
+ *
183
+ * Returns `false` when there is no such split: a column of zero length or not
184
+ * finite, two columns further from perpendicular than about `1e-6` in cosine (a
185
+ * shear), or a translation that is not finite. The three outputs then hold
186
+ * `NaN`, never a stale or partial result, and nothing throws.
187
+ */
188
+ export declare function affine3Decompose(outTranslation: Vec3, outRotation: Quaternion, outScale: Vec3, a: ReadonlyAffine3): boolean;
189
+ /**
190
+ * Writes `a · T(translation)` into `out`: the translation applied first, in the
191
+ * local space of `a`. Only the translation column changes. `out` may be `a`.
192
+ */
193
+ export declare function affine3Translate(out: Affine3, a: ReadonlyAffine3, translation: ReadonlyVec3): Affine3;
194
+ /**
195
+ * Writes `a · R(rotation)` into `out`: the rotation of the unit quaternion
196
+ * `rotation` applied first, in the local space of `a` (`rotation` is not
197
+ * normalised here). The translation does not change. `out` may be `a`.
198
+ */
199
+ export declare function affine3Rotate(out: Affine3, a: ReadonlyAffine3, rotation: ReadonlyQuaternion): Affine3;
200
+ /**
201
+ * Writes `a · S(scale)` into `out`: the scale applied first, in the local space
202
+ * of `a`. The translation does not change. `out` may be `a`.
203
+ */
204
+ export declare function affine3Scale(out: Affine3, a: ReadonlyAffine3, scale: ReadonlyVec3): Affine3;
205
+ //# sourceMappingURL=affine3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affine3.d.ts","sourceRoot":"","sources":["../src/affine3.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC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