Tests: a loft cut whose top is the basin's whole outline leaves the walls above as their own body

loft_cut_through_a_shelled_basin_in_either_order asserted one body. The loft's top section is
the basin's full 100 x 60 outline at z = 10, so the cut takes the walls' whole cross-section
there and leaves the walls above (z 10 to 30) touching the rest only along their outer rim, an
edge: two pieces, which a cut makes two bodies (eval's lumps rule). SMLib gives exactly that;
truck kept them as one. The test now expects two bodies, the upper one the walls' exact
924 mm² ring times 20 = 18480 mm³, and the total as before (41582.028).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 01:30:09 -04:00
committed by Irakli Kourtis
parent 23bfa1cf73
commit 0e3f01ec01
+8 -1
View File
@@ -968,7 +968,14 @@ fn loft_cut_through_a_shelled_basin_in_either_order() {
assert!(r.is_ok(), "{pad:?} reverse {reverse}: {r:?}");
let v = volume(&mut s);
assert!((v - want).abs() < 1.0, "{pad:?} reverse {reverse}: {v} vs {want}");
assert_eq!(measure(&mut s)["body_count"], 1);
// The loft's top section is the basin's whole outline at z = 10, so the cut leaves the
// walls above it touching the rest only along their outer rim: two bodies, as a cut's
// pieces are (18480 mm³ of walls from z = 10 to 30, and the floor part below).
let m = measure(&mut s);
assert_eq!(m["body_count"], 2, "{m}");
let upper =
m["bodies"].as_array().unwrap().iter().find(|b| b["bbox"]["min"][2].as_f64().is_some_and(|z| (z - 10.0).abs() < 1e-9)).unwrap();
assert!((upper["volume_mm3"].as_f64().unwrap() - 18480.0).abs() < 1e-6, "{upper}");
}
}
// As a new body and joined: a valid solid of positive volume either way.