mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
Treat hot pixels as half-open when snapping to a layer's common set
With consistent snapping, edges are snapped to every hot pixel they touch, including those whose corners they only touch. But with closed pixels, an edge passing diagonally through a lattice point touches the corners of the two pixels beside it as well, and is snapped into a zigzag through all four. Two edges from different polygons that cross at a pixel corner zigzag through the same pixels in different orders, and the zigzags cross each other. (In Dane County tile 10/258/376, this left a quarter-pixel gap and a quarter-pixel overlap between two blocks on either side of a sliver.) Hobby's snap rounding, whose guarantee that snapped edges don't cross is what makes snapping to a common set of hot pixels work, uses half-open pixels, [x - 0.5, x + 0.5) by [y - 0.5, y + 0.5), consistent with rounding halves up, which is how wagyu rounds intersection points. So when snapping to a common set of hot pixels, find the range of pixels an edge passes through in each row that way, so that a point on a pixel boundary belongs to only one pixel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
@@ -162,7 +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
|
||||
// Snapping to a common set of hot pixels shared with other geometries:
|
||||
// treat pixels as half-open, and don't skip any corner touches that remain
|
||||
bool snap_all_corners = false;
|
||||
hot_pixel_itr<T> current_hp_itr;
|
||||
std::deque<point<T>> points;
|
||||
|
||||
Reference in New Issue
Block a user