mesh.Mesh.boolean#

Mesh.boolean(surf, op='+', remove_degenerate=True)#

Perform a boolean operation with another tri3 Mesh.

Boolean operations between surface meshes are a basic operation in free surface modeling. Both surfaces should be closed orientable non-intersecting manifolds.

Available operations on the enclosed volumes are: union (‘+’), difference (‘-‘), and intersection (‘*’).

Parameters#

surf: Mesh (eltype=’tri3’)

Another surface Mesh that is a closed manifold surface.

op: ‘+’, ‘-’ or ‘*’

The boolean operation to perform: union(‘+’), difference(‘-‘) or intersection(‘*’).

remove_degeneratebool, default=True

Whether to remove degenerate elements (e.g. with 2 coinciding nodes) before and after performing the boolean operation.

Returns#

Mesh

A closed manifold surface Mesh (eltype=’tri3’) that is the volume union, difference or intersection of self with surf.

Examples#

>>> cube = Mesh(eltype='hex8').border_mesh().convert('tri3')
>>> cube2 = cube.translate([0.5, 0.5, 0.5])
>>> intersect = cube.boolean(cube2, op='*')
>>> print(intersect.area())
1.5