triangulate

UnstructuredGrid.triangulate(inplace=False, progress_bar=False)

Return an all triangle mesh.

More complex polygons will be broken down into triangles.

Parameters
inplacebool, optional

Updates mesh in-place.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Mesh containing only triangles.

Examples

Generate a mesh with quadrilateral faces.

>>> import pyvista
>>> plane = pyvista.Plane()
>>> plane.point_data.clear()
>>> plane.plot(show_edges=True, line_width=5)
../../../_images/pyvista-UnstructuredGrid-triangulate-1_00_00.png

Convert it to an all triangle mesh.

>>> mesh = plane.triangulate()
>>> mesh.plot(show_edges=True, line_width=5)
../../../_images/pyvista-UnstructuredGrid-triangulate-1_01_00.png