mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
With -pn, snap-round each layer's polygons consistently with each other
Wagyu snaps each edge to every "hot pixel" (vertex or rounded intersection) that it passes through. Each polygon was cleaned on its own, with only its own hot pixels, so a border shared by two polygons could be bent through a hot pixel in one of them and not in the other, leaving a shard gap or overlap between them even though --no-simplification-of-shared-nodes had simplified and rounded the border identically in both. (In Dane County tile 11/515/751, rounding moved one of a block's own vertices across its border with a sliver, and cleaning bent the block's copy of the border through a hot pixel that the sliver's copy didn't have.) Wagyu now has hot_pixels(), which returns the hot pixels of the rings added to it, and add_hot_pixels(), which gives execute() more hot pixels to snap to. When extra hot pixels are given, edges are snapped to every hot pixel they touch, including corner touches, so that whether a shared edge is snapped to a hot pixel can't depend on which polygon it is in. With -pn, the simplification worker now runs in two passes. The first simplifies and rounds every feature in the tile. Then the hot pixels of all the polygons in each layer are found together, which also finds crossings between features that no single feature would see. The second pass cleans each polygon with the layer's hot pixels near it as well as its own, so the borders it shares are snapped identically in each polygon. This is snap rounding of the whole layer's arrangement at once, so the result is still free of crossings. For Dane County Census blocks at -D8 -d8 -pt -pn, tiles 12/1031/1503 and 11/515/751 now have no gaps between blocks (from 10 and 23 pixels), and the gaps and overlaps at z9 and z10 go from 55/113 and 155/175 to 13/56 and 23/59 pixels, with no self-intersecting polygons. Natural Earth 10m countries at -z8 -pn take about 7% longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -162,6 +162,8 @@ struct ring_manager {
|
||||
// The hot pixels that are the rounded locations of intersections, sorted,
|
||||
// which edges must be snapped to even if they only touch their corners
|
||||
hot_pixel_vector<T> intersection_hot_pixels;
|
||||
// Snap edges to every hot pixel they touch, even ones whose corners they only touch
|
||||
bool snap_all_corners = false;
|
||||
hot_pixel_itr<T> current_hp_itr;
|
||||
std::deque<point<T>> points;
|
||||
std::deque<ring<T>> rings;
|
||||
|
||||
Reference in New Issue
Block a user