Thanks @DuBearte.
This commit is contained in:
1 parent
737c9358d0
commit
4a4911b473
3 files changed
+50
-1
No files matched your search
@@ -1196,6 +1196,43 @@ fn extrude_auto_operation() {
|
||||
assert!(rel(volume(&mut s), 40.0 * 30.0 * 15.0 - 100.0 * 8.0) < 1e-6);
|
||||
}
|
||||
|
||||
/// #1666: a loft between two 18-point polylines has twisted (bilinear) side faces. Each was
|
||||
/// meshed as two flat triangles, which cross the surface; the mesh volume was 16 800.6 mm³
|
||||
/// against the B-rep's 17 884. Divided to the chord tolerance, the mesh matches the B-rep.
|
||||
#[test]
|
||||
fn twisted_ruled_faces_are_meshed_to_the_chord_tolerance() {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "sketch.create", json!({"plane": "XY", "name": "Bottom"}));
|
||||
run(
|
||||
&mut s,
|
||||
"sketch.line",
|
||||
json!({"closed": true, "infer": false, "connect": false, "points": [[-26,3],[-24.76384,3],[-16.0568,14.97217],[-8,4.90117],[0,14.90117],[8,4.90117],[16.0568,14.97217],[24.76384,3],[26,3],[26,0],[23.23616,0],[15.9432,10.02783],[8,0.09883],[0,10.09883],[-8,0.09883],[-15.9432,10.02783],[-23.23616,0],[-26,0]]}),
|
||||
);
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
run(&mut s, "sketch.create", json!({"plane": "XY", "offset": 90.5, "name": "Top"}));
|
||||
run(
|
||||
&mut s,
|
||||
"sketch.line",
|
||||
json!({"closed": true, "infer": false, "connect": false, "points": [[-26,3],[-24,3],[-16,3],[-8,3],[0,3],[8,3],[16,3],[24,3],[26,3],[26,0],[24,0],[16,0],[8,0],[0,0],[-8,0],[-16,0],[-24,0],[-26,0]]}),
|
||||
);
|
||||
run(&mut s, "sketch.finish", json!({}));
|
||||
run(&mut s, "solid.loft", json!({"sections": [{"sketch": "Bottom"}, {"sketch": "Top"}], "operation": "new"}));
|
||||
let st = s.model.state();
|
||||
let body = &st.bodies.first().unwrap().body;
|
||||
let exact = solidcraft_kernel::measure(body).unwrap().volume;
|
||||
let mesh = body.tessellate(0.05).unwrap();
|
||||
let volume: f64 = mesh
|
||||
.triangles
|
||||
.iter()
|
||||
.map(|t| {
|
||||
let p = |i: u32| mesh.positions[i as usize];
|
||||
p(t[0]).dot(p(t[1]).cross(p(t[2]))) / 6.0
|
||||
})
|
||||
.sum();
|
||||
assert!(mesh.triangles.len() > 72, "the twisted faces are divided: {} triangles", mesh.triangles.len());
|
||||
assert!(rel(volume.abs(), exact) < 2e-3, "mesh {volume} against B-rep {exact}");
|
||||
}
|
||||
|
||||
/// #1633: to an object, the extrude goes to it on whichever side it is, whatever its
|
||||
/// `direction`: through the body to its far face is a Cut, out to something above is a Join.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user