pyvista.examples.cells.Triangle#

Triangle() UnstructuredGrid[source]#

Create a pyvista.UnstructuredGrid containing a single Triangle.

This cell corresponds to the pyvista.CellType.TRIANGLE cell type.

Returns:
pyvista.UnstructuredGrid

UnstructuredGrid containing a single triangle.

Examples

Create and plot a single triangle.

>>> from pyvista import examples
>>> grid = examples.cells.Triangle()
>>> examples.plot_cell(grid, cpos='xy')

List the grid’s cells.

>>> grid.cells
array([3, 0, 1, 2])

List the grid’s points.

>>> grid.points
pyvista_ndarray([[1., 0., 0.],
                 [0., 0., 0.],
                 [0., 1., 0.]])
>>> grid.celltypes  # same as pyvista.CellType.TRIANGLE
array([5], dtype=uint8)
https://d33wubrfki0l68.cloudfront.net/afd79037ef0a626c1f475463b274a0a9a268aa6b/ab2f1/_images/pyvista-examples-cells-triangle-1_00_00.png