smooth

PolyData.smooth(n_iter=20, relaxation_factor=0.01, convergence=0.0, edge_angle=15, feature_angle=45, boundary_smoothing=True, feature_smoothing=False, inplace=False, progress_bar=False)

Adjust point coordinates using Laplacian smoothing.

The effect is to “relax” the mesh, making the cells better shaped and the vertices more evenly distributed.

Parameters
n_iterint

Number of iterations for Laplacian smoothing.

relaxation_factorfloat, optional

Relaxation factor controls the amount of displacement in a single iteration. Generally a lower relaxation factor and higher number of iterations is numerically more stable.

convergencefloat, optional

Convergence criterion for the iteration process. Smaller numbers result in more smoothing iterations. Range from (0 to 1).

edge_anglefloat, optional

Edge angle to control smoothing along edges (either interior or boundary).

feature_anglefloat, optional

Feature angle for sharp edge identification.

boundary_smoothingbool, optional

Boolean flag to control smoothing of boundary edges.

feature_smoothingbool, optional

Boolean flag to control smoothing of feature edges.

inplacebool, optional

Updates mesh in-place.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Smoothed mesh.

Examples

Smooth the edges of an all triangular cube

>>> import pyvista as pv
>>> cube = pv.Cube().triangulate().subdivide(5).clean()
>>> smooth_cube = cube.smooth(1000, feature_smoothing=False)
>>> n_edge_cells = cube.extract_feature_edges().n_cells
>>> n_smooth_cells = smooth_cube.extract_feature_edges().n_cells
>>> f'Sharp Edges on Cube:        {n_edge_cells}'
'Sharp Edges on Cube:        384'
>>> f'Sharp Edges on Smooth Cube: {n_smooth_cells}'
'Sharp Edges on Smooth Cube: 12'
>>> smooth_cube.plot()
../../../_images/pyvista-PolyData-smooth-1_00_00.png

See Surface Smoothing for more examples using this filter.