@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,542 @@
1
+ // Generated from scripts/templates/vec-componentwise.liquid by scripts/generate-componentwise.ts. Do not edit.
2
+ import { compareNaturalAscending, isCloseTo, numberAtOrNaN, round, } from "@ac-kit/core";
3
+ import { lerp, sumOfProducts } from "@ac-kit/math-scalar";
4
+ /**
5
+ * Every creator copies this array, which holds non-integer doubles and is never
6
+ * exposed: nothing a caller does can change the element kind it copies.
7
+ */
8
+ const TEMPLATE_ = [0.5, 0.5];
9
+ /**
10
+ * Creates the zero vector `[0, 0]`.
11
+ *
12
+ * Allocates; keep it out of hot loops.
13
+ */
14
+ export function vec2Create() {
15
+ const out = TEMPLATE_.slice();
16
+ out[0] = 0;
17
+ out[1] = 0;
18
+ return out;
19
+ }
20
+ /**
21
+ * Creates the vector `[x, y]`. Like every creator it starts from an array of
22
+ * doubles, so a vector made of whole numbers is still `PACKED_DOUBLE_ELEMENTS`
23
+ * in V8, where an array literal such as `[1, 2, 3]` is an array of small
24
+ * integers that a shared `out` would turn into a generic array for good.
25
+ *
26
+ * Allocates; keep it out of hot loops.
27
+ */
28
+ export function vec2Of(x, y) {
29
+ const out = TEMPLATE_.slice();
30
+ out[0] = x;
31
+ out[1] = y;
32
+ return out;
33
+ }
34
+ /**
35
+ * Creates a copy of `a`. Like every creator it starts from a clean array, so a
36
+ * clone of an array of small integers is an array of doubles.
37
+ *
38
+ * Allocates; keep it out of hot loops.
39
+ */
40
+ export function vec2Clone(a) {
41
+ const out = TEMPLATE_.slice();
42
+ out[0] = a[0];
43
+ out[1] = a[1];
44
+ return out;
45
+ }
46
+ /**
47
+ * The checked way in from untyped data (JSON, messages, arrays of unknown
48
+ * origin): `source[offset … offset + 2)` copied into `out`, each element that
49
+ * is not a number written as `NaN`, an index below zero or at or past
50
+ * `source.length` too, so `out` never holds a non-number. Test the result with
51
+ * {@link vec2IsFinite} when `NaN` must not get through. A cold path: a
52
+ * `Float64Array` of vectors is read with {@link vec2Load}. O(1).
53
+ *
54
+ * `source` may be `out` itself: the 2 elements are read before the first write.
55
+ *
56
+ * @param out The vector to fill.
57
+ * @param source The array to read, of any length and any content.
58
+ * @param offset The index of the first component in `source`.
59
+ * @returns `out`.
60
+ */
61
+ export function vec2FromArray(out, source, offset = 0) {
62
+ const x = numberAtOrNaN(source, offset);
63
+ const y = numberAtOrNaN(source, offset + 1);
64
+ out[0] = x;
65
+ out[1] = y;
66
+ return out;
67
+ }
68
+ /** Writes the vector `[x, y]` into `out`. */
69
+ export function vec2Set(out, x, y) {
70
+ out[0] = x;
71
+ out[1] = y;
72
+ return out;
73
+ }
74
+ /** Writes a copy of `a` into `out`. */
75
+ export function vec2Copy(out, a) {
76
+ const x = a[0];
77
+ const y = a[1];
78
+ out[0] = x;
79
+ out[1] = y;
80
+ return out;
81
+ }
82
+ /** Writes the zero vector `[0, 0]` into `out`. */
83
+ export function vec2Zero(out) {
84
+ out[0] = 0;
85
+ out[1] = 0;
86
+ return out;
87
+ }
88
+ /** Writes `a + b` into `out`. `out` may be `a` or `b`. */
89
+ export function vec2Add(out, a, b) {
90
+ out[0] = a[0] + b[0];
91
+ out[1] = a[1] + b[1];
92
+ return out;
93
+ }
94
+ /** Writes `a − b` into `out`. `out` may be `a` or `b`. */
95
+ export function vec2Subtract(out, a, b) {
96
+ out[0] = a[0] - b[0];
97
+ out[1] = a[1] - b[1];
98
+ return out;
99
+ }
100
+ /**
101
+ * Writes the component-wise product of `a` and `b` into `out`: not the dot
102
+ * product, and not a cross product. `out` may be `a` or `b`.
103
+ */
104
+ export function vec2Multiply(out, a, b) {
105
+ out[0] = a[0] * b[0];
106
+ out[1] = a[1] * b[1];
107
+ return out;
108
+ }
109
+ /**
110
+ * Writes the component-wise quotient `a / b` into `out`. A zero component of
111
+ * `b` gives `±Infinity`, or `NaN` for `0 / 0`; nothing throws. `out` may be `a`
112
+ * or `b`.
113
+ */
114
+ export function vec2Divide(out, a, b) {
115
+ out[0] = a[0] / b[0];
116
+ out[1] = a[1] / b[1];
117
+ return out;
118
+ }
119
+ /**
120
+ * Writes `a` with `scalar` added to every component into `out`. `out` may be
121
+ * `a`.
122
+ */
123
+ export function vec2AddScalar(out, a, scalar) {
124
+ out[0] = a[0] + scalar;
125
+ out[1] = a[1] + scalar;
126
+ return out;
127
+ }
128
+ /** Writes `a · scalar` into `out`. `out` may be `a`. */
129
+ export function vec2MultiplyScalar(out, a, scalar) {
130
+ out[0] = a[0] * scalar;
131
+ out[1] = a[1] * scalar;
132
+ return out;
133
+ }
134
+ /**
135
+ * Writes `a / scalar` into `out`. A zero `scalar` gives `±Infinity` or `NaN`
136
+ * components, not an exception. `out` may be `a`.
137
+ */
138
+ export function vec2DivideScalar(out, a, scalar) {
139
+ out[0] = a[0] / scalar;
140
+ out[1] = a[1] / scalar;
141
+ return out;
142
+ }
143
+ /**
144
+ * Writes `a + b · scale` into `out`: two roundings per component, not a fused
145
+ * multiply-add. `out` may be `a` or `b`.
146
+ */
147
+ export function vec2AddScaled(out, a, b, scale) {
148
+ out[0] = a[0] + b[0] * scale;
149
+ out[1] = a[1] + b[1] * scale;
150
+ return out;
151
+ }
152
+ /** Writes `−a` into `out`. `out` may be `a`. */
153
+ export function vec2Negate(out, a) {
154
+ out[0] = -a[0];
155
+ out[1] = -a[1];
156
+ return out;
157
+ }
158
+ /**
159
+ * Writes the absolute value of every component of `a` into `out`. `out` may be
160
+ * `a`.
161
+ */
162
+ export function vec2Abs(out, a) {
163
+ out[0] = Math.abs(a[0]);
164
+ out[1] = Math.abs(a[1]);
165
+ return out;
166
+ }
167
+ /**
168
+ * Writes `a` with every component rounded by `@ac-kit/core`'s `round` into
169
+ * `out`: `options` choose the method (round, floor, ceil, trunc) and the digits
170
+ * kept, and none rounds to whole numbers. `out` may be `a`.
171
+ */
172
+ export function vec2Round(out, a, options) {
173
+ out[0] = round(a[0], options);
174
+ out[1] = round(a[1], options);
175
+ return out;
176
+ }
177
+ /**
178
+ * Writes the component-wise minimum of `a` and `b` into `out`, as `Math.min`
179
+ * takes it: a `NaN` gives `NaN`, and `−0` is below `+0`. `out` may be `a` or
180
+ * `b`.
181
+ */
182
+ export function vec2Min(out, a, b) {
183
+ out[0] = Math.min(a[0], b[0]);
184
+ out[1] = Math.min(a[1], b[1]);
185
+ return out;
186
+ }
187
+ /**
188
+ * Writes the component-wise maximum of `a` and `b` into `out`, as `Math.max`
189
+ * takes it: a `NaN` gives `NaN`, and `+0` is above `−0`. `out` may be `a` or
190
+ * `b`.
191
+ */
192
+ export function vec2Max(out, a, b) {
193
+ out[0] = Math.max(a[0], b[0]);
194
+ out[1] = Math.max(a[1], b[1]);
195
+ return out;
196
+ }
197
+ /**
198
+ * Writes `a` limited component-wise to `[min, max]` into `out`. Where a `min`
199
+ * component is above its `max`, the `max` wins, and a `NaN` gives `NaN`:
200
+ * nothing throws, unlike `@ac-kit/core`'s `clamp`. `out` may be any of the
201
+ * arguments.
202
+ */
203
+ export function vec2Clamp(out, a, min, max) {
204
+ out[0] = Math.min(Math.max(a[0], min[0]), max[0]);
205
+ out[1] = Math.min(Math.max(a[1], min[1]), max[1]);
206
+ return out;
207
+ }
208
+ /**
209
+ * Writes `a` with every component limited to `[min, max]` into `out`. Where
210
+ * `min` is above `max` the `max` wins, and a `NaN` gives `NaN`: nothing throws,
211
+ * unlike `@ac-kit/core`'s `clamp`. `out` may be `a`.
212
+ */
213
+ export function vec2ClampScalar(out, a, min, max) {
214
+ out[0] = Math.min(Math.max(a[0], min), max);
215
+ out[1] = Math.min(Math.max(a[1], min), max);
216
+ return out;
217
+ }
218
+ /**
219
+ * Writes `a + (b − a)·t` into `out`, each component by `@ac-kit/math-scalar`'s
220
+ * `lerp`: exactly `a` at `t = 0`, and `b` at `t = 1` up to rounding when `a`
221
+ * and `b` differ greatly in magnitude. A `t` outside `[0, 1]` extrapolates.
222
+ * `out` may be `a` or `b`.
223
+ */
224
+ export function vec2Lerp(out, a, b, t) {
225
+ out[0] = lerp(a[0], b[0], t);
226
+ out[1] = lerp(a[1], b[1], t);
227
+ return out;
228
+ }
229
+ /**
230
+ * Exact component-wise equality: `−0` equals `+0`, and `NaN` equals nothing,
231
+ * itself included. See {@link vec2IsClose} for a tolerant test.
232
+ * {@link vec2CompareLexicographic} returns `0` for exactly the pairs this calls
233
+ * equal (leaving `NaN` aside).
234
+ */
235
+ export function vec2Equals(a, b) {
236
+ return a[0] === b[0] && a[1] === b[1];
237
+ }
238
+ /**
239
+ * Component-wise approximate equality, each pair compared by `@ac-kit/core`'s
240
+ * `isCloseTo` with `options`: none means exact.
241
+ *
242
+ * Not transitive, so it is not an equality in the sense a `Set` or `Map` needs,
243
+ * and never a basis for ordering — use {@link vec2Equals} there. The tolerance
244
+ * is required: a vector carries no units of its own, so only the caller knows
245
+ * what counts as close.
246
+ */
247
+ export function vec2IsClose(a, b, options) {
248
+ return isCloseTo(a[0], b[0], options) && isCloseTo(a[1], b[1], options);
249
+ }
250
+ /**
251
+ * Whether every component is a finite number: the check to run after parsing
252
+ * untrusted data or before an upload, as operations never check. A component
253
+ * that is not a number at all (a vector built by a caller who bypassed the
254
+ * types) counts as not finite.
255
+ */
256
+ export function vec2IsFinite(a) {
257
+ return Number.isFinite(a[0]) && Number.isFinite(a[1]);
258
+ }
259
+ /**
260
+ * Writes element `index` of `array`, the numbers at `[index·2, index·2 + 2)`,
261
+ * into `out`. Each component is written as `+array[i]`, so an index past the
262
+ * end of `array` gives `NaN`, never `undefined`: the vector stays clean
263
+ * whatever the caller does. Checking the index is the job of the checked
264
+ * layer.
265
+ *
266
+ * The vector is copied: it is never a view of `array`. O(1).
267
+ */
268
+ export function vec2Load(out, array, index) {
269
+ const base = index * 2;
270
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
271
+ out[0] = +array[base];
272
+ out[1] = +array[base + 1];
273
+ return out;
274
+ }
275
+ /**
276
+ * Writes `value` into `array` as element `index`, at `[index·2, index·2 + 2)`.
277
+ * An element past the end of `array` writes nothing, as a typed array drops an
278
+ * out-of-range write. O(1).
279
+ */
280
+ export function vec2Store(array, index, value) {
281
+ const base = index * 2;
282
+ array[base] = value[0];
283
+ array[base + 1] = value[1];
284
+ }
285
+ /**
286
+ * Like {@link vec2Load} for interleaved data: element `index` starts at `offset +
287
+ * index·stride`, both counted in numbers, and its 2 components follow one
288
+ * another. An index past the end gives `NaN` components. O(1).
289
+ */
290
+ export function vec2LoadStrided(out, array, offset, stride, index) {
291
+ const base = offset + index * stride;
292
+ // The `!` is for the compiler: past the end `+undefined` is `NaN`.
293
+ out[0] = +array[base];
294
+ out[1] = +array[base + 1];
295
+ return out;
296
+ }
297
+ /**
298
+ * Like {@link vec2Store} for interleaved data: element `index` starts at `offset +
299
+ * index·stride`, both counted in numbers. A component past the end of `array`
300
+ * writes nothing. O(1).
301
+ */
302
+ export function vec2StoreStrided(array, offset, stride, index, value) {
303
+ const base = offset + index * stride;
304
+ array[base] = value[0];
305
+ array[base + 1] = value[1];
306
+ }
307
+ /**
308
+ * Narrows `value` to binary32 and writes its 2 components into `array` from
309
+ * element `offset` on, unrolled: the way to stage a vertex, instance or uniform
310
+ * value for the GPU, where `array.set` costs several times as much for one
311
+ * value. A component past the end of `array` writes nothing. O(1).
312
+ */
313
+ export function vec2StoreFloat32(array, offset, value) {
314
+ array[offset] = value[0];
315
+ array[offset + 1] = value[1];
316
+ }
317
+ /**
318
+ * Whether every number of `array` is finite: the check for a buffer of vec2
319
+ * elements read from untrusted data or about to be uploaded. The length is not
320
+ * required to be a multiple of 2 (see `assertFiniteBuffer` for that). O(n).
321
+ */
322
+ export function vec2ArrayIsFinite(array) {
323
+ for (let index = 0; index < array.length; index++) {
324
+ if (!Number.isFinite(array[index])) {
325
+ return false;
326
+ }
327
+ }
328
+ return true;
329
+ }
330
+ /**
331
+ * The inner product `Σ aᵢ·bᵢ`, in plain arithmetic: where the terms cancel its
332
+ * error can exceed the result, and {@link vec2DotPrecise} is the form to use
333
+ * there.
334
+ */
335
+ export function vec2Dot(a, b) {
336
+ return a[0] * b[0] + a[1] * b[1];
337
+ }
338
+ /**
339
+ * The inner product with the rounding error of every product and every addition
340
+ * recovered and folded back in (Ogita–Rump–Oishi's compensated dot product,
341
+ * computed by `@ac-kit/math-scalar`'s `sumOfProducts`; the two terms are summed
342
+ * in the order `sumOfProducts` uses, not `dotPrecise`'s, so the two can differ
343
+ * in the last bit): as accurate as a dot product in doubled precision rounded
344
+ * once, so it survives the cancellation that leaves {@link vec2Dot} with none of
345
+ * its digits. A few times the cost of the plain form.
346
+ */
347
+ export function vec2DotPrecise(a, b) {
348
+ return sumOfProducts(a[0], b[0], a[1], b[1]);
349
+ }
350
+ /**
351
+ * The length `√(Σ aᵢ²)`, right when the largest component lies between about
352
+ * `1e−150` and `1e150`. Beyond, the squares overflow (above about `1.3e154`),
353
+ * or underflow and lose their digits to the subnormal range (below about
354
+ * `1.5e−154`), and the result is `Infinity`, `0` or wrong: use
355
+ * {@link vec2LengthScaled}.
356
+ */
357
+ export function vec2Length(a) {
358
+ return Math.sqrt(a[0] * a[0] + a[1] * a[1]);
359
+ }
360
+ /**
361
+ * The squared length `Σ aᵢ²`, without the square root, right when the largest
362
+ * component lies between about `1e−150` and `1e150`: beyond, it overflows to
363
+ * `Infinity` or loses its digits to the subnormal range.
364
+ */
365
+ export function vec2LengthSquared(a) {
366
+ return a[0] * a[0] + a[1] * a[1];
367
+ }
368
+ /**
369
+ * The length at any magnitude: every component is divided by the largest first,
370
+ * so the squares stay in range where {@link vec2Length} returns `0` or
371
+ * `Infinity` beyond about `1e±150`. Zero for the zero vector, `Infinity` for an
372
+ * infinite component, `NaN` for a `NaN` one. About three times the cost.
373
+ */
374
+ export function vec2LengthScaled(a) {
375
+ const largest = Math.max(Math.abs(a[0]), Math.abs(a[1]));
376
+ if (largest === 0 || largest === Infinity) {
377
+ return largest;
378
+ }
379
+ const x = a[0] / largest;
380
+ const y = a[1] / largest;
381
+ return largest * Math.sqrt(x * x + y * y);
382
+ }
383
+ /** The Manhattan length `Σ |aᵢ|`: the distance along the axes. */
384
+ export function vec2LengthManhattan(a) {
385
+ return Math.abs(a[0]) + Math.abs(a[1]);
386
+ }
387
+ /** The Chebyshev length `max |aᵢ|`: the largest move along one axis. */
388
+ export function vec2LengthChebyshev(a) {
389
+ return Math.max(Math.abs(a[0]), Math.abs(a[1]));
390
+ }
391
+ /**
392
+ * The Euclidean distance `|a − b|`, right when the largest difference lies
393
+ * between about `1e−150` and `1e150`; beyond, the squares overflow or lose
394
+ * their digits as in {@link vec2Length}: take {@link vec2LengthScaled} of `a − b`
395
+ * (from {@link vec2Subtract}) instead.
396
+ */
397
+ export function vec2Distance(a, b) {
398
+ const dx = a[0] - b[0];
399
+ const dy = a[1] - b[1];
400
+ return Math.sqrt(dx * dx + dy * dy);
401
+ }
402
+ /**
403
+ * The squared distance `|a − b|²`, without the square root, right when the
404
+ * largest difference lies between about `1e−150` and `1e150`: beyond, it
405
+ * overflows to `Infinity` or loses its digits.
406
+ */
407
+ export function vec2DistanceSquared(a, b) {
408
+ const dx = a[0] - b[0];
409
+ const dy = a[1] - b[1];
410
+ return dx * dx + dy * dy;
411
+ }
412
+ /** The Manhattan distance `Σ |aᵢ − bᵢ|`: the distance along the axes. */
413
+ export function vec2DistanceManhattan(a, b) {
414
+ return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]);
415
+ }
416
+ /** The Chebyshev distance `max |aᵢ − bᵢ|`: the largest move along one axis. */
417
+ export function vec2DistanceChebyshev(a, b) {
418
+ return Math.max(Math.abs(a[0] - b[0]), Math.abs(a[1] - b[1]));
419
+ }
420
+ /**
421
+ * Writes `a / |a|` into `out`: the unit vector in the same direction, from one
422
+ * reciprocal of the length multiplied in. The zero vector stays zero, and a
423
+ * `NaN` component gives `NaN` throughout. Right when the largest component lies
424
+ * between about `1e−150` and `1e150`; beyond, the squared length overflows,
425
+ * underflows or loses its digits to the subnormal range, and the result is
426
+ * zeros or wrong: use {@link vec2NormalizeScaled}. `out` may be `a`.
427
+ */
428
+ export function vec2Normalize(out, a) {
429
+ const x = a[0];
430
+ const y = a[1];
431
+ const lengthSquared = x * x + y * y;
432
+ const scale = lengthSquared === 0 ? 0 : 1 / Math.sqrt(lengthSquared);
433
+ out[0] = x * scale;
434
+ out[1] = y * scale;
435
+ return out;
436
+ }
437
+ /**
438
+ * Writes `a / |a|` into `out` at any magnitude, subnormal and near the largest
439
+ * binary64 included: the components are divided by the largest first, so the
440
+ * squares stay in range (see {@link vec2Normalize} for the plain form). The zero
441
+ * vector stays zero; `NaN` and infinite components give `NaN` throughout. About
442
+ * three times the cost. `out` may be `a`.
443
+ */
444
+ export function vec2NormalizeScaled(out, a) {
445
+ const largest = Math.max(Math.abs(a[0]), Math.abs(a[1]));
446
+ if (largest === 0) {
447
+ out[0] = 0;
448
+ out[1] = 0;
449
+ return out;
450
+ }
451
+ const x = a[0] / largest;
452
+ const y = a[1] / largest;
453
+ const scale = 1 / Math.sqrt(x * x + y * y);
454
+ out[0] = x * scale;
455
+ out[1] = y * scale;
456
+ return out;
457
+ }
458
+ /**
459
+ * Writes `a` with its length limited to `[min, max]` into `out`, the direction
460
+ * kept. The zero vector stays zero whatever `min` is, a `min` above `max` gives
461
+ * `max`, and a `NaN` gives `NaN`. The length is that of {@link vec2Length}, so
462
+ * the result is right when the largest component lies between about `1e−150`
463
+ * and `1e150`. Beyond, a vector whose length overflows (components above about
464
+ * `1.3e154`) comes back as the zero vector instead of being limited to `max`,
465
+ * and one whose squares underflow (below about `1.5e−154`) comes back unchanged
466
+ * instead of being lengthened to `min`: limit {@link vec2LengthScaled} yourself
467
+ * and scale {@link vec2NormalizeScaled} by it. `out` may be `a`.
468
+ */
469
+ export function vec2ClampLength(out, a, min, max) {
470
+ const x = a[0];
471
+ const y = a[1];
472
+ const length = Math.sqrt(x * x + y * y);
473
+ const scale = length === 0 ? 1 : Math.min(Math.max(length, min), max) / length;
474
+ out[0] = x * scale;
475
+ out[1] = y * scale;
476
+ return out;
477
+ }
478
+ /**
479
+ * Writes the projection of `a` onto the line along `onto`, `onto · (a·onto) /
480
+ * (onto·onto)`, into `out`. `onto` need not be a unit vector; a zero `onto`
481
+ * gives `NaN`. Right when the largest component of `onto` lies between about
482
+ * `1e−150` and `1e150`, where `onto·onto` stays in range: above about `1.3e154`
483
+ * it overflows and the projection is the zero vector, and below about
484
+ * `1.5e−154` it underflows and the result is not finite. Beyond, normalise
485
+ * `onto` with {@link vec2NormalizeScaled} first. `out` may be `a` or `onto`.
486
+ */
487
+ export function vec2Project(out, a, onto) {
488
+ const ax = a[0];
489
+ const ay = a[1];
490
+ const ox = onto[0];
491
+ const oy = onto[1];
492
+ const scale = (ax * ox + ay * oy) / (ox * ox + oy * oy);
493
+ out[0] = ox * scale;
494
+ out[1] = oy * scale;
495
+ return out;
496
+ }
497
+ /**
498
+ * Writes `a` minus its projection onto `onto` into `out`: the part of `a`
499
+ * perpendicular to `onto`. A zero `onto` gives `NaN`. Right when the largest
500
+ * component of `onto` lies between about `1e−150` and `1e150`, as for
501
+ * {@link vec2Project}: beyond, the result is `a` (the projection is zero) or not
502
+ * finite; normalise `onto` with {@link vec2NormalizeScaled} first. `out` may be
503
+ * `a` or `onto`.
504
+ */
505
+ export function vec2Reject(out, a, onto) {
506
+ const ax = a[0];
507
+ const ay = a[1];
508
+ const ox = onto[0];
509
+ const oy = onto[1];
510
+ const scale = (ax * ox + ay * oy) / (ox * ox + oy * oy);
511
+ out[0] = ax - ox * scale;
512
+ out[1] = ay - oy * scale;
513
+ return out;
514
+ }
515
+ /**
516
+ * Writes `a` mirrored across the line whose normal is `normal`, `a −
517
+ * 2(a·normal)·normal`, into `out`. `normal` must be a unit vector: it is not
518
+ * normalised here. `out` may be `a` or `normal`.
519
+ */
520
+ export function vec2Reflect(out, a, normal) {
521
+ const ax = a[0];
522
+ const ay = a[1];
523
+ const nx = normal[0];
524
+ const ny = normal[1];
525
+ const scale = 2 * (ax * nx + ay * ny);
526
+ out[0] = ax - nx * scale;
527
+ out[1] = ay - ny * scale;
528
+ return out;
529
+ }
530
+ /**
531
+ * Orders vectors lexicographically: by x, then by y. Exact, so it returns `0`
532
+ * for exactly the pairs {@link vec2Equals} calls equal, and a total order
533
+ * whatever the components: `NaN` sorts after every number and equals itself
534
+ * (where `vec2Equals` says it equals nothing), and `−0` equals `+0`. Fit for a
535
+ * sort comparator or an ordered container.
536
+ *
537
+ * @returns `−1` when `a` comes first, `1` when `b` does, `0` when neither.
538
+ */
539
+ export function vec2CompareLexicographic(a, b) {
540
+ return (compareNaturalAscending(a[0], b[0]) || compareNaturalAscending(a[1], b[1]));
541
+ }
542
+ //# sourceMappingURL=vec2-componentwise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vec2-componentwise.js","sourceRoot":"","sources":["../src/vec2-componentwise.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,EACN,uBAAuB,EAEvB,SAAS,EAET,aAAa,EACb,KAAK,GAEL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;;GAGG;AACH,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAEhD;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACzB,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAU,CAAC;IACtC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,CAAS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