kernel: loft rails tests measure against the record's surfaces

(not built: base in progress)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
jyviko
2026-10-22 07:36:06 -04:00
parent 5aaf405d8d
commit 4897ce17b4
+7 -7
View File
@@ -42,15 +42,15 @@ fn volume(b: &crate::Body) -> f64 {
b.volume_at(1e-4).unwrap()
}
/// How far `p` is from the nearest face of the body.
/// How far `p` is from the nearest face's surface of the body.
fn off(b: &crate::Body, p: Vec3) -> f64 {
use truck_modeling::{ParametricSurface, SearchNearestParameter};
b.solid
.face_iter()
b.record()
.faces
.iter()
.filter_map(|f| {
let s = f.surface();
let (u, v) = s.search_nearest_parameter(crate::body::p3(p), None, 100)?;
Some(crate::body::from_p3(s.subs(u, v)).dist(p))
let s = solidcraft_geom::brep::eval::SurfaceEval::new(&f.surface).ok()?;
let uv = s.project(p, None, f64::INFINITY)?;
Some(s.point(uv)?.dist(p))
})
.fold(f64::INFINITY, f64::min)
}