fix(hatch): stop drawing ghost line between boundary polylines

The polyline arm of the hatch wire outline guarded its NaN separator
with `if count > 0 && pts.len() != start_idx`. `start_idx` was assigned
to `pts.len()` two lines earlier with nothing in between to grow `pts`,
so the inequality was structurally always false — the separator was
never emitted.

When a hatch carried more than one boundary path (multi-region hatch),
the renderer drew a straight segment from the last vertex of path A to
the first vertex of path B because the two polylines lived in `pts`
back-to-back with no NaN break. The result was a visible stray line
between hatch regions.

Switch the polyline arm to the same `if !pts.is_empty()` guard the
Line / CircularArc / EllipticArc arms use, and capture `start_idx`
*after* the separator so the closed-loop close-back logic still points
at this polyline's first real vertex.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-05-26 18:16:40 +03:00
1 parent 89a01a8654
commit a3e9b05130
1 file changed
+13 -4
+13 -4
View File
@@ -352,17 +352,26 @@ impl FallbackTess for Hatch {
// `Vector3.z`; straight segments emit just the
// start vertex, bulged segments tessellate the arc
// between v0 → v1.
let start_idx = pts.len();
let verts = &poly.vertices;
let count = verts.len();
if count == 0 {
continue;
}
// Break the wire between this polyline and whatever
// preceded it — without the separator the renderer
// draws a ghost segment from the previous edge / path
// straight to this polyline's first vertex, which
// shows up as a stray boundary line between hatch
// regions.
if !pts.is_empty() {
pts.push([f32::NAN; 3]);
}
let start_idx = pts.len();
let seg_count = if poly.is_closed {
count
} else {
count.saturating_sub(1)
};
if count > 0 && pts.len() != start_idx {
pts.push([f32::NAN; 3]);
}
for i in 0..seg_count {
let v0 = &verts[i];
let v1 = &verts[(i + 1) % count];