Issue 616 test: the lid's volume is its closed form, 6703.5344

The expected 6703.5222 was a mesh measure (truck). The lid exactly: the 76.8 x 89.3 x 2.4
plate less its four 3 mm corner rounds ((76.8 * 89.3 - 36 (1 - pi/4)) * 2.4 = 16441.2344), the
skirt ring ((71.5 * 84 - 68.5 * 81) * 3 = 1372.5), less the window (68 * 61 * 2.4 = 9955.2) and
the slot (44 * 10 * 2.4 = 1056) through the plate, and the notch through the skirt's 1.5 mm wall
(22 * 1.5 * 3 = 99): 6703.534401. The window and slot lie inside the ring's opening and the
notch above the plate, so nothing else overlaps. SMLib measures 6703.534401575, 2.6e-7 off.
The test now computes that closed form and holds the body to 1e-6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 22:10:22 -04:00
committed by Irakli Kourtis
parent a100c7c063
commit e5476706b1
+6 -1
View File
@@ -72,7 +72,12 @@ fn assert_local(target: &Body, tool: &Body, joined: &Body, what: &str) {
#[test]
fn ribs_joined_flush_to_the_lid_change_nothing_else() {
let mut b = lid();
assert!((volume(&b) - 6703.5222).abs() < 1e-3, "{}", volume(&b));
// The plate less its four 3 mm corner rounds, the skirt ring, less the window and the slot
// through the plate and the notch through the skirt's wall (1.5 thick, 3 high, 22 long).
let plate = (76.8 * 89.3 - 4.0 * 9.0 * (1.0 - std::f64::consts::FRAC_PI_4)) * 2.4;
let ring = (71.5 * 84.0 - 68.5 * 81.0) * 3.0;
let want = plate + ring - 68.0 * 61.0 * 2.4 - 44.0 * 10.0 * 2.4 - 22.0 * 1.5 * 3.0;
assert!((volume(&b) - want).abs() < 1e-6, "{} vs {want}", volume(&b));
for c in [[102.8, 14., 2.4], [102.8, 48., 2.4], [172.4, 14., 2.4], [172.4, 48., 2.4]] {
let tool = bx(c, [1.6, 6., 11.7]);
let r = boolean(&b, &tool, BoolOp::Union).unwrap().unwrap();