microcad_core/geo3d/
mod.rs1mod align;
7mod bounds;
8mod collection;
9mod extrude;
10mod geometry;
11mod mesh;
12mod plane;
13mod reflect;
14mod triangle;
15mod vertex;
16
17pub use align::*;
18pub use bounds::*;
19pub use collection::*;
20pub use extrude::*;
21pub use geometry::*;
22pub use manifold_rs::Manifold;
23pub use mesh::TriangleMesh;
24pub use plane::Plane;
25pub use reflect::*;
26pub use vertex::Vertex;
27
28use crate::BooleanOp;
29
30impl From<&BooleanOp> for manifold_rs::BooleanOp {
31 fn from(op: &BooleanOp) -> Self {
32 match op {
33 BooleanOp::Union => manifold_rs::BooleanOp::Union,
34 BooleanOp::Intersect => manifold_rs::BooleanOp::Intersection,
35 BooleanOp::Subtract => manifold_rs::BooleanOp::Difference,
36 _ => unimplemented!(),
37 }
38 }
39}
40
41#[test]
42fn test_mesh_volume() {
43 let manifold = Manifold::sphere(1.0, 512);
44 let mesh = TriangleMesh::from(manifold.to_mesh());
45
46 let volume = mesh.volume();
47 assert!((volume - 4.0 / 3.0 * std::f64::consts::PI).abs() < 1e-3);
48}