From 4626f83e5ddd5c76c1244df5b2f029c1fafc5ee1 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:46:25 -0400 Subject: [PATCH] Tests: a sketch curve splits a cylinder's one side face in two, not a half side SMLib's cylinder side is one face round the whole turn (truck's two halves): a line at z = 5 splits it into a quarter and three quarters of 2 pi 10 x 20, two side faces, not three. (The test still fails further on, at the face-split tool's "invalid argument", engine-builds' cause fixed on their branch in 50356dbf2.) Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/splitface.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/kernel/src/splitface.rs b/crates/kernel/src/splitface.rs index f39dc005f..934ded035 100644 --- a/crates/kernel/src/splitface.rs +++ b/crates/kernel/src/splitface.rs @@ -656,12 +656,13 @@ mod tests { let m = measure(&s).unwrap(); // (Measured on meshes: curved faces agree to about 1e-4.) assert!(rel(m.volume, m0.volume) < 2e-4 && rel(m.area, m0.area) < 2e-4, "{} {} {} {}", m.volume, m0.volume, m.area, m0.area); - // The half side face splits at z = 5: a quarter and three quarters of its area. + // The side (one face round the whole turn) splits at z = 5: a quarter and three quarters + // of its area. let mut sides: Vec = s.faces(0.01).unwrap().iter().filter(|f| f.plane_normal.is_none()).map(|f| f.area).collect(); sides.sort_by(f64::total_cmp); - let half = std::f64::consts::PI * 10.0 * 20.0; - assert_eq!(sides.len(), 3); - assert!(rel(sides[0], half / 4.0) < 1e-3 && rel(sides[1], half * 0.75) < 1e-3 && rel(sides[2], half) < 1e-3, "{sides:?}"); + let whole = std::f64::consts::TAU * 10.0 * 20.0; + assert_eq!(sides.len(), 2); + assert!(rel(sides[0], whole / 4.0) < 1e-3 && rel(sides[1], whole * 0.75) < 1e-3, "{sides:?}"); assert!(s.face_count() > c.face_count()); // A smaller cylinder's side splits the top in a ring and a disc. let pin = cylinder(Vec3::ZERO, Vec3::Z, 4.0, 40.0).unwrap();