mesh_slice_plane

compas.datastructures.mesh_slice_plane(mesh, plane)[source]

Slice a mesh with a plane and construct the resulting submeshes.

Parameters:
meshcompas.datastructures.Mesh

The original mesh.

planecompas.geometry.Plane

The cutting plane.

Returns:
tuple[compas.datastructures.Mesh, compas.datastructures.Mesh] | None

The “positive” and “negative” submeshes. If the mesh and plane do not intersect, or if the intersection is degenerate (point or line), the function returns None.

Examples

>>> from compas.geometry import Plane
>>> from compas.geometry import Box
>>> from compas.datastructures import Mesh
>>> plane = Plane((0, 0, 0), (1, 0, 0))
>>> box = Box.from_width_height_depth(1, 1, 1)
>>> mesh = Mesh.from_shape(box)
>>> result = mesh_slice_plane(mesh, plane)
>>> len(result) == 2
True