PolyData.strip_offsets

PolyData.strip_offsets#

property PolyData.strip_offsets: NumpyArray[int][source]#

Return the offsets array of the triangle strips.

The offsets array has n_strips + 1 values and stores the index into strip_connectivity at which each strip begins. The point ids of strip i are strip_connectivity[strip_offsets[i]:strip_offsets[i + 1]].

Vertices, lines, faces, and strips are held in four separate cell arrays, each with its own offsets and connectivity. len(strip_offsets) - 1 is therefore n_strips, not n_cells.

Added in version 0.49.

Returns:
numpy.ndarray

Array of strip offsets with n_strips + 1 values.

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 strip_connectivity; to replace both at once, assign a pyvista.CellArray to strips. See the examples below.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> mesh = pv.Rectangle().extrude((0, 0, 1), capping=False)
>>> mesh.strip_offsets
array([ 0,  4,  8, 12, 16]...)

The offsets and connectivity together describe each strip.

The array is read-only and writing to it raises a ValueError.

>>> mesh.strip_offsets.flags['WRITEABLE']
False

Assign a new array instead. Here the four strips are merged into two.

>>> mesh.strip_offsets = [0, 8, 16]
>>> mesh.n_strips
2

To replace the offsets and connectivity together, assign a pyvista.CellArray to strips.

>>> mesh.strips = pv.CellArray.from_arrays([0, 4], [0, 1, 4, 5])
>>> mesh.n_strips
1

See Also#

strip_connectivity

Point ids that define the strips.

n_strips

Number of strips, one less than the size of this array.

strips

Strips in the legacy padded format.

vert_offsets, line_offsets, face_offsets

Offsets arrays of the other PolyData cell types.