CellArray.from_regular_cells#
- classmethod CellArray.from_regular_cells(
- cells: MatrixLikeInt,
- *,
- deep: bool = False,
Construct a
CellArrayfrom cells which all have the same size.Use this method when every cell has the same number of points, for example, an array of triangles or an array of quads. The cell offsets are computed directly from the cell size, and the input array is used as the connectivity array. Use
from_irregular_cells()instead if the cells have varying sizes.- Parameters:
- cells
MatrixLikeInt Cell array of shape (
n_cells,cell_size) where all cells have the samecell_size.- deepbool, default:
False Whether to deep copy the cell array data into the vtk connectivity array. If
False, the returned cell array may share memory withcells.
- cells
- Returns:
pyvista.CellArrayConstructed
CellArray.
Examples#
Download Python source code | Download Jupyter notebook
Create a cell array of two triangles.
>>> import pyvista as pv
>>> cells = pv.CellArray.from_regular_cells([[0, 1, 2], [1, 2, 3]])
>>> cells.n_cells
2
>>> cells.regular_cells
array([[0, 1, 2],
[1, 2, 3]]...)
See Also#
from_irregular_cellsEquivalent method for cells with varying sizes.
regular_cellsRead the cells back as a (n_cells, cell_size) array.
Used In#
API Examples
PolyData(1 use)PolyData.verts(1 use)