Only skip corner-touching hot pixels for edges without intersections

The previous change, which stopped wagyu from snapping an edge to a hot
pixel whose corner it only touches, made two of upstream wagyu's 3320
geometry fixtures produce spikes. When an intersection lies exactly on a
pixel corner, it is rounded to that pixel, and the edges that intersect
there must be snapped to it; and once an edge has been snapped to one hot
pixel, its new segments may pass through the interior of another hot pixel
whose corner the original edge only touched.

So now the inward rounding of the hot pixel range only applies to an edge
that intersects no other edge (which is recorded while the hot pixels are
built), and never to a hot pixel that is the rounded location of an
intersection (which are now kept in a separate sorted list). Edges that are
part of intersections are snapped exactly as before. With this, upstream
wagyu's unit tests and all 3320 of its geometry fixtures pass, and the
narrow diagonal Census block in Dane County is still preserved.

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 22:27:53 +00:00
parent 1b17becfa3
commit 5b35e5dacf
11 changed files with 102 additions and 43 deletions
+9 -3
View File
@@ -30,7 +30,9 @@ struct hp_intersection_swap {
throw std::runtime_error("Trying to find intersection of lines that do not intersect");
// LCOV_EXCL_END
}
add_to_hot_pixels(round_point<T>(pt), manager);
b1->current_edge->intersected = true;
b2->current_edge->intersected = true;
add_intersection_to_hot_pixels(round_point<T>(pt), manager);
}
};
@@ -60,7 +62,9 @@ bool horizontals_at_top_scanbeam(T top_y,
if (*bnd_next != nullptr && (*bnd_next)->current_edge->top.y != top_y &&
(*bnd_next)->current_edge->bot.y != top_y) {
mapbox::geometry::point<T> pt(wround<T>((*bnd_next)->current_x), top_y);
add_to_hot_pixels(pt, manager);
(*bnd_next)->current_edge->intersected = true;
current_edge->intersected = true;
add_intersection_to_hot_pixels(pt, manager);
}
std::iter_swap(bnd_curr, bnd_next);
++bnd_curr;
@@ -76,7 +80,9 @@ bool horizontals_at_top_scanbeam(T top_y,
if (*bnd_prev != nullptr && (*bnd_prev)->current_edge->top.y != top_y &&
(*bnd_prev)->current_edge->bot.y != top_y) {
mapbox::geometry::point<T> pt(wround<T>((*bnd_prev)->current_x), top_y);
add_to_hot_pixels(pt, manager);
(*bnd_prev)->current_edge->intersected = true;
current_edge->intersected = true;
add_intersection_to_hot_pixels(pt, manager);
}
std::iter_swap(bnd_curr, bnd_prev);
--bnd_curr;