mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 18:45:55 +00:00
Tests: a blend refused as too large is SMLib's NO_ROOM, in its own words
Since bcbb99005 a blend larger than its faces is SMLib's refusal (KernelError::TooLarge,
"the fillet is larger than the faces beside its edges allow"); truck's room check, whose
words these tests still matched, went with blend_fit. The refusals themselves stand:
- fillet_consuming_a_side_face_makes_a_full_round: R3.001 and R3.5 on the 14 x 6 x 10
box's four vertical edges, past the full round, are refused as too large (no longer
"larger than the neighbouring faces"); the body unchanged is its own volume before
(SMLib's measure of the box is 839.9999999999998, not 840 bit for bit).
- a_chamfer_that_would_grow_the_part_on_a_convex_edge_is_refused: refused as too large;
the word "convex" was the old check's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,13 +27,14 @@ fn block_with_ball_cut() -> Body {
|
||||
|
||||
/// The ball's rim on the back face dips to 0.04 mm above the bottom: a 0.5 mm chamfer of it
|
||||
/// would run off the back face, and what was built grew the part (by 0.65 mm³, more with other
|
||||
/// edge orders). On a convex edge a chamfer takes material away, so it is refused.
|
||||
/// edge orders). On a convex edge a chamfer takes material away, so it is refused, as too large
|
||||
/// (SMLib's NO_ROOM).
|
||||
#[test]
|
||||
fn a_chamfer_that_would_grow_the_part_on_a_convex_edge_is_refused() {
|
||||
let body = block_with_ball_cut();
|
||||
let rim = Vec3::new(3.1526309873924174, 22.5, 0.04277569594852188);
|
||||
let e = chamfer(&body, &[rim], 0.5).expect_err("refused");
|
||||
assert!(matches!(e, KernelError::TooLarge(_)) && e.to_string().contains("convex"), "{e}");
|
||||
assert!(matches!(e, KernelError::TooLarge(_)), "{e}");
|
||||
}
|
||||
|
||||
/// Curved convex edges that a chamfer does take material from still build: a hole's rim in a
|
||||
|
||||
@@ -322,6 +322,7 @@ fn loop_fillet_as_tall_as_its_wall_consumes_it() {
|
||||
fn fillet_consuming_a_side_face_makes_a_full_round() {
|
||||
// 14 x 6 x 10: r = 3 on the four vertical edges uses up both 6 mm end faces (#199).
|
||||
let b = box_solid(Vec3::new(14.0, 0.0, 0.0), Vec3::new(28.0, 6.0, 10.0)).unwrap();
|
||||
let before = measure(&b).unwrap().volume;
|
||||
let mids = [Vec3::new(14.0, 0.0, 5.0), Vec3::new(28.0, 0.0, 5.0), Vec3::new(14.0, 6.0, 5.0), Vec3::new(28.0, 6.0, 5.0)];
|
||||
let full = 840.0 - (4.0 - PI) * 9.0 * 10.0;
|
||||
for order in [mids.to_vec(), mids.iter().rev().copied().collect()] {
|
||||
@@ -343,12 +344,13 @@ fn fillet_consuming_a_side_face_makes_a_full_round() {
|
||||
let c = fillet(&post, &corners, 3.0).unwrap();
|
||||
assert!(rel(measure(&c).unwrap().volume, PI * 9.0 * 10.0) < 2e-4, "{}", measure(&c).unwrap().volume);
|
||||
assert!(c.validity().is_empty());
|
||||
// Past the limit there is no face left to consume: still refused, the body unchanged.
|
||||
// Past the limit the two rounds on each 6 mm end would cross: still refused as too large
|
||||
// (SMLib's NO_ROOM), the body unchanged.
|
||||
for r in [3.0 + 1e-3, 3.5] {
|
||||
let e = fillet(&b, &mids, r).unwrap_err();
|
||||
assert!(e.to_string().contains("larger than the neighbouring faces"), "{r}: {e}");
|
||||
assert!(matches!(e, KernelError::TooLarge(_)), "{r}: {e}");
|
||||
}
|
||||
assert_eq!(measure(&b).unwrap().volume, 840.0);
|
||||
assert_eq!(measure(&b).unwrap().volume, before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user