Through-all holes beside walls: a long thin tool keeps its outside out (#629)
Body::new no longer turns a long thin solid (a through-all hole's tool) inside out on the strength of a coarse mesh volume: it checks again on a fine mesh first. 79 more face.hole actions pass in the action matrix; the remaining no-result cuts stay under #559. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d58e3b9f9
commit
bb60a95289
4 files changed
+115
-87
No files matched your search
@@ -303,3 +303,19 @@ fn grouping_lumps_does_not_infer_absent_or_misaligned_sources() {
|
||||
let malformed = body.with_face_sources(Some(std::sync::Arc::new(vec![None])));
|
||||
assert!(malformed.lumps().unwrap_err().to_string().contains("face source table"));
|
||||
}
|
||||
|
||||
/// A long thin cylinder (a through hole's tool) far from the origin, its seam turned: its
|
||||
/// vertices span only its length, so the coarse orientation mesh can give it a negative volume.
|
||||
/// It must still come out outward, or a Cut with it removes the wrong side (#559).
|
||||
#[test]
|
||||
fn a_long_thin_cylinder_comes_out_outward() {
|
||||
use solidcraft_geom::{Loop2, Plane, Region2, Vec2, Vec3};
|
||||
let plane = Plane::from_normal(Vec3::new(0., 24., 30.), Vec3::Z).unwrap();
|
||||
for (lo, seam) in [(-181.0, 0.613), (-100.0, 0.613), (-10.0, 0.613), (-181.0, 0.0)] {
|
||||
let disc = Region2 { outer: Loop2::circle_from(Vec2::ZERO, 0.5, seam), holes: vec![] };
|
||||
let tool = crate::extrude(&plane, &[disc], lo, 0.9).unwrap().pop().unwrap();
|
||||
let volume = tool.tessellate(0.01).unwrap().measure().volume;
|
||||
let want = std::f64::consts::PI * 0.25 * (0.9 - lo);
|
||||
assert!((volume - want).abs() < want * 0.02, "{lo} {seam}: {volume} vs {want}");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user