pyvista_js.PolyData.shrink#
- PolyData.shrink(shrink_factor: float = 0.8) PolyData#
Shrink the cells of a mesh towards their centroid.
This filter shrinks the individual cells of a mesh towards their centroids, producing visual separation between adjacent cells. It mirrors the PyVista
shrinkfilter API.Note
The shrink is computed in JavaScript at render time by iterating over the cell array from the vtk.js source, moving each vertex toward its cell’s centroid.
vtk.jsdoes not includevtkShrinkFilter, so this filter is implemented as a custom JavaScript pass.- Parameters:
shrink_factor (float, optional) – The factor to shrink each cell by, between 0 and 1. A value of 1.0 produces no change; lower values produce more shrinkage. Default is 0.8.
- Returns:
A new mesh with shrunk cells.
- Return type:
Examples
>>> import pyvista_js as pv >>> sphere = pv.Sphere() >>> shrunk = sphere.shrink(shrink_factor=0.8) >>> isinstance(shrunk, pv.PolyData) True
Render the shrunk mesh:
>>> shrunk.plot()