mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-05 11:35:55 +00:00
Tests: rustfmt the board fixture example and the coplanar asserts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,7 +65,11 @@ mod run {
|
||||
.enumerate()
|
||||
.map(|(c, bodies)| ExportProduct {
|
||||
name: format!("U{c}"),
|
||||
bodies: bodies.iter().enumerate().map(|(k, b)| ExportBody { name: format!("U{c}_{k}"), body: b, color: Some([0.2, 0.2, 0.2]) }).collect(),
|
||||
bodies: bodies
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(k, b)| ExportBody { name: format!("U{c}_{k}"), body: b, color: Some([0.2, 0.2, 0.2]) })
|
||||
.collect(),
|
||||
children: Vec::new(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -1237,7 +1237,14 @@ fn coplanar_curved_booleans() {
|
||||
// the union adds the parts outside. A cylinder inside but for a flush cap adds nothing.
|
||||
let b = box_solid(Vec3::ZERO, Vec3::new(40.0, 30.0, 20.0)).unwrap();
|
||||
let disc = PI * 25.0;
|
||||
for (z0, z1, inside, outside) in [(0.0, 20.0, 20.0, 0.0), (-5.0, 20.0, 20.0, 5.0), (0.0, 25.0, 20.0, 5.0), (-5.0, 25.0, 20.0, 10.0), (5.0, 20.0, 15.0, 0.0), (5.0, 25.0, 15.0, 5.0)] {
|
||||
for (z0, z1, inside, outside) in [
|
||||
(0.0, 20.0, 20.0, 0.0),
|
||||
(-5.0, 20.0, 20.0, 5.0),
|
||||
(0.0, 25.0, 20.0, 5.0),
|
||||
(-5.0, 25.0, 20.0, 10.0),
|
||||
(5.0, 20.0, 15.0, 0.0),
|
||||
(5.0, 25.0, 15.0, 5.0),
|
||||
] {
|
||||
let c = cylinder(Vec3::new(20.0, 15.0, z0), Vec3::Z, 5.0, z1 - z0).unwrap();
|
||||
let cut = measure(&boolean(&b, &c, BoolOp::Cut).unwrap().unwrap()).unwrap().volume;
|
||||
assert!(rel(cut, 24000.0 - disc * inside) < 1e-6, "cut z {z0}..{z1}: {cut}");
|
||||
|
||||
Reference in New Issue
Block a user