With -pn, let neighbors close over polygons that collapse entirely

A polygon that collapses away entirely is replaced by its outline, but with
--no-simplification-of-shared-nodes that outline overlaps the neighboring
features along every shared border, and those features already cover the
space. So leave the shared borders out of the outline, as the spindle strips
already do, and if every border is shared, leave the polygon out entirely
instead of falling back to a rectangle.

For Dane County Census blocks at -D8 -d8 -pt -pn, this reduces the
overlapping pixels in tile 12/1031/1503 from 141 to 11 and in 11/515/751
from 915 to 38, and the number of revived rectangles at z8 from 6307 to
1414, at the cost of a few more one-pixel gaps (7 to 10 and 14 to 23) where
a block of less than a pixel is left out and its neighbors' borders don't
round to the same line.

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-11-30 23:03:40 +00:00
parent 34e1f56bdd
commit 4f64526ab4
4 changed files with 43 additions and 8 deletions
+3 -1
View File
@@ -674,7 +674,9 @@ TEST_CASE("A polygon that collapses entirely can be replaced by its outline", "[
to_tile_scale(scaled, z, detail);
REQUIRE(clean_or_clip_poly(scaled, 0, 0, false, true).size() == 0);
drawvec outline = union_polygon_strips(drawvec(), outline_strips(geom, z, detail));
bool all_shared;
drawvec outline = union_polygon_strips(drawvec(), outline_strips(geom, z, detail, 1, 0, 0, &all_shared));
REQUIRE(!all_shared);
double area = get_mp_area(outline);
// About a pixel wide along both arms, rather than a square