Kernel: a half turn's caps keep their roles when its end plane is its start plane

efd0a577b kept the cap flatness tolerance under a quarter of the gap between parallel start
and end planes. A half turn's end plane is its start plane: the gap is 0, the tolerance became
0 and neither cap was found, so m0-revolve-primitives' two flat ends could keep no sketch
attachment (design_corpus every_flat_face_of_every_corpus_design_takes_an_attached_sketch).
Only planes apart by more than rounding bound the tolerance; coinciding ones are told apart by
the profile's edges, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 00:53:12 -04:00
committed by Irakli Kourtis
parent db9cf693a5
commit de16a6b99a
+7 -2
View File
@@ -275,8 +275,13 @@ mod imp {
// A cap's points lie on its plane to the evaluation's precision. Sized to the body, the
// flatness tolerance can exceed the gap between parallel start and end planes (a box
// 0.1 µm thick in a 14 mm body), which would put each cap in both: it stays under a
// quarter of that gap.
let gap = end.filter(|e| e.normal().cross(start.normal()).len() < 1e-9).map_or(f64::INFINITY, |e| start.height(e.origin).abs());
// quarter of that gap. Planes that coincide (the ends of a half turn) are told apart by
// the profile's edges instead.
let gap = end
.filter(|e| e.normal().cross(start.normal()).len() < 1e-9)
.map(|e| start.height(e.origin).abs())
.filter(|g| *g > size * 1e-9)
.unwrap_or(f64::INFINITY);
let flat_tol = (size * 1e-5 + 1e-9).min(0.25 * gap);
let near = 3.0 * mesh_tol + flat_tol;
let flat = |f: usize, pl: &Plane| {