@ac-kit/math-grid 0.3.0 → 0.5.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 (95) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +117 -10
  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/_coverage-contour2.d.ts +55 -0
  8. package/dist/_coverage-contour2.d.ts.map +1 -0
  9. package/dist/_coverage-contour2.js +2068 -0
  10. package/dist/_coverage-contour2.js.map +1 -0
  11. package/dist/_grid-offsets2.d.ts +15 -0
  12. package/dist/_grid-offsets2.d.ts.map +1 -0
  13. package/dist/_grid-offsets2.js +53 -0
  14. package/dist/_grid-offsets2.js.map +1 -0
  15. package/dist/_nearest-site-propagation2.d.ts +80 -0
  16. package/dist/_nearest-site-propagation2.d.ts.map +1 -0
  17. package/dist/_nearest-site-propagation2.js +707 -0
  18. package/dist/_nearest-site-propagation2.js.map +1 -0
  19. package/dist/breadth-first-grid2.d.ts +65 -0
  20. package/dist/breadth-first-grid2.d.ts.map +1 -0
  21. package/dist/breadth-first-grid2.js +116 -0
  22. package/dist/breadth-first-grid2.js.map +1 -0
  23. package/dist/flood-fill2.d.ts +39 -0
  24. package/dist/flood-fill2.d.ts.map +1 -0
  25. package/dist/flood-fill2.js +76 -0
  26. package/dist/flood-fill2.js.map +1 -0
  27. package/dist/grid-neighbors2.d.ts +45 -0
  28. package/dist/grid-neighbors2.d.ts.map +1 -0
  29. package/dist/grid-neighbors2.js +45 -0
  30. package/dist/grid-neighbors2.js.map +1 -0
  31. package/dist/grid-pack-dfs.d.ts.map +1 -1
  32. package/dist/grid-pack-dfs.js +4 -2
  33. package/dist/grid-pack-dfs.js.map +1 -1
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +6 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/infinite-grid2.js.map +1 -1
  39. package/dist/max-rects-pack.d.ts +90 -0
  40. package/dist/max-rects-pack.d.ts.map +1 -0
  41. package/dist/max-rects-pack.js +310 -0
  42. package/dist/max-rects-pack.js.map +1 -0
  43. package/dist/rasterize-line2.d.ts +33 -0
  44. package/dist/rasterize-line2.d.ts.map +1 -0
  45. package/dist/rasterize-line2.js +103 -0
  46. package/dist/rasterize-line2.js.map +1 -0
  47. package/dist/shelf-allocator.d.ts +7 -1
  48. package/dist/shelf-allocator.d.ts.map +1 -1
  49. package/dist/shelf-allocator.js +32 -32
  50. package/dist/shelf-allocator.js.map +1 -1
  51. package/dist/signed-distance-from-coverage2.d.ts +63 -21
  52. package/dist/signed-distance-from-coverage2.d.ts.map +1 -1
  53. package/dist/signed-distance-from-coverage2.js +327 -99
  54. package/dist/signed-distance-from-coverage2.js.map +1 -1
  55. package/dist/squared-distance-transform2.d.ts +9 -4
  56. package/dist/squared-distance-transform2.d.ts.map +1 -1
  57. package/dist/squared-distance-transform2.js +9 -4
  58. package/dist/squared-distance-transform2.js.map +1 -1
  59. package/dist/tile/_tile-matrix.d.ts +33 -0
  60. package/dist/tile/_tile-matrix.d.ts.map +1 -0
  61. package/dist/tile/_tile-matrix.js +186 -0
  62. package/dist/tile/_tile-matrix.js.map +1 -0
  63. package/dist/tile/index.d.ts +8 -0
  64. package/dist/tile/index.d.ts.map +1 -0
  65. package/dist/tile/index.js +8 -0
  66. package/dist/tile/index.js.map +1 -0
  67. package/dist/tile/quadkey.d.ts +30 -0
  68. package/dist/tile/quadkey.d.ts.map +1 -0
  69. package/dist/tile/quadkey.js +91 -0
  70. package/dist/tile/quadkey.js.map +1 -0
  71. package/dist/tile/tile-address.d.ts +91 -0
  72. package/dist/tile/tile-address.d.ts.map +1 -0
  73. package/dist/tile/tile-address.js +228 -0
  74. package/dist/tile/tile-address.js.map +1 -0
  75. package/dist/tile/tile-index.d.ts +26 -0
  76. package/dist/tile/tile-index.d.ts.map +1 -0
  77. package/dist/tile/tile-index.js +2 -0
  78. package/dist/tile/tile-index.js.map +1 -0
  79. package/dist/tile/tile-level.d.ts +24 -0
  80. package/dist/tile/tile-level.d.ts.map +1 -0
  81. package/dist/tile/tile-level.js +53 -0
  82. package/dist/tile/tile-level.js.map +1 -0
  83. package/dist/tile/tile-matrix-set-json.d.ts +67 -0
  84. package/dist/tile/tile-matrix-set-json.d.ts.map +1 -0
  85. package/dist/tile/tile-matrix-set-json.js +247 -0
  86. package/dist/tile/tile-matrix-set-json.js.map +1 -0
  87. package/dist/tile/tile-matrix-set.d.ts +174 -0
  88. package/dist/tile/tile-matrix-set.d.ts.map +1 -0
  89. package/dist/tile/tile-matrix-set.js +244 -0
  90. package/dist/tile/tile-matrix-set.js.map +1 -0
  91. package/dist/tile/tile-range.d.ts +57 -0
  92. package/dist/tile/tile-range.d.ts.map +1 -0
  93. package/dist/tile/tile-range.js +140 -0
  94. package/dist/tile/tile-range.js.map +1 -0
  95. package/package.json +10 -8
@@ -1,27 +1,69 @@
1
- import { buffersMayShareMemory, describeValue } from "@ac-kit/core";
1
+ import { describeValue, viewByteLength, viewPrefixesMayOverlap, } from "@ac-kit/core";
2
+ import { findContour_, isCorner_, isSiteCell_, locateEdgeAndResidual_, } from "./_coverage-contour2.js";
3
+ import { COVERAGE_STRIDE_, coverageSiteSide_, propagateNearestSites_, REACH_, siteSegmentCount_, splatNearestSites_, } from "./_nearest-site-propagation2.js";
2
4
  /**
3
5
  * Signed distance field of an antialiased coverage grid, in texels: negative
4
6
  * inside the shape, positive outside, zero on the 50 % contour, magnitudes
5
7
  * capped at `range`. Rows are stored contiguously, `index = y · width + x`,
6
8
  * texel centres at `(x, y)`.
7
9
  *
8
- * Each edge texel (coverage strictly between 0 and 255) locates the contour
9
- * inside it: the normal is the Sobel gradient of the coverage, and the offset
10
- * from the texel centre inverts the exact area coverage of a straight edge
11
- * through a unit square at that angle, so the field keeps sub-texel edges
12
- * instead of snapping to a threshold. Binary transitions (a full texel beside
13
- * an empty one, as hand-drawn masks have) put the contour midway. Each contour
14
- * piece lowers the distance of every texel within `range` of it, by the
15
- * distance to the piece's segment, which a bare point would overestimate by up
16
- * to a quarter texel between samples. Texels farther than `range` from any
17
- * contour saturate at `±range` (inside when coverage is at least 128).
10
+ * Gustavson & Strand's antialiased Euclidean distance transform (2011, _Pattern
11
+ * Recognition Letters_ 32(2)), seeded with sub-texel contour pieces and
12
+ * extended to straight runs and corners. Each edge texel (coverage strictly
13
+ * between 0 and 255) locates the contour inside it: the normal is the Sobel
14
+ * gradient of the coverage, and the offset from the texel centre inverts the
15
+ * exact area coverage of a straight edge through a unit square at that angle,
16
+ * so the field keeps sub-texel edges instead of snapping to a threshold. Binary
17
+ * transitions (a full texel beside an empty one, as hand-drawn masks have) put
18
+ * the contour midway. The pieces whose 3 × 3 coverage is one straight edge
19
+ * merge into straight runs, each one segment along the line fitted through
20
+ * them; where two runs end next to each other at an angle, the lines cross at a
21
+ * corner's vertex, which the coverage around it then places along the bisector
22
+ * (a sharp tip's crossing is ill-conditioned), the runs end there, and the
23
+ * texels around the vertex that the corner explains take it, so that no piece
24
+ * overshoots it. Every texel then learns its nearest piece of contour, measured
25
+ * to its segments rather than to a point, which would overestimate by up to a
26
+ * quarter texel between samples: from the pieces themselves, each measuring the
27
+ * texels within `range` of it, when that is cheaper (few edge texels, short
28
+ * range); else from its neighbours in two raster sweeps (vector propagation),
29
+ * then along the contour to a nearer piece, which leaves up to about 0.05 texel
30
+ * where pieces of the contour compete (its medial axis). A texel whose 3 × 3
31
+ * coverage is symmetric about it (no gradient) holds no straight edge: when a
32
+ * stripe thinner than a texel through its centre explains that coverage (a
33
+ * hairline, or a thin gap), the stripe's two edges are its contour, so that the
34
+ * stripe's centreline lies half its width inside (or outside, for a gap); else
35
+ * the coverage determines nothing and the contour is taken at its centre. The
36
+ * side of every texel is decided before its magnitude is capped: by its
37
+ * coverage (inside when at least 128), unless a corner it holds or is nearest
38
+ * to, or a stripe it holds, places its centre on the other side. Texels farther
39
+ * than `range` from any contour saturate at the cap.
18
40
  *
19
- * Accurate to 0.1 texel on discs of radius 6 and more; the TinySDF seeding of
20
- * {@link squaredDistanceTransform2} (a seed adds its offset to a squared
21
- * distance) is 0.5 texel off near the edge, so use this for fields that keep
22
- * sub-texel edges and the transform for exact distances between feature cells.
41
+ * The field is stored as 32-bit floats: magnitudes are capped at the largest
42
+ * 32-bit float not above `range` (`3.4028234663852886e38` for a larger
43
+ * `range`), so the field never exceeds `range` and never overflows to an
44
+ * infinity; below the smallest 32-bit float (`2⁻¹⁴⁹`) only the sign of zero is
45
+ * left.
23
46
  *
24
- * O(edge texels · range²) time, O(1) extra memory, no allocation.
47
+ * Within 0.1 texel of the analytic distance, up to 5 texels from the edge, on
48
+ * coverage sampled 16 × 16 per texel and rounded to bytes, for discs of radius
49
+ * 4 and more and polygons whose sides are at least 8 texels long and whose
50
+ * corners are at least 20°, convex or concave; and within 0.02 texel, on
51
+ * exact-area coverage rounded to bytes, for stripes from 0.1 to 0.8 texel wide,
52
+ * of ink or a gap, along a row, a column or a diagonal of texel centres.
53
+ * Smaller polygons and sharper tips leave their corners to the straight pieces,
54
+ * up to half a texel off near the vertex; a feature thinner than a texel that
55
+ * crosses texels off their centres (a hairline at another angle) can be up to
56
+ * half a texel off, as one texel's coverage cannot tell where in it such a
57
+ * feature lies.
58
+ *
59
+ * O(width · height) time: a pass over the grid, the runs grown once from the
60
+ * pieces, a corner tried only where two runs end next to each other, then the
61
+ * lesser of O(pieces · range²) and two sweeps that measure only the texels
62
+ * within `range + 2` of the contour. `8 · width · height` doubles of working
63
+ * memory, none allocated when `scratch` is given. Unlike TinySDF's seeding of
64
+ * {@link squaredDistanceTransform2} (a squared sub-texel offset added at the
65
+ * edge texel, half a texel off near the edge), the distance is measured to the
66
+ * contour itself.
25
67
  *
26
68
  * @example
27
69
  * const coverage = new Uint8Array([0, 0, 128, 255, 255]);
@@ -31,115 +73,301 @@ import { buffersMayShareMemory, describeValue } from "@ac-kit/core";
31
73
  * @param out - At least `width · height` entries; overwritten.
32
74
  * @param coverage - `width · height` bytes, 0 outside to 255 inside.
33
75
  * @param range - The most distance kept, in texels, positive and finite.
76
+ * @param scratch - At least `8 · width · height` entries of working memory,
77
+ * overwritten; allocated when omitted.
34
78
  * @returns `out`.
35
79
  * @throws {RangeError} When a size is not a positive integer, `range` is not
36
- * positive and finite, `coverage` or `out` is too short, or `out` shares
37
- * bytes with the first `width · height` entries of `coverage` (checked before
38
- * anything is written: the field is built in `out` while `coverage` is read).
39
- * Views over a `SharedArrayBuffer` and over any other shared buffer, a clone
40
- * of it included, are taken to share memory.
80
+ * positive and finite, `coverage`, `out` or `scratch` is too short, or two of
81
+ * `out`, `coverage` and `scratch` share bytes within the entries the call
82
+ * uses (checked before anything is written). Views over a `SharedArrayBuffer`
83
+ * and over any other shared buffer, a clone of it included, are taken to
84
+ * share memory.
41
85
  */
42
- export function signedDistanceFromCoverage2(out, coverage, width, height, range) {
86
+ export function signedDistanceFromCoverage2(out, coverage, width, height, range, scratch) {
43
87
  if (!Number.isSafeInteger(width) ||
44
88
  width <= 0 ||
45
89
  !Number.isSafeInteger(height) ||
46
90
  height <= 0) {
47
91
  throw new RangeError(`width and height must be positive integers, got ${describeValue(width)}×${describeValue(height)}`);
48
92
  }
49
- if (!(range > 0) || !Number.isFinite(range)) {
93
+ // compared rather than Number.isFinite, which an engine tier calls with
94
+ // the double boxed
95
+ if (!(range > 0 && range < Infinity)) {
50
96
  throw new RangeError(`range must be positive and finite, got ${describeValue(range)}`);
51
97
  }
52
98
  const count = width * height;
53
- if (coverage.length < count || out.length < count) {
54
- throw new RangeError(`coverage and out must hold ${count} entries, got ${coverage.length} and ${out.length}`);
99
+ // the intrinsic lengths: a shadowed `length` cannot pass a short view
100
+ const coverageBytes = viewByteLength(coverage);
101
+ const outBytes = viewByteLength(out);
102
+ if (coverageBytes < count || outBytes < 4 * count) {
103
+ throw new RangeError(`coverage and out must hold ${count} entries, got ${coverageBytes} and ${outBytes / 4}`);
55
104
  }
56
- if (buffersMayShareMemory(coverage.buffer, out.buffer) &&
57
- coverage.byteOffset < out.byteOffset + count * 4 &&
58
- out.byteOffset < coverage.byteOffset + count) {
105
+ if (viewPrefixesMayOverlap(coverage, count, out, count * 4)) {
59
106
  throw new RangeError("out must not overlap coverage");
60
107
  }
61
- out.fill(range, 0, count);
62
- const reach = Math.ceil(range) + 1;
63
- for (let y = 0; y < height; y += 1) {
64
- for (let x = 0; x < width; x += 1) {
65
- const value = coverage[y * width + x];
66
- if (value > 0 && value < 255) {
67
- splatEdge_(coverage, x, y, value / 255, width, height, range, reach, out);
68
- }
69
- else {
70
- const opposite = value === 255 ? 0 : 255;
71
- if (x + 1 < width && coverage[y * width + x + 1] === opposite) {
72
- splat_(x + 0.5, y, 1, 0, 0.5, width, height, reach, out);
73
- }
74
- if (y + 1 < height && coverage[(y + 1) * width + x] === opposite) {
75
- splat_(x, y + 0.5, 0, 1, 0.5, width, height, reach, out);
76
- }
77
- }
78
- }
79
- }
80
- for (let index = 0; index < count; index += 1) {
81
- const distance = Math.min(out[index], range);
82
- out[index] = coverage[index] >= 128 ? -distance : distance;
108
+ const needed = (2 + COVERAGE_STRIDE_) * count;
109
+ if (scratch === undefined) {
110
+ scratch = new Float64Array(needed);
83
111
  }
84
- return out;
85
- }
86
- function at_(coverage, width, height, x, y) {
87
- return coverage[Math.min(height - 1, Math.max(0, y)) * width +
88
- Math.min(width - 1, Math.max(0, x))];
89
- }
90
- function splatEdge_(coverage, x, y, alpha, width, height, _range, reach, out) {
91
- const c = (dx, dy) => at_(coverage, width, height, x + dx, y + dy);
92
- // the Sobel gradient points toward more coverage; the outward normal is its opposite
93
- const gradientX = c(1, -1) + 2 * c(1, 0) + c(1, 1) - c(-1, -1) - 2 * c(-1, 0) - c(-1, 1);
94
- const gradientY = c(-1, 1) + 2 * c(0, 1) + c(1, 1) - c(-1, -1) - 2 * c(0, -1) - c(1, -1);
95
- const length = Math.hypot(gradientX, gradientY);
96
- if (length === 0) {
97
- splat_(x, y, 1, 0, 0, width, height, reach, out);
98
- return;
112
+ else {
113
+ const scratchBytes = viewByteLength(scratch);
114
+ if (scratchBytes < 8 * needed) {
115
+ throw new RangeError(`scratch holds ${scratchBytes / 8} entries, ${needed} needed`);
116
+ }
117
+ if (viewPrefixesMayOverlap(scratch, needed * 8, out, count * 4) ||
118
+ viewPrefixesMayOverlap(scratch, needed * 8, coverage, count)) {
119
+ throw new RangeError("scratch must not overlap out or coverage");
120
+ }
99
121
  }
100
- const outwardX = -gradientX / length;
101
- const outwardY = -gradientY / length;
102
- // a straight edge through a unit square with normal (a, b), a ≥ b ≥ 0:
103
- // coverage is a function of the edge's offset from the centre, inverted
104
- const a = Math.max(Math.abs(outwardX), Math.abs(outwardY));
105
- const b = Math.min(Math.abs(outwardX), Math.abs(outwardY));
106
- let offset;
107
- if (b < 1e-6) {
108
- offset = a * (alpha - 0.5);
122
+ // scratch: each contour cell's label, then its nearest site's cell
123
+ // [0, count), room for lists, then the squared distance to the nearest
124
+ // site [count, 2 · count), then each cell's site geometry; out holds each
125
+ // edge texel's straight-edge residual until the end
126
+ const sites = 2 * count;
127
+ const siteCount = locateContour_(scratch, out, coverage, width, height);
128
+ const corners = findContour_(scratch, out, coverage, width, height, siteCells_, siteCount);
129
+ // each texel within range finds its nearest site, by measuring from each
130
+ // site the texels within range of it while that is cheap (few sites, short
131
+ // range: exact), else by vector propagation through the grid, whose sweeps
132
+ // carry a site through texels at most √2 farther from it than the texel in
133
+ // range (an edge texel's site, within 0.71 of its centre, is always found)
134
+ const splatReach = Math.max(range, 1);
135
+ const span = 2 * Math.ceil(splatReach + 1) + 1;
136
+ const useSplat = siteCount * span * span <= SPLAT_COST_ * count;
137
+ if (useSplat) {
138
+ if (cornerHolders_.length < corners) {
139
+ cornerHolders_ = new Int32Array(Math.max(corners, cornerHolders_.length * 2));
140
+ }
141
+ for (let index = 0; index < corners; index += 1) {
142
+ cornerHolders_[index] = scratch[count + index] | 0;
143
+ }
144
+ const splatReachSquared = splatReach * splatReach;
145
+ for (let i = 0; i < count; i += 1) {
146
+ out[i] = splatReachSquared;
147
+ }
148
+ REACH_[0] = splatReach;
149
+ REACH_[1] = splatReachSquared;
150
+ splatNearestSites_(scratch, out, coverage, cornerHolders_, corners, siteCells_, siteCount, sites, width, height);
109
151
  }
110
- else if (alpha <= b / (2 * a)) {
111
- offset = -(a + b) / 2 + Math.sqrt(2 * a * b * alpha);
152
+ else {
153
+ scratch.fill(Infinity, count, 2 * count);
154
+ // a cell that took a corner holds a copy of its holder's site: only the
155
+ // holder is a site
156
+ for (let cell = 0; cell < count; cell += 1) {
157
+ scratch[cell] =
158
+ isSiteCell_(coverage, cell, width, count) &&
159
+ siteSegmentCount_(scratch, sites, width, cell) > 0 &&
160
+ (!isCorner_(scratch, sites, cell) || scratch[cell] === cell)
161
+ ? cell
162
+ : -1;
163
+ }
164
+ REACH_[0] = range + 2;
165
+ REACH_[1] = (range + 2) * (range + 2);
166
+ propagateNearestSites_(scratch, out, sites, width, height);
112
167
  }
113
- else if (alpha >= 1 - b / (2 * a)) {
114
- offset = (a + b) / 2 - Math.sqrt(2 * a * b * (1 - alpha));
168
+ // out holds 32-bit floats: the cap is the largest one not above range, so
169
+ // that no magnitude passes the range and none overflows to infinity
170
+ CAP_[0] = range;
171
+ if (CAP_[0] > range) {
172
+ // the 32-bit float below: cap · (1 − 2⁻²⁴) is exact and rounds to it,
173
+ // but below the normal range, where the step is 2⁻¹⁴⁹, and past the
174
+ // largest float; stored through CAP_, whose 32-bit rounding is
175
+ // Math.fround's, so that the cap stays a double the engine never boxes
176
+ const above = CAP_[0];
177
+ CAP_[0] = above * (1 - 2 ** -24);
178
+ if (above === Infinity) {
179
+ CAP_[0] = 3.4028234663852886e38;
180
+ }
181
+ else if (CAP_[0] === above) {
182
+ CAP_[0] = above - 2 ** -149;
183
+ }
115
184
  }
116
- else {
117
- offset = a * (alpha - 0.5);
185
+ const cap = CAP_[0];
186
+ const rangeSquared = range * range;
187
+ for (let cell = 0; cell < count; cell += 1) {
188
+ const value = coverage[cell];
189
+ const distanceSquared = useSplat ? out[cell] : scratch[count + cell];
190
+ if (value === 0 || value === 255) {
191
+ if (distanceSquared >= rangeSquared) {
192
+ out[cell] = value === 0 ? cap : -cap;
193
+ }
194
+ else {
195
+ const distance = Math.sqrt(distanceSquared);
196
+ const magnitude = distance < cap ? distance : cap;
197
+ out[cell] = value === 0 ? magnitude : -magnitude;
198
+ }
199
+ continue;
200
+ }
201
+ // an edge texel's centre may be inside with less than half its
202
+ // area (near a sharp corner, or on a stripe thinner than a
203
+ // texel): a corner it holds, or one nearest to it, else a stripe
204
+ // it holds, decides by its geometry
205
+ let side = value >= 128 ? -1 : 1;
206
+ let site = scratch[cell];
207
+ if (isCorner_(scratch, sites, cell)) {
208
+ site = cell;
209
+ }
210
+ let decided = 0;
211
+ let holder = -1;
212
+ if (site >= 0 && isCorner_(scratch, sites, site)) {
213
+ holder = site;
214
+ }
215
+ else {
216
+ // a stripe's own site: an edge's format, its kind set
217
+ const own = sites + COVERAGE_STRIDE_ * cell;
218
+ const fourth = scratch[own + 3];
219
+ const first = scratch[own];
220
+ if (fourth !== fourth && first === first && scratch[own + 4] !== 0) {
221
+ holder = cell;
222
+ }
223
+ }
224
+ if (holder >= 0) {
225
+ // integer arithmetic: a floating-point remainder is a library call
226
+ const y = (cell / width) | 0;
227
+ decided = coverageSiteSide_(scratch, sites, width, holder, cell - y * width, y);
228
+ }
229
+ if (decided !== 0) {
230
+ side = decided;
231
+ }
232
+ let magnitude = cap;
233
+ if (distanceSquared < rangeSquared) {
234
+ const distance = Math.sqrt(distanceSquared);
235
+ if (distance < cap) {
236
+ magnitude = distance;
237
+ }
238
+ }
239
+ out[cell] = side * magnitude;
118
240
  }
119
- // consecutive edge texels are 1 / a apart along the contour: this one's share
120
- splat_(x + outwardX * offset, y + outwardY * offset, outwardX, outwardY, 0.5 / a, width, height, reach, out);
241
+ return out;
121
242
  }
122
243
  /**
123
- * Lowers the distance of every texel within reach of the contour segment
124
- * through (`pointX`, `pointY`), normal (`normalX`, `normalY`), of half-length
125
- * `half` along its tangent.
244
+ * Where measuring from each site the texels within reach of it stops being
245
+ * cheaper than propagating through the grid: sites times squared texels of
246
+ * reach, per texel of the grid (measured on glyphs from 64² to 512²: the
247
+ * measuring wins up to a range of about 64 on a 512² glyph).
126
248
  */
127
- function splat_(pointX, pointY, normalX, normalY, half, width, height, reach, out) {
128
- const left = Math.max(0, Math.round(pointX) - reach);
129
- const right = Math.min(width - 1, Math.round(pointX) + reach);
130
- const top = Math.max(0, Math.round(pointY) - reach);
131
- const bottom = Math.min(height - 1, Math.round(pointY) + reach);
132
- for (let y = top; y <= bottom; y += 1) {
133
- const dy = y - pointY;
134
- for (let x = left; x <= right; x += 1) {
135
- const dx = x - pointX;
136
- const across = normalX * dx + normalY * dy;
137
- const along = Math.max(0, Math.abs(-normalY * dx + normalX * dy) - half);
138
- const value = Math.sqrt(across * across + along * along);
139
- if (value < out[y * width + x]) {
140
- out[y * width + x] = value;
249
+ const SPLAT_COST_ = 100;
250
+ /**
251
+ * The cap of the field's magnitudes, as a 32-bit float: storing into it rounds
252
+ * as `Math.fround` does, and reading it back gives a double the engine keeps
253
+ * unboxed.
254
+ */
255
+ const CAP_ = new Float32Array(1);
256
+ /**
257
+ * Reusable list of contour cell indices found by {@link locateContour_}, grown
258
+ * geometrically so repeated calls allocate nothing.
259
+ */
260
+ let siteCells_ = new Int32Array(0);
261
+ let cornerHolders_ = new Int32Array(0);
262
+ /**
263
+ * Writes the site geometry of every contour cell of the coverage grid (see
264
+ * {@link COVERAGE_STRIDE_}), each antialiased texel's straight-edge residual
265
+ * into `residuals`, and labels each contour cell unassigned (`-1`) in
266
+ * `scratch[cell]`; the other cells are left as they are. Records each contour
267
+ * cell in {@link siteCells_} and returns how many there are.
268
+ */
269
+ function locateContour_(scratch, residuals, coverage, width, height) {
270
+ const sites = 2 * width * height;
271
+ let siteCount = 0;
272
+ const lastX = width - 1;
273
+ const lastY = height - 1;
274
+ for (let y = 0; y < height; y += 1) {
275
+ const row = y * width;
276
+ const hasBelow = y < lastY;
277
+ if (hasBelow) {
278
+ for (let x = 0; x < lastX; x += 1) {
279
+ const cell = row + x;
280
+ const value = coverage[cell];
281
+ if (value === 0) {
282
+ const right = coverage[cell + 1] === 255;
283
+ const down = coverage[cell + width] === 255;
284
+ if (!right && !down) {
285
+ continue;
286
+ }
287
+ const at = sites + COVERAGE_STRIDE_ * cell;
288
+ scratch[at] = Number.NaN;
289
+ scratch[at + 1] = right ? -1 : 0;
290
+ scratch[at + 2] = down ? -1 : 0;
291
+ scratch[at + 3] = Number.NaN;
292
+ }
293
+ else if (value === 255) {
294
+ const right = coverage[cell + 1] === 0;
295
+ const down = coverage[cell + width] === 0;
296
+ if (!right && !down) {
297
+ continue;
298
+ }
299
+ const at = sites + COVERAGE_STRIDE_ * cell;
300
+ scratch[at] = Number.NaN;
301
+ scratch[at + 1] = right ? 1 : 0;
302
+ scratch[at + 2] = down ? 1 : 0;
303
+ scratch[at + 3] = Number.NaN;
304
+ }
305
+ else {
306
+ locateEdgeAndResidual_(scratch, sites + COVERAGE_STRIDE_ * cell, coverage, value, x, y, width, height, residuals, cell);
307
+ }
308
+ scratch[cell] = -1;
309
+ if (siteCount === siteCells_.length) {
310
+ const grown = new Int32Array(Math.max(256, siteCells_.length * 2));
311
+ grown.set(siteCells_);
312
+ siteCells_ = grown;
313
+ }
314
+ siteCells_[siteCount] = cell;
315
+ siteCount += 1;
316
+ }
317
+ // last column of non-last row
318
+ const cell = row + lastX;
319
+ const value = coverage[cell];
320
+ if (value === 0 || value === 255) {
321
+ const down = coverage[cell + width] === 255 - value;
322
+ if (!down) {
323
+ continue;
324
+ }
325
+ const at = sites + COVERAGE_STRIDE_ * cell;
326
+ scratch[at] = Number.NaN;
327
+ scratch[at + 1] = 0;
328
+ scratch[at + 2] = value === 255 ? 1 : -1;
329
+ scratch[at + 3] = Number.NaN;
330
+ }
331
+ else {
332
+ locateEdgeAndResidual_(scratch, sites + COVERAGE_STRIDE_ * cell, coverage, value, lastX, y, width, height, residuals, cell);
333
+ }
334
+ scratch[cell] = -1;
335
+ if (siteCount === siteCells_.length) {
336
+ const grown = new Int32Array(Math.max(256, siteCells_.length * 2));
337
+ grown.set(siteCells_);
338
+ siteCells_ = grown;
339
+ }
340
+ siteCells_[siteCount] = cell;
341
+ siteCount += 1;
342
+ continue;
343
+ }
344
+ for (let x = 0; x < width; x += 1) {
345
+ const cell = row + x;
346
+ const value = coverage[cell];
347
+ if (value === 0 || value === 255) {
348
+ const right = x < lastX && coverage[cell + 1] === 255 - value;
349
+ if (!right) {
350
+ continue;
351
+ }
352
+ const at = sites + COVERAGE_STRIDE_ * cell;
353
+ scratch[at] = Number.NaN;
354
+ scratch[at + 1] = value === 255 ? 1 : -1;
355
+ scratch[at + 2] = 0;
356
+ scratch[at + 3] = Number.NaN;
357
+ }
358
+ else {
359
+ locateEdgeAndResidual_(scratch, sites + COVERAGE_STRIDE_ * cell, coverage, value, x, y, width, height, residuals, cell);
360
+ }
361
+ scratch[cell] = -1;
362
+ if (siteCount === siteCells_.length) {
363
+ const grown = new Int32Array(Math.max(256, siteCells_.length * 2));
364
+ grown.set(siteCells_);
365
+ siteCells_ = grown;
141
366
  }
367
+ siteCells_[siteCount] = cell;
368
+ siteCount += 1;
142
369
  }
143
370
  }
371
+ return siteCount;
144
372
  }
145
373
  //# sourceMappingURL=signed-distance-from-coverage2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"signed-distance-from-coverage2.js","sourceRoot":"","sources":["../src/signed-distance-from-coverage2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,2BAA2B,CAC1C,GAAiB,EACjB,QAAoB,EACpB,KAAa,EACb,MAAc,EACd,KAAa;I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C;QAChB,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC"}
@@ -1,10 +1,15 @@
1
1
  /**
2
2
  * Felzenszwalb–Huttenlocher (2012) exact distance transform of a sampled
3
3
  * function, separable, O(width · height): each cell holds its seed `f(q)` — 0
4
- * at a feature, `Infinity` far from any, or a squared sub-texel distance for an
5
- * edge cell estimated from coverage (TinySDF's seeding) — and becomes `min over
6
- * q of (|p − q|² + f(q))`, in cell units. Rows are stored contiguously, `grid[y *
7
- * width + x]`.
4
+ * at a feature, `Infinity` far from any, or any other non-negative cost — and
5
+ * becomes `min over q of (|p − q|² + f(q))`, in cell units, exactly. Rows are
6
+ * stored contiguously, `grid[y * width + x]`.
7
+ *
8
+ * Features are cell centres. A seed cannot place a feature between centres:
9
+ * adding a squared sub-texel offset to the squared distance of a cell
10
+ * (TinySDF's seeding from antialiased coverage) is up to half a texel off near
11
+ * the edge; {@link signedDistanceFromCoverage2} measures to the sub-texel
12
+ * contour itself, in O(width · height) too.
8
13
  *
9
14
  * In place; `scratch` (at least `3 · max(width, height) + 1` entries) avoids
10
15
  * the allocation of a working buffer. A grid with no finite seed stays
@@ -1 +1 @@
1
- {"version":3,"file":"squared-distance-transform2.d.ts","sourceRoot":"","sources":["../src/squared-distance-transform2.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,GACpB,YAAY,CAoDd"}
1
+ {"version":3,"file":"squared-distance-transform2.d.ts","sourceRoot":"","sources":["../src/squared-distance-transform2.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,GACpB,YAAY,CAoDd"}
@@ -2,10 +2,15 @@ import { describeValue } from "@ac-kit/core";
2
2
  /**
3
3
  * Felzenszwalb–Huttenlocher (2012) exact distance transform of a sampled
4
4
  * function, separable, O(width · height): each cell holds its seed `f(q)` — 0
5
- * at a feature, `Infinity` far from any, or a squared sub-texel distance for an
6
- * edge cell estimated from coverage (TinySDF's seeding) — and becomes `min over
7
- * q of (|p − q|² + f(q))`, in cell units. Rows are stored contiguously, `grid[y *
8
- * width + x]`.
5
+ * at a feature, `Infinity` far from any, or any other non-negative cost — and
6
+ * becomes `min over q of (|p − q|² + f(q))`, in cell units, exactly. Rows are
7
+ * stored contiguously, `grid[y * width + x]`.
8
+ *
9
+ * Features are cell centres. A seed cannot place a feature between centres:
10
+ * adding a squared sub-texel offset to the squared distance of a cell
11
+ * (TinySDF's seeding from antialiased coverage) is up to half a texel off near
12
+ * the edge; {@link signedDistanceFromCoverage2} measures to the sub-texel
13
+ * contour itself, in O(width · height) too.
9
14
  *
10
15
  * In place; `scratch` (at least `3 · max(width, height) + 1` entries) avoids
11
16
  * the allocation of a working buffer. A grid with no finite seed stays
@@ -1 +1 @@
1
- {"version":3,"file":"squared-distance-transform2.js","sourceRoot":"","sources":["../src/squared-distance-transform2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAkB,EAClB,KAAa,EACb,MAAc,EACd,OAAsB;IAEtB,IACC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAC5B,KAAK,IAAI,CAAC;QACV,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC7B,MAAM,IAAI,CAAC,EACV,CAAC;QACF,MAAM,IAAI,UAAU,CACnB,mDAAmD,aAAa,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAClG,CAAC;IACH,CAAC;I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AAG,MAAM,CAAC,GAAG,KAAK,GAAG,KAAK,GAAI,OAAO,CAAC,CAAC,CAAY,CAAC;IACpE,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"squared-distance-transform2.js","sourceRoot":"","sources":["../src/squared-distance-transform2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAkB,EAClB,KAAa,EACb,MAAc,EACd,OAAsB;IAEtB,IACC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAC5B,KAAK,IAAI,CAAC;QACV,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC7B,MAAM,IAAI,CAAC,EACV,CAAC;QACF,MAAM,IAAI,UAAU,CACnB,mDAAmD,aAAa,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAClG,CAAC;IACH,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;IACjC,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,UAAU,CACnB,cAAc,IAAI,CAAC,MAAM,WAAW,SAAS,SAAS,CACtD,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC;IAC/B,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;SAAM,CAAC;QACP,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,UAAU,CACnB,iBAAiB,OAAO,CAAC,MAAM,aAAa,MAAM,SAAS,CAC3D,CAAC;QACH,C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AC,CAAC;QAC9B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;QACnC,OAAO,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IAC3C,CAAC;IACD,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACd,OAAO;IACR,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC,UAAU,GAAG,OAAO,GAAG,CAAC,CAAE,GAAG,CAAC,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC,CAAC;QACd,CAAC;QACD,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,GAAG,OAAO,CAAE,CAAC;QACxC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;IACzD,CAAC;AACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { TileIndex, TileRange } from "./tile-index.js";
2
+ import type { TileMatrix, TileMatrixSet } from "./tile-matrix-set.js";
3
+ /** The coalescence factor of `row`, without validation. O(coalescences). */
4
+ export declare function coalescenceAt_(matrix: TileMatrix, row: number): number;
5
+ /** The x of the left edge of grid column `col` (cold paths). */
6
+ export declare function columnEdge_(matrix: TileMatrix, col: number): number;
7
+ /** The grid column of `point[0]`, `-1` outside the matrix or for `NaN`. */
8
+ export declare function columnAt_(matrix: TileMatrix, point: ArrayLike<number>): number;
9
+ /** The row of `point[1]`, `-1` outside the matrix or for `NaN`. */
10
+ export declare function rowAt_(matrix: TileMatrix, point: ArrayLike<number>): number;
11
+ /**
12
+ * The matrix of `tile` in `set`, or `undefined` when a component is `NaN`.
13
+ *
14
+ * @throws {RangeError} When the level, column or row is not an integer of the
15
+ * set.
16
+ */
17
+ export declare function tileMatrixOf_(name: string, set: TileMatrixSet, tile: Readonly<TileIndex>): TileMatrix | undefined;
18
+ /**
19
+ * The matrix of `level` in `set`.
20
+ *
21
+ * @throws {RangeError} When `level` is not an integer level of the set.
22
+ */
23
+ export declare function levelMatrix_(name: string, set: TileMatrixSet, level: number): TileMatrix;
24
+ /** Writes the empty range of `level` into `out`. */
25
+ export declare function rangeEmpty_(out: TileRange, level: number): TileRange;
26
+ /**
27
+ * Writes the range of tiles of `matrix` (level `level`) covering the plane box
28
+ * `box` (`[minX, minY, maxX, maxY]`) into `out`, with the OGC `epsilon` in tile
29
+ * units (read from `box[4]` when `box` has one, else 0); empty when the box
30
+ * misses the matrix or has a `NaN`.
31
+ */
32
+ export declare function rangeForBox_(out: TileRange, matrix: TileMatrix, level: number, box: ArrayLike<number>): TileRange;
33
+ //# sourceMappingURL=_tile-matrix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tile-matrix.d.ts","sourceRoot":"","sources":["../../src/tile/_tile-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAYtE,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAYtE;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CACxB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GACtB,MAAM,CAeR;AAED,mEAAmE;AACnE,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,KAA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