@ac-kit/math-linear 0.2.0 → 0.3.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 +268 -0
- package/README.md +229 -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 +19 -0
- package/dist/_invert.d.ts.map +1 -0
- package/dist/_invert.js +48 -0
- package/dist/_invert.js.map +1 -0
- package/dist/_slerp.d.ts +15 -0
- package/dist/_slerp.d.ts.map +1 -1
- package/dist/_slerp.js +47 -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 +144 -0
- package/dist/affine2.d.ts.map +1 -0
- package/dist/affine2.js +375 -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 +192 -0
- package/dist/affine3.d.ts.map +1 -0
- package/dist/affine3.js +718 -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 +67 -25
- package/dist/mat2x2.d.ts.map +1 -1
- package/dist/mat2x2.js +150 -94
- 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 +131 -48
- package/dist/mat3x3.d.ts.map +1 -1
- package/dist/mat3x3.js +434 -193
- 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 +195 -67
- package/dist/mat4x4.d.ts.map +1 -1
- package/dist/mat4x4.js +849 -335
- package/dist/mat4x4.js.map +1 -1
- package/dist/projection.d.ts +98 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +369 -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 +104 -22
- package/dist/quaternion.d.ts.map +1 -1
- package/dist/quaternion.js +294 -181
- 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 +189 -0
- package/dist/vec2-array-componentwise.d.ts.map +1 -0
- package/dist/vec2-array-componentwise.js +424 -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 +189 -0
- package/dist/vec3-array-componentwise.d.ts.map +1 -0
- package/dist/vec3-array-componentwise.js +458 -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 +366 -273
- package/dist/vec3.js.map +1 -1
- package/dist/vec4-array-componentwise.d.ts +155 -0
- package/dist/vec4-array-componentwise.d.ts.map +1 -0
- package/dist/vec4-array-componentwise.js +401 -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 +57 -53
- package/dist/vec4.d.ts.map +1 -1
- package/dist/vec4.js +94 -246
- 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 +18 -9
package/dist/mat2x2.js
CHANGED
|
@@ -1,111 +1,167 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
];
|
|
1
|
+
import { sumOfProducts } from "@ac-kit/math-scalar";
|
|
2
|
+
import { scaleForInversion_, unscaleInverse_ } from "./_invert.js";
|
|
3
|
+
/**
|
|
4
|
+
* Writes the product `a · b` into `out`: `b` is applied first. Not commutative.
|
|
5
|
+
* Plain arithmetic: each entry is within two roundings of the exact value
|
|
6
|
+
* relative to the sum of the absolute values of its terms, so it can lose every
|
|
7
|
+
* digit where the terms cancel (see {@link mat2x2MultiplyPrecise}). `out` may be
|
|
8
|
+
* `a` or `b`.
|
|
9
|
+
*/
|
|
10
|
+
export function mat2x2Multiply(out, a, b) {
|
|
11
|
+
const a0 = a[0];
|
|
12
|
+
const a1 = a[1];
|
|
13
|
+
const a2 = a[2];
|
|
14
|
+
const a3 = a[3];
|
|
15
|
+
const b0 = b[0];
|
|
16
|
+
const b1 = b[1];
|
|
17
|
+
const b2 = b[2];
|
|
18
|
+
const b3 = b[3];
|
|
19
|
+
out[0] = a0 * b0 + a2 * b1;
|
|
20
|
+
out[1] = a1 * b0 + a3 * b1;
|
|
21
|
+
out[2] = a0 * b2 + a2 * b3;
|
|
22
|
+
out[3] = a1 * b2 + a3 * b3;
|
|
23
|
+
return out;
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
/**
|
|
26
|
+
* {@link mat2x2Multiply} with each entry a compensated sum of products, within
|
|
27
|
+
* 1.5 ULP of the exact value however badly the terms cancel. `out` may be `a`
|
|
28
|
+
* or `b`.
|
|
29
|
+
*/
|
|
30
|
+
export function mat2x2MultiplyPrecise(out, a, b) {
|
|
31
|
+
const a0 = a[0];
|
|
32
|
+
const a1 = a[1];
|
|
33
|
+
const a2 = a[2];
|
|
34
|
+
const a3 = a[3];
|
|
35
|
+
const b0 = b[0];
|
|
36
|
+
const b1 = b[1];
|
|
37
|
+
const b2 = b[2];
|
|
38
|
+
const b3 = b[3];
|
|
39
|
+
out[0] = sumOfProducts(a0, b0, a2, b1);
|
|
40
|
+
out[1] = sumOfProducts(a1, b0, a3, b1);
|
|
41
|
+
out[2] = sumOfProducts(a0, b2, a2, b3);
|
|
42
|
+
out[3] = sumOfProducts(a1, b2, a3, b3);
|
|
43
|
+
return out;
|
|
28
44
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Writes `m · diag(v)` into `out`: column `c` of `m` multiplied by `v[c]`.
|
|
47
|
+
* `out` may be `m`.
|
|
48
|
+
*/
|
|
49
|
+
export function mat2x2ScaleColumns(out, m, v) {
|
|
50
|
+
out[0] = m[0] * v[0];
|
|
51
|
+
out[1] = m[1] * v[0];
|
|
52
|
+
out[2] = m[2] * v[1];
|
|
53
|
+
out[3] = m[3] * v[1];
|
|
54
|
+
return out;
|
|
34
55
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
];
|
|
56
|
+
/**
|
|
57
|
+
* Writes `diag(v) · m` into `out`: row `r` of `m` multiplied by `v[r]`. `out`
|
|
58
|
+
* may be `m`.
|
|
59
|
+
*/
|
|
60
|
+
export function mat2x2ScaleRows(out, m, v) {
|
|
61
|
+
out[0] = m[0] * v[0];
|
|
62
|
+
out[1] = m[1] * v[1];
|
|
63
|
+
out[2] = m[2] * v[0];
|
|
64
|
+
out[3] = m[3] * v[1];
|
|
65
|
+
return out;
|
|
46
66
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
];
|
|
67
|
+
/** Writes the transpose of `m` into `out`. `out` may be `m`. */
|
|
68
|
+
export function mat2x2Transpose(out, m) {
|
|
69
|
+
const m1 = m[1];
|
|
70
|
+
const m2 = m[2];
|
|
71
|
+
out[0] = m[0];
|
|
72
|
+
out[1] = m2;
|
|
73
|
+
out[2] = m1;
|
|
74
|
+
out[3] = m[3];
|
|
75
|
+
return out;
|
|
52
76
|
}
|
|
53
|
-
|
|
54
|
-
|
|
77
|
+
/**
|
|
78
|
+
* The determinant, in plain arithmetic: the signed area scale of the
|
|
79
|
+
* transformation.
|
|
80
|
+
*/
|
|
81
|
+
export function mat2x2Determinant(m) {
|
|
82
|
+
return m[0] * m[3] - m[2] * m[1];
|
|
55
83
|
}
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Writes the inverse of `m` into `out` and returns `true`. When `m` has no
|
|
86
|
+
* inverse a binary64 number can hold (the determinant is zero, an entry is not
|
|
87
|
+
* finite, or an entry of the inverse overflows) `out` is filled with `NaN` and
|
|
88
|
+
* the result is `false`: `true` always comes with a finite `out`, never a stale
|
|
89
|
+
* or partial matrix, and nothing throws. A matrix of one very large or very
|
|
90
|
+
* small magnitude, whose determinant overflows or underflows, is inverted all
|
|
91
|
+
* the same (`diag(1e-150)` gives `diag(1e150)`), by scaling it by a power of
|
|
92
|
+
* two first. Plain arithmetic. `out` may be `m`.
|
|
93
|
+
*/
|
|
94
|
+
export function mat2x2Invert(out, m) {
|
|
95
|
+
if (invert_(out, m, false)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const exponent = scaleForInversion_(out, m);
|
|
99
|
+
if (!Number.isNaN(exponent) &&
|
|
100
|
+
invert_(out, out, true) &&
|
|
101
|
+
unscaleInverse_(out, exponent)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
out[0] = Number.NaN;
|
|
105
|
+
out[1] = Number.NaN;
|
|
106
|
+
out[2] = Number.NaN;
|
|
107
|
+
out[3] = Number.NaN;
|
|
108
|
+
return false;
|
|
62
109
|
}
|
|
63
110
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
111
|
+
* The inverse by the adjugate over the determinant, written to `out` only when
|
|
112
|
+
* every entry is finite. The reciprocal of the determinant multiplies the
|
|
113
|
+
* adjugate; when it overflows (a subnormal determinant) the adjugate is divided
|
|
114
|
+
* by the determinant instead, if `divide`, and not otherwise.
|
|
68
115
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
116
|
+
function invert_(out, m, divide) {
|
|
117
|
+
const m0 = m[0];
|
|
118
|
+
const m1 = m[1];
|
|
119
|
+
const m2 = m[2];
|
|
120
|
+
const m3 = m[3];
|
|
121
|
+
const determinant = m0 * m3 - m2 * m1;
|
|
122
|
+
if (determinant === 0 || !Number.isFinite(determinant)) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
const scale = 1 / determinant;
|
|
126
|
+
const reciprocal = Number.isFinite(scale);
|
|
127
|
+
if (!reciprocal && !divide) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const o0 = reciprocal ? m3 * scale : m3 / determinant;
|
|
131
|
+
const o1 = reciprocal ? -m1 * scale : -m1 / determinant;
|
|
132
|
+
const o2 = reciprocal ? -m2 * scale : -m2 / determinant;
|
|
133
|
+
const o3 = reciprocal ? m0 * scale : m0 / determinant;
|
|
134
|
+
if (!(Number.isFinite(o0) &&
|
|
135
|
+
Number.isFinite(o1) &&
|
|
136
|
+
Number.isFinite(o2) &&
|
|
137
|
+
Number.isFinite(o3))) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
out[0] = o0;
|
|
141
|
+
out[1] = o1;
|
|
142
|
+
out[2] = o2;
|
|
143
|
+
out[3] = o3;
|
|
144
|
+
return true;
|
|
74
145
|
}
|
|
75
146
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
147
|
+
* Writes the rotation by `angle` radians, counter-clockwise, into `out`: `[cos,
|
|
148
|
+
* sin, −sin, cos]`.
|
|
78
149
|
*/
|
|
79
|
-
export function mat2x2FromRotation(angle) {
|
|
150
|
+
export function mat2x2FromRotation(out, angle) {
|
|
80
151
|
const cos = Math.cos(angle);
|
|
81
152
|
const sin = Math.sin(angle);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
];
|
|
86
|
-
|
|
87
|
-
export function mat2x2Invert(matrix) {
|
|
88
|
-
const det = mat2x2Determinant(matrix);
|
|
89
|
-
if (det === 0) {
|
|
90
|
-
throw new Error("Matrix is not invertible");
|
|
91
|
-
}
|
|
92
|
-
const [[a, b], [c, d]] = matrix;
|
|
93
|
-
const adjugate = [
|
|
94
|
-
[d, -b],
|
|
95
|
-
[-c, a],
|
|
96
|
-
];
|
|
97
|
-
return mat2x2MultiplyScalar(adjugate, 1 / det);
|
|
98
|
-
}
|
|
99
|
-
export function mat2x2Negate(matrix) {
|
|
100
|
-
return [
|
|
101
|
-
[-matrix[0][0], -matrix[0][1]],
|
|
102
|
-
[-matrix[1][0], -matrix[1][1]],
|
|
103
|
-
];
|
|
153
|
+
out[0] = cos;
|
|
154
|
+
out[1] = sin;
|
|
155
|
+
out[2] = -sin;
|
|
156
|
+
out[3] = cos;
|
|
157
|
+
return out;
|
|
104
158
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
];
|
|
159
|
+
/** Writes the scale `diag(scale)` into `out`. */
|
|
160
|
+
export function mat2x2FromScale(out, scale) {
|
|
161
|
+
out[0] = scale[0];
|
|
162
|
+
out[1] = 0;
|
|
163
|
+
out[2] = 0;
|
|
164
|
+
out[3] = scale[1];
|
|
165
|
+
return out;
|
|
110
166
|
}
|
|
111
167
|
//# sourceMappingURL=mat2x2.js.map
|
package/dist/mat2x2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mat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I,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACd,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;IACb,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,KAAmB;IAC/D,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReadonlyMat3x3, Mat3x3 } from "./mat3x3.js";
|
|
2
|
+
/**
|
|
3
|
+
* Writes element `index` of `array`, the numbers at `[index·9, index·9 + 9)`,
|
|
4
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
5
|
+
* end of `array` gives `NaN`, never `undefined`: the matrix stays clean
|
|
6
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
7
|
+
* layer.
|
|
8
|
+
*
|
|
9
|
+
* The matrix is copied: it is never a view of `array`. O(1).
|
|
10
|
+
*/
|
|
11
|
+
export declare function mat3x3Load(out: Mat3x3, array: Float64Array, index: number): Mat3x3;
|
|
12
|
+
/**
|
|
13
|
+
* Writes `value` into `array` as element `index`, at `[index·9, index·9 + 9)`.
|
|
14
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
15
|
+
* out-of-range write. O(1).
|
|
16
|
+
*/
|
|
17
|
+
export declare function mat3x3Store(array: Float64Array, index: number, value: ReadonlyMat3x3): void;
|
|
18
|
+
/**
|
|
19
|
+
* Like {@link mat3x3Load} for interleaved data: element `index` starts at
|
|
20
|
+
* `offset + index·stride`, both counted in numbers, and its 9 components follow
|
|
21
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
22
|
+
*/
|
|
23
|
+
export declare function mat3x3LoadStrided(out: Mat3x3, array: Float64Array, offset: number, stride: number, index: number): Mat3x3;
|
|
24
|
+
/**
|
|
25
|
+
* Like {@link mat3x3Store} for interleaved data: element `index` starts at
|
|
26
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
27
|
+
* `array` writes nothing. O(1).
|
|
28
|
+
*/
|
|
29
|
+
export declare function mat3x3StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlyMat3x3): void;
|
|
30
|
+
/**
|
|
31
|
+
* Whether every number of `array` is finite: the check for a buffer of mat3x3
|
|
32
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
33
|
+
* required to be a multiple of 9 (see `assertFiniteBuffer` for that). O(n).
|
|
34
|
+
*/
|
|
35
|
+
export declare function mat3x3ArrayIsFinite(array: Float64Array): boolean;
|
|
36
|
+
//# sourceMappingURL=mat3x3-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mat3x3-array.d.ts","sourceRoot":"","sources":["../src/mat3x3-array.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACX,MAAM,CAaR;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,GACnB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,MAAM,CAaR;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,GACnB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAOhE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Generated from scripts/templates/value-array.liquid by scripts/generate-componentwise.ts. Do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* Writes element `index` of `array`, the numbers at `[index·9, index·9 + 9)`,
|
|
4
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
5
|
+
* end of `array` gives `NaN`, never `undefined`: the matrix stays clean
|
|
6
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
7
|
+
* layer.
|
|
8
|
+
*
|
|
9
|
+
* The matrix is copied: it is never a view of `array`. O(1).
|
|
10
|
+
*/
|
|
11
|
+
export function mat3x3Load(out, array, index) {
|
|
12
|
+
const base = index * 9;
|
|
13
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
14
|
+
out[0] = +array[base];
|
|
15
|
+
out[1] = +array[base + 1];
|
|
16
|
+
out[2] = +array[base + 2];
|
|
17
|
+
out[3] = +array[base + 3];
|
|
18
|
+
out[4] = +array[base + 4];
|
|
19
|
+
out[5] = +array[base + 5];
|
|
20
|
+
out[6] = +array[base + 6];
|
|
21
|
+
out[7] = +array[base + 7];
|
|
22
|
+
out[8] = +array[base + 8];
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Writes `value` into `array` as element `index`, at `[index·9, index·9 + 9)`.
|
|
27
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
28
|
+
* out-of-range write. O(1).
|
|
29
|
+
*/
|
|
30
|
+
export function mat3x3Store(array, index, value) {
|
|
31
|
+
const base = index * 9;
|
|
32
|
+
array[base] = value[0];
|
|
33
|
+
array[base + 1] = value[1];
|
|
34
|
+
array[base + 2] = value[2];
|
|
35
|
+
array[base + 3] = value[3];
|
|
36
|
+
array[base + 4] = value[4];
|
|
37
|
+
array[base + 5] = value[5];
|
|
38
|
+
array[base + 6] = value[6];
|
|
39
|
+
array[base + 7] = value[7];
|
|
40
|
+
array[base + 8] = value[8];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Like {@link mat3x3Load} for interleaved data: element `index` starts at
|
|
44
|
+
* `offset + index·stride`, both counted in numbers, and its 9 components follow
|
|
45
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
46
|
+
*/
|
|
47
|
+
export function mat3x3LoadStrided(out, array, offset, stride, index) {
|
|
48
|
+
const base = offset + index * stride;
|
|
49
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
50
|
+
out[0] = +array[base];
|
|
51
|
+
out[1] = +array[base + 1];
|
|
52
|
+
out[2] = +array[base + 2];
|
|
53
|
+
out[3] = +array[base + 3];
|
|
54
|
+
out[4] = +array[base + 4];
|
|
55
|
+
out[5] = +array[base + 5];
|
|
56
|
+
out[6] = +array[base + 6];
|
|
57
|
+
out[7] = +array[base + 7];
|
|
58
|
+
out[8] = +array[base + 8];
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Like {@link mat3x3Store} for interleaved data: element `index` starts at
|
|
63
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
64
|
+
* `array` writes nothing. O(1).
|
|
65
|
+
*/
|
|
66
|
+
export function mat3x3StoreStrided(array, offset, stride, index, value) {
|
|
67
|
+
const base = offset + index * stride;
|
|
68
|
+
array[base] = value[0];
|
|
69
|
+
array[base + 1] = value[1];
|
|
70
|
+
array[base + 2] = value[2];
|
|
71
|
+
array[base + 3] = value[3];
|
|
72
|
+
array[base + 4] = value[4];
|
|
73
|
+
array[base + 5] = value[5];
|
|
74
|
+
array[base + 6] = value[6];
|
|
75
|
+
array[base + 7] = value[7];
|
|
76
|
+
array[base + 8] = value[8];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Whether every number of `array` is finite: the check for a buffer of mat3x3
|
|
80
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
81
|
+
* required to be a multiple of 9 (see `assertFiniteBuffer` for that). O(n).
|
|
82
|
+
*/
|
|
83
|
+
export function mat3x3ArrayIsFinite(array) {
|
|
84
|
+
for (let index = 0; index < array.length; index++) {
|
|
85
|
+
if (!Number.isFinite(array[index])) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=mat3x3-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mat3x3-array.js","sourceRoot":"","sources":["../src/mat3x3-array.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAIzG;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACzB,GAAW,EACX,KAAmB,EACnB,KAAa;IAEb,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;IACvB,mEAAmE;IACnE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC;IACvB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAE,CAAC;IAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAE,CAAC;IAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAA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AAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAmB;IACtD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type IsCloseToOptions } from "@ac-kit/core";
|
|
2
|
+
import type { ReadonlyMat3x3, Mat3x3 } from "./mat3x3.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates the identity matrix.
|
|
5
|
+
*
|
|
6
|
+
* Allocates; keep it out of hot loops.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mat3x3Create(): Mat3x3;
|
|
9
|
+
/**
|
|
10
|
+
* Creates the matrix from its entries in storage order, the columns one after
|
|
11
|
+
* the other (`m10` is row 1, column 0): the order of the type's labels, of a
|
|
12
|
+
* `Float64Array` and of a GPU buffer. See {@link mat3x3OfRows} for the order of
|
|
13
|
+
* a textbook.
|
|
14
|
+
*
|
|
15
|
+
* Allocates; keep it out of hot loops.
|
|
16
|
+
*/
|
|
17
|
+
export declare function mat3x3Of(m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number): Mat3x3;
|
|
18
|
+
/**
|
|
19
|
+
* Creates the matrix from its entries row by row, as a matrix is written on
|
|
20
|
+
* paper: the first 3 arguments are the first row.
|
|
21
|
+
*
|
|
22
|
+
* Allocates; keep it out of hot loops.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mat3x3OfRows(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): Mat3x3;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a copy of `m`. Like every creator it starts from a clean array.
|
|
27
|
+
*
|
|
28
|
+
* Allocates; keep it out of hot loops.
|
|
29
|
+
*/
|
|
30
|
+
export declare function mat3x3Clone(m: ReadonlyMat3x3): Mat3x3;
|
|
31
|
+
/**
|
|
32
|
+
* The checked way in from untyped data (JSON, messages, arrays of unknown
|
|
33
|
+
* origin): `source[offset … offset + 9)` copied into `out`, each element that
|
|
34
|
+
* is not a number written as `NaN`, an index below zero or at or past
|
|
35
|
+
* `source.length` too, so `out` never holds a non-number. Test the result with
|
|
36
|
+
* {@link mat3x3IsFinite} when `NaN` must not get through. A cold path. O(1).
|
|
37
|
+
*
|
|
38
|
+
* `source` may be `out` itself: the 9 elements are read before the first write.
|
|
39
|
+
*
|
|
40
|
+
* @param out The matrix to fill.
|
|
41
|
+
* @param source The array to read, of any length and any content, the entries
|
|
42
|
+
* in storage order.
|
|
43
|
+
* @param offset The index of the first entry in `source`.
|
|
44
|
+
* @returns `out`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function mat3x3FromArray(out: Mat3x3, source: ArrayLike<number>, offset?: number): Mat3x3;
|
|
47
|
+
/** Writes the matrix with the entries in storage order into `out`. */
|
|
48
|
+
export declare function mat3x3Set(out: Mat3x3, m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number): Mat3x3;
|
|
49
|
+
/** Writes the matrix with the entries given row by row into `out`. */
|
|
50
|
+
export declare function mat3x3SetRows(out: Mat3x3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): Mat3x3;
|
|
51
|
+
/** Writes a copy of `m` into `out`. */
|
|
52
|
+
export declare function mat3x3Copy(out: Mat3x3, m: ReadonlyMat3x3): Mat3x3;
|
|
53
|
+
/** Writes the identity matrix into `out`. */
|
|
54
|
+
export declare function mat3x3Identity(out: Mat3x3): Mat3x3;
|
|
55
|
+
/** Writes the zero matrix into `out`. */
|
|
56
|
+
export declare function mat3x3Zero(out: Mat3x3): Mat3x3;
|
|
57
|
+
/** Writes `a + b`, entry by entry, into `out`. `out` may be `a` or `b`. */
|
|
58
|
+
export declare function mat3x3Add(out: Mat3x3, a: ReadonlyMat3x3, b: ReadonlyMat3x3): Mat3x3;
|
|
59
|
+
/** Writes `a − b`, entry by entry, into `out`. `out` may be `a` or `b`. */
|
|
60
|
+
export declare function mat3x3Subtract(out: Mat3x3, a: ReadonlyMat3x3, b: ReadonlyMat3x3): Mat3x3;
|
|
61
|
+
/** Writes `m · scalar`, every entry multiplied, into `out`. `out` may be `m`. */
|
|
62
|
+
export declare function mat3x3MultiplyScalar(out: Mat3x3, m: ReadonlyMat3x3, scalar: number): Mat3x3;
|
|
63
|
+
/** Writes `−m`, every entry negated, into `out`. `out` may be `m`. */
|
|
64
|
+
export declare function mat3x3Negate(out: Mat3x3, m: ReadonlyMat3x3): Mat3x3;
|
|
65
|
+
/**
|
|
66
|
+
* Exact entry-wise equality: `−0` equals `+0`, and `NaN` equals nothing, itself
|
|
67
|
+
* included. See {@link mat3x3IsClose} for a tolerant test.
|
|
68
|
+
*/
|
|
69
|
+
export declare function mat3x3Equals(a: ReadonlyMat3x3, b: ReadonlyMat3x3): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Entry-wise approximate equality, each pair compared by `@ac-kit/core`'s
|
|
72
|
+
* `isCloseTo` with `options`: none means exact.
|
|
73
|
+
*
|
|
74
|
+
* Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
|
|
75
|
+
* and never a basis for ordering — use {@link mat3x3Equals} there. The tolerance
|
|
76
|
+
* is required: a matrix carries no units of its own, so only the caller knows
|
|
77
|
+
* what counts as close.
|
|
78
|
+
*/
|
|
79
|
+
export declare function mat3x3IsClose(a: ReadonlyMat3x3, b: ReadonlyMat3x3, options: IsCloseToOptions): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether every entry is a finite number: the check to run after parsing
|
|
82
|
+
* untrusted data or before an upload, as operations never check. An entry that
|
|
83
|
+
* is not a number at all counts as not finite.
|
|
84
|
+
*/
|
|
85
|
+
export declare function mat3x3IsFinite(m: ReadonlyMat3x3): boolean;
|
|
86
|
+
//# sourceMappingURL=mat3x3-componentwise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mat3x3-componentwise.d.ts","sourceRoot":"","sources":["../src/mat3x3-componentwise.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,gBAAgB,EAAiB,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAU1D;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACvB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,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