pyvista_wasm.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. The shrink is computed in JavaScript at render time as a manual implementation becausevtkShrinkPolyDatais not registered with thevtkDeserializerin VTK.wasm’s rendering-mode binary.- 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_wasm as pv >>> sphere = pv.Sphere() >>> shrunk = sphere.shrink(shrink_factor=0.8) >>> isinstance(shrunk, pv.PolyData) True
Render the shrunk mesh:
>>> shrunk.plot()