@ac-kit/math-geometry 0.3.0 → 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 (51) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/README.md +43 -3
  3. package/dist/_polygon3-cross.d.ts +23 -0
  4. package/dist/_polygon3-cross.d.ts.map +1 -0
  5. package/dist/_polygon3-cross.js +418 -0
  6. package/dist/_polygon3-cross.js.map +1 -0
  7. package/dist/_triangle3-cross.d.ts +66 -0
  8. package/dist/_triangle3-cross.d.ts.map +1 -0
  9. package/dist/_triangle3-cross.js +396 -0
  10. package/dist/_triangle3-cross.js.map +1 -0
  11. package/dist/line2.d.ts +4 -0
  12. package/dist/line2.d.ts.map +1 -1
  13. package/dist/line2.js +26 -5
  14. package/dist/line2.js.map +1 -1
  15. package/dist/mesh/_index-kernels-u16.d.ts +51 -9
  16. package/dist/mesh/_index-kernels-u16.d.ts.map +1 -1
  17. package/dist/mesh/_index-kernels-u16.js +905 -124
  18. package/dist/mesh/_index-kernels-u16.js.map +1 -1
  19. package/dist/mesh/_index-kernels-u32.d.ts +51 -9
  20. package/dist/mesh/_index-kernels-u32.d.ts.map +1 -1
  21. package/dist/mesh/_index-kernels-u32.js +905 -124
  22. package/dist/mesh/_index-kernels-u32.js.map +1 -1
  23. package/dist/mesh/mesh3-kernels.d.ts +56 -16
  24. package/dist/mesh/mesh3-kernels.d.ts.map +1 -1
  25. package/dist/mesh/mesh3-kernels.js +56 -16
  26. package/dist/mesh/mesh3-kernels.js.map +1 -1
  27. package/dist/plane3.d.ts +4 -3
  28. package/dist/plane3.d.ts.map +1 -1
  29. package/dist/plane3.js +18 -35
  30. package/dist/plane3.js.map +1 -1
  31. package/dist/polygon2.d.ts +54 -4
  32. package/dist/polygon2.d.ts.map +1 -1
  33. package/dist/polygon2.js +297 -7
  34. package/dist/polygon2.js.map +1 -1
  35. package/dist/polygon3.d.ts +19 -3
  36. package/dist/polygon3.d.ts.map +1 -1
  37. package/dist/polygon3.js +40 -16
  38. package/dist/polygon3.js.map +1 -1
  39. package/dist/quadtree.d.ts +40 -23
  40. package/dist/quadtree.d.ts.map +1 -1
  41. package/dist/quadtree.js +196 -119
  42. package/dist/quadtree.js.map +1 -1
  43. package/dist/segment2.d.ts +6 -1
  44. package/dist/segment2.d.ts.map +1 -1
  45. package/dist/segment2.js +20 -4
  46. package/dist/segment2.js.map +1 -1
  47. package/dist/triangle3.d.ts +20 -1
  48. package/dist/triangle3.d.ts.map +1 -1
  49. package/dist/triangle3.js +38 -18
  50. package/dist/triangle3.js.map +1 -1
  51. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,109 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0b4fe43: `polygon2SignedArea(coordinates, vertexCount?)` and
8
+ `polygon2Area(coordinates, vertexCount?)` measure the polygon of the first
9
+ `vertexCount` vertices when a count is given, so a polygon can live at the start
10
+ of a longer working buffer; a count that is not an integer from 0 to
11
+ `coordinates.length / 2` throws a `RangeError`. Without it they read every
12
+ vertex, as before.
13
+
14
+ `polygon2ClipHalfPlane(out, coordinates, vertexCount, halfPlanes, index?)`
15
+ writes the polygon cut to the half-plane `normal · p ≤ limit`, read as
16
+ `(normalX, normalY, limit)` from `halfPlanes[index]`, into `out` and
17
+ returns its vertex count (Sutherland–Hodgman): the convex intersection, at most
18
+ `vertexCount + 1` vertices, for a convex polygon; pieces of the same area joined
19
+ by zero-width bridges, at most `⌊3 · vertexCount / 2⌋` vertices, for a concave
20
+ one. Vertices on the line are kept; an infinite limit (or a zero normal) keeps
21
+ everything or nothing, and the half-plane is scaled by a power of two before
22
+ any side is evaluated, so every finite input gives finite vertices; a vertex
23
+ too near the line for the scaled evaluation is placed by the exact sign of its
24
+ side, so which vertices are kept is exact. No double
25
+ crosses the call, so it allocates nothing whether or not the engine inlines it;
26
+ it throws a `RangeError` before
27
+ writing when `out` is shorter than `2 · ⌊3 · vertexCount / 2⌋` entries or
28
+ shares memory with the vertices read, the count or index is out of range, the
29
+ normal is not finite or `limit` is `NaN`.
30
+
31
+ `line2IntersectLine2` now allocates nothing for coordinate-sized lines (its
32
+ determinants go through `diffOfProductsInPlace`), and `segment2ClosestPoint`
33
+ allocates nothing whether or not the engine inlines it; their results are
34
+ unchanged.
35
+
36
+ ### Patch Changes
37
+
38
+ - 0b4fe43: The mesh kernels stay finite and independent of order over the whole binary64
39
+ range. `triangle3Normal`, `mesh3FaceNormals` and `mesh3VertexNormals` take the
40
+ exact cross product's direction for any finite corners: the unit normal within
41
+ 2^−48 per component (normwise, about 3.4 · 2^−53 at worst in testing), so a
42
+ component smaller than that beside the largest may round to a zero of either
43
+ sign while every larger one has the exact sign; +0 where the exact component
44
+ is 0, and the zero
45
+ vector exactly for a degenerate triangle (collinear or repeated corners) — a
46
+ triangle with edges of `Number.MAX_VALUE` and `Number.MIN_VALUE` gets its
47
+ normal; `plane3FromPoints` takes the same normal. `mesh3VertexNormals` takes faces of any size, spanning
48
+ ±`Number.MAX_VALUE` included. `mesh3SurfaceArea` scales each face's edges per
49
+ axis by powers of two, so no square overflows or underflows, and sums the faces
50
+ exactly. `mesh3Volume` and `mesh3Centroid` are exact sums over face-local edges,
51
+ relative to a corner of the mesh's bounding box, each axis scaled by its own
52
+ power of two: the result is the same in every face or merge order, and nothing
53
+ overflows for a mesh however thin, wide or small, anywhere up to
54
+ ±`Number.MAX_VALUE`. `mesh3TriangleDepths` is finite next to ±`Number.MAX_VALUE`
55
+ wherever `z / w` is.
56
+ - 0b4fe43: The quadtree stores its nodes in typed columns reused across calls, so once
57
+ warmed up `assign`, `visit`, `visitAfter`, `find` and `forEachInBox` allocate
58
+ nothing, and not only the traversal per node.
59
+ - 0b4fe43: `polygon3Normal` takes the exact Newell vector's direction for any finite
60
+ coordinates, with `triangle3Normal`'s guarantee: each component within 2^−48 of
61
+ the exact unit normal's (normwise), +0 where the exact component is 0, the exact
62
+ sign wherever that bound cannot reach 0, and the zero vector exactly when the
63
+ vector is zero. A polygon of `Number.MAX_VALUE` or `Number.MIN_VALUE` size, or
64
+ one whose fan triangles cancel, gets its normal where it used to get `NaN` or
65
+ the zero vector; a coordinate that is not finite gives `NaN`s.
66
+ `mesh3VertexNormals` gives each vertex the direction of the exact sum of its
67
+ faces' cross products, within 2^−48 per component: opposite faces that cancel no
68
+ longer take a far smaller face's normal with them (two faces of 2^2000 beside
69
+ one of `Number.MIN_VALUE²`, or unit faces beside one of 2^−80), and a vertex
70
+ whose faces cancel exactly, as on a double-sided mesh, gets the zero vector
71
+ exactly. Neither allocates once its scratch has grown to the largest input.
72
+ - Updated dependencies [0b4fe43]
73
+ - Updated dependencies [0b4fe43]
74
+ - Updated dependencies [0b4fe43]
75
+ - Updated dependencies [0b4fe43]
76
+ - Updated dependencies [0b4fe43]
77
+ - Updated dependencies [0b4fe43]
78
+ - Updated dependencies [0b4fe43]
79
+ - Updated dependencies [0b4fe43]
80
+ - Updated dependencies [0b4fe43]
81
+ - Updated dependencies [0b4fe43]
82
+ - Updated dependencies [0b4fe43]
83
+ - Updated dependencies [0b4fe43]
84
+ - Updated dependencies [0b4fe43]
85
+ - Updated dependencies [0b4fe43]
86
+ - Updated dependencies [0b4fe43]
87
+ - Updated dependencies [0b4fe43]
88
+ - Updated dependencies [0b4fe43]
89
+ - Updated dependencies [0b4fe43]
90
+ - Updated dependencies [0b4fe43]
91
+ - Updated dependencies [0b4fe43]
92
+ - Updated dependencies [0b4fe43]
93
+ - Updated dependencies [0b4fe43]
94
+ - Updated dependencies [0b4fe43]
95
+ - Updated dependencies [0b4fe43]
96
+ - Updated dependencies [0b4fe43]
97
+ - Updated dependencies [0b4fe43]
98
+ - Updated dependencies [0b4fe43]
99
+ - Updated dependencies [0b4fe43]
100
+ - Updated dependencies [0b4fe43]
101
+ - Updated dependencies [0b4fe43]
102
+ - Updated dependencies [0b4fe43]
103
+ - @ac-kit/core@0.13.0
104
+ - @ac-kit/math-linear@0.4.0
105
+ - @ac-kit/math-scalar@0.4.0
106
+
3
107
  ## 0.3.0
4
108
 
5
109
  ### Minor Changes
package/README.md CHANGED
@@ -197,6 +197,29 @@ implicitly closed, holes given by the vertex index where each hole ring starts
197
197
  with the holes bridged to the outer ring, writing triangle indices into a
198
198
  `Uint32Array` (`3·(n + 2h − 2)` entries).
199
199
 
200
+ `polygon2SignedArea` and `polygon2Area` take an optional vertex count, for a
201
+ polygon held at the start of a longer working buffer, and
202
+ `polygon2ClipHalfPlane` cuts the first `n` vertices of one buffer to a
203
+ half-plane `(normalX, normalY, limit)` read from a third (Sutherland–Hodgman;
204
+ at most `n + 1` vertices for a convex polygon, `⌊3n/2⌋` for a concave one,
205
+ whose pieces stay joined by zero-width bridges of no area). No double crosses
206
+ the clip's call, so clipping twice and measuring, as area-coverage
207
+ antialiasing does per pixel, allocates nothing; the clip refuses an `out` that
208
+ shares memory with its input, since it cannot work in place.
209
+
210
+ ```ts
211
+ import { polygon2Area, polygon2ClipHalfPlane } from "@ac-kit/math-geometry";
212
+
213
+ // The area of a pixel square left of x = 0.3 and below y = 0.2.
214
+ const pixel = new Float64Array([0, 0, 1, 0, 1, 1, 0, 1]);
215
+ const planes = new Float64Array([1, 0, 0.3, 0, 1, 0.2]);
216
+ const half = new Float64Array(12);
217
+ const quarter = new Float64Array(16);
218
+ const halfCount = polygon2ClipHalfPlane(half, pixel, 4, planes, 0);
219
+ const count = polygon2ClipHalfPlane(quarter, half, halfCount, planes, 3);
220
+ polygon2Area(quarter, count); // ≈ 0.06
221
+ ```
222
+
200
223
  ```ts
201
224
  import { polygon2Area, polygon2Triangulate } from "@ac-kit/math-geometry";
202
225
 
@@ -290,8 +313,23 @@ meshes with every attribute, and `mesh3Merge` joins several into one. The kernel
290
313
  `mesh3ReorderTriangles`) write into an `out` you provide, which must not share
291
314
  memory with an input (`RangeError`). They check lengths once
292
315
  and no index: an index past the last vertex reads `NaN`, which the checked layer
293
- catches before an upload. A vertex no triangle uses, and a zero-area face, get
294
- the zero normal; the volume is signed, positive when the faces point outward.
316
+ catches before an upload. A vertex no triangle uses, and a degenerate face (an
317
+ exactly zero cross product: collinear or repeated corners), get the zero
318
+ normal; every other face gets a unit normal with the exact cross product's
319
+ direction, within 2^−48 per component (normwise, about 3.4 · 2^−53 at worst
320
+ in testing): a component smaller than that beside the largest may round to a
321
+ zero of either sign, an exactly zero one is +0. That holds however long, thin,
322
+ small or far out the face is. A vertex normal is the direction of the exact sum
323
+ of its faces' cross products, within 2^−48 per component (normwise), the zero
324
+ vector where that sum is zero: each sum carries a running error bound, and a
325
+ vertex it does not settle (faces that cancel, however large beside the ones
326
+ left) is summed again exactly. `polygon3Normal` gives a polygon's normal with
327
+ the same guarantee as a face's, from the exact Newell vector. The volume is
328
+ signed, positive when the faces point outward.
329
+ The area, volume and centroid scale each axis by its own power of two and sum
330
+ exactly, so they give the same result in every face order and never overflow
331
+ on the way, for a mesh however thin, wide or small and anywhere up to
332
+ ±`Number.MAX_VALUE`.
295
333
 
296
334
  ```ts
297
335
  import { mesh3Heightfield, mesh3VertexNormals } from "@ac-kit/math-geometry";
@@ -329,7 +367,9 @@ index.tryInsert(box2FromXywh(box2Create(), 100, 44, 60, 14), 2); // false: it ov
329
367
  ## Nearest point and range queries
330
368
 
331
369
  `Quadtree` indexes 2-D points by integer id over a `Float64Array` of x, y
332
- pairs, with d3-quadtree's cells and visit order at every ordinary scale. Stored
370
+ pairs, with d3-quadtree's cells and visit order at every ordinary scale. Its
371
+ storage is typed columns reused across calls, so once warmed up `assign`,
372
+ `visit`, `visitAfter`, `find` and `forEachInBox` allocate nothing. Stored
333
373
  coordinates (construction, `assign`, `add`) must be finite with |x|, |y| ≤
334
374
  1e150; larger or non-finite values throw `RangeError` before the tree changes.
335
375
  Queries never throw: `find` returns −1 for a NaN, infinite or beyond-±1e150
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Writes Newell's vector of the ring of the first `count` (at least 3) vertices
3
+ * of `coordinates` into `out` as `[x, y, z, k]`, the vector being `(x, y, z) ·
4
+ * 2^k`, with `triangle3Cross_`'s guarantees: every component within 2^−49 of
5
+ * the largest component of the exact vector, for any finite coordinates; `[0,
6
+ * 0, 0, 0]` exactly when the exact vector is zero, a component +0 where the
7
+ * exact one is 0, and one with the exact one's sign wherever that bound cannot
8
+ * reach 0; k = 0 when the largest component lies in `[2^−400, 2^402)`,
9
+ * otherwise the largest lies in `[1, 2)`. A coordinate that is not finite gives
10
+ * `NaN`s. Allocates nothing.
11
+ *
12
+ * The plain fan sum where its rigorous bound settles every component (edges up
13
+ * to 2^200, no cancellation between the fan triangles beyond about 2^−50 of the
14
+ * largest component); then the same sum in doubled precision (each edge split
15
+ * exactly by TwoSum and scaled per axis as `triangle3Cross_` scales a
16
+ * triangle's, each product of high parts by TwoProduct, every part summed by
17
+ * Ogita, Rump & Oishi's `Sum2`, with a rigorous bound on what is lost); last,
18
+ * each component as the exact sum `Σ vᵢ × vᵢ₊₁` around the ring (the fan's sum
19
+ * expanded, the first vertex's terms cancelling) by Kulisch's long accumulator,
20
+ * rounded once at any exponent.
21
+ */
22
+ export declare function polygon3Cross_(out: Float64Array, coordinates: Float64Array, count: number): void;
23
+ //# sourceMappingURL=_polygon3-cross.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_polygon3-cross.d.ts","sourceRoot":"","sources":["../src/_polygon3-cross.ts"],"names":[],"mappings":"AA8EA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,YAAY,EACjB,WAAW,EAAE,YAAY,EACzB,KAAK,EAAE,MAAM,GACX,IAAI,CA0BN"}
@@ -0,0 +1,418 @@
1
+ import { binaryExponent, scaleByPowerOfTwoInPlace } from "@ac-kit/core";
2
+ import { DotExactAccumulator, twoProductInRangeInPlace, twoSumInPlace, } from "@ac-kit/math-scalar";
3
+ import { NONE_, PLAIN_ACCURACY_, PLAIN_BOUND_, PLAIN_EDGE_MAX_, PLAIN_EDGE_MIN_, PLAIN_MAX_, PLAIN_MIN_, PLAIN_UNDERFLOW_, UNDERFLOW_BOUND_, UNIT_ROUNDOFF_, writeScaledComponents_, } from "./_triangle3-cross.js";
4
+ // Newell's vector of a polygon in space, `Σ (vᵢ − v₀) × (vᵢ₊₁ − v₀)` over the
5
+ // fan from its first vertex (twice its area times its unit normal), with the
6
+ // guarantees and the three paths of `triangle3Cross_`, which this is the sum of
7
+ // such products of: plain arithmetic, then doubled precision, then exact sums,
8
+ // each with a rigorous error bound settling the result before the next is
9
+ // tried.
10
+ /**
11
+ * The fans the plain and doubled paths take: their bounds grow with the number
12
+ * of terms and are stated for fewer than 2^24 of them per part; a polygon with
13
+ * more triangles goes to the exact path.
14
+ */
15
+ const MAX_TRIANGLES_ = 2 ** 24;
16
+ /**
17
+ * The doubled path's bound on a product of two parts it rounds: within u of the
18
+ * exact one, so within u / (1 − u) of the rounded one.
19
+ */
20
+ const ROUNDED_PRODUCT_BOUND_ = 1.01 * UNIT_ROUNDOFF_;
21
+ /** The exact path's products per call to the accumulator. */
22
+ const CHUNK_ = 32;
23
+ /**
24
+ * Per axis, the edges `vᵢ − v₀` and `vᵢ₊₁ − v₀` of one fan triangle as TwoSum
25
+ * leaves them, the rounded difference then its exact error (0–3 for x, 4–7 for
26
+ * y, 8–11 for z), then scaled by the axis's power of two.
27
+ */
28
+ const EDGES_ = new Float64Array(12);
29
+ /** Per axis, the power of two its scaled edges are to be multiplied by. */
30
+ const AXIS_EXPONENTS_ = new Int32Array(3);
31
+ /** Per edge component (`vᵢ` then `vᵢ₊₁`, per axis), 1 when it is exactly 0. */
32
+ const ZEROS_ = new Uint8Array(6);
33
+ /** A fan triangle's two products per component, as TwoProduct leaves them. */
34
+ const PRODUCTS_ = new Float64Array(4);
35
+ /** One component's eight parts in a fan triangle, summed as they come. */
36
+ const PARTS_ = new Float64Array(8);
37
+ /** Per component, the doubled path's running sum and its compensation. */
38
+ const SUMS_ = new Float64Array(6);
39
+ /** Per component, the sum of the magnitudes of the parts summed. */
40
+ const MAGNITUDES_ = new Float64Array(3);
41
+ /** Per component, the bound on what the parts lost before summing. */
42
+ const LOSSES_ = new Float64Array(3);
43
+ /** Per component, 1 while every fan triangle's component is exactly 0. */
44
+ const IS_ZERO_ = new Uint8Array(3);
45
+ /** Per component, the bound the doubled path settled it with. */
46
+ const BOUNDS_ = new Float64Array(3);
47
+ /** The components, each `COMPONENTS_[i] · 2^EXPONENTS_[i]`. */
48
+ const COMPONENTS_ = new Float64Array(3);
49
+ const EXPONENTS_ = new Int32Array(3);
50
+ /** The exact path's factors, a chunk of products at a time. */
51
+ const LEFT_ = new Float64Array(CHUNK_);
52
+ const RIGHT_ = new Float64Array(CHUNK_);
53
+ /** An exact component, as significand and exponent. */
54
+ const SCALED_ = new Float64Array(2);
55
+ const EXACT_ = new DotExactAccumulator();
56
+ /**
57
+ * Writes Newell's vector of the ring of the first `count` (at least 3) vertices
58
+ * of `coordinates` into `out` as `[x, y, z, k]`, the vector being `(x, y, z) ·
59
+ * 2^k`, with `triangle3Cross_`'s guarantees: every component within 2^−49 of
60
+ * the largest component of the exact vector, for any finite coordinates; `[0,
61
+ * 0, 0, 0]` exactly when the exact vector is zero, a component +0 where the
62
+ * exact one is 0, and one with the exact one's sign wherever that bound cannot
63
+ * reach 0; k = 0 when the largest component lies in `[2^−400, 2^402)`,
64
+ * otherwise the largest lies in `[1, 2)`. A coordinate that is not finite gives
65
+ * `NaN`s. Allocates nothing.
66
+ *
67
+ * The plain fan sum where its rigorous bound settles every component (edges up
68
+ * to 2^200, no cancellation between the fan triangles beyond about 2^−50 of the
69
+ * largest component); then the same sum in doubled precision (each edge split
70
+ * exactly by TwoSum and scaled per axis as `triangle3Cross_` scales a
71
+ * triangle's, each product of high parts by TwoProduct, every part summed by
72
+ * Ogita, Rump & Oishi's `Sum2`, with a rigorous bound on what is lost); last,
73
+ * each component as the exact sum `Σ vᵢ × vᵢ₊₁` around the ring (the fan's sum
74
+ * expanded, the first vertex's terms cancelling) by Kulisch's long accumulator,
75
+ * rounded once at any exponent.
76
+ */
77
+ export function polygon3Cross_(out, coordinates, count) {
78
+ for (let index = 0; index < 3 * count; index++) {
79
+ const value = coordinates[index];
80
+ if (value - value !== 0) {
81
+ out[0] = Number.NaN;
82
+ out[1] = Number.NaN;
83
+ out[2] = Number.NaN;
84
+ out[3] = 0;
85
+ return;
86
+ }
87
+ }
88
+ if (count - 2 <= MAX_TRIANGLES_) {
89
+ if (plainNewell_(out, coordinates, count)) {
90
+ return;
91
+ }
92
+ const scaling = axisScaling_(coordinates, count);
93
+ if (scaling !== SCALING_WIDE_ &&
94
+ doubledNewell_(coordinates, count, scaling)) {
95
+ writeScaledComponents_(out, COMPONENTS_, EXPONENTS_);
96
+ return;
97
+ }
98
+ }
99
+ exactNewell_(coordinates, count);
100
+ writeScaledComponents_(out, COMPONENTS_, EXPONENTS_);
101
+ }
102
+ /**
103
+ * The plain path of {@link polygon3Cross_}: the fan sum in plain arithmetic,
104
+ * written into `out` with k = 0 when a rigorous bound settles every sign and
105
+ * puts every component within 2^−50 of the largest (and the largest in the
106
+ * unscaled range). Returns whether it did.
107
+ *
108
+ * Each fan triangle's component is within `triangle3Cross_`'s plain bound of
109
+ * its exact value: 3.001u of its two products, u of itself, and 2^−1070 per
110
+ * product that underflows (u = 2^−53). The recursive sum of T of them adds
111
+ * γ_{T−1} of the sum of their magnitudes (Higham, "Accuracy and Stability of
112
+ * Numerical Algorithms", §4.2); the bound, itself a sum of T positive terms, is
113
+ * widened by 2(T + 2)u for its own roundings.
114
+ */
115
+ function plainNewell_(out, coordinates, count) {
116
+ const originX = coordinates[0];
117
+ const originY = coordinates[1];
118
+ const originZ = coordinates[2];
119
+ let sumX = 0;
120
+ let sumY = 0;
121
+ let sumZ = 0;
122
+ let productsX = 0;
123
+ let productsY = 0;
124
+ let productsZ = 0;
125
+ let termsX = 0;
126
+ let termsY = 0;
127
+ let termsZ = 0;
128
+ let isZeroX = true;
129
+ let isZeroY = true;
130
+ let isZeroZ = true;
131
+ let longest = 0;
132
+ let abX = coordinates[3] - originX;
133
+ let abY = coordinates[4] - originY;
134
+ let abZ = coordinates[5] - originZ;
135
+ for (let vertex = 2; vertex < count; vertex++) {
136
+ const acX = coordinates[3 * vertex] - originX;
137
+ const acY = coordinates[3 * vertex + 1] - originY;
138
+ const acZ = coordinates[3 * vertex + 2] - originZ;
139
+ longest = Math.max(longest, Math.abs(abX), Math.abs(abY), Math.abs(abZ), Math.abs(acX), Math.abs(acY), Math.abs(acZ));
140
+ const p0 = abY * acZ;
141
+ const q0 = abZ * acY;
142
+ const p1 = abZ * acX;
143
+ const q1 = abX * acZ;
144
+ const p2 = abX * acY;
145
+ const q2 = abY * acX;
146
+ const crossX = p0 - q0;
147
+ const crossY = p1 - q1;
148
+ const crossZ = p2 - q2;
149
+ sumX += crossX;
150
+ sumY += crossY;
151
+ sumZ += crossZ;
152
+ productsX += Math.abs(p0) + Math.abs(q0);
153
+ productsY += Math.abs(p1) + Math.abs(q1);
154
+ productsZ += Math.abs(p2) + Math.abs(q2);
155
+ termsX += Math.abs(crossX);
156
+ termsY += Math.abs(crossY);
157
+ termsZ += Math.abs(crossZ);
158
+ // An edge component 0 in each product: exactly 0, as is its product.
159
+ isZeroX &&= (abY === 0 || acZ === 0) && (abZ === 0 || acY === 0);
160
+ isZeroY &&= (abZ === 0 || acX === 0) && (abX === 0 || acZ === 0);
161
+ isZeroZ &&= (abX === 0 || acY === 0) && (abY === 0 || acX === 0);
162
+ abX = acX;
163
+ abY = acY;
164
+ abZ = acZ;
165
+ }
166
+ if (!(longest <= PLAIN_EDGE_MAX_)) {
167
+ return false;
168
+ }
169
+ const largest = Math.max(Math.abs(sumX), Math.abs(sumY), Math.abs(sumZ));
170
+ if (!(largest >= PLAIN_MIN_ && largest < PLAIN_MAX_)) {
171
+ return false;
172
+ }
173
+ const triangles = count - 2;
174
+ const termsFactor = (triangles + 1) * 1.0001 * UNIT_ROUNDOFF_;
175
+ const underflow = 2 * triangles * PLAIN_UNDERFLOW_;
176
+ const widening = 1 + 2 * (triangles + 2) * UNIT_ROUNDOFF_;
177
+ const boundX = (PLAIN_BOUND_ * productsX + termsFactor * termsX + underflow) * widening;
178
+ const boundY = (PLAIN_BOUND_ * productsY + termsFactor * termsY + underflow) * widening;
179
+ const boundZ = (PLAIN_BOUND_ * productsZ + termsFactor * termsZ + underflow) * widening;
180
+ const limit = largest * PLAIN_ACCURACY_;
181
+ if ((isZeroX
182
+ ? sumX === 0
183
+ : Math.abs(sumX) * (1 - 2 * UNIT_ROUNDOFF_) > boundX &&
184
+ boundX <= limit) &&
185
+ (isZeroY
186
+ ? sumY === 0
187
+ : Math.abs(sumY) * (1 - 2 * UNIT_ROUNDOFF_) > boundY &&
188
+ boundY <= limit) &&
189
+ (isZeroZ
190
+ ? sumZ === 0
191
+ : Math.abs(sumZ) * (1 - 2 * UNIT_ROUNDOFF_) > boundZ && boundZ <= limit)) {
192
+ // A zero component is +0, whatever the signs of the zeros summed.
193
+ out[0] = sumX + 0;
194
+ out[1] = sumY + 0;
195
+ out[2] = sumZ + 0;
196
+ out[3] = 0;
197
+ return true;
198
+ }
199
+ return false;
200
+ }
201
+ /** {@link axisScaling_}'s answers. */
202
+ const SCALING_PLAIN_ = 0;
203
+ const SCALING_SCALED_ = 1;
204
+ const SCALING_WIDE_ = 2;
205
+ /**
206
+ * Sets `AXIS_EXPONENTS_` for the doubled path, as `triangle3Cross_` does over
207
+ * one triangle's edges, over every edge `vᵢ − v₀`: 0 on every axis when each
208
+ * axis's longest edge component is 0 or in `[2^−200, 2^200]`
209
+ * (`SCALING_PLAIN_`), otherwise the exponent that brings it to `[1, 2)`
210
+ * (`SCALING_SCALED_`); `SCALING_WIDE_` when a difference overflows, which
211
+ * leaves the polygon to the exact path.
212
+ */
213
+ function axisScaling_(coordinates, count) {
214
+ let isPlain = true;
215
+ for (let axis = 0; axis < 3; axis++) {
216
+ const origin = coordinates[axis];
217
+ let longest = 0;
218
+ for (let vertex = 1; vertex < count; vertex++) {
219
+ longest = Math.max(longest, Math.abs(coordinates[3 * vertex + axis] - origin));
220
+ }
221
+ if (longest === Number.POSITIVE_INFINITY) {
222
+ return SCALING_WIDE_;
223
+ }
224
+ isPlain &&=
225
+ longest === 0 ||
226
+ (longest >= PLAIN_EDGE_MIN_ && longest <= PLAIN_EDGE_MAX_);
227
+ AXIS_EXPONENTS_[axis] = longest > 0 ? binaryExponent(longest) : 0;
228
+ }
229
+ if (isPlain) {
230
+ AXIS_EXPONENTS_.fill(0);
231
+ return SCALING_PLAIN_;
232
+ }
233
+ return SCALING_SCALED_;
234
+ }
235
+ /**
236
+ * The doubled-precision path of {@link polygon3Cross_}: writes each component
237
+ * into `COMPONENTS_` and its exponent into `EXPONENTS_` and returns whether its
238
+ * bound settles them.
239
+ *
240
+ * In a fan triangle, with the edges split exactly (`a + a′`, `c + c′`, scaled
241
+ * per axis), a component is `(a₁ + a₁′)(c₂ + c₂′) − (a₂ + a₂′)(c₁ + c₁′)`: the
242
+ * products of high parts by TwoProduct (exact, but for products below 2^−969,
243
+ * which `UNDERFLOW_BOUND_` covers), the four products of a high part and a low
244
+ * one rounded (each within 1.01u of itself), the two of low parts dropped
245
+ * (bounded by themselves, widened by 1%). The eight parts of every triangle are
246
+ * summed by `Sum2` (Ogita, Rump & Oishi, "Accurate sum and dot product", SIAM
247
+ * J. Sci. Comput. 26, 2005, Proposition 4.5): within u of the exact sum plus
248
+ * γ²_{N−1} of the sum of the parts' magnitudes, for N parts; the final rounding
249
+ * is the u, kept out of the bound as in `triangle3Cross_`. The bound, a sum of
250
+ * positive terms, is widened by 2(N + 4)u for its own roundings.
251
+ */
252
+ function doubledNewell_(coordinates, count, scaling) {
253
+ const edges = EDGES_;
254
+ const products = PRODUCTS_;
255
+ const parts = PARTS_;
256
+ const sums = SUMS_;
257
+ SUMS_.fill(0);
258
+ MAGNITUDES_.fill(0);
259
+ LOSSES_.fill(0);
260
+ IS_ZERO_.fill(1);
261
+ for (let vertex = 1; vertex + 1 < count; vertex++) {
262
+ for (let axis = 0; axis < 3; axis++) {
263
+ const at = 4 * axis;
264
+ const origin = -coordinates[axis];
265
+ edges[at] = coordinates[3 * vertex + axis];
266
+ edges[at + 1] = origin;
267
+ twoSumInPlace(edges, at);
268
+ edges[at + 2] = coordinates[3 * vertex + 3 + axis];
269
+ edges[at + 3] = origin;
270
+ twoSumInPlace(edges, at + 2);
271
+ // Zero before scaling, where a component far below the longest flushes.
272
+ ZEROS_[2 * axis] = edges[at] === 0 ? 1 : 0;
273
+ ZEROS_[2 * axis + 1] = edges[at + 2] === 0 ? 1 : 0;
274
+ if (scaling === SCALING_SCALED_) {
275
+ for (let part = at; part < at + 4; part++) {
276
+ scaleByPowerOfTwoInPlace(edges, part, -AXIS_EXPONENTS_[axis]);
277
+ }
278
+ }
279
+ }
280
+ for (let component = 0; component < 3; component++) {
281
+ const firstAxis = (component + 1) % 3;
282
+ const secondAxis = (component + 2) % 3;
283
+ if ((ZEROS_[2 * firstAxis] === 1 || ZEROS_[2 * secondAxis + 1] === 1) &&
284
+ (ZEROS_[2 * secondAxis] === 1 || ZEROS_[2 * firstAxis + 1] === 1)) {
285
+ continue;
286
+ }
287
+ IS_ZERO_[component] = 0;
288
+ const first = 4 * firstAxis;
289
+ const second = 4 * secondAxis;
290
+ const abFirst = edges[first];
291
+ const abFirstLow = edges[first + 1];
292
+ const acFirst = edges[first + 2];
293
+ const acFirstLow = edges[first + 3];
294
+ const abSecond = edges[second];
295
+ const abSecondLow = edges[second + 1];
296
+ const acSecond = edges[second + 2];
297
+ const acSecondLow = edges[second + 3];
298
+ products[0] = abFirst;
299
+ products[1] = acSecond;
300
+ twoProductInRangeInPlace(products, 0);
301
+ products[2] = abSecond;
302
+ products[3] = acFirst;
303
+ twoProductInRangeInPlace(products, 2);
304
+ parts[0] = products[0];
305
+ parts[1] = -products[2];
306
+ parts[2] = products[1];
307
+ parts[3] = -products[3];
308
+ parts[4] = abFirst * acSecondLow;
309
+ parts[5] = abFirstLow * acSecond;
310
+ parts[6] = -(abSecond * acFirstLow);
311
+ parts[7] = -(abSecondLow * acFirst);
312
+ LOSSES_[component] =
313
+ LOSSES_[component] +
314
+ ROUNDED_PRODUCT_BOUND_ *
315
+ (Math.abs(parts[4]) +
316
+ Math.abs(parts[5]) +
317
+ Math.abs(parts[6]) +
318
+ Math.abs(parts[7])) +
319
+ 1.01 *
320
+ (Math.abs(abFirstLow * acSecondLow) +
321
+ Math.abs(abSecondLow * acFirstLow)) +
322
+ UNDERFLOW_BOUND_;
323
+ // Sum2: each part added by TwoSum, the errors summed plainly.
324
+ const at = 2 * component;
325
+ for (let index = 0; index < 8; index++) {
326
+ const part = parts[index];
327
+ const sum = sums[at];
328
+ const next = sum + part;
329
+ const partRounded = next - sum;
330
+ sums[at] = next;
331
+ sums[at + 1] =
332
+ sums[at + 1] + (sum - (next - partRounded) + (part - partRounded));
333
+ MAGNITUDES_[component] = MAGNITUDES_[component] + Math.abs(part);
334
+ }
335
+ }
336
+ }
337
+ const partCount = 8 * (count - 2);
338
+ return settleDoubled_(partCount);
339
+ }
340
+ /**
341
+ * The end of {@link doubledNewell_}, kept apart so that `binaryExponent` is
342
+ * inlined here whatever budget the accumulation spent (a double passed to a
343
+ * call the engine does not inline is boxed): each component and its bound from
344
+ * the sums, and whether they settle it.
345
+ */
346
+ function settleDoubled_(partCount) {
347
+ const sums = SUMS_;
348
+ const gamma = (partCount * UNIT_ROUNDOFF_) / (1 - partCount * UNIT_ROUNDOFF_);
349
+ const widening = 1 + 2 * (partCount + 4) * UNIT_ROUNDOFF_;
350
+ let top = NONE_;
351
+ for (let component = 0; component < 3; component++) {
352
+ const firstAxis = (component + 1) % 3;
353
+ const secondAxis = (component + 2) % 3;
354
+ EXPONENTS_[component] =
355
+ AXIS_EXPONENTS_[firstAxis] + AXIS_EXPONENTS_[secondAxis];
356
+ if (IS_ZERO_[component] === 1) {
357
+ COMPONENTS_[component] = 0;
358
+ BOUNDS_[component] = 0;
359
+ continue;
360
+ }
361
+ const value = sums[2 * component] + sums[2 * component + 1];
362
+ const bound = (LOSSES_[component] + gamma * gamma * MAGNITUDES_[component]) *
363
+ widening;
364
+ // The sign is settled when the bound, and the last rounding, cannot
365
+ // reach 0.
366
+ if (!(Math.abs(value) * (1 - 4 * UNIT_ROUNDOFF_) > bound)) {
367
+ return false;
368
+ }
369
+ COMPONENTS_[component] = value;
370
+ BOUNDS_[component] = bound;
371
+ top = Math.max(top, binaryExponent(value) + EXPONENTS_[component]);
372
+ }
373
+ // Every bound below 2^−54 of the largest component, and the rounding of the
374
+ // sum below 2^−53 of the component itself.
375
+ for (let component = 0; component < 3; component++) {
376
+ if (COMPONENTS_[component] !== 0 &&
377
+ binaryExponent(BOUNDS_[component]) + EXPONENTS_[component] > top - 54) {
378
+ return false;
379
+ }
380
+ }
381
+ return true;
382
+ }
383
+ /**
384
+ * The exact path of {@link polygon3Cross_}: each component as the exact sum of
385
+ * `Σ vᵢ × vᵢ₊₁` around the ring (`x = Σ yᵢ zᵢ₊₁ − zᵢ yᵢ₊₁`, cyclically), which
386
+ * the fan's sum is, rounded once to 53 bits at any exponent.
387
+ */
388
+ function exactNewell_(coordinates, count) {
389
+ const left = LEFT_;
390
+ const right = RIGHT_;
391
+ for (let component = 0; component < 3; component++) {
392
+ const first = (component + 1) % 3;
393
+ const second = (component + 2) % 3;
394
+ EXACT_.reset();
395
+ let filled = 0;
396
+ for (let vertex = 0; vertex < count; vertex++) {
397
+ const next = vertex + 1 === count ? 0 : vertex + 1;
398
+ left[filled] = coordinates[3 * vertex + first];
399
+ right[filled] = coordinates[3 * next + second];
400
+ left[filled + 1] = -coordinates[3 * vertex + second];
401
+ right[filled + 1] = coordinates[3 * next + first];
402
+ filled += 2;
403
+ if (filled === CHUNK_) {
404
+ EXACT_.addProducts(left, right);
405
+ filled = 0;
406
+ }
407
+ }
408
+ if (filled > 0) {
409
+ left.fill(0, filled);
410
+ right.fill(0, filled);
411
+ EXACT_.addProducts(left, right);
412
+ }
413
+ EXACT_.writeScaled(SCALED_, 0);
414
+ COMPONENTS_[component] = SCALED_[0];
415
+ EXPONENTS_[component] = SCALED_[1];
416
+ }
417
+ }
418
+ //# sourceMappingURL=_polygon3-cross.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_polygon3-cross.js","sourceRoot":"","sources":["../src/_polygon3-cross.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,EACL,eAAe,EACf,YAAY,EACZ,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,0EAA0E;AAC1E,SAAS;AAET;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,CAAC;AAE/B;;;GAGG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,cAAc,CAAC;AAErD,6DAA6D;AAC7D,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC;AACpC,2EAA2E;AAC3E,MAAM,eAAe,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAC1C,+EAA+E;AAC/E,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AACjC,8EAA8E;AAC9E,MAAM,SAAS,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AACtC,0EAA0E;AAC1E,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AACnC,0EAA0E;AAC1E,MAAM,KAAK,GAAG,IAA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