@ac-kit/math-linear 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +232 -16
  3. package/dist/_brand.d.ts +14 -0
  4. package/dist/_brand.d.ts.map +1 -0
  5. package/dist/_brand.js +2 -0
  6. package/dist/_brand.js.map +1 -0
  7. package/dist/_invert.d.ts +214 -0
  8. package/dist/_invert.d.ts.map +1 -0
  9. package/dist/_invert.js +884 -0
  10. package/dist/_invert.js.map +1 -0
  11. package/dist/_slerp.d.ts +29 -0
  12. package/dist/_slerp.d.ts.map +1 -1
  13. package/dist/_slerp.js +103 -0
  14. package/dist/_slerp.js.map +1 -1
  15. package/dist/_strided-range.d.ts +23 -0
  16. package/dist/_strided-range.d.ts.map +1 -0
  17. package/dist/_strided-range.js +75 -0
  18. package/dist/_strided-range.js.map +1 -0
  19. package/dist/_trs.d.ts +38 -0
  20. package/dist/_trs.d.ts.map +1 -0
  21. package/dist/_trs.js +132 -0
  22. package/dist/_trs.js.map +1 -0
  23. package/dist/affine2-array.d.ts +53 -0
  24. package/dist/affine2-array.d.ts.map +1 -0
  25. package/dist/affine2-array.js +107 -0
  26. package/dist/affine2-array.js.map +1 -0
  27. package/dist/affine2-componentwise.d.ts +28 -0
  28. package/dist/affine2-componentwise.d.ts.map +1 -0
  29. package/dist/affine2-componentwise.js +66 -0
  30. package/dist/affine2-componentwise.js.map +1 -0
  31. package/dist/affine2.d.ts +156 -0
  32. package/dist/affine2.d.ts.map +1 -0
  33. package/dist/affine2.js +437 -0
  34. package/dist/affine2.js.map +1 -0
  35. package/dist/affine3-array.d.ts +53 -0
  36. package/dist/affine3-array.d.ts.map +1 -0
  37. package/dist/affine3-array.js +137 -0
  38. package/dist/affine3-array.js.map +1 -0
  39. package/dist/affine3-componentwise.d.ts +32 -0
  40. package/dist/affine3-componentwise.d.ts.map +1 -0
  41. package/dist/affine3-componentwise.js +100 -0
  42. package/dist/affine3-componentwise.js.map +1 -0
  43. package/dist/affine3.d.ts +205 -0
  44. package/dist/affine3.d.ts.map +1 -0
  45. package/dist/affine3.js +792 -0
  46. package/dist/affine3.js.map +1 -0
  47. package/dist/checked/index.d.ts +35 -0
  48. package/dist/checked/index.d.ts.map +1 -0
  49. package/dist/checked/index.js +58 -0
  50. package/dist/checked/index.js.map +1 -0
  51. package/dist/euler.d.ts +65 -0
  52. package/dist/euler.d.ts.map +1 -0
  53. package/dist/euler.js +217 -0
  54. package/dist/euler.js.map +1 -0
  55. package/dist/index.d.ts +29 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +29 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/kl-activations.d.ts.map +1 -1
  60. package/dist/kl-activations.js +4 -3
  61. package/dist/kl-activations.js.map +1 -1
  62. package/dist/mat2x2-array.d.ts +36 -0
  63. package/dist/mat2x2-array.d.ts.map +1 -0
  64. package/dist/mat2x2-array.js +71 -0
  65. package/dist/mat2x2-array.js.map +1 -0
  66. package/dist/mat2x2-componentwise.d.ts +86 -0
  67. package/dist/mat2x2-componentwise.d.ts.map +1 -0
  68. package/dist/mat2x2-componentwise.js +199 -0
  69. package/dist/mat2x2-componentwise.js.map +1 -0
  70. package/dist/mat2x2.d.ts +79 -25
  71. package/dist/mat2x2.d.ts.map +1 -1
  72. package/dist/mat2x2.js +192 -93
  73. package/dist/mat2x2.js.map +1 -1
  74. package/dist/mat3x3-array.d.ts +36 -0
  75. package/dist/mat3x3-array.d.ts.map +1 -0
  76. package/dist/mat3x3-array.js +91 -0
  77. package/dist/mat3x3-array.js.map +1 -0
  78. package/dist/mat3x3-componentwise.d.ts +86 -0
  79. package/dist/mat3x3-componentwise.d.ts.map +1 -0
  80. package/dist/mat3x3-componentwise.js +299 -0
  81. package/dist/mat3x3-componentwise.js.map +1 -0
  82. package/dist/mat3x3.d.ts +153 -48
  83. package/dist/mat3x3.d.ts.map +1 -1
  84. package/dist/mat3x3.js +470 -192
  85. package/dist/mat3x3.js.map +1 -1
  86. package/dist/mat4x4-array.d.ts +46 -0
  87. package/dist/mat4x4-array.d.ts.map +1 -0
  88. package/dist/mat4x4-array.js +133 -0
  89. package/dist/mat4x4-array.js.map +1 -0
  90. package/dist/mat4x4-componentwise.d.ts +87 -0
  91. package/dist/mat4x4-componentwise.d.ts.map +1 -0
  92. package/dist/mat4x4-componentwise.js +434 -0
  93. package/dist/mat4x4-componentwise.js.map +1 -0
  94. package/dist/mat4x4.d.ts +221 -67
  95. package/dist/mat4x4.d.ts.map +1 -1
  96. package/dist/mat4x4.js +972 -334
  97. package/dist/mat4x4.js.map +1 -1
  98. package/dist/projection.d.ts +113 -0
  99. package/dist/projection.d.ts.map +1 -0
  100. package/dist/projection.js +418 -0
  101. package/dist/projection.js.map +1 -0
  102. package/dist/quaternion-array.d.ts +47 -0
  103. package/dist/quaternion-array.d.ts.map +1 -0
  104. package/dist/quaternion-array.js +86 -0
  105. package/dist/quaternion-array.js.map +1 -0
  106. package/dist/quaternion.d.ts +106 -22
  107. package/dist/quaternion.d.ts.map +1 -1
  108. package/dist/quaternion.js +253 -182
  109. package/dist/quaternion.js.map +1 -1
  110. package/dist/transform.d.ts +220 -0
  111. package/dist/transform.d.ts.map +1 -0
  112. package/dist/transform.js +412 -0
  113. package/dist/transform.js.map +1 -0
  114. package/dist/tridiagonal.d.ts +52 -0
  115. package/dist/tridiagonal.d.ts.map +1 -0
  116. package/dist/tridiagonal.js +90 -0
  117. package/dist/tridiagonal.js.map +1 -0
  118. package/dist/upload.d.ts +55 -0
  119. package/dist/upload.d.ts.map +1 -0
  120. package/dist/upload.js +129 -0
  121. package/dist/upload.js.map +1 -0
  122. package/dist/vec2-array-componentwise.d.ts +207 -0
  123. package/dist/vec2-array-componentwise.d.ts.map +1 -0
  124. package/dist/vec2-array-componentwise.js +472 -0
  125. package/dist/vec2-array-componentwise.js.map +1 -0
  126. package/dist/vec2-array.d.ts +53 -0
  127. package/dist/vec2-array.d.ts.map +1 -0
  128. package/dist/vec2-array.js +123 -0
  129. package/dist/vec2-array.js.map +1 -0
  130. package/dist/vec2-componentwise.d.ts +311 -0
  131. package/dist/vec2-componentwise.d.ts.map +1 -0
  132. package/dist/vec2-componentwise.js +542 -0
  133. package/dist/vec2-componentwise.js.map +1 -0
  134. package/dist/vec2.d.ts +97 -82
  135. package/dist/vec2.d.ts.map +1 -1
  136. package/dist/vec2.js +121 -216
  137. package/dist/vec2.js.map +1 -1
  138. package/dist/vec3-array-componentwise.d.ts +207 -0
  139. package/dist/vec3-array-componentwise.d.ts.map +1 -0
  140. package/dist/vec3-array-componentwise.js +510 -0
  141. package/dist/vec3-array-componentwise.js.map +1 -0
  142. package/dist/vec3-array.d.ts +102 -0
  143. package/dist/vec3-array.d.ts.map +1 -0
  144. package/dist/vec3-array.js +299 -0
  145. package/dist/vec3-array.js.map +1 -0
  146. package/dist/vec3-componentwise.d.ts +310 -0
  147. package/dist/vec3-componentwise.d.ts.map +1 -0
  148. package/dist/vec3-componentwise.js +594 -0
  149. package/dist/vec3-componentwise.js.map +1 -0
  150. package/dist/vec3.d.ts +177 -87
  151. package/dist/vec3.d.ts.map +1 -1
  152. package/dist/vec3.js +391 -272
  153. package/dist/vec3.js.map +1 -1
  154. package/dist/vec4-array-componentwise.d.ts +198 -0
  155. package/dist/vec4-array-componentwise.d.ts.map +1 -0
  156. package/dist/vec4-array-componentwise.js +521 -0
  157. package/dist/vec4-array-componentwise.js.map +1 -0
  158. package/dist/vec4-array.d.ts +12 -0
  159. package/dist/vec4-array.d.ts.map +1 -0
  160. package/dist/vec4-array.js +43 -0
  161. package/dist/vec4-array.js.map +1 -0
  162. package/dist/vec4-componentwise.d.ts +299 -0
  163. package/dist/vec4-componentwise.d.ts.map +1 -0
  164. package/dist/vec4-componentwise.js +637 -0
  165. package/dist/vec4-componentwise.js.map +1 -0
  166. package/dist/vec4.d.ts +59 -53
  167. package/dist/vec4.d.ts.map +1 -1
  168. package/dist/vec4.js +74 -249
  169. package/dist/vec4.js.map +1 -1
  170. package/dist/view-basis.d.ts +15 -0
  171. package/dist/view-basis.d.ts.map +1 -0
  172. package/dist/view-basis.js +29 -0
  173. package/dist/view-basis.js.map +1 -0
  174. package/dist/viewport.d.ts +114 -0
  175. package/dist/viewport.d.ts.map +1 -0
  176. package/dist/viewport.js +250 -0
  177. package/dist/viewport.js.map +1 -0
  178. package/package.json +19 -9
@@ -0,0 +1,510 @@
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
+ * Splits a tight binary64 buffer into two binary32 parts in one pass: for each
104
+ * number `x`, `high = fround(x)` at `out[highOffset + i·outStride …]` and `low
105
+ * = fround(x − high)` at `out[lowOffset + i·outStride …]`, offsets and stride
106
+ * counted in numbers, the other numbers of each stride untouched. `high + low`
107
+ * keeps about 48 bits of `x` (the two-float "split" positions of a vertex
108
+ * buffer, recombined relative to a reference on the GPU). `x − high` is exact
109
+ * in binary64; past the binary32 range `high` is infinite. `out` and `input`
110
+ * share no memory. O(n), no allocation.
111
+ *
112
+ * @returns `out`.
113
+ * @throws {RangeError} Unless `input.length` is a multiple of 3, the offsets
114
+ * and the stride are non-negative integers (the stride at least 3 from two
115
+ * elements on), the two parts of every element lie apart from each other and
116
+ * from the parts of the other elements, the last element fits in `out`, and
117
+ * `out` and `input` share no memory.
118
+ */
119
+ export function vec3ArraySplitStrided(out, highOffset, lowOffset, outStride, input) {
120
+ const length = input.length;
121
+ if (length % 3 !== 0) {
122
+ throw new RangeError("vec3ArraySplitStrided: input must be a multiple of 3 long.");
123
+ }
124
+ const count = length / 3;
125
+ assertStridedRange_("vec3ArraySplitStrided", "out", out.length, highOffset, outStride, count, 3);
126
+ assertStridedRange_("vec3ArraySplitStrided", "out", out.length, lowOffset, outStride, count, 3);
127
+ if (count > 0) {
128
+ const apart = count === 1
129
+ ? Math.abs(lowOffset - highOffset)
130
+ : (((lowOffset - highOffset) % outStride) + outStride) % outStride;
131
+ if (apart < 3 || (count > 1 && outStride - apart < 3)) {
132
+ throw new RangeError("vec3ArraySplitStrided: the high and low parts must not overlap.");
133
+ }
134
+ }
135
+ if (length > 0 && viewsMayOverlap(out, input)) {
136
+ throw new RangeError("vec3ArraySplitStrided: out and input must not share memory.");
137
+ }
138
+ for (let index = 0, high = highOffset, low = lowOffset; index < length; index += 3, high += outStride, low += outStride) {
139
+ const xx = input[index];
140
+ const hx = Math.fround(xx);
141
+ out[high] = hx;
142
+ out[low] = xx - hx;
143
+ const xy = input[index + 1];
144
+ const hy = Math.fround(xy);
145
+ out[high + 1] = hy;
146
+ out[low + 1] = xy - hy;
147
+ const xz = input[index + 2];
148
+ const hz = Math.fround(xz);
149
+ out[high + 2] = hz;
150
+ out[low + 2] = xz - hz;
151
+ }
152
+ return out;
153
+ }
154
+ /**
155
+ * Narrows `input − origin` to binary32 in one pass, the subtraction in
156
+ * binary64: large coordinates (a map in metres, a time axis in milliseconds)
157
+ * keep their precision relative to a nearby `origin`, where narrowing first
158
+ * loses it. `out` and `input` hold the same number of elements and share no
159
+ * memory (a `Float32Array` and a `Float64Array` over one buffer overlap in
160
+ * bytes, and the narrowing would read what it already wrote). O(n).
161
+ *
162
+ * @returns `out`.
163
+ * @throws {RangeError} Unless `out` and `input` have the same length, a
164
+ * multiple of 3, and share no memory.
165
+ */
166
+ export function vec3ArrayNarrowRelative(out, input, origin) {
167
+ const length = input.length;
168
+ if (out.length !== length || length % 3 !== 0) {
169
+ throw new RangeError("vec3ArrayNarrowRelative: out and input must have the same length, a multiple of 3.");
170
+ }
171
+ if (length > 0 && viewsMayOverlap(out, input)) {
172
+ throw new RangeError("vec3ArrayNarrowRelative: out and input must not share memory.");
173
+ }
174
+ const ox = origin[0];
175
+ const oy = origin[1];
176
+ const oz = origin[2];
177
+ for (let index = 0; index < length; index += 3) {
178
+ out[index] = input[index] - ox;
179
+ out[index + 1] = input[index + 1] - oy;
180
+ out[index + 2] = input[index + 2] - oz;
181
+ }
182
+ return out;
183
+ }
184
+ /**
185
+ * {@link vec3ArrayNarrowRelative} into an interleaved buffer: element `i` goes
186
+ * to `out[outOffset + i·outStride …]`, offset and stride counted in numbers.
187
+ * `out` and `input` share no memory. O(n).
188
+ *
189
+ * @returns `out`.
190
+ * @throws {RangeError} Unless `input.length` is a multiple of 3, `count`, the
191
+ * offset and the stride are non-negative integers (the stride at least 3 from
192
+ * two elements on), the last element fits in `out`, and `out` and `input`
193
+ * share no memory.
194
+ */
195
+ export function vec3ArrayNarrowRelativeStrided(out, outOffset, outStride, input, origin) {
196
+ const length = input.length;
197
+ if (length % 3 !== 0) {
198
+ throw new RangeError("vec3ArrayNarrowRelativeStrided: input must be a multiple of 3 long.");
199
+ }
200
+ assertStridedRange_("vec3ArrayNarrowRelativeStrided", "out", out.length, outOffset, outStride, length / 3, 3);
201
+ if (length > 0 && viewsMayOverlap(out, input)) {
202
+ throw new RangeError("vec3ArrayNarrowRelativeStrided: out and input must not share memory.");
203
+ }
204
+ const ox = origin[0];
205
+ const oy = origin[1];
206
+ const oz = origin[2];
207
+ for (let index = 0, target = outOffset; index < length; index += 3, target += outStride) {
208
+ out[target] = input[index] - ox;
209
+ out[target + 1] = input[index + 1] - oy;
210
+ out[target + 2] = input[index + 2] - oz;
211
+ }
212
+ return out;
213
+ }
214
+ /**
215
+ * The mean Euclidean distance of the elements of `values` to `center`: the
216
+ * spread of a gesture's touch points, for one. Plain arithmetic, so right where
217
+ * the largest difference lies between about `1e−150` and `1e150`. No element
218
+ * gives `NaN`. O(n).
219
+ *
220
+ * @throws {RangeError} Unless `values.length` is a multiple of 3.
221
+ */
222
+ export function vec3ArrayMeanDistance(values, center) {
223
+ const length = values.length;
224
+ if (length % 3 !== 0) {
225
+ throw new RangeError("vec3ArrayMeanDistance: values must be a multiple of 3 long.");
226
+ }
227
+ const cx = center[0];
228
+ const cy = center[1];
229
+ const cz = center[2];
230
+ let total = 0;
231
+ for (let index = 0; index < length; index += 3) {
232
+ const dx = values[index] - cx;
233
+ const dy = values[index + 1] - cy;
234
+ const dz = values[index + 2] - cz;
235
+ total += Math.sqrt(dx * dx + dy * dy + dz * dz);
236
+ }
237
+ return total / (length / 3);
238
+ }
239
+ /**
240
+ * Writes `a + b`, element by element, into `out`. One fused pass over tight
241
+ * buffers; the element count is `a.length / 3`. `out` may be `a` or `b`, but
242
+ * not a partially overlapping view of either. O(n).
243
+ *
244
+ * @returns `out`.
245
+ * @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
246
+ * multiple of 3.
247
+ */
248
+ export function vec3ArrayAdd(out, a, b) {
249
+ const length = a.length;
250
+ if (out.length !== length || b.length !== length || length % 3 !== 0) {
251
+ throw new RangeError("vec3ArrayAdd: out, a and b must have the same length, a multiple of 3.");
252
+ }
253
+ for (let index = 0; index < length; index += 3) {
254
+ out[index] = a[index] + b[index];
255
+ out[index + 1] = a[index + 1] + b[index + 1];
256
+ out[index + 2] = a[index + 2] + b[index + 2];
257
+ }
258
+ return out;
259
+ }
260
+ /**
261
+ * Writes `a − b`, element by element, into `out`. `out` may be `a` or `b`, but
262
+ * not a partially overlapping view. O(n).
263
+ *
264
+ * @returns `out`.
265
+ * @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
266
+ * multiple of 3.
267
+ */
268
+ export function vec3ArraySubtract(out, a, b) {
269
+ const length = a.length;
270
+ if (out.length !== length || b.length !== length || length % 3 !== 0) {
271
+ throw new RangeError("vec3ArraySubtract: out, a and b must have the same length, a multiple of 3.");
272
+ }
273
+ for (let index = 0; index < length; index += 3) {
274
+ out[index] = a[index] - b[index];
275
+ out[index + 1] = a[index + 1] - b[index + 1];
276
+ out[index + 2] = a[index + 2] - b[index + 2];
277
+ }
278
+ return out;
279
+ }
280
+ /**
281
+ * Writes `a · scalar`, element by element, into `out`. `out` may be `a`, but
282
+ * not a partially overlapping view. O(n).
283
+ *
284
+ * @returns `out`.
285
+ * @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
286
+ */
287
+ export function vec3ArrayMultiplyScalar(out, a, scalar) {
288
+ const length = a.length;
289
+ if (out.length !== length || length % 3 !== 0) {
290
+ throw new RangeError("vec3ArrayMultiplyScalar: out and a must have the same length, a multiple of 3.");
291
+ }
292
+ for (let index = 0; index < length; index += 3) {
293
+ out[index] = a[index] * scalar;
294
+ out[index + 1] = a[index + 1] * scalar;
295
+ out[index + 2] = a[index + 2] * scalar;
296
+ }
297
+ return out;
298
+ }
299
+ /**
300
+ * Writes `a + b · scale`, element by element, into `out`: two roundings per
301
+ * component, not a fused multiply-add. `out` may be `a` or `b`, but not a
302
+ * partially overlapping view. O(n).
303
+ *
304
+ * @returns `out`.
305
+ * @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
306
+ * multiple of 3.
307
+ */
308
+ export function vec3ArrayAddScaled(out, a, b, scale) {
309
+ const length = a.length;
310
+ if (out.length !== length || b.length !== length || length % 3 !== 0) {
311
+ throw new RangeError("vec3ArrayAddScaled: out, a and b must have the same length, a multiple of 3.");
312
+ }
313
+ for (let index = 0; index < length; index += 3) {
314
+ out[index] = a[index] + b[index] * scale;
315
+ out[index + 1] = a[index + 1] + b[index + 1] * scale;
316
+ out[index + 2] = a[index + 2] + b[index + 2] * scale;
317
+ }
318
+ return out;
319
+ }
320
+ /**
321
+ * Writes `a + offset`, `offset` added to every element, into `out`. `out` may
322
+ * be `a`, but not a partially overlapping view. O(n).
323
+ *
324
+ * @returns `out`.
325
+ * @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
326
+ */
327
+ export function vec3ArrayTranslate(out, a, offset) {
328
+ const length = a.length;
329
+ if (out.length !== length || length % 3 !== 0) {
330
+ throw new RangeError("vec3ArrayTranslate: out and a must have the same length, a multiple of 3.");
331
+ }
332
+ const ox = offset[0];
333
+ const oy = offset[1];
334
+ const oz = offset[2];
335
+ for (let index = 0; index < length; index += 3) {
336
+ out[index] = a[index] + ox;
337
+ out[index + 1] = a[index + 1] + oy;
338
+ out[index + 2] = a[index + 2] + oz;
339
+ }
340
+ return out;
341
+ }
342
+ /**
343
+ * Writes `a + (b − a)·t`, element by element, into `out`, the expression of
344
+ * `@ac-kit/math-scalar`'s `lerp` written inline as {@link vec3Lerp} computes it
345
+ * (a kernel calls no per-component helper): a morph between two buffers, such
346
+ * as a chart transition. A `t` outside `[0, 1]` extrapolates. `out` may be `a`
347
+ * or `b`, but not a partially overlapping view. O(n).
348
+ *
349
+ * @returns `out`.
350
+ * @throws {RangeError} Unless `out`, `a` and `b` have the same length, a
351
+ * multiple of 3.
352
+ */
353
+ export function vec3ArrayLerp(out, a, b, t) {
354
+ const length = a.length;
355
+ if (out.length !== length || b.length !== length || length % 3 !== 0) {
356
+ throw new RangeError("vec3ArrayLerp: out, a and b must have the same length, a multiple of 3.");
357
+ }
358
+ for (let index = 0; index < length; index += 3) {
359
+ const ax = a[index];
360
+ out[index] = ax + (b[index] - ax) * t;
361
+ const ay = a[index + 1];
362
+ out[index + 1] = ay + (b[index + 1] - ay) * t;
363
+ const az = a[index + 2];
364
+ out[index + 2] = az + (b[index + 2] - az) * t;
365
+ }
366
+ return out;
367
+ }
368
+ /**
369
+ * Writes every element of `a` scaled to unit length into `out`, as
370
+ * {@link vec3Normalize} does for one: a zero element stays zero, and a `NaN`
371
+ * component gives `NaN` throughout that element. Plain arithmetic, right where
372
+ * the largest component lies between about `1e−150` and `1e150`. `out` may be
373
+ * `a`, but not a partially overlapping view. O(n).
374
+ *
375
+ * @returns `out`.
376
+ * @throws {RangeError} Unless `out` and `a` have the same length, a multiple of 3.
377
+ */
378
+ export function vec3ArrayNormalize(out, a) {
379
+ const length = a.length;
380
+ if (out.length !== length || length % 3 !== 0) {
381
+ throw new RangeError("vec3ArrayNormalize: out and a must have the same length, a multiple of 3.");
382
+ }
383
+ for (let index = 0; index < length; index += 3) {
384
+ const x = a[index];
385
+ const y = a[index + 1];
386
+ const z = a[index + 2];
387
+ const lengthSquared = x * x + y * y + z * z;
388
+ const scale = lengthSquared === 0 ? 0 : 1 / Math.sqrt(lengthSquared);
389
+ out[index] = x * scale;
390
+ out[index + 1] = y * scale;
391
+ out[index + 2] = z * scale;
392
+ }
393
+ return out;
394
+ }
395
+ /**
396
+ * Writes the mean of the elements of `values` into `out`, in plain arithmetic.
397
+ * No element gives `NaN` in every component. O(n).
398
+ *
399
+ * @returns `out`.
400
+ * @throws {RangeError} Unless `values.length` is a multiple of 3.
401
+ */
402
+ export function vec3ArrayMean(out, values) {
403
+ const length = values.length;
404
+ if (length % 3 !== 0) {
405
+ throw new RangeError("vec3ArrayMean: values must be a multiple of 3 long.");
406
+ }
407
+ let sumx = 0;
408
+ let sumy = 0;
409
+ let sumz = 0;
410
+ for (let index = 0; index < length; index += 3) {
411
+ sumx += values[index];
412
+ sumy += values[index + 1];
413
+ sumz += values[index + 2];
414
+ }
415
+ const count = length / 3;
416
+ out[0] = count === 0 ? NaN : sumx / count;
417
+ out[1] = count === 0 ? NaN : sumy / count;
418
+ out[2] = count === 0 ? NaN : sumz / count;
419
+ return out;
420
+ }
421
+ /**
422
+ * Writes `Σ wᵢ·vᵢ / Σ wᵢ` into `out`, one weight per element, in plain
423
+ * arithmetic. A zero total weight (no element included) gives `NaN` in every
424
+ * component. See {@link vec3ArrayWeightedMeanPrecise} for cancelling terms.
425
+ * O(n).
426
+ *
427
+ * @returns `out`.
428
+ * @throws {RangeError} Unless `values.length` is a multiple of 3 and
429
+ * `weights.length` is the number of elements.
430
+ */
431
+ export function vec3ArrayWeightedMean(out, values, weights) {
432
+ const length = values.length;
433
+ if (length % 3 !== 0 || weights.length * 3 !== length) {
434
+ throw new RangeError("vec3ArrayWeightedMean: values must be a multiple of 3 long, with one weight per element.");
435
+ }
436
+ let sumx = 0;
437
+ let sumy = 0;
438
+ let sumz = 0;
439
+ let totalWeight = 0;
440
+ for (let index = 0, element = 0; index < length; index += 3, element++) {
441
+ const weight = weights[element];
442
+ sumx += values[index] * weight;
443
+ sumy += values[index + 1] * weight;
444
+ sumz += values[index + 2] * weight;
445
+ totalWeight += weight;
446
+ }
447
+ out[0] = totalWeight === 0 ? NaN : sumx / totalWeight;
448
+ out[1] = totalWeight === 0 ? NaN : sumy / totalWeight;
449
+ out[2] = totalWeight === 0 ? NaN : sumz / totalWeight;
450
+ return out;
451
+ }
452
+ /**
453
+ * {@link vec3ArrayWeightedMean} with the numerator and the total weight summed
454
+ * exactly: every product `wᵢ·vᵢ` and the rounding error it dropped (what
455
+ * `@ac-kit/math-scalar`'s `twoProductError` recovers) go into `@ac-kit/core`'s
456
+ * `PreciseSum`, which is exact however the terms cancel (`[1e16, 1, 1e100,
457
+ * −1e100, −1e16]` with unit weights sums to `1`) and settles intermediate
458
+ * overflow. The only roundings left are the final one of each sum and the
459
+ * division. Exact where each product `wᵢ·vᵢ` stays in the normal range, from
460
+ * about `1e−290` to `1e300`: a product that underflows to zero
461
+ * (`Number.MIN_VALUE` with weight `0.5`) or overflows to infinity
462
+ * (`Number.MAX_VALUE` with weight `2`) is lost or infinite before it is summed,
463
+ * as in the plain form. It allocates one `PreciseSum` per component and one for
464
+ * the weights per call, and costs several times the plain form. O(n).
465
+ *
466
+ * @returns `out`.
467
+ * @throws {RangeError} Unless `values.length` is a multiple of 3 and
468
+ * `weights.length` is the number of elements.
469
+ */
470
+ export function vec3ArrayWeightedMeanPrecise(out, values, weights) {
471
+ const length = values.length;
472
+ if (length % 3 !== 0 || weights.length * 3 !== length) {
473
+ throw new RangeError("vec3ArrayWeightedMeanPrecise: values must be a multiple of 3 long, with one weight per element.");
474
+ }
475
+ const sumx = new PreciseSum();
476
+ const sumy = new PreciseSum();
477
+ const sumz = new PreciseSum();
478
+ const totalWeight = new PreciseSum();
479
+ for (let index = 0, element = 0; index < length; index += 3, element++) {
480
+ const weight = weights[element];
481
+ const valuex = values[index];
482
+ const productx = valuex * weight;
483
+ sumx.add(productx);
484
+ // No error to recover from a product that overflowed or is not a number.
485
+ if (Number.isFinite(productx)) {
486
+ sumx.add(twoProductError(valuex, weight, productx));
487
+ }
488
+ const valuey = values[index + 1];
489
+ const producty = valuey * weight;
490
+ sumy.add(producty);
491
+ // No error to recover from a product that overflowed or is not a number.
492
+ if (Number.isFinite(producty)) {
493
+ sumy.add(twoProductError(valuey, weight, producty));
494
+ }
495
+ const valuez = values[index + 2];
496
+ const productz = valuez * weight;
497
+ sumz.add(productz);
498
+ // No error to recover from a product that overflowed or is not a number.
499
+ if (Number.isFinite(productz)) {
500
+ sumz.add(twoProductError(valuez, weight, productz));
501
+ }
502
+ totalWeight.add(weight);
503
+ }
504
+ const divisor = totalWeight.value;
505
+ out[0] = divisor === 0 ? NaN : sumx.value / divisor;
506
+ out[1] = divisor === 0 ? NaN : sumy.value / divisor;
507
+ out[2] = divisor === 0 ? NaN : sumz.value / divisor;
508
+ return out;
509
+ }
510
+ //# 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,aAAa,CAAC,KAAK,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC;IAClD,OAAO,IAAI,YAAY,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA+B;IAE/B,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClD,K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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","sourceRo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