Wave 346/509: Engine tests: SMLib's faces, not truck's pieces, in the face counts and measures (and 3 more)
4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - ee9fc3793 jyviko: Tests: a torus patch to thicken is cut from SMLib's one-face torus - ca53656a2 jyviko: Schema tests: an empty face list is checked on the draft, which refuses it - ab68a3d0f jyviko: View tests: the section cap test draws the cap in the cap colour - 24bcaca03 jyviko: Engine tests: SMLib's faces, not truck's pieces, in the face counts and measures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
@@ -1883,8 +1883,15 @@ mod tests {
|
||||
// A torus patch (R 20, r 5): between the tube radii r and r + 1 over its own angles, θ round
|
||||
// the tube and φ round the axis (read off its mesh): the volume is
|
||||
// Δφ·[R((r+1)² − r²)/2·Δθ + ((r+1)³ − r³)/3·(sin θ1 − sin θ0)].
|
||||
let ring = torus(Vec3::ZERO, 20.0, 5.0).unwrap();
|
||||
let face = copy_faces(&ring, &[Vec3::new(25.0, 0.0, 0.0)]).unwrap();
|
||||
// SMLib makes a torus one face: the patch is the piece of it with x, y > 0 and z > 1
|
||||
// (bounded by iso lines both ways: planes through the axis, and z = 1 round the tube).
|
||||
let mut ring = torus(Vec3::ZERO, 20.0, 5.0).unwrap();
|
||||
for (o, n) in [(Vec3::ZERO, Vec3::X), (Vec3::ZERO, Vec3::Y), (Vec3::new(0.0, 0.0, 1.0), Vec3::Z)] {
|
||||
let pieces = crate::split_by_plane(&ring, &Plane::from_normal(o, n).unwrap()).unwrap();
|
||||
ring = pieces.into_iter().find(|b| (measure(b).unwrap().bbox.min - o).dot(n) > -1e-6).unwrap();
|
||||
}
|
||||
let (c, s) = (std::f64::consts::FRAC_PI_4.cos(), std::f64::consts::FRAC_PI_4.sin());
|
||||
let face = copy_faces(&ring, &[Vec3::new((20.0 + 5.0 * c) * c, (20.0 + 5.0 * c) * s, 5.0 * s)]).unwrap();
|
||||
let mesh = face.mesh(&crate::MeshTolerance::chord(0.01)).unwrap();
|
||||
let angles: Vec<(f64, f64)> = mesh.positions.iter().map(|p| (p.z.atan2((p.x * p.x + p.y * p.y).sqrt() - 20.0), p.y.atan2(p.x))).collect();
|
||||
let span = |f: &dyn Fn(&(f64, f64)) -> f64| {
|
||||
|
||||
Reference in New Issue
Block a user