diff --git a/crates/kernel/src/tests.rs b/crates/kernel/src/tests.rs index 5f8c89966..2514924a6 100644 --- a/crates/kernel/src/tests.rs +++ b/crates/kernel/src/tests.rs @@ -311,10 +311,32 @@ fn loop_fillet_as_tall_as_its_wall_consumes_it() { let m = measure(&f).unwrap(); assert!(rel(m.volume, want) < 2e-4, "{} vs {want}", m.volume); assert!(f.validity().is_empty(), "{:?}", f.validity()); - // Taller than the wall: still refused, the body unchanged. + // Taller than the wall the round overflows on its tangent side, past the wall's bottom + // edge: it is built on the wall continued down and cut from the disc (the owner's + // blend-overflow ruling, 2026-10-30), keeping its radius. Its section in (ρ, z) is the r + // square at the edge outside the circle about (13 − r, 2 − r), above z = 0: with + // t = z − (2 − r) = r sin θ and ρ(θ) = 13 − r + r cos θ the disc keeps + // π (169·2 − ∫ (169 − ρ²) dz), θ from asin((r − 2) / r) (957.692239 at r = 2.5). + let kept = |r: f64| { + let (n, lo) = (20000, ((r - 2.0) / r).asin()); + let taken: f64 = (0..n) + .map(|i| { + let th = lo + (f64::from(i) + 0.5) * (PI / 2.0 - lo) / f64::from(n); + let rho = 13.0 - r + r * th.cos(); + (169.0 - rho * rho) * r * th.cos() + }) + .sum::() + * (PI / 2.0 - lo) + / f64::from(n); + PI * (169.0 * 2.0 - taken) + }; + assert!(rel(kept(2.0), PI * 169.0 * 2.0 - spandrel(2.0).0 * 2.0 * PI * (13.0 - spandrel(2.0).1)) < 1e-9); + assert!((kept(2.5) - 957.692239).abs() < 1e-6, "{}", kept(2.5)); for r in [2.0 + 1e-3, 2.5] { - let e = fillet(&disc, &[Vec3::new(0.0, 13.0, 2.0), Vec3::new(0.0, -13.0, 2.0)], r).unwrap_err(); - assert!(e.to_string().contains("taller than the walls"), "{r}: {e}"); + let f = fillet(&disc, &[Vec3::new(0.0, 13.0, 2.0), Vec3::new(0.0, -13.0, 2.0)], r).unwrap_or_else(|e| panic!("{r}: {e}")); + assert!(f.validity().is_empty(), "{r}: {:?}", f.validity()); + let v = measure(&f).unwrap().volume; + assert!(rel(v, kept(r)) < 1e-6, "{r}: {v} vs {}", kept(r)); } }