Booleans: planar cuts beside rounds take the exact route before the retries (#1197) (#1445)

Planar cuts beside rounds take the exact route before the boolean retries (#1197).
This commit is contained in:
Erikas authored and GitHub committed 2026-10-15 13:31:41 -04:00
1 parent 56747edb46
commit 17b48d9e7e
4 files changed
+153 -3

No files matched your search

+13
View File
@@ -733,6 +733,19 @@ fn boolean_whole(a: &Body, b: &Body, op: BoolOp) -> Result<Option<Body>> {
None
};
for (attempt, j) in JITTER.iter().enumerate() {
// The operands as they lie failed. A planar tool beside the target's curved faces (a tooth
// or a pocket cut next to a round edge) is decided exactly in the slab it lies in, where
// the target is planar too, before the shifted tries: that is where they end anyway, as a
// retry, after costing several times as much (on every copy of a pattern, #1197).
if attempt == 1 && matches!(op, BoolOp::Cut | BoolOp::Intersect) {
let (sliced, diagnostics) = capture_boolean_diagnostics(|| crate::polybool::sliced_planar_boolean(a, b, op));
if let Some(Ok(Some(body))) = sliced
&& check(&body).0
{
merge(diagnostics);
return Ok(Some(body));
}
}
let shift = mt::Vector3::new(j[0], j[1], j[2]) * (size * 0.01);
for k in [2e-3, 5e-4] {
let tol = (size * k).max(1e-5);