Split Body: a face tool runs over its own surface's parameters

face_patch put the tool face's surface (a cylinder) over the domain of its NURBS form, which
SMLib parameterises otherwise (0..1, not the angle and height), so the patch handed to SMLib
was a sliver of the cylinder or empty and SMLib refused it as an invalid argument
(split_body_by_a_face). The domain is the analytic surface's: a whole turn, unbounded along
the axis, closed past the body as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-28 22:11:05 -04:00
committed by Irakli Kourtis
parent e0545b2bda
commit ae5dc2416c
+3 -2
View File
@@ -154,8 +154,9 @@ fn face_patch(body: &Body, face: usize) -> Result<Patch> {
let record = body.record();
let f = record.faces.get(face).ok_or_else(|| invalid(format!("the tool body has no face {face}")))?;
let forward = body.face_forward(face);
// The surface's own parameter box, unbounded where it is.
let dom = SurfaceEval::new(f.parameters()).map_err(|e| invalid(format!("the split tool's surface: {e}")))?.domain();
// The surface's own parameter box, unbounded where it is: of `surface` itself, not of its
// NURBS form (SMLib's cylinder is held on one, parameterised otherwise).
let dom = SurfaceEval::new(&f.surface).map_err(|e| invalid(format!("the split tool's surface: {e}")))?.domain();
let range = |k: usize| dom.range[k].map_or(ALL, |(a, b)| [a, b]);
Ok(Patch { surface: f.surface.clone(), domain: [range(0), range(1)], flip: !forward })
}