@ac-kit/math-grid 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.
- package/CHANGELOG.md +65 -0
- package/README.md +20 -7
- package/dist/_coverage-contour2.d.ts +48 -0
- package/dist/_coverage-contour2.d.ts.map +1 -0
- package/dist/_coverage-contour2.js +1670 -0
- package/dist/_coverage-contour2.js.map +1 -0
- package/dist/_nearest-site-propagation2.d.ts +80 -0
- package/dist/_nearest-site-propagation2.d.ts.map +1 -0
- package/dist/_nearest-site-propagation2.js +551 -0
- package/dist/_nearest-site-propagation2.js.map +1 -0
- package/dist/grid-pack-dfs.d.ts.map +1 -1
- package/dist/grid-pack-dfs.js +4 -2
- package/dist/grid-pack-dfs.js.map +1 -1
- package/dist/infinite-grid2.js.map +1 -1
- package/dist/shelf-allocator.d.ts +7 -1
- package/dist/shelf-allocator.d.ts.map +1 -1
- package/dist/shelf-allocator.js +32 -32
- package/dist/shelf-allocator.js.map +1 -1
- package/dist/signed-distance-from-coverage2.d.ts +63 -21
- package/dist/signed-distance-from-coverage2.d.ts.map +1 -1
- package/dist/signed-distance-from-coverage2.js +238 -98
- package/dist/signed-distance-from-coverage2.js.map +1 -1
- package/dist/squared-distance-transform2.d.ts +9 -4
- package/dist/squared-distance-transform2.d.ts.map +1 -1
- package/dist/squared-distance-transform2.js +9 -4
- package/dist/squared-distance-transform2.js.map +1 -1
- package/package.json +7 -6
|
@@ -1,27 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describeValue, viewByteLength, viewPrefixesMayOverlap, } from "@ac-kit/core";
|
|
2
|
+
import { edgeResidual_, findContour_, isCorner_, isSiteCell_, locateEdge_, } 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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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
|
-
*
|
|
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,213 @@ 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 `
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
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 (
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
}
|
|
108
|
+
const needed = (2 + COVERAGE_STRIDE_) * count;
|
|
109
|
+
if (scratch === undefined) {
|
|
110
|
+
scratch = new Float64Array(needed);
|
|
79
111
|
}
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
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
|
+
}
|
|
83
121
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return;
|
|
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);
|
|
129
|
+
// the corners' holders, as (column, row) pairs that 32-bit floats hold
|
|
130
|
+
// exactly: out is free until the end
|
|
131
|
+
for (let index = 0; index < corners; index += 1) {
|
|
132
|
+
const holder = scratch[count + index];
|
|
133
|
+
const column = holder % width;
|
|
134
|
+
out[2 * index] = column;
|
|
135
|
+
out[2 * index + 1] = (holder - column) / width;
|
|
99
136
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
137
|
+
// each texel within range finds its nearest site, by measuring from each
|
|
138
|
+
// site the texels within range of it while that is cheap (few sites, short
|
|
139
|
+
// range: exact), else by vector propagation through the grid, whose sweeps
|
|
140
|
+
// carry a site through texels at most √2 farther from it than the texel in
|
|
141
|
+
// range (an edge texel's site, within 0.71 of its centre, is always found)
|
|
142
|
+
scratch.fill(Infinity, count, 2 * count);
|
|
143
|
+
const splatReach = Math.max(range, 1);
|
|
144
|
+
const span = 2 * Math.ceil(splatReach + 1) + 1;
|
|
145
|
+
if (siteCount * span * span <= SPLAT_COST_ * count) {
|
|
146
|
+
REACH_[0] = splatReach;
|
|
147
|
+
REACH_[1] = splatReach * splatReach;
|
|
148
|
+
splatNearestSites_(scratch, coverage, out, corners, sites, width, height);
|
|
109
149
|
}
|
|
110
|
-
else
|
|
111
|
-
|
|
150
|
+
else {
|
|
151
|
+
// a cell that took a corner holds a copy of its holder's site: only the
|
|
152
|
+
// holder is a site
|
|
153
|
+
for (let cell = 0; cell < count; cell += 1) {
|
|
154
|
+
scratch[cell] =
|
|
155
|
+
isSiteCell_(coverage, cell, width, count) &&
|
|
156
|
+
siteSegmentCount_(scratch, sites, width, cell) > 0 &&
|
|
157
|
+
(!isCorner_(scratch, sites, cell) || scratch[cell] === cell)
|
|
158
|
+
? cell
|
|
159
|
+
: -1;
|
|
160
|
+
}
|
|
161
|
+
REACH_[0] = range + 2;
|
|
162
|
+
REACH_[1] = (range + 2) * (range + 2);
|
|
163
|
+
propagateNearestSites_(scratch, out, sites, width, height);
|
|
112
164
|
}
|
|
113
|
-
|
|
114
|
-
|
|
165
|
+
// out holds 32-bit floats: the cap is the largest one not above range, so
|
|
166
|
+
// that no magnitude passes the range and none overflows to infinity
|
|
167
|
+
CAP_[0] = range;
|
|
168
|
+
if (CAP_[0] > range) {
|
|
169
|
+
// the 32-bit float below: cap · (1 − 2⁻²⁴) is exact and rounds to it,
|
|
170
|
+
// but below the normal range, where the step is 2⁻¹⁴⁹, and past the
|
|
171
|
+
// largest float; stored through CAP_, whose 32-bit rounding is
|
|
172
|
+
// Math.fround's, so that the cap stays a double the engine never boxes
|
|
173
|
+
const above = CAP_[0];
|
|
174
|
+
CAP_[0] = above * (1 - 2 ** -24);
|
|
175
|
+
if (above === Infinity) {
|
|
176
|
+
CAP_[0] = 3.4028234663852886e38;
|
|
177
|
+
}
|
|
178
|
+
else if (CAP_[0] === above) {
|
|
179
|
+
CAP_[0] = above - 2 ** -149;
|
|
180
|
+
}
|
|
115
181
|
}
|
|
116
|
-
|
|
117
|
-
|
|
182
|
+
const cap = CAP_[0];
|
|
183
|
+
const rangeSquared = range * range;
|
|
184
|
+
for (let cell = 0; cell < count; cell += 1) {
|
|
185
|
+
const value = coverage[cell];
|
|
186
|
+
const distanceSquared = scratch[count + cell];
|
|
187
|
+
// the side first, then the magnitude clamped, so that clamping never
|
|
188
|
+
// turns a texel the corner geometry puts inside to the outside
|
|
189
|
+
let side = value >= 128 ? -1 : 1;
|
|
190
|
+
if (value !== 0 && value !== 255) {
|
|
191
|
+
// an edge texel's centre may be inside with less than half its
|
|
192
|
+
// area (near a sharp corner, or on a stripe thinner than a
|
|
193
|
+
// texel): a corner it holds, or one nearest to it, else a stripe
|
|
194
|
+
// it holds, decides by its geometry
|
|
195
|
+
let site = scratch[cell];
|
|
196
|
+
if (isCorner_(scratch, sites, cell)) {
|
|
197
|
+
site = cell;
|
|
198
|
+
}
|
|
199
|
+
let decided = 0;
|
|
200
|
+
let holder = -1;
|
|
201
|
+
if (site >= 0 && isCorner_(scratch, sites, site)) {
|
|
202
|
+
holder = site;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// a stripe's own site: an edge's format, its kind set
|
|
206
|
+
const own = sites + COVERAGE_STRIDE_ * cell;
|
|
207
|
+
const fourth = scratch[own + 3];
|
|
208
|
+
const first = scratch[own];
|
|
209
|
+
if (fourth !== fourth && first === first && scratch[own + 4] !== 0) {
|
|
210
|
+
holder = cell;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (holder >= 0) {
|
|
214
|
+
// integer arithmetic: a floating-point remainder is a library call
|
|
215
|
+
const y = (cell / width) | 0;
|
|
216
|
+
decided = coverageSiteSide_(scratch, sites, width, holder, cell - y * width, y);
|
|
217
|
+
}
|
|
218
|
+
if (decided !== 0) {
|
|
219
|
+
side = decided;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
let magnitude = cap;
|
|
223
|
+
if (distanceSquared < rangeSquared) {
|
|
224
|
+
const distance = Math.sqrt(distanceSquared);
|
|
225
|
+
if (distance < cap) {
|
|
226
|
+
magnitude = distance;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
out[cell] = side * magnitude;
|
|
118
230
|
}
|
|
119
|
-
|
|
120
|
-
splat_(x + outwardX * offset, y + outwardY * offset, outwardX, outwardY, 0.5 / a, width, height, reach, out);
|
|
231
|
+
return out;
|
|
121
232
|
}
|
|
122
233
|
/**
|
|
123
|
-
*
|
|
124
|
-
* through
|
|
125
|
-
*
|
|
234
|
+
* Where measuring from each site the texels within reach of it stops being
|
|
235
|
+
* cheaper than propagating through the grid: sites times squared texels of
|
|
236
|
+
* reach, per texel of the grid (measured on glyphs from 64² to 512²: the
|
|
237
|
+
* measuring wins up to a range of about 64 on a 512² glyph).
|
|
238
|
+
*/
|
|
239
|
+
const SPLAT_COST_ = 100;
|
|
240
|
+
/**
|
|
241
|
+
* The cap of the field's magnitudes, as a 32-bit float: storing into it rounds
|
|
242
|
+
* as `Math.fround` does, and reading it back gives a double the engine keeps
|
|
243
|
+
* unboxed.
|
|
244
|
+
*/
|
|
245
|
+
const CAP_ = new Float32Array(1);
|
|
246
|
+
/**
|
|
247
|
+
* Writes the site geometry of every contour cell of the coverage grid (see
|
|
248
|
+
* {@link COVERAGE_STRIDE_}), each antialiased texel's straight-edge residual
|
|
249
|
+
* into `residuals`, and labels each contour cell unassigned (`-1`) in
|
|
250
|
+
* `scratch[cell]`; the other cells are left as they are. Returns how many
|
|
251
|
+
* contour cells there are.
|
|
126
252
|
*/
|
|
127
|
-
function
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
253
|
+
function locateContour_(scratch, residuals, coverage, width, height) {
|
|
254
|
+
const sites = 2 * width * height;
|
|
255
|
+
let siteCount = 0;
|
|
256
|
+
for (let y = 0; y < height; y += 1) {
|
|
257
|
+
for (let x = 0; x < width; x += 1) {
|
|
258
|
+
const cell = y * width + x;
|
|
259
|
+
const value = coverage[cell];
|
|
260
|
+
const at = sites + COVERAGE_STRIDE_ * cell;
|
|
261
|
+
if (value === 0 || value === 255) {
|
|
262
|
+
const opposite = 255 - value;
|
|
263
|
+
const right = x + 1 < width && coverage[cell + 1] === opposite;
|
|
264
|
+
const down = y + 1 < height && coverage[cell + width] === opposite;
|
|
265
|
+
if (!right && !down) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
// the flag's sign is the direction of the outward normal
|
|
269
|
+
const outward = value === 255 ? 1 : -1;
|
|
270
|
+
scratch[at] = Number.NaN;
|
|
271
|
+
scratch[at + 1] = right ? outward : 0;
|
|
272
|
+
scratch[at + 2] = down ? outward : 0;
|
|
273
|
+
scratch[at + 3] = Number.NaN;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
locateEdge_(scratch, at, coverage, value, x, y, width, height);
|
|
277
|
+
edgeResidual_(scratch, at, coverage, x, y, width, height, residuals, cell);
|
|
141
278
|
}
|
|
279
|
+
scratch[cell] = -1;
|
|
280
|
+
siteCount += 1;
|
|
142
281
|
}
|
|
143
282
|
}
|
|
283
|
+
return siteCount;
|
|
144
284
|
}
|
|
145
285
|
//# 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,
|
|
1
|
+
{"version":3,"file":"signed-distance-from-coverage2.js","sourceRoot":"","sources":["../src/signed-distance-from-coverage2.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,cAAc,EACd,sBAAsB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,aAAa,EACb,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,EACN,iBAAiB,EACjB,kBAAkB,GAClB,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH,MAAM,UAAU,2BAA2B,CAC1C,GAAiB,EACjB,QAAoB,EACpB,KAAa,EACb,MAAc,EACd,KAAa,EACb,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,wEAAwE;IACxE,mBAAmB;IACnB,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,UAAU,CACnB,0CAA0C,aAAa,CAAC,KAAK,CAAC,EAAE,CAChE,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,K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AG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACP,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC/D,aAAa,CACZ,OAAO,EACP,EAAE,EACF,QAAQ,EACR,CAAC,EACD,CAAC,EACD,KAAK,EACL,MAAM,EACN,SAAS,EACT,IAAI,CACJ,CAAC;YACH,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACnB,SAAS,IAAI,CAAC,CAAC;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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
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
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
|
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,IA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;QACD,IAAI,IAAI,CAAC,CAAC;QACV,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/math-grid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Discrete two-dimensional integer lattices: grid coordinates, storage strategies, and packing and tiling algorithms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"2d",
|
|
@@ -45,14 +45,15 @@
|
|
|
45
45
|
"prepack": "yarn build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ac-kit/algo": "^0.
|
|
49
|
-
"@ac-kit/core": "^0.
|
|
50
|
-
"@ac-kit/math-geometry": "^0.
|
|
51
|
-
"@ac-kit/math-linear": "^0.
|
|
48
|
+
"@ac-kit/algo": "^0.6.0",
|
|
49
|
+
"@ac-kit/core": "^0.13.0",
|
|
50
|
+
"@ac-kit/math-geometry": "^0.4.0",
|
|
51
|
+
"@ac-kit/math-linear": "^0.4.0",
|
|
52
52
|
"@types/web": "^0.0.367"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@ac-kit/math-random": "0.4.
|
|
55
|
+
"@ac-kit/math-random": "0.4.1",
|
|
56
|
+
"@ac-kit/test-util": "0.5.0",
|
|
56
57
|
"@ac-kit/tsconfig": "0.1.0",
|
|
57
58
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
58
59
|
"@ac-kit/vitest-config": "0.2.0",
|