@ac-kit/math-linear 0.2.1 → 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 +257 -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/_slerp.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReadonlyQuaternion } from "@ac-kit/math-complex";
|
|
1
2
|
/**
|
|
2
3
|
* Largest `dot` at which spherical linear interpolation still divides by `sin
|
|
3
4
|
* θ₀` safely; above it, callers fall back to normalised linear interpolation.
|
|
@@ -37,4 +38,18 @@
|
|
|
37
38
|
* computes the answer, never what the answer means.
|
|
38
39
|
*/
|
|
39
40
|
export declare const SLERP_LINEAR_FALLBACK_DOT_ = 0.9995;
|
|
41
|
+
/**
|
|
42
|
+
* Whether two quaternions lie in opposite hemispheres, `q1 · q2 < 0`, so that
|
|
43
|
+
* negating `q2` takes the shorter arc.
|
|
44
|
+
*
|
|
45
|
+
* The plain dot product `plainDot` decides when its magnitude exceeds its error
|
|
46
|
+
* bound, underflow included, which is nearly always. When it does not, the sign
|
|
47
|
+
* is whatever rounding left, and `exactSign` decides: by default the sign of
|
|
48
|
+
* the exact dot product, which no precision of compensated summation guarantees
|
|
49
|
+
* (a dot product of `−2⁻¹²⁰` is `0` to `dotPrecise`, and `−1` to `dotSign`),
|
|
50
|
+
* for any finite components. The magnitude, for the angle and the linear
|
|
51
|
+
* fallback threshold, stays the plain one: an error of a few ulp is harmless
|
|
52
|
+
* there.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isOppositeHemisphere_(q1: ReadonlyQuaternion, q2: ReadonlyQuaternion, plainDot: number, exactSign?: (a: ReadonlyQuaternion, b: ReadonlyQuaternion) => number): boolean;
|
|
40
55
|
//# sourceMappingURL=_slerp.d.ts.map
|
package/dist/_slerp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_slerp.d.ts","sourceRoot":"","sources":["../src/_slerp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,0BAA0B,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"_slerp.d.ts","sourceRoot":"","sources":["../src/_slerp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,0BAA0B,SAAS,CAAC;AA0BjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACpC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,kBAAkB,EACtB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,KAAK,MAAgB,GAC3E,OAAO,CAaT"}
|
package/dist/_slerp.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dotSign } from "@ac-kit/math-scalar";
|
|
1
2
|
/**
|
|
2
3
|
* Largest `dot` at which spherical linear interpolation still divides by `sin
|
|
3
4
|
* θ₀` safely; above it, callers fall back to normalised linear interpolation.
|
|
@@ -37,4 +38,50 @@
|
|
|
37
38
|
* computes the answer, never what the answer means.
|
|
38
39
|
*/
|
|
39
40
|
export const SLERP_LINEAR_FALLBACK_DOT_ = 0.9995;
|
|
41
|
+
/**
|
|
42
|
+
* The error of the plain four-term dot product, relative to the sum of the
|
|
43
|
+
* products' magnitudes; see {@link DOT_UNDERFLOW_ERROR_} for the whole bound.
|
|
44
|
+
*/
|
|
45
|
+
const DOT_ERROR_FACTOR_ = 4 * Number.EPSILON;
|
|
46
|
+
/**
|
|
47
|
+
* The absolute part of the error bound, `4·2⁻¹⁰⁷⁴`: what underflow adds.
|
|
48
|
+
*
|
|
49
|
+
* With `pᵢ = q1ᵢ·q2ᵢ`, `S = Σ|pᵢ|`, `u = ε / 2`, `m = 2⁻¹⁰⁷⁴` and `γₖ = ku / (1
|
|
50
|
+
* − ku)`: a product rounds within `u·|pᵢ|` while normal and within `m / 2` once
|
|
51
|
+
* subnormal, and a sum within `u` of itself (one that underflows is exact). So
|
|
52
|
+
* the plain dot, summed left to right, is within `γ₄·S + 2m·(1 + γ₃)` of the
|
|
53
|
+
* exact one.
|
|
54
|
+
*
|
|
55
|
+
* The bound is computed as `fl(fl(4ε·T) + 4m)`, with `T` the rounded sum of the
|
|
56
|
+
* rounded `|pᵢ|`: `T ≥ (1 − u)⁴·S − 2m`, `4ε·T` loses up to `m / 2` when it
|
|
57
|
+
* underflows, and the addition `u` of itself. That leaves at least `(1 −
|
|
58
|
+
* u)⁵·8u·S + (1 − u)·(3.5 − 16u)·m`, which covers both terms of the error: a
|
|
59
|
+
* plain dot of greater magnitude has the sign of the exact one. From `T =
|
|
60
|
+
* 2⁻⁹⁶⁸` up the absolute term is under half an ulp of `4ε·T` and rounds away.
|
|
61
|
+
*/
|
|
62
|
+
const DOT_UNDERFLOW_ERROR_ = 4 * Number.MIN_VALUE;
|
|
63
|
+
/**
|
|
64
|
+
* Whether two quaternions lie in opposite hemispheres, `q1 · q2 < 0`, so that
|
|
65
|
+
* negating `q2` takes the shorter arc.
|
|
66
|
+
*
|
|
67
|
+
* The plain dot product `plainDot` decides when its magnitude exceeds its error
|
|
68
|
+
* bound, underflow included, which is nearly always. When it does not, the sign
|
|
69
|
+
* is whatever rounding left, and `exactSign` decides: by default the sign of
|
|
70
|
+
* the exact dot product, which no precision of compensated summation guarantees
|
|
71
|
+
* (a dot product of `−2⁻¹²⁰` is `0` to `dotPrecise`, and `−1` to `dotSign`),
|
|
72
|
+
* for any finite components. The magnitude, for the angle and the linear
|
|
73
|
+
* fallback threshold, stays the plain one: an error of a few ulp is harmless
|
|
74
|
+
* there.
|
|
75
|
+
*/
|
|
76
|
+
export function isOppositeHemisphere_(q1, q2, plainDot, exactSign = dotSign) {
|
|
77
|
+
const termsMagnitude = Math.abs(q1[0] * q2[0]) +
|
|
78
|
+
Math.abs(q1[1] * q2[1]) +
|
|
79
|
+
Math.abs(q1[2] * q2[2]) +
|
|
80
|
+
Math.abs(q1[3] * q2[3]);
|
|
81
|
+
if (Math.abs(plainDot) >
|
|
82
|
+
DOT_ERROR_FACTOR_ * termsMagnitude + DOT_UNDERFLOW_ERROR_) {
|
|
83
|
+
return plainDot < 0;
|
|
84
|
+
}
|
|
85
|
+
return exactSign(q1, q2) < 0;
|
|
86
|
+
}
|
|
40
87
|
//# sourceMappingURL=_slerp.js.map
|
package/dist/_slerp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_slerp.js","sourceRoot":"","sources":["../src/_slerp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_slerp.js","sourceRoot":"","sources":["../src/_slerp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CACpC,EAAsB,EACtB,EAAsB,EACtB,QAAgB,EAChB,SAAS,GAA6D,OAAO;IAE7E,MAAM,cAAc,GACnB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACzB,IACC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,iBAAiB,GAAG,cAAc,GAAG,oBAAoB,EACxD,CAAC;QACF,OAAO,QAAQ,GAAG,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* That `count` elements of `elementSize` numbers, the first at `offset` and
|
|
3
|
+
* each `stride` numbers after the last, lie inside an array of `length`
|
|
4
|
+
* numbers: `count`, `offset` and `stride` are non-negative safe integers and,
|
|
5
|
+
* from two elements on, `stride` is at least `elementSize` (elements do not
|
|
6
|
+
* overlap). A `count` of zero needs nothing else.
|
|
7
|
+
*
|
|
8
|
+
* @throws {RangeError} Naming `name` and `role` (`"out"`, `"input"`) otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertStridedRange_(name: string, role: string, length: number, offset: number, stride: number, count: number, elementSize: number): void;
|
|
11
|
+
/**
|
|
12
|
+
* That the strided elements read from `input` and written into `out` (both
|
|
13
|
+
* `Float64Array`, already range-checked) either share no memory, or are the
|
|
14
|
+
* same elements: one array, one offset, one stride, each element read before it
|
|
15
|
+
* is written. Records that overlap in any other way (a shifted offset, an
|
|
16
|
+
* interleaving stride) would read what was already written, so they are
|
|
17
|
+
* refused. Equal strides are checked exactly; with two different strides the
|
|
18
|
+
* whole spans must be apart.
|
|
19
|
+
*
|
|
20
|
+
* @throws {RangeError} Naming `name` on an overlap that is not an exact alias.
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertStridedAlias_(name: string, out: Float64Array, outOffset: number, outStride: number, input: Float64Array, inputOffset: number, inputStride: number, count: number, elementSize: number): void;
|
|
23
|
+
//# sourceMappingURL=_strided-range.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_strided-range.d.ts","sourceRoot":"","sources":["../src/_strided-range.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GACjB,IAAI,CAmBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GACjB,IAAI,CAoCN"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { assertInteger, asUint8Array, buffersMayShareMemory, } from "@ac-kit/core";
|
|
2
|
+
/*
|
|
3
|
+
* The checks of the strided kernels, all O(1). The range check is
|
|
4
|
+
* `copyByteRows`' (`@ac-kit/core`'s byte-row validation is internal and counts
|
|
5
|
+
* bytes: the logic is the same, in numbers).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* That `count` elements of `elementSize` numbers, the first at `offset` and
|
|
9
|
+
* each `stride` numbers after the last, lie inside an array of `length`
|
|
10
|
+
* numbers: `count`, `offset` and `stride` are non-negative safe integers and,
|
|
11
|
+
* from two elements on, `stride` is at least `elementSize` (elements do not
|
|
12
|
+
* overlap). A `count` of zero needs nothing else.
|
|
13
|
+
*
|
|
14
|
+
* @throws {RangeError} Naming `name` and `role` (`"out"`, `"input"`) otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export function assertStridedRange_(name, role, length, offset, stride, count, elementSize) {
|
|
17
|
+
assertInteger(count, `${name}: count`, 0);
|
|
18
|
+
assertInteger(offset, `${name}: ${role} offset`, 0);
|
|
19
|
+
assertInteger(stride, `${name}: ${role} stride`, 0);
|
|
20
|
+
if (count >= 2 && stride < elementSize) {
|
|
21
|
+
throw new RangeError(`${name}: ${role} stride must be at least ${elementSize} so elements do not overlap, got ${stride}`);
|
|
22
|
+
}
|
|
23
|
+
if (count === 0) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// A sum past 2^53 rounds to at least 2^53, still above any array length.
|
|
27
|
+
const needed = offset + stride * (count - 1) + elementSize;
|
|
28
|
+
if (needed > length) {
|
|
29
|
+
throw new RangeError(`${name}: ${count} elements of ${elementSize} numbers at ${role} offset ${offset}, stride ${stride} reach number ${needed}, but ${role} holds ${length}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* That the strided elements read from `input` and written into `out` (both
|
|
34
|
+
* `Float64Array`, already range-checked) either share no memory, or are the
|
|
35
|
+
* same elements: one array, one offset, one stride, each element read before it
|
|
36
|
+
* is written. Records that overlap in any other way (a shifted offset, an
|
|
37
|
+
* interleaving stride) would read what was already written, so they are
|
|
38
|
+
* refused. Equal strides are checked exactly; with two different strides the
|
|
39
|
+
* whole spans must be apart.
|
|
40
|
+
*
|
|
41
|
+
* @throws {RangeError} Naming `name` on an overlap that is not an exact alias.
|
|
42
|
+
*/
|
|
43
|
+
export function assertStridedAlias_(name, out, outOffset, outStride, input, inputOffset, inputStride, count, elementSize) {
|
|
44
|
+
if (count === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const outBytes = asUint8Array(out);
|
|
48
|
+
const inputBytes = asUint8Array(input);
|
|
49
|
+
// Buffers that may share memory are compared as if they were one buffer.
|
|
50
|
+
if (!buffersMayShareMemory(outBytes.buffer, inputBytes.buffer)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const outBase = outBytes.byteOffset / 8 + outOffset;
|
|
54
|
+
const inputBase = inputBytes.byteOffset / 8 + inputOffset;
|
|
55
|
+
if (outBase === inputBase && outStride === inputStride) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const last = count - 1;
|
|
59
|
+
if (outStride === inputStride && last > 0) {
|
|
60
|
+
const delta = outBase - inputBase;
|
|
61
|
+
const shift = Math.max(-last, Math.min(last, Math.round(-delta / outStride)));
|
|
62
|
+
if (Math.abs(delta + shift * outStride) >= elementSize) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const outEnd = outBase + outStride * last + elementSize;
|
|
68
|
+
const inputEnd = inputBase + inputStride * last + elementSize;
|
|
69
|
+
if (outEnd <= inputBase || inputEnd <= outBase) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
throw new RangeError(`${name}: out and input overlap, other than as the same elements at the same offset and stride.`);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=_strided-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_strided-range.js","sourceRoot":"","sources":["../src/_strided-range.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,YAAY,EACZ,qBAAqB,GACrB,MAAM,cAAc,CAAC;AAEtB;;;;GAIG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAClC,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,MAAc,EACd,MAAc,EACd,KAAa,EACb,WAAmB;IAEnB,aAAa,CAAC,KAAK,EAAE,GAAG,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC;IAC1C,aAAa,CAAC,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC;IACpD,aAAa,CAAC,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC;IACpD,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,GAAG,WAAW,EAAE,CAAC;QACxC,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,KAAK,IAAI,4BAA4B,WAAW,oCAAoC,MAAM,EAAE,CACnG,CAAC;IACH,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO;IACR,CAAC;IACD,yEAAyE;IACzE,MAAM,MAAM,GAAG,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AI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAC9C,CAAC;QACF,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC,IAAI,WAAW,EAAE,CAAC;YACxD,OAAO;QACR,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,GAAG,WAAW,CAAC;QACxD,MAAM,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,WAAW,CAAC;QAC9D,IAAI,MAAM,IAAI,SAAS,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YAChD,OAAO;QACR,CAAC;IACF,CAAC;IACD,MAAM,IAAI,UAAU,CACnB,GAAG,IAAI,yFAAyF,CAChG,CAAC;AACH,CAAC"}
|
package/dist/_trs.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Quaternion } from "@ac-kit/math-complex";
|
|
2
|
+
import type { Vec3 } from "./vec3.js";
|
|
3
|
+
/**
|
|
4
|
+
* How far from perpendicular two columns of a matrix may be, as the cosine of
|
|
5
|
+
* the angle between them, for the matrix still to count as having no shear. The
|
|
6
|
+
* cosine of a matrix that went through a `Float32Array` (a glTF node, an
|
|
7
|
+
* uploaded uniform read back) is a few `1e-8`, and that of one made by
|
|
8
|
+
* composing in binary64 a few `1e-16`: this is above the first by a factor of
|
|
9
|
+
* thirty and far below any shear a person means.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SHEAR_TOLERANCE_ = 0.000001;
|
|
12
|
+
/**
|
|
13
|
+
* How far the bottom-right entry of a 4 × 4 matrix may be from 1, for the
|
|
14
|
+
* matrix still to count as affine: what the inverse of an affine matrix
|
|
15
|
+
* leaves.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AFFINE_CORNER_TOLERANCE_: number;
|
|
18
|
+
/**
|
|
19
|
+
* Writes into `out` the unit quaternion of the rotation matrix whose entries
|
|
20
|
+
* are given in column-major order (Shepperd's method: the largest of the trace
|
|
21
|
+
* and the three diagonal entries picks the formula, so the divisor never
|
|
22
|
+
* vanishes). The matrix must be orthonormal; the result is not normalised.
|
|
23
|
+
*/
|
|
24
|
+
export declare function quaternionFromRotationEntries_(out: Quaternion, m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number): Quaternion;
|
|
25
|
+
/**
|
|
26
|
+
* Splits the linear part of a transform, given as its three columns `c0`, `c1`
|
|
27
|
+
* and `c2`, into the rotation and the scale that `T · R · S` composes from: the
|
|
28
|
+
* scale is the length of each column (the sign of the first is flipped when the
|
|
29
|
+
* matrix is a reflection, so the rotation is proper) and the rotation is the
|
|
30
|
+
* unit quaternion of the columns divided by it.
|
|
31
|
+
*
|
|
32
|
+
* Returns `false`, with `NaN` in both outputs, when a column has no length or a
|
|
33
|
+
* length that is not finite, or when two columns are further from perpendicular
|
|
34
|
+
* than {@link SHEAR_TOLERANCE_}: there is no rotation and scale that compose
|
|
35
|
+
* it. Never throws.
|
|
36
|
+
*/
|
|
37
|
+
export declare function decomposeLinear_(outRotation: Quaternion, outScale: Vec3, c0x: number, c0y: number, c0z: number, c1x: number, c1y: number, c1z: number, c2x: number, c2y: number, c2z: number): boolean;
|
|
38
|
+
//# sourceMappingURL=_trs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_trs.d.ts","sourceRoot":"","sources":["../src/_trs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,sBAAsB,CAAC;AAQ5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,WAAO,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAqB,CAAC;AAU3D;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC7C,GAAG,EAAE,UAAU,EACf,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,UAAU,CA4BZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC/B,WAAW,EAAE,UAAU,EACvB,QAAQ,EAAE,IAAI,EACd,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,CAwET"}
|
package/dist/_trs.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { quaternionNormalize } from "@ac-kit/math-complex";
|
|
2
|
+
import { vec3Create, vec3LengthScaled, vec3NormalizeScaled, vec3Set, } from "./vec3-componentwise.js";
|
|
3
|
+
/**
|
|
4
|
+
* How far from perpendicular two columns of a matrix may be, as the cosine of
|
|
5
|
+
* the angle between them, for the matrix still to count as having no shear. The
|
|
6
|
+
* cosine of a matrix that went through a `Float32Array` (a glTF node, an
|
|
7
|
+
* uploaded uniform read back) is a few `1e-8`, and that of one made by
|
|
8
|
+
* composing in binary64 a few `1e-16`: this is above the first by a factor of
|
|
9
|
+
* thirty and far below any shear a person means.
|
|
10
|
+
*/
|
|
11
|
+
export const SHEAR_TOLERANCE_ = 1e-6;
|
|
12
|
+
/**
|
|
13
|
+
* How far the bottom-right entry of a 4 × 4 matrix may be from 1, for the
|
|
14
|
+
* matrix still to count as affine: what the inverse of an affine matrix
|
|
15
|
+
* leaves.
|
|
16
|
+
*/
|
|
17
|
+
export const AFFINE_CORNER_TOLERANCE_ = 8 * Number.EPSILON;
|
|
18
|
+
/**
|
|
19
|
+
* Scratch for {@link decomposeLinear_}: one call at a time, no callback inside
|
|
20
|
+
* it.
|
|
21
|
+
*/
|
|
22
|
+
const COLUMN_0_ = vec3Create();
|
|
23
|
+
const COLUMN_1_ = vec3Create();
|
|
24
|
+
const COLUMN_2_ = vec3Create();
|
|
25
|
+
/**
|
|
26
|
+
* Writes into `out` the unit quaternion of the rotation matrix whose entries
|
|
27
|
+
* are given in column-major order (Shepperd's method: the largest of the trace
|
|
28
|
+
* and the three diagonal entries picks the formula, so the divisor never
|
|
29
|
+
* vanishes). The matrix must be orthonormal; the result is not normalised.
|
|
30
|
+
*/
|
|
31
|
+
export function quaternionFromRotationEntries_(out, m00, m10, m20, m01, m11, m21, m02, m12, m22) {
|
|
32
|
+
const trace = m00 + m11 + m22;
|
|
33
|
+
if (trace > 0) {
|
|
34
|
+
const s = 0.5 / Math.sqrt(trace + 1);
|
|
35
|
+
out[3] = 0.25 / s;
|
|
36
|
+
out[0] = (m21 - m12) * s;
|
|
37
|
+
out[1] = (m02 - m20) * s;
|
|
38
|
+
out[2] = (m10 - m01) * s;
|
|
39
|
+
}
|
|
40
|
+
else if (m00 > m11 && m00 > m22) {
|
|
41
|
+
const s = 2 * Math.sqrt(1 + m00 - m11 - m22);
|
|
42
|
+
out[3] = (m21 - m12) / s;
|
|
43
|
+
out[0] = 0.25 * s;
|
|
44
|
+
out[1] = (m01 + m10) / s;
|
|
45
|
+
out[2] = (m02 + m20) / s;
|
|
46
|
+
}
|
|
47
|
+
else if (m11 > m22) {
|
|
48
|
+
const s = 2 * Math.sqrt(1 + m11 - m00 - m22);
|
|
49
|
+
out[3] = (m02 - m20) / s;
|
|
50
|
+
out[0] = (m01 + m10) / s;
|
|
51
|
+
out[1] = 0.25 * s;
|
|
52
|
+
out[2] = (m12 + m21) / s;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const s = 2 * Math.sqrt(1 + m22 - m00 - m11);
|
|
56
|
+
out[3] = (m10 - m01) / s;
|
|
57
|
+
out[0] = (m02 + m20) / s;
|
|
58
|
+
out[1] = (m12 + m21) / s;
|
|
59
|
+
out[2] = 0.25 * s;
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Splits the linear part of a transform, given as its three columns `c0`, `c1`
|
|
65
|
+
* and `c2`, into the rotation and the scale that `T · R · S` composes from: the
|
|
66
|
+
* scale is the length of each column (the sign of the first is flipped when the
|
|
67
|
+
* matrix is a reflection, so the rotation is proper) and the rotation is the
|
|
68
|
+
* unit quaternion of the columns divided by it.
|
|
69
|
+
*
|
|
70
|
+
* Returns `false`, with `NaN` in both outputs, when a column has no length or a
|
|
71
|
+
* length that is not finite, or when two columns are further from perpendicular
|
|
72
|
+
* than {@link SHEAR_TOLERANCE_}: there is no rotation and scale that compose
|
|
73
|
+
* it. Never throws.
|
|
74
|
+
*/
|
|
75
|
+
export function decomposeLinear_(outRotation, outScale, c0x, c0y, c0z, c1x, c1y, c1z, c2x, c2y, c2z) {
|
|
76
|
+
vec3Set(COLUMN_0_, c0x, c0y, c0z);
|
|
77
|
+
vec3Set(COLUMN_1_, c1x, c1y, c1z);
|
|
78
|
+
vec3Set(COLUMN_2_, c2x, c2y, c2z);
|
|
79
|
+
let scale0 = vec3LengthScaled(COLUMN_0_);
|
|
80
|
+
const scale1 = vec3LengthScaled(COLUMN_1_);
|
|
81
|
+
const scale2 = vec3LengthScaled(COLUMN_2_);
|
|
82
|
+
// The unit columns come from the scaled normalisation, not from dividing by
|
|
83
|
+
// the rounded scale: a column of subnormal numbers has a length that rounds
|
|
84
|
+
// to a coarse multiple of the smallest one, and dividing by it would skew
|
|
85
|
+
// the direction.
|
|
86
|
+
vec3NormalizeScaled(COLUMN_0_, COLUMN_0_);
|
|
87
|
+
vec3NormalizeScaled(COLUMN_1_, COLUMN_1_);
|
|
88
|
+
vec3NormalizeScaled(COLUMN_2_, COLUMN_2_);
|
|
89
|
+
let u0x = COLUMN_0_[0];
|
|
90
|
+
let u0y = COLUMN_0_[1];
|
|
91
|
+
let u0z = COLUMN_0_[2];
|
|
92
|
+
const u1x = COLUMN_1_[0];
|
|
93
|
+
const u1y = COLUMN_1_[1];
|
|
94
|
+
const u1z = COLUMN_1_[2];
|
|
95
|
+
const u2x = COLUMN_2_[0];
|
|
96
|
+
const u2y = COLUMN_2_[1];
|
|
97
|
+
const u2z = COLUMN_2_[2];
|
|
98
|
+
if (!(scale0 > 0 &&
|
|
99
|
+
scale1 > 0 &&
|
|
100
|
+
scale2 > 0 &&
|
|
101
|
+
scale0 < Infinity &&
|
|
102
|
+
scale1 < Infinity &&
|
|
103
|
+
scale2 < Infinity &&
|
|
104
|
+
Math.abs(u0x * u1x + u0y * u1y + u0z * u1z) <= SHEAR_TOLERANCE_ &&
|
|
105
|
+
Math.abs(u1x * u2x + u1y * u2y + u1z * u2z) <= SHEAR_TOLERANCE_ &&
|
|
106
|
+
Math.abs(u0x * u2x + u0y * u2y + u0z * u2z) <= SHEAR_TOLERANCE_)) {
|
|
107
|
+
outRotation[0] = Number.NaN;
|
|
108
|
+
outRotation[1] = Number.NaN;
|
|
109
|
+
outRotation[2] = Number.NaN;
|
|
110
|
+
outRotation[3] = Number.NaN;
|
|
111
|
+
outScale[0] = Number.NaN;
|
|
112
|
+
outScale[1] = Number.NaN;
|
|
113
|
+
outScale[2] = Number.NaN;
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const determinant = u0x * (u1y * u2z - u1z * u2y) +
|
|
117
|
+
u0y * (u1z * u2x - u1x * u2z) +
|
|
118
|
+
u0z * (u1x * u2y - u1y * u2x);
|
|
119
|
+
if (determinant < 0) {
|
|
120
|
+
scale0 = -scale0;
|
|
121
|
+
u0x = -u0x;
|
|
122
|
+
u0y = -u0y;
|
|
123
|
+
u0z = -u0z;
|
|
124
|
+
}
|
|
125
|
+
outScale[0] = scale0;
|
|
126
|
+
outScale[1] = scale1;
|
|
127
|
+
outScale[2] = scale2;
|
|
128
|
+
quaternionFromRotationEntries_(outRotation, u0x, u0y, u0z, u1x, u1y, u1z, u2x, u2y, u2z);
|
|
129
|
+
quaternionNormalize(outRotation, outRotation);
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=_trs.js.map
|
package/dist/_trs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_trs.js","sourceRoot":"","sources":["../src/_trs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,GACP,MAAM,yBAAyB,CAAC;AAGjC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;AAE3D;;;GAGG;AACH,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;AAC/B,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;AAC/B,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC7C,GAAe,EACf,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW,EACX,GAAW;IAEX,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACrC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;QAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,GAA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AC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;QAC5B,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;QACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;QACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,WAAW,GAChB,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;QAC7B,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;QAC7B,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;IAC/B,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,GAAG,CAAC,MAAM,CAAC;QACjB,GAAG,GAAG,CAAC,GAAG,CAAC;QACX,GAAG,GAAG,CAAC,GAAG,CAAC;QACX,GAAG,GAAG,CAAC,GAAG,CAAC;IACZ,CAAC;IACD,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IACrB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IACrB,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IACrB,8BAA8B,CAC7B,WAAW,EACX,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,CACH,CAAC;IACF,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ReadonlyAffine2, Affine2 } from "./affine2.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a buffer for `count` affine2 elements: a zero-filled `Float64Array`
|
|
4
|
+
* of `count × 6` numbers, element `i` at `[i·6, i·6 + 6)`, a zero element being
|
|
5
|
+
* the all-zero transform (use {@link affine2Store} with the identity to fill it
|
|
6
|
+
* with identities). Allocates.
|
|
7
|
+
*
|
|
8
|
+
* @throws {RangeError} When `count` is not a non-negative safe integer or
|
|
9
|
+
* `count × 6` is not a valid typed array length.
|
|
10
|
+
*/
|
|
11
|
+
export declare function affine2ArrayCreate(count: number): Float64Array<ArrayBuffer>;
|
|
12
|
+
/**
|
|
13
|
+
* Writes element `index` of `array`, the numbers at `[index·6, index·6 + 6)`,
|
|
14
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
15
|
+
* end of `array` gives `NaN`, never `undefined`: the transform stays clean
|
|
16
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
17
|
+
* layer.
|
|
18
|
+
*
|
|
19
|
+
* The transform is copied: it is never a view of `array`. O(1).
|
|
20
|
+
*/
|
|
21
|
+
export declare function affine2Load(out: Affine2, array: Float64Array, index: number): Affine2;
|
|
22
|
+
/**
|
|
23
|
+
* Writes `value` into `array` as element `index`, at `[index·6, index·6 + 6)`.
|
|
24
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
25
|
+
* out-of-range write. O(1).
|
|
26
|
+
*/
|
|
27
|
+
export declare function affine2Store(array: Float64Array, index: number, value: ReadonlyAffine2): void;
|
|
28
|
+
/**
|
|
29
|
+
* Like {@link affine2Load} for interleaved data: element `index` starts at
|
|
30
|
+
* `offset + index·stride`, both counted in numbers, and its 6 components follow
|
|
31
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
32
|
+
*/
|
|
33
|
+
export declare function affine2LoadStrided(out: Affine2, array: Float64Array, offset: number, stride: number, index: number): Affine2;
|
|
34
|
+
/**
|
|
35
|
+
* Like {@link affine2Store} for interleaved data: element `index` starts at
|
|
36
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
37
|
+
* `array` writes nothing. O(1).
|
|
38
|
+
*/
|
|
39
|
+
export declare function affine2StoreStrided(array: Float64Array, offset: number, stride: number, index: number, value: ReadonlyAffine2): void;
|
|
40
|
+
/**
|
|
41
|
+
* Narrows `value` to binary32 and writes its 6 components into `array` from
|
|
42
|
+
* element `offset` on, unrolled: the way to stage a vertex, instance or uniform
|
|
43
|
+
* value for the GPU, where `array.set` costs several times as much for one
|
|
44
|
+
* value. A component past the end of `array` writes nothing. O(1).
|
|
45
|
+
*/
|
|
46
|
+
export declare function affine2StoreFloat32(array: Float32Array, offset: number, value: ReadonlyAffine2): void;
|
|
47
|
+
/**
|
|
48
|
+
* Whether every number of `array` is finite: the check for a buffer of affine2
|
|
49
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
50
|
+
* required to be a multiple of 6 (see `assertFiniteBuffer` for that). O(n).
|
|
51
|
+
*/
|
|
52
|
+
export declare function affine2ArrayIsFinite(array: Float64Array): boolean;
|
|
53
|
+
//# sourceMappingURL=affine2-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine2-array.d.ts","sourceRoot":"","sources":["../src/affine2-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE7D;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAG3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAC1B,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACX,OAAO,CAUT;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAQN;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX,OAAO,CAUT;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,GACpB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,eAAe,GACpB,IAAI,CAON;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAOjE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Generated from scripts/templates/value-array.liquid by scripts/generate-componentwise.ts. Do not edit.
|
|
2
|
+
import { assertInteger } from "@ac-kit/core";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a buffer for `count` affine2 elements: a zero-filled `Float64Array`
|
|
5
|
+
* of `count × 6` numbers, element `i` at `[i·6, i·6 + 6)`, a zero element being
|
|
6
|
+
* the all-zero transform (use {@link affine2Store} with the identity to fill it
|
|
7
|
+
* with identities). Allocates.
|
|
8
|
+
*
|
|
9
|
+
* @throws {RangeError} When `count` is not a non-negative safe integer or
|
|
10
|
+
* `count × 6` is not a valid typed array length.
|
|
11
|
+
*/
|
|
12
|
+
export function affine2ArrayCreate(count) {
|
|
13
|
+
assertInteger(count, "affine2ArrayCreate: count", 0);
|
|
14
|
+
return new Float64Array(count * 6);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Writes element `index` of `array`, the numbers at `[index·6, index·6 + 6)`,
|
|
18
|
+
* into `out`. Each component is written as `+array[i]`, so an index past the
|
|
19
|
+
* end of `array` gives `NaN`, never `undefined`: the transform stays clean
|
|
20
|
+
* whatever the caller does. Checking the index is the job of the checked
|
|
21
|
+
* layer.
|
|
22
|
+
*
|
|
23
|
+
* The transform is copied: it is never a view of `array`. O(1).
|
|
24
|
+
*/
|
|
25
|
+
export function affine2Load(out, array, index) {
|
|
26
|
+
const base = index * 6;
|
|
27
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
28
|
+
out[0] = +array[base];
|
|
29
|
+
out[1] = +array[base + 1];
|
|
30
|
+
out[2] = +array[base + 2];
|
|
31
|
+
out[3] = +array[base + 3];
|
|
32
|
+
out[4] = +array[base + 4];
|
|
33
|
+
out[5] = +array[base + 5];
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Writes `value` into `array` as element `index`, at `[index·6, index·6 + 6)`.
|
|
38
|
+
* An element past the end of `array` writes nothing, as a typed array drops an
|
|
39
|
+
* out-of-range write. O(1).
|
|
40
|
+
*/
|
|
41
|
+
export function affine2Store(array, index, value) {
|
|
42
|
+
const base = index * 6;
|
|
43
|
+
array[base] = value[0];
|
|
44
|
+
array[base + 1] = value[1];
|
|
45
|
+
array[base + 2] = value[2];
|
|
46
|
+
array[base + 3] = value[3];
|
|
47
|
+
array[base + 4] = value[4];
|
|
48
|
+
array[base + 5] = value[5];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Like {@link affine2Load} for interleaved data: element `index` starts at
|
|
52
|
+
* `offset + index·stride`, both counted in numbers, and its 6 components follow
|
|
53
|
+
* one another. An index past the end gives `NaN` components. O(1).
|
|
54
|
+
*/
|
|
55
|
+
export function affine2LoadStrided(out, array, offset, stride, index) {
|
|
56
|
+
const base = offset + index * stride;
|
|
57
|
+
// The `!` is for the compiler: past the end `+undefined` is `NaN`.
|
|
58
|
+
out[0] = +array[base];
|
|
59
|
+
out[1] = +array[base + 1];
|
|
60
|
+
out[2] = +array[base + 2];
|
|
61
|
+
out[3] = +array[base + 3];
|
|
62
|
+
out[4] = +array[base + 4];
|
|
63
|
+
out[5] = +array[base + 5];
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Like {@link affine2Store} for interleaved data: element `index` starts at
|
|
68
|
+
* `offset + index·stride`, both counted in numbers. A component past the end of
|
|
69
|
+
* `array` writes nothing. O(1).
|
|
70
|
+
*/
|
|
71
|
+
export function affine2StoreStrided(array, offset, stride, index, value) {
|
|
72
|
+
const base = offset + index * stride;
|
|
73
|
+
array[base] = value[0];
|
|
74
|
+
array[base + 1] = value[1];
|
|
75
|
+
array[base + 2] = value[2];
|
|
76
|
+
array[base + 3] = value[3];
|
|
77
|
+
array[base + 4] = value[4];
|
|
78
|
+
array[base + 5] = value[5];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Narrows `value` to binary32 and writes its 6 components into `array` from
|
|
82
|
+
* element `offset` on, unrolled: the way to stage a vertex, instance or uniform
|
|
83
|
+
* value for the GPU, where `array.set` costs several times as much for one
|
|
84
|
+
* value. A component past the end of `array` writes nothing. O(1).
|
|
85
|
+
*/
|
|
86
|
+
export function affine2StoreFloat32(array, offset, value) {
|
|
87
|
+
array[offset] = value[0];
|
|
88
|
+
array[offset + 1] = value[1];
|
|
89
|
+
array[offset + 2] = value[2];
|
|
90
|
+
array[offset + 3] = value[3];
|
|
91
|
+
array[offset + 4] = value[4];
|
|
92
|
+
array[offset + 5] = value[5];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Whether every number of `array` is finite: the check for a buffer of affine2
|
|
96
|
+
* elements read from untrusted data or about to be uploaded. The length is not
|
|
97
|
+
* required to be a multiple of 6 (see `assertFiniteBuffer` for that). O(n).
|
|
98
|
+
*/
|
|
99
|
+
export function affine2ArrayIsFinite(array) {
|
|
100
|
+
for (let index = 0; index < array.length; index++) {
|
|
101
|
+
if (!Number.isFinite(array[index])) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=affine2-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine2-array.js","sourceR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C,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IsCloseToOptions } from "@ac-kit/core";
|
|
2
|
+
import type { ReadonlyAffine2, Affine2 } from "./affine2.js";
|
|
3
|
+
/**
|
|
4
|
+
* Writes the entries in storage order into `out`: the columns of the matrix one
|
|
5
|
+
* after the other, `a, b, c, d, e, f`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function affine2Set(out: Affine2, m00: number, m10: number, m01: number, m11: number, m02: number, m12: number): Affine2;
|
|
8
|
+
/** Writes a copy of `a` into `out`. `out` may be `a`. */
|
|
9
|
+
export declare function affine2Copy(out: Affine2, a: ReadonlyAffine2): Affine2;
|
|
10
|
+
/** Writes the identity transform `[1, 0, 0, 1, 0, 0]` into `out`. */
|
|
11
|
+
export declare function affine2Identity(out: Affine2): Affine2;
|
|
12
|
+
/**
|
|
13
|
+
* Exact entry-wise equality: `−0` equals `+0`, and `NaN` equals nothing, itself
|
|
14
|
+
* included. See {@link affine2IsClose} for a tolerant test.
|
|
15
|
+
*/
|
|
16
|
+
export declare function affine2Equals(a: ReadonlyAffine2, b: ReadonlyAffine2): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Entry-wise approximate equality, each pair compared by `@ac-kit/core`'s
|
|
19
|
+
* `isCloseTo` with `options`: none means exact.
|
|
20
|
+
*
|
|
21
|
+
* Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
|
|
22
|
+
* and never a basis for ordering — use {@link affine2Equals} there. The
|
|
23
|
+
* tolerance is required: a transform carries no units of its own, so only the
|
|
24
|
+
* caller knows what counts as close (and the same tolerance covers a matrix
|
|
25
|
+
* entry and a translation).
|
|
26
|
+
*/
|
|
27
|
+
export declare function affine2IsClose(a: ReadonlyAffine2, b: ReadonlyAffine2, options: IsCloseToOptions): boolean;
|
|
28
|
+
//# sourceMappingURL=affine2-componentwise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affine2-componentwise.d.ts","sourceRoot":"","sources":["../src/affine2-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;;;GAGG;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,GACT,OAAO,CAQT;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAQrE;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAQrD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAS7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC7B,CAAC,EAAE,eAAe,EAClB,CAAC,EAAE,eAAe,EAClB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAST"}
|