@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
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
// Generated from scripts/templates/vec-array-componentwise.liquid by scripts/generate-componentwise.ts. Do not edit.
|
|
2
|
+
import { assertInteger, PreciseSum, viewsMayOverlap } from "@ac-kit/core";
|
|
3
|
+
import { twoProductError } from "@ac-kit/math-scalar";
|
|
4
|
+
import { assertStridedRange_ } from "./_strided-range.js";
|
|
5
|
+
import { vec3Of } from "./vec3-componentwise.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a buffer for `count` vec3 elements: a zero-filled `Float64Array` of
|
|
8
|
+
* `count × 3` numbers, element `i` at `[i·3, i·3 + 3)`. Allocates.
|
|
9
|
+
*
|
|
10
|
+
* @throws {RangeError} When `count` is not a non-negative safe integer or
|
|
11
|
+
* `count × 3` is not a valid typed array length.
|
|
12
|
+
*/
|
|
13
|
+
export function vec3ArrayCreate(count) {
|
|
14
|
+
assertInteger(count, "vec3ArrayCreate: count", 0);
|
|
15
|
+
return new Float64Array(count * 3);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a buffer holding `values`, element `i` being `values[i]`. O(n),
|
|
19
|
+
* allocates.
|
|
20
|
+
*/
|
|
21
|
+
export function vec3ArrayFromValues(values) {
|
|
22
|
+
const array = new Float64Array(values.length * 3);
|
|
23
|
+
for (let index = 0; index < values.length; index++) {
|
|
24
|
+
const value = values[index];
|
|
25
|
+
const base = index * 3;
|
|
26
|
+
array[base] = value[0];
|
|
27
|
+
array[base + 1] = value[1];
|
|
28
|
+
array[base + 2] = value[2];
|
|
29
|
+
}
|
|
30
|
+
return array;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reads every element of `array` into a Vec3 made by {@link vec3Of}, so each one
|
|
34
|
+
* is a clean array of doubles (never `Array.from` or a spread, which would not
|
|
35
|
+
* start from the creator's template). A tail shorter than one element is
|
|
36
|
+
* ignored. O(n), allocates one value per element.
|
|
37
|
+
*/
|
|
38
|
+
export function vec3ArrayToValues(array) {
|
|
39
|
+
const values = [];
|
|
40
|
+
for (let index = 0; index + 3 <= array.length; index += 3) {
|
|
41
|
+
values.push(vec3Of(array[index], array[index + 1], array[index + 2]));
|
|
42
|
+
}
|
|
43
|
+
return values;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Narrows a tight binary64 buffer into an interleaved binary32 one: element `i`
|
|
47
|
+
* of `input` goes to `out[outOffset + i·outStride …]`, offset and stride
|
|
48
|
+
* counted in numbers, the other numbers of each stride untouched (a vertex
|
|
49
|
+
* buffer's normals, colours, …). For the whole array with no stride use
|
|
50
|
+
* `Float32Array.prototype.set`. `out` and `input` share no memory. O(n).
|
|
51
|
+
*
|
|
52
|
+
* @returns `out`.
|
|
53
|
+
* @throws {RangeError} Unless `input.length` is a multiple of 3, `count`, the
|
|
54
|
+
* offset and the stride are non-negative integers (the stride at least 3 from
|
|
55
|
+
* two elements on), the last element fits in `out`, and `out` and `input`
|
|
56
|
+
* share no memory.
|
|
57
|
+
*/
|
|
58
|
+
export function vec3ArrayNarrowStrided(out, outOffset, outStride, input) {
|
|
59
|
+
const length = input.length;
|
|
60
|
+
if (length % 3 !== 0) {
|
|
61
|
+
throw new RangeError("vec3ArrayNarrowStrided: input must be a multiple of 3 long.");
|
|
62
|
+
}
|
|
63
|
+
assertStridedRange_("vec3ArrayNarrowStrided", "out", out.length, outOffset, outStride, length / 3, 3);
|
|
64
|
+
if (length > 0 && viewsMayOverlap(out, input)) {
|
|
65
|
+
throw new RangeError("vec3ArrayNarrowStrided: out and input must not share memory.");
|
|
66
|
+
}
|
|
67
|
+
for (let index = 0, target = outOffset; index < length; index += 3, target += outStride) {
|
|
68
|
+
out[target] = input[index];
|
|
69
|
+
out[target + 1] = input[index + 1];
|
|
70
|
+
out[target + 2] = input[index + 2];
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Widens an interleaved binary32 buffer (a glTF accessor, a readback) into a
|
|
76
|
+
* tight binary64 one: element `i` of `out` is read from `input[inputOffset +
|
|
77
|
+
* i·inputStride …]`, offset and stride counted in numbers. The element count is
|
|
78
|
+
* `out.length / 3`. `out` and `input` share no memory. O(n).
|
|
79
|
+
*
|
|
80
|
+
* @returns `out`.
|
|
81
|
+
* @throws {RangeError} Unless `out.length` is a multiple of 3, the offset and
|
|
82
|
+
* the stride are non-negative integers (the stride at least 3 from two
|
|
83
|
+
* elements on), the last element lies inside `input`, and `out` and `input`
|
|
84
|
+
* share no memory.
|
|
85
|
+
*/
|
|
86
|
+
export function vec3ArrayWidenStrided(out, input, inputOffset, inputStride) {
|
|
87
|
+
const length = out.length;
|
|
88
|
+
if (length % 3 !== 0) {
|
|
89
|
+
throw new RangeError("vec3ArrayWidenStrided: out must be a multiple of 3 long.");
|
|
90
|
+
}
|
|
91
|
+
assertStridedRange_("vec3ArrayWidenStrided", "input", input.length, inputOffset, inputStride, length / 3, 3);
|
|
92
|
+
if (length > 0 && viewsMayOverlap(out, input)) {
|
|
93
|
+
throw new RangeError("vec3ArrayWidenStrided: out and input must not share memory.");
|
|
94
|
+
}
|
|
95
|
+
for (let index = 0, source = inputOffset; index < length; index += 3, source += inputStride) {
|
|
96
|
+
out[index] = input[source];
|
|
97
|
+
out[index + 1] = input[source + 1];
|
|
98
|
+
out[index + 2] = input[source + 2];
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Narrows `input − origin` to binary32 in one pass, the subtraction in
|
|
104
|
+
* binary64: large coordinates (a map in metres, a time axis in milliseconds)
|
|
105
|
+
* keep their precision relative to a nearby `origin`, where narrowing first
|
|
106
|
+
* loses it. `out` and `input` hold the same number of elements and share no
|
|
107
|
+
* memory (a `Float32Array` and a `Float64Array` over one buffer overlap in
|
|
108
|
+
* bytes, and the narrowing would read what it already wrote). O(n).
|
|
109
|
+
*
|
|
110
|
+
* @returns `out`.
|
|
111
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
112
|
+
* multiple of 3, and share no memory.
|
|
113
|
+
*/
|
|
114
|
+
export function vec3ArrayNarrowRelative(out, input, origin) {
|
|
115
|
+
const length = input.length;
|
|
116
|
+
if (out.length !== length || length % 3 !== 0) {
|
|
117
|
+
throw new RangeError("vec3ArrayNarrowRelative: out and input must have the same length, a multiple of 3.");
|
|
118
|
+
}
|
|
119
|
+
if (length > 0 && viewsMayOverlap(out, input)) {
|
|
120
|
+
throw new RangeError("vec3ArrayNarrowRelative: out and input must not share memory.");
|
|
121
|
+
}
|
|
122
|
+
const ox = origin[0];
|
|
123
|
+
const oy = origin[1];
|
|
124
|
+
const oz = origin[2];
|
|
125
|
+
for (let index = 0; index < length; index += 3) {
|
|
126
|
+
out[index] = input[index] - ox;
|
|
127
|
+
out[index + 1] = input[index + 1] - oy;
|
|
128
|
+
out[index + 2] = input[index + 2] - oz;
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* {@link vec3ArrayNarrowRelative} into an interleaved buffer: element `i` goes
|
|
134
|
+
* to `out[outOffset + i·outStride …]`, offset and stride counted in numbers.
|
|
135
|
+
* `out` and `input` share no memory. O(n).
|
|
136
|
+
*
|
|
137
|
+
* @returns `out`.
|
|
138
|
+
* @throws {RangeError} Unless `input.length` is a multiple of 3, `count`, the
|
|
139
|
+
* offset and the stride are non-negative integers (the stride at least 3 from
|
|
140
|
+
* two elements on), the last element fits in `out`, and `out` and `input`
|
|
141
|
+
* share no memory.
|
|
142
|
+
*/
|
|
143
|
+
export function vec3ArrayNarrowRelativeStrided(out, outOffset, outStride, input, origin) {
|
|
144
|
+
const length = input.length;
|
|
145
|
+
if (length % 3 !== 0) {
|
|
146
|
+
throw new RangeError("vec3ArrayNarrowRelativeStrided: input must be a multiple of 3 long.");
|
|
147
|
+
}
|
|
148
|
+
assertStridedRange_("vec3ArrayNarrowRelativeStrided", "out", out.length, outOffset, outStride, length / 3, 3);
|
|
149
|
+
if (length > 0 && viewsMayOverlap(out, input)) {
|
|
150
|
+
throw new RangeError("vec3ArrayNarrowRelativeStrided: out and input must not share memory.");
|
|
151
|
+
}
|
|
152
|
+
const ox = origin[0];
|
|
153
|
+
const oy = origin[1];
|
|
154
|
+
const oz = origin[2];
|
|
155
|
+
for (let index = 0, target = outOffset; index < length; index += 3, target += outStride) {
|
|
156
|
+
out[target] = input[index] - ox;
|
|
157
|
+
out[target + 1] = input[index + 1] - oy;
|
|
158
|
+
out[target + 2] = input[index + 2] - oz;
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The mean Euclidean distance of the elements of `values` to `center`: the
|
|
164
|
+
* spread of a gesture's touch points, for one. Plain arithmetic, so right where
|
|
165
|
+
* the largest difference lies between about `1e−150` and `1e150`. No element
|
|
166
|
+
* gives `NaN`. O(n).
|
|
167
|
+
*
|
|
168
|
+
* @throws {RangeError} Unless `values.length` is a multiple of 3.
|
|
169
|
+
*/
|
|
170
|
+
export function vec3ArrayMeanDistance(values, center) {
|
|
171
|
+
const length = values.length;
|
|
172
|
+
if (length % 3 !== 0) {
|
|
173
|
+
throw new RangeError("vec3ArrayMeanDistance: values must be a multiple of 3 long.");
|
|
174
|
+
}
|
|
175
|
+
const cx = center[0];
|
|
176
|
+
const cy = center[1];
|
|
177
|
+
const cz = center[2];
|
|
178
|
+
let total = 0;
|
|
179
|
+
for (let index = 0; index < length; index += 3) {
|
|
180
|
+
const dx = values[index] - cx;
|
|
181
|
+
const dy = values[index + 1] - cy;
|
|
182
|
+
const dz = values[index + 2] - cz;
|
|
183
|
+
total += Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
184
|
+
}
|
|
185
|
+
return total / (length / 3);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Writes `a + b`, element by element, into `out`. One fused pass over tight
|
|
189
|
+
* buffers; the element count is `a.length / 3`. `out` may be `a` or `b`, but
|
|
190
|
+
* not a partially overlapping view of either. O(n).
|
|
191
|
+
*
|
|
192
|
+
* @returns `out`.
|
|
193
|
+
* @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
|
|
194
|
+
* multiple of 3.
|
|
195
|
+
*/
|
|
196
|
+
export function vec3ArrayAdd(out, a, b) {
|
|
197
|
+
const length = a.length;
|
|
198
|
+
if (out.length !== length || b.length !== length || length % 3 !== 0) {
|
|
199
|
+
throw new RangeError("vec3ArrayAdd: out, a and b must have the same length, a multiple of 3.");
|
|
200
|
+
}
|
|
201
|
+
for (let index = 0; index < length; index += 3) {
|
|
202
|
+
out[index] = a[index] + b[index];
|
|
203
|
+
out[index + 1] = a[index + 1] + b[index + 1];
|
|
204
|
+
out[index + 2] = a[index + 2] + b[index + 2];
|
|
205
|
+
}
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Writes `a − b`, element by element, into `out`. `out` may be `a` or `b`, but
|
|
210
|
+
* not a partially overlapping view. O(n).
|
|
211
|
+
*
|
|
212
|
+
* @returns `out`.
|
|
213
|
+
* @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
|
|
214
|
+
* multiple of 3.
|
|
215
|
+
*/
|
|
216
|
+
export function vec3ArraySubtract(out, a, b) {
|
|
217
|
+
const length = a.length;
|
|
218
|
+
if (out.length !== length || b.length !== length || length % 3 !== 0) {
|
|
219
|
+
throw new RangeError("vec3ArraySubtract: out, a and b must have the same length, a multiple of 3.");
|
|
220
|
+
}
|
|
221
|
+
for (let index = 0; index < length; index += 3) {
|
|
222
|
+
out[index] = a[index] - b[index];
|
|
223
|
+
out[index + 1] = a[index + 1] - b[index + 1];
|
|
224
|
+
out[index + 2] = a[index + 2] - b[index + 2];
|
|
225
|
+
}
|
|
226
|
+
return out;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Writes `a · scalar`, element by element, into `out`. `out` may be `a`, but
|
|
230
|
+
* not a partially overlapping view. O(n).
|
|
231
|
+
*
|
|
232
|
+
* @returns `out`.
|
|
233
|
+
* @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
|
|
234
|
+
*/
|
|
235
|
+
export function vec3ArrayMultiplyScalar(out, a, scalar) {
|
|
236
|
+
const length = a.length;
|
|
237
|
+
if (out.length !== length || length % 3 !== 0) {
|
|
238
|
+
throw new RangeError("vec3ArrayMultiplyScalar: out and a must have the same length, a multiple of 3.");
|
|
239
|
+
}
|
|
240
|
+
for (let index = 0; index < length; index += 3) {
|
|
241
|
+
out[index] = a[index] * scalar;
|
|
242
|
+
out[index + 1] = a[index + 1] * scalar;
|
|
243
|
+
out[index + 2] = a[index + 2] * scalar;
|
|
244
|
+
}
|
|
245
|
+
return out;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Writes `a + b · scale`, element by element, into `out`: two roundings per
|
|
249
|
+
* component, not a fused multiply-add. `out` may be `a` or `b`, but not a
|
|
250
|
+
* partially overlapping view. O(n).
|
|
251
|
+
*
|
|
252
|
+
* @returns `out`.
|
|
253
|
+
* @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
|
|
254
|
+
* multiple of 3.
|
|
255
|
+
*/
|
|
256
|
+
export function vec3ArrayAddScaled(out, a, b, scale) {
|
|
257
|
+
const length = a.length;
|
|
258
|
+
if (out.length !== length || b.length !== length || length % 3 !== 0) {
|
|
259
|
+
throw new RangeError("vec3ArrayAddScaled: out, a and b must have the same length, a multiple of 3.");
|
|
260
|
+
}
|
|
261
|
+
for (let index = 0; index < length; index += 3) {
|
|
262
|
+
out[index] = a[index] + b[index] * scale;
|
|
263
|
+
out[index + 1] = a[index + 1] + b[index + 1] * scale;
|
|
264
|
+
out[index + 2] = a[index + 2] + b[index + 2] * scale;
|
|
265
|
+
}
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Writes `a + offset`, `offset` added to every element, into `out`. `out` may
|
|
270
|
+
* be `a`, but not a partially overlapping view. O(n).
|
|
271
|
+
*
|
|
272
|
+
* @returns `out`.
|
|
273
|
+
* @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
|
|
274
|
+
*/
|
|
275
|
+
export function vec3ArrayTranslate(out, a, offset) {
|
|
276
|
+
const length = a.length;
|
|
277
|
+
if (out.length !== length || length % 3 !== 0) {
|
|
278
|
+
throw new RangeError("vec3ArrayTranslate: out and a must have the same length, a multiple of 3.");
|
|
279
|
+
}
|
|
280
|
+
const ox = offset[0];
|
|
281
|
+
const oy = offset[1];
|
|
282
|
+
const oz = offset[2];
|
|
283
|
+
for (let index = 0; index < length; index += 3) {
|
|
284
|
+
out[index] = a[index] + ox;
|
|
285
|
+
out[index + 1] = a[index + 1] + oy;
|
|
286
|
+
out[index + 2] = a[index + 2] + oz;
|
|
287
|
+
}
|
|
288
|
+
return out;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Writes `a + (b − a)·t`, element by element, into `out`, the expression of
|
|
292
|
+
* `@ac-kit/math-scalar`'s `lerp` written inline as {@link vec3Lerp} computes it
|
|
293
|
+
* (a kernel calls no per-component helper): a morph between two buffers, such
|
|
294
|
+
* as a chart transition. A `t` outside `[0, 1]` extrapolates. `out` may be `a`
|
|
295
|
+
* or `b`, but not a partially overlapping view. O(n).
|
|
296
|
+
*
|
|
297
|
+
* @returns `out`.
|
|
298
|
+
* @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
|
|
299
|
+
* multiple of 3.
|
|
300
|
+
*/
|
|
301
|
+
export function vec3ArrayLerp(out, a, b, t) {
|
|
302
|
+
const length = a.length;
|
|
303
|
+
if (out.length !== length || b.length !== length || length % 3 !== 0) {
|
|
304
|
+
throw new RangeError("vec3ArrayLerp: out, a and b must have the same length, a multiple of 3.");
|
|
305
|
+
}
|
|
306
|
+
for (let index = 0; index < length; index += 3) {
|
|
307
|
+
const ax = a[index];
|
|
308
|
+
out[index] = ax + (b[index] - ax) * t;
|
|
309
|
+
const ay = a[index + 1];
|
|
310
|
+
out[index + 1] = ay + (b[index + 1] - ay) * t;
|
|
311
|
+
const az = a[index + 2];
|
|
312
|
+
out[index + 2] = az + (b[index + 2] - az) * t;
|
|
313
|
+
}
|
|
314
|
+
return out;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Writes every element of `a` scaled to unit length into `out`, as
|
|
318
|
+
* {@link vec3Normalize} does for one: a zero element stays zero, and a `NaN`
|
|
319
|
+
* component gives `NaN` throughout that element. Plain arithmetic, right where
|
|
320
|
+
* the largest component lies between about `1e−150` and `1e150`. `out` may be
|
|
321
|
+
* `a`, but not a partially overlapping view. O(n).
|
|
322
|
+
*
|
|
323
|
+
* @returns `out`.
|
|
324
|
+
* @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
|
|
325
|
+
*/
|
|
326
|
+
export function vec3ArrayNormalize(out, a) {
|
|
327
|
+
const length = a.length;
|
|
328
|
+
if (out.length !== length || length % 3 !== 0) {
|
|
329
|
+
throw new RangeError("vec3ArrayNormalize: out and a must have the same length, a multiple of 3.");
|
|
330
|
+
}
|
|
331
|
+
for (let index = 0; index < length; index += 3) {
|
|
332
|
+
const x = a[index];
|
|
333
|
+
const y = a[index + 1];
|
|
334
|
+
const z = a[index + 2];
|
|
335
|
+
const lengthSquared = x * x + y * y + z * z;
|
|
336
|
+
const scale = lengthSquared === 0 ? 0 : 1 / Math.sqrt(lengthSquared);
|
|
337
|
+
out[index] = x * scale;
|
|
338
|
+
out[index + 1] = y * scale;
|
|
339
|
+
out[index + 2] = z * scale;
|
|
340
|
+
}
|
|
341
|
+
return out;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Writes the mean of the elements of `values` into `out`, in plain arithmetic.
|
|
345
|
+
* No element gives `NaN` in every component. O(n).
|
|
346
|
+
*
|
|
347
|
+
* @returns `out`.
|
|
348
|
+
* @throws {RangeError} Unless `values.length` is a multiple of 3.
|
|
349
|
+
*/
|
|
350
|
+
export function vec3ArrayMean(out, values) {
|
|
351
|
+
const length = values.length;
|
|
352
|
+
if (length % 3 !== 0) {
|
|
353
|
+
throw new RangeError("vec3ArrayMean: values must be a multiple of 3 long.");
|
|
354
|
+
}
|
|
355
|
+
let sumx = 0;
|
|
356
|
+
let sumy = 0;
|
|
357
|
+
let sumz = 0;
|
|
358
|
+
for (let index = 0; index < length; index += 3) {
|
|
359
|
+
sumx += values[index];
|
|
360
|
+
sumy += values[index + 1];
|
|
361
|
+
sumz += values[index + 2];
|
|
362
|
+
}
|
|
363
|
+
const count = length / 3;
|
|
364
|
+
out[0] = count === 0 ? NaN : sumx / count;
|
|
365
|
+
out[1] = count === 0 ? NaN : sumy / count;
|
|
366
|
+
out[2] = count === 0 ? NaN : sumz / count;
|
|
367
|
+
return out;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Writes `Σ wᵢ·vᵢ / Σ wᵢ` into `out`, one weight per element, in plain
|
|
371
|
+
* arithmetic. A zero total weight (no element included) gives `NaN` in every
|
|
372
|
+
* component. See {@link vec3ArrayWeightedMeanPrecise} for cancelling terms.
|
|
373
|
+
* O(n).
|
|
374
|
+
*
|
|
375
|
+
* @returns `out`.
|
|
376
|
+
* @throws {RangeError} Unless `values.length` is a multiple of 3 and
|
|
377
|
+
* `weights.length` is the number of elements.
|
|
378
|
+
*/
|
|
379
|
+
export function vec3ArrayWeightedMean(out, values, weights) {
|
|
380
|
+
const length = values.length;
|
|
381
|
+
if (length % 3 !== 0 || weights.length * 3 !== length) {
|
|
382
|
+
throw new RangeError("vec3ArrayWeightedMean: values must be a multiple of 3 long, with one weight per element.");
|
|
383
|
+
}
|
|
384
|
+
let sumx = 0;
|
|
385
|
+
let sumy = 0;
|
|
386
|
+
let sumz = 0;
|
|
387
|
+
let totalWeight = 0;
|
|
388
|
+
for (let index = 0, element = 0; index < length; index += 3, element++) {
|
|
389
|
+
const weight = weights[element];
|
|
390
|
+
sumx += values[index] * weight;
|
|
391
|
+
sumy += values[index + 1] * weight;
|
|
392
|
+
sumz += values[index + 2] * weight;
|
|
393
|
+
totalWeight += weight;
|
|
394
|
+
}
|
|
395
|
+
out[0] = totalWeight === 0 ? NaN : sumx / totalWeight;
|
|
396
|
+
out[1] = totalWeight === 0 ? NaN : sumy / totalWeight;
|
|
397
|
+
out[2] = totalWeight === 0 ? NaN : sumz / totalWeight;
|
|
398
|
+
return out;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* {@link vec3ArrayWeightedMean} with the numerator and the total weight summed
|
|
402
|
+
* exactly: every product `wᵢ·vᵢ` and the rounding error it dropped (what
|
|
403
|
+
* `@ac-kit/math-scalar`'s `twoProductError` recovers) go into `@ac-kit/core`'s
|
|
404
|
+
* `PreciseSum`, which is exact however the terms cancel (`[1e16, 1, 1e100,
|
|
405
|
+
* −1e100, −1e16]` with unit weights sums to `1`) and settles intermediate
|
|
406
|
+
* overflow. The only roundings left are the final one of each sum and the
|
|
407
|
+
* division. Exact where each product `wᵢ·vᵢ` stays in the normal range, from
|
|
408
|
+
* about `1e−290` to `1e300`: a product that underflows to zero
|
|
409
|
+
* (`Number.MIN_VALUE` with weight `0.5`) or overflows to infinity
|
|
410
|
+
* (`Number.MAX_VALUE` with weight `2`) is lost or infinite before it is summed,
|
|
411
|
+
* as in the plain form. It allocates one `PreciseSum` per component and one for
|
|
412
|
+
* the weights per call, and costs several times the plain form. O(n).
|
|
413
|
+
*
|
|
414
|
+
* @returns `out`.
|
|
415
|
+
* @throws {RangeError} Unless `values.length` is a multiple of 3 and
|
|
416
|
+
* `weights.length` is the number of elements.
|
|
417
|
+
*/
|
|
418
|
+
export function vec3ArrayWeightedMeanPrecise(out, values, weights) {
|
|
419
|
+
const length = values.length;
|
|
420
|
+
if (length % 3 !== 0 || weights.length * 3 !== length) {
|
|
421
|
+
throw new RangeError("vec3ArrayWeightedMeanPrecise: values must be a multiple of 3 long, with one weight per element.");
|
|
422
|
+
}
|
|
423
|
+
const sumx = new PreciseSum();
|
|
424
|
+
const sumy = new PreciseSum();
|
|
425
|
+
const sumz = new PreciseSum();
|
|
426
|
+
const totalWeight = new PreciseSum();
|
|
427
|
+
for (let index = 0, element = 0; index < length; index += 3, element++) {
|
|
428
|
+
const weight = weights[element];
|
|
429
|
+
const valuex = values[index];
|
|
430
|
+
const productx = valuex * weight;
|
|
431
|
+
sumx.add(productx);
|
|
432
|
+
// No error to recover from a product that overflowed or is not a number.
|
|
433
|
+
if (Number.isFinite(productx)) {
|
|
434
|
+
sumx.add(twoProductError(valuex, weight, productx));
|
|
435
|
+
}
|
|
436
|
+
const valuey = values[index + 1];
|
|
437
|
+
const producty = valuey * weight;
|
|
438
|
+
sumy.add(producty);
|
|
439
|
+
// No error to recover from a product that overflowed or is not a number.
|
|
440
|
+
if (Number.isFinite(producty)) {
|
|
441
|
+
sumy.add(twoProductError(valuey, weight, producty));
|
|
442
|
+
}
|
|
443
|
+
const valuez = values[index + 2];
|
|
444
|
+
const productz = valuez * weight;
|
|
445
|
+
sumz.add(productz);
|
|
446
|
+
// No error to recover from a product that overflowed or is not a number.
|
|
447
|
+
if (Number.isFinite(productz)) {
|
|
448
|
+
sumz.add(twoProductError(valuez, weight, productz));
|
|
449
|
+
}
|
|
450
|
+
totalWeight.add(weight);
|
|
451
|
+
}
|
|
452
|
+
const divisor = totalWeight.value;
|
|
453
|
+
out[0] = divisor === 0 ? NaN : sumx.value / divisor;
|
|
454
|
+
out[1] = divisor === 0 ? NaN : sumy.value / divisor;
|
|
455
|
+
out[2] = divisor === 0 ? NaN : sumz.value / divisor;
|
|
456
|
+
return out;
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=vec3-array-componentwise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec3-array-componentwise.js","sourceRoot":"","sources":["../src/vec3-array-componentwise.ts"],"names":[],"mappings":"AAAA,qHAAqH;AAErH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC5C,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,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;QACjC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnB,yEAAyE;QACzE,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC;IAClC,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACpD,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACpD,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACpD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ReadonlyAffine3 } from "./affine3.js";
|
|
2
|
+
import type { ReadonlyMat3x3 } from "./mat3x3.js";
|
|
3
|
+
import type { ReadonlyMat4x4 } from "./mat4x4.js";
|
|
4
|
+
import type { ReadonlyVec3 } from "./vec3.js";
|
|
5
|
+
/**
|
|
6
|
+
* The index of the element of `points` nearest to `point` among those within
|
|
7
|
+
* `maxDistance`, or `−1` when there is none (an empty buffer, every point
|
|
8
|
+
* farther, a `NaN` distance). A tie goes to the lower index. Distances are
|
|
9
|
+
* compared squared, in plain arithmetic, so the result is right where the
|
|
10
|
+
* coordinate differences lie between about `1e−150` and `1e150`: beyond, the
|
|
11
|
+
* squares overflow (a point at `[1e200, 0, 0]` is never found, whatever
|
|
12
|
+
* `maxDistance`) or lose their digits. One pass, no allocation. O(n).
|
|
13
|
+
*
|
|
14
|
+
* @param points A buffer of `Vec3` elements.
|
|
15
|
+
* @param maxDistance The largest distance that counts, `Infinity` by default.
|
|
16
|
+
* @returns The element index (not the offset into `points`).
|
|
17
|
+
* @throws {RangeError} Unless `points.length` is a multiple of 3.
|
|
18
|
+
*/
|
|
19
|
+
export declare function vec3ArrayFindNearest(points: Float64Array, point: ReadonlyVec3, maxDistance?: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Writes `m · v` for every element `v` of `input` into `out`, as
|
|
22
|
+
* {@link vec3TransformMat3x3} does for one. `out` may be `input`, but not a
|
|
23
|
+
* partially overlapping view. O(n).
|
|
24
|
+
*
|
|
25
|
+
* @returns `out`.
|
|
26
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
27
|
+
* multiple of 3.
|
|
28
|
+
*/
|
|
29
|
+
export declare function vec3ArrayTransformMat3x3<T extends Float64Array>(out: T, input: Float64Array, m: ReadonlyMat3x3): T;
|
|
30
|
+
/**
|
|
31
|
+
* Transforms every element of `input` by the normal matrix `normalMatrix` (the
|
|
32
|
+
* inverse transpose of a model matrix's linear part), then scales it to unit
|
|
33
|
+
* length, in one pass: a zero result stays zero, a `NaN` gives `NaN` throughout
|
|
34
|
+
* that element. The squared length is plain arithmetic, so the result is right
|
|
35
|
+
* where the transformed components lie between about `1e−150` and `1e150`:
|
|
36
|
+
* beyond, the square overflows or underflows and the element comes back as
|
|
37
|
+
* zeros (`[1e200, 0, 0]` under the identity), as {@link vec3Normalize} does.
|
|
38
|
+
* `out` may be `input`, but not a partially overlapping view. O(n).
|
|
39
|
+
*
|
|
40
|
+
* @returns `out`.
|
|
41
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
42
|
+
* multiple of 3.
|
|
43
|
+
*/
|
|
44
|
+
export declare function vec3ArrayTransformNormal<T extends Float64Array>(out: T, input: Float64Array, normalMatrix: ReadonlyMat3x3): T;
|
|
45
|
+
/**
|
|
46
|
+
* Writes every point of `input` transformed by the affine transform (the linear
|
|
47
|
+
* part, then the translation) into `out`, as {@link vec3TransformAffine3} does
|
|
48
|
+
* for one. `out` may be `input`, but not a partially overlapping view. O(n).
|
|
49
|
+
*
|
|
50
|
+
* @returns `out`.
|
|
51
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
52
|
+
* multiple of 3.
|
|
53
|
+
*/
|
|
54
|
+
export declare function vec3ArrayTransformAffine3<T extends Float64Array>(out: T, input: Float64Array, transform: ReadonlyAffine3): T;
|
|
55
|
+
/**
|
|
56
|
+
* Writes every direction of `input` transformed by the linear part of the
|
|
57
|
+
* affine transform, with no translation, into `out`, as
|
|
58
|
+
* {@link vec3TransformDirectionAffine3} does for one. `out` may be `input`, but
|
|
59
|
+
* not a partially overlapping view. O(n).
|
|
60
|
+
*
|
|
61
|
+
* @returns `out`.
|
|
62
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
63
|
+
* multiple of 3.
|
|
64
|
+
*/
|
|
65
|
+
export declare function vec3ArrayTransformDirectionAffine3<T extends Float64Array>(out: T, input: Float64Array, transform: ReadonlyAffine3): T;
|
|
66
|
+
/**
|
|
67
|
+
* Writes every point of `input` (as `[x, y, z, 1]`) transformed by `m` and
|
|
68
|
+
* divided by the resulting `w` into `out`, as {@link vec3TransformMat4x4} does
|
|
69
|
+
* for one: for an affine matrix `w` is exactly `1`, for a projection this is
|
|
70
|
+
* the perspective divide. A `w` of zero gives non-finite components. `out` may
|
|
71
|
+
* be `input`, but not a partially overlapping view. O(n).
|
|
72
|
+
*
|
|
73
|
+
* @returns `out`.
|
|
74
|
+
* @throws {RangeError} Unless `out` and `input` have the same length, a
|
|
75
|
+
* multiple of 3.
|
|
76
|
+
*/
|
|
77
|
+
export declare function vec3ArrayTransformMat4x4<T extends Float64Array>(out: T, input: Float64Array, m: ReadonlyMat4x4): T;
|
|
78
|
+
/**
|
|
79
|
+
* {@link vec3ArrayTransformAffine3} over interleaved data: point `i` is read at
|
|
80
|
+
* `input[inputOffset + i·inputStride …]` and written at `out[outOffset +
|
|
81
|
+
* i·outStride …]`, offsets and strides counted in numbers, for `count` points.
|
|
82
|
+
* `out` may be `input` only as the same elements (one array, offset and stride,
|
|
83
|
+
* so each is read before it is written) or as elements that share no memory:
|
|
84
|
+
* any other overlap is refused. O(n).
|
|
85
|
+
*
|
|
86
|
+
* @returns `out`.
|
|
87
|
+
* @throws {RangeError} Unless `count`, the offsets and the strides are
|
|
88
|
+
* non-negative integers, the strides are at least 3 from two points on, the
|
|
89
|
+
* points fit in both arrays, and `out` and `input` overlap in no other way.
|
|
90
|
+
*/
|
|
91
|
+
export declare function vec3ArrayTransformAffine3Strided<T extends Float64Array>(out: T, outOffset: number, outStride: number, input: Float64Array, inputOffset: number, inputStride: number, count: number, transform: ReadonlyAffine3): T;
|
|
92
|
+
/**
|
|
93
|
+
* {@link vec3ArrayTransformMat4x4} over interleaved data, with the offsets,
|
|
94
|
+
* strides, count and aliasing rule of {@link vec3ArrayTransformAffine3Strided}
|
|
95
|
+
* (the same elements, or none shared). O(n).
|
|
96
|
+
*
|
|
97
|
+
* @returns `out`.
|
|
98
|
+
* @throws {RangeError} On the conditions of
|
|
99
|
+
* {@link vec3ArrayTransformAffine3Strided}.
|
|
100
|
+
*/
|
|
101
|
+
export declare function vec3ArrayTransformMat4x4Strided<T extends Float64Array>(out: T, outOffset: number, outStride: number, input: Float64Array, inputOffset: number, inputStride: number, count: number, m: ReadonlyMat4x4): T;
|
|
102
|
+
//# sourceMappingURL=vec3-array.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec3-array.d.ts","sourceRoot":"","sources":["../src/vec3-array.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAgB9C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,EACnB,WAAW,SAAW,GACpB,MAAM,CAwBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,YAAY,EAC9D,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,CAAC,EAAE,cAAc,GACf,CAAC,CAoBH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,YAAY,EAC9D,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,YAAY,EAAE,cAAc,GAC1B,CAAC,CAyBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,YAAY,EAC/D,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,eAAe,GACxB,CAAC,CAuBH;AAED;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,YAAY,EACxE,GAAG,EAAE,CAAC,EACN,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,eAAe,GACxB,CAAC,CAwBH;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,YAAY,EAC9D,GAAG,EAAE,CAAC,EACN,K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