split

compas_cgal.booleans.split(A, B)[source]

Split one mesh with another.

Parameters
  • A (tuple[Sequence[[float, float, float] | Point], Sequence[[int, int, int]]]) – Mesh A.

  • B (tuple[Sequence[[float, float, float] | Point], Sequence[[int, int, int]]]) – Mesh B.

  • operation (Literal[‘union’, ‘difference’, ‘intersection’]) – The type of boolean operation.

Returns

  • NDArray[(Any, 3), np.float64] – The vertices of the boolean mesh.

  • NDArray[(Any, 3), np.int32] – The faces of the boolean mesh.

Examples

>>> from compas.geometry import Box, Sphere, Polyhedron
>>> from compas_cgal.booleans import split
>>> box = Box.from_width_height_depth(1, 1, 1)
>>> sphere = Sphere([1, 1, 1], 0.5)
>>> A = box.to_vertices_and_faces(triangulated=True)
>>> B = sphere.to_vertices_and_faces(u=32, v=32, triangulated=True)
>>> V, F = split(A, B)
>>> mesh = Mesh.from_vertices_and_faces(V, F)