boolean_union_mesh_mesh
- compas.geometry.boolean_union_mesh_mesh(A, B)[source]
Compute the boolean union of two triangle meshes.
- Parameters:
- Atuple[sequence[point], sequence[[int, int, int]]]
The vertices and faces of mesh A.
- Btuple[sequence[point], sequence[[int, int, int]]]
The vertices and faces of mesh B.
- Returns:
- tuple[list[point], list[[int, int, int]]]
The vertices and the faces of the boolean union.
Notes
This function is a “pluggable”. This means that it doesn’t provide an implementation, but receives an implementation from a corresponding “plugin”. To use the plugin implementation, you have to install it in the same environment as COMPAS. One such plugin is available in
compas_cgal
.Examples
>>> from compas.geometry import Box, Sphere >>> from compas.geometry import boolean_union_mesh_mesh >>> from compas.geometry import trimesh_remesh >>> from compas.datastructures import Mesh
>>> box = Box.from_width_height_depth(2, 2, 2) >>> box = Mesh.from_shape(box) >>> box.quads_to_triangles()
>>> sphere = Sphere([1, 1, 1], 1) >>> sphere = Mesh.from_shape(sphere, u=30, v=30) >>> sphere.quads_to_triangles()
>>> A = box.to_vertices_and_faces() >>> B = sphere.to_vertices_and_faces() >>> B = trimesh_remesh(B, 0.3, 10)
>>> V, F = boolean_union_mesh_mesh(A, B) >>> union = Mesh.from_vertices_and_faces(V, F)