Tests: a wall that folds names the largest wall that works, a collapsed offset says why

A thicken of solidcore#2350's parabolic sheet past its apex's radius of curvature is refused
by solidcore's one construction (ShellRefused, Fold, naming 10); the wrapper passed it on as
"solidcore: ..." with no words of its own. A round at the radius of the round it rolls on
beside the 851 part's arc wall is refused as a collapsed offset (NoRoomReason::OffsetCollapses,
solidcore#2431); the message named the size but not why. Both fail until the reasons are
carried through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
jyviko
2026-11-02 20:34:28 -05:00
parent 954e10d6f0
commit a3f06a4f94
2 changed files with 49 additions and 0 deletions
+26
View File
@@ -361,3 +361,29 @@ fn rounds_ending_in_a_sphere_of_any_size_never_panic() {
}
}
}
/// The front's top edge rounded r 2, then the edge between that round and the arc wall (the
/// middle of the arc top edge's tangent chain) at the round's own radius: the ball sits on the
/// round's axis, fixed, and the plane square to the edge at its top end misses that centre, so
/// no round ends there. solidcore refuses it as a collapsed offset (`NoRoomReason::
/// OffsetCollapses`, solidcore#2431), naming 2 less its fit margin; the refusal says why.
#[test]
fn a_ball_as_wide_as_the_round_it_rolls_on_is_refused_saying_why() {
let rounded = fillet(&part(), &[tf()], 2.0).unwrap();
let middle = Vec3::new(41.17486688363082, -20.413218067968561, 9.415188112149071);
let why = match fillet(&rounded, &[middle], 2.0) {
Err(KernelError::TooLarge(why)) => why,
other => panic!("{:?}", other.map(|b| b.face_count())),
};
assert!(
why.contains("the ball is as wide as a face it rolls on, so its centre stays put and the round cannot end at the edge's end"),
"{why}"
);
// 2 less solidcore's fit margin.
let largest: f64 = why
.split_once("the largest radius that fits is ")
.and_then(|(_, n)| n.split_once(" mm"))
.and_then(|(n, _)| n.parse().ok())
.unwrap_or_else(|| panic!("{why}"));
assert!(largest < 2.0 && largest > 1.9, "{why}");
}
+23
View File
@@ -640,3 +640,26 @@ fn an_l_sheet_thickens() {
let core = thicken(&sheet, 2.0, false).unwrap();
assert!(rel(volume(&core, 1e-8).unwrap(), 840.0) < 1e-9);
}
/// solidcore#2350's parabolic sheet: the quadratic Bézier (-10, 0), (0, 10), (10, 0) lofted 20
/// along z, a B-spline face whose radius of curvature at its apex is 10. Thickened 11 towards
/// its centre of curvature its offset folds there: solidcore's one construction refuses it
/// naming 10, the largest wall that works (`fixes.shell_one_construction`); 2 builds.
#[test]
fn a_wall_thicker_than_its_face_curves_is_refused_naming_the_largest() {
use crate::sweeps::Curve;
let parabola = |z: f64| Curve::Nurbs {
degree: 2,
points: vec![[-10.0, 0.0, z, 1.0], [0.0, 10.0, z, 1.0], [10.0, 0.0, z, 1.0]],
knots: vec![0.0, 0.0, 0.0, 1.0, 1.0, 1.0],
};
let sheet = super::sweep::loft(&[vec![parabola(0.0)], vec![parabola(20.0)]], 1, false).unwrap();
// Towards the centre is the side where an 11 wall folds; the other side takes any wall.
let folds: Vec<String> = [11.0, -11.0].iter().filter_map(|&t| thicken(&sheet, t, false).err()).map(|e| e.to_string()).collect();
let [why] = folds.as_slice() else { panic!("one side folds: {folds:?}") };
let (words, largest) = why.split_once("; the largest wall that works is ").unwrap_or_else(|| panic!("{why}"));
assert_eq!(words, "the wall is thicker than a face curves, so the face's offset folds");
let largest: f64 = largest.parse().unwrap();
assert!((largest - 10.0).abs() < 1e-9, "{largest}");
assert!(thicken(&sheet, 2.0, false).is_ok() && thicken(&sheet, -2.0, false).is_ok());
}