Triangle#
- Triangle() UnstructuredGrid[source]#
Create a
pyvista.UnstructuredGridcontaining a single Triangle.This cell corresponds to the
pyvista.CellType.TRIANGLEcell type.- Returns:
pyvista.UnstructuredGridUnstructuredGrid containing a single triangle.
Examples#
Download Python source code | Download Jupyter notebook
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([[ 0.5 , -0.28867513, 0. ],
[ 0. , 0.57735027, 0. ],
[-0.5 , -0.28867513, 0. ]])
>>> grid.celltypes # same as pyvista.CellType.TRIANGLE
array([5], dtype=uint8)