Skip to content

Commit 9bd03bc

Browse files
committed
one by one
1 parent 15af37a commit 9bd03bc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_booleans.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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)

0 commit comments

Comments
 (0)