Tests: the helical groove's removed volume from the cut's exact volume, not a 0.01 mm mesh's

faceted_cut_of_a_helical_groove took the volume removed as the shaft's exact volume less the cut
body's mesh volume at a 0.01 mm chord. That mesh sags inside the shaft's round wall: the uncut
shaft's own mesh at 0.01 is 0.18 mm³ short of pi r^2 h, five times the 3 % the groove is held
to, so the groove read 1.326 where the screw integral gives 1.2214 (the section's 2 pi int r dA
over 4 turns plus the ramp at z = 0). The cut is a B-rep: its exact volume (measure) gives the
removed volume within the 3 %.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-29 01:02:38 -04:00
committed by Irakli Kourtis
parent 39e1dcea03
commit 6a780de5fd
+3 -1
View File
@@ -18,7 +18,9 @@ fn faceted_cut_of_a_helical_groove() {
let section = [Vec2::new(1.2, -0.06), Vec2::new(1.6, -0.06), Vec2::new(1.6, 0.06), Vec2::new(1.2, 0.06)];
let groove = sweep_helix_mesh(&plane, &section, base, k, p, 5.0, 48).unwrap();
let cut = faceted_boolean(&shaft, &groove, BoolOp::Cut, 1e-3).unwrap().unwrap();
let m = cut.mesh(&crate::MeshTolerance::chord(0.01)).unwrap().measure();
// The cut's own volume (SMLib's, of its exact faces): a mesh's at 0.01 mm sags inside the
// shaft's round wall by 0.18 mm³, five times the 3 % the groove is held to.
let m = crate::measure(&cut).unwrap();
// In the shaft from z = 0: the section (r 1.2…1.5, 0.12 tall) for 4 turns, plus the part of
// the first turn's section above z = 0 (its z range is ±0.06 about the turn's height).
let per_turn = 2.0 * PI * 0.12 * (1.5f64.powi(2) - 1.2f64.powi(2)) / 2.0;