pyvista.PolyDataFilters.triangulate#

PolyDataFilters.triangulate(inplace=False, progress_bar=False)[source]#

Return an all triangle mesh.

More complex polygons will be broken down into triangles.

Parameters:
inplacebool, default: False

Whether to update the mesh in-place.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

Mesh containing only triangles.

Examples

Generate a mesh with quadrilateral faces.

>>> import pyvista as pv
>>> plane = pv.Plane()
>>> plane.point_data.clear()
>>> plane.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/b59c85a7b9babf981eaf433413e7262e75ca1af1/a8599/_images/pyvista-polydatafilters-triangulate-1_00_00.png

Convert it to an all triangle mesh.

>>> mesh = plane.triangulate()
>>> mesh.plot(show_edges=True, line_width=5)
https://d33wubrfki0l68.cloudfront.net/6065584de26ec9a024386478e9e0719fa8eedd69/d1a95/_images/pyvista-polydatafilters-triangulate-1_01_00.png