mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
Find all the overlaps between polygons when removing them
Overlap removal could miss overlapping polygons in three ways: - An overlap can be bounded entirely by vertices that both polygons share (for example, a half-pixel triangle cut off one block's square by another block's diagonal), so no vertex is strictly inside the other polygon. But the overlap is then bounded by an edge of one polygon that isn't on the other's boundary, so the edge's midpoint is strictly inside the other. So test the midpoints of edges as well as the vertices, in doubled coordinates so the test stays exact. - A polygon whose edges weren't snapped to the layer's hot pixels (an outline replacing a collapsed polygon, or one with spindle strips) can run along another polygon's border without having vertices where the other does, so neither the shared-edge test nor the vertex and midpoint tests see the overlap. So first split each polygon's edges exactly wherever another polygon's vertex lies on them, which doesn't change any shape. Polygons whose overlaps aren't removed are left as they were. - Where spindle strips made two polygons' edges cross, the difference has to snap the crossing to tile coordinates, which can leave a smaller overlap. So repeat overlap removal until nothing changes, at most 4 times. For Dane County Census blocks at -D8 -d8 -pt -pn, there are now no points covered by more than one polygon at any zoom level (sampled at four points per pixel), with -z8 and with -zg up to z12, and no self-intersecting polygons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
+1
-1
@@ -64,6 +64,6 @@ drawvec clean_polygon_with_hot_pixels(drawvec const &geom, hot_pixel_list const
|
||||
// from all but the first of the polygons that cover it. Returns how many
|
||||
// polygons were changed.
|
||||
// `hot` is the hot pixels of the layer, from layer_hot_pixels(), if any.
|
||||
size_t remove_overlaps(std::vector<drawvec *> const &geoms, hot_pixel_list const *hot);
|
||||
size_t remove_overlaps(std::vector<drawvec *> const &geoms_in, hot_pixel_list const *hot);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user