File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ from compas .geometry import Box
2+ from compas .geometry import Sphere
3+ from compas .datastructures import Mesh
4+
5+ from compas_cgal .booleans import boolean_union_mesh_mesh
6+ from compas_cgal .meshing import mesh_remesh
7+
8+
9+ def test_booleans ():
10+ # ==============================================================================
11+ # Make a box and a sphere
12+ # ==============================================================================
13+
14+ box = Box (2 )
15+ A = box .to_vertices_and_faces (triangulated = True )
16+
17+ sphere = Sphere (1 , point = [1 , 1 , 1 ])
18+ B = sphere .to_vertices_and_faces (u = 32 , v = 32 , triangulated = True )
19+
20+ # ==============================================================================
21+ # Remesh the sphere
22+ # ==============================================================================
23+
24+ B = mesh_remesh (B , 0.3 , 10 )
25+
26+ # ==============================================================================
27+ # Compute the boolean mesh
28+ # ==============================================================================
29+
30+ V , F = boolean_union_mesh_mesh (A , B )
31+
32+ Mesh .from_vertices_and_faces (V , F )
You can’t perform that action at this time.
0 commit comments