With -pn, union spindle strips in the same pass that cleans each polygon

With consistent snapping, each polygon was cleaned with the layer's hot
pixels, but then its spindle strips (if it had any) were unioned with it
in a separate pass, which snapped the whole polygon to tile coordinates a
second time. Snapping already-snapped geometry doesn't necessarily leave it
the same, and the neighbors it shares borders with weren't snapped again to
match. In Dane County tile 12/1027/1502, a narrow water channel's strips
were added where it crossed the edge of the tile's buffer, and that second
pass bent its border with the block next to it, far from the strips,
through the hot pixel at (11, 249), so their edges crossed and overlapped.

So include the rounded strips of every polygon in the layer's hot pixels,
and union each polygon with its strips (with the non-zero fill rule, as
before) in the same wagyu pass that cleans it, so that every polygon is
snapped exactly once, consistently with its neighbors, including where
strips meet other polygons.

For Dane County Census blocks at -D8 -d8 -pt -pn -zg, this reduces the
number of polygons whose overlaps have to be removed afterwards from 2732 to
2482, and the number that are still changing after 4 rounds of overlap
removal from 156 to 14, with still no points covered by more than one
polygon at z8 to z12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
Claude
2026-12-01 03:29:02 +00:00
parent c7f45ee81d
commit 91a3ff99f8
7 changed files with 82 additions and 62 deletions
+2 -2
View File
@@ -664,9 +664,9 @@ hot_pixel_list layer_hot_pixels(std::vector<drawvec const *> const &geoms) {
return out;
}
drawvec clean_polygon_with_hot_pixels(drawvec const &geom, hot_pixel_list const &hot, bool *ok) {
drawvec clean_polygon_with_hot_pixels(drawvec const &geom, drawvec const &strips, hot_pixel_list const &hot, bool *ok) {
drawvec out;
*ok = wagyu_union(geom, NULL, 1, out, false, &hot);
*ok = wagyu_union(geom, strips.size() > 0 ? &strips : NULL, 1, out, false, &hot);
return out;
}