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
+6 -3
View File
@@ -31,9 +31,12 @@ drawvec thin_polygon_strips(drawvec const &geom, int z, int detail, double simpl
double unshared_perimeter(drawvec const &geom, size_t i, size_t j, long long ox, long long oy);
// Strips (in tile coordinates) one pixel wide along every edge of a polygon
// (in world coordinates), which together trace its outline. This is used to
// stand in for a polygon that has collapsed away to nothing entirely.
drawvec outline_strips(drawvec const &geom, int z, int detail);
// (in world coordinates relative to a tile origin at (ox, oy)), which together
// trace its outline. This is used to stand in for a polygon that has collapsed
// away to nothing entirely. Edges shared with other features (with
// --no-simplification-of-shared-nodes) are left out, since those features
// already cover the space, and *all_shared is set if every edge was shared.
drawvec outline_strips(drawvec const &geom, int z, int detail, double simplification, long long ox, long long oy, bool *all_shared);
// Union the strips from thin_polygon_strips() with a cleaned polygon
// (both in tile coordinates)