mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-11 11:11:59 +00:00
Sketch profiles: treat pieces shorter than the end join tolerance as a point (#14512)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1483,6 +1483,26 @@ fn island_loops(sk: &Sketch, curves: &[usize], max_edges: usize) -> Island {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A piece no longer than the end join tolerance is a point: its ends become one node. A
|
||||
// split next to where a line touches an arc leaves such pieces, and the hairline faces they
|
||||
// close with the line hide the profile around them (#14512).
|
||||
let mut short: Vec<usize> = (0..nodes.len()).collect();
|
||||
edges.retain(|e| {
|
||||
let length = match e.seg {
|
||||
Seg2::Line { a, b } => a.dist(b),
|
||||
Seg2::Arc { radius, sweep, .. } => radius * sweep.abs(),
|
||||
_ => f64::INFINITY,
|
||||
};
|
||||
if length > ENDPOINT_JOIN_TOL {
|
||||
return true;
|
||||
}
|
||||
union(&mut short, e.u, e.v);
|
||||
false
|
||||
});
|
||||
for e in &mut edges {
|
||||
e.u = find(&mut short, e.u);
|
||||
e.v = find(&mut short, e.v);
|
||||
}
|
||||
let n = nodes.len();
|
||||
// One edge where pieces overlap, then prune dangling edges.
|
||||
let mut alive = without_overlaps(&edges, tol);
|
||||
|
||||
Reference in New Issue
Block a user