PolyData.vert_offsets#
- property PolyData.vert_offsets: NumpyArray[int][source]#
Return the offsets array of the vertex cells.
The offsets array has
n_verts + 1values and stores the index intovert_connectivityat which each vertex cell begins. The point ids of vertex celliarevert_connectivity[vert_offsets[i]:vert_offsets[i + 1]].Vertices, lines, faces, and strips are held in four separate cell arrays, each with its own offsets and connectivity.
len(vert_offsets) - 1is thereforen_verts, notn_cells.Added in version 0.49.
- Returns:
numpy.ndarrayArray of vertex cell offsets with
n_verts + 1values.
Notes#
The returned array is read-only and cannot be modified in place. To change
the offsets, assign a new array to this property. The new offsets must remain
consistent with the current vert_connectivity; to replace both at once,
assign a pyvista.CellArray to verts. See the examples below.
Examples#
Download Python source code | Download Jupyter notebook
>>> import pyvista as pv
>>> mesh = pv.PolyData([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [2.0, 0.0, 0.0]])
>>> mesh.vert_offsets
array([0, 1, 2, 3]...)
The offsets and connectivity together describe each vertex cell.
>>> mesh.vert_connectivity[mesh.vert_offsets[0] : mesh.vert_offsets[1]]
array([0]...)
The array is read-only and writing to it raises a ValueError.
>>> mesh.vert_offsets.flags['WRITEABLE']
False
Assign a new array instead. Here the three point ids are re-partitioned into a single polyvertex cell.
>>> mesh.vert_offsets = [0, 3]
>>> mesh.n_verts
1
To replace the offsets and connectivity together, assign a
pyvista.CellArray to verts.
>>> mesh.verts = pv.CellArray.from_arrays([0, 1, 2], [0, 1])
>>> mesh.n_verts
2
See Also#
vert_connectivityPoint ids that define the vertex cells.
n_vertsNumber of vertex cells, one less than the size of this array.
vertsVertex cells in the legacy padded format.
line_offsets,face_offsets,strip_offsetsOffsets arrays of the other
PolyDatacell types.