# Examples from pyvista.PolyDataFilters.smooth_taubin
# ===================================================

# Smooth the example bone mesh. Here, it's necessary to subdivide the
# mesh to increase the number of faces as the original mesh is so coarse.
import pyvista as pv
from pyvista import examples
mesh = examples.download_foot_bones().subdivide(2)
smoothed_mesh = mesh.smooth_taubin()
pv.plot_compare({'Original Mesh': mesh, 'Smoothed Mesh': smoothed_mesh})

# Use `plot_compare()` to show differences between
# window functions. The keys of the dict are used as labels.
mesh = examples.download_foot_bones()
window_functions = ['nuttall', 'blackman', 'hamming', 'hanning']
datasets = {
    window: mesh.smooth_taubin(window_function=window)
    for window in window_functions
}

cpos = pv.CameraPosition(
    position=(-0.778, -12.74, -2.019),
    focal_point=(1.257, -1.716, -0.2136),
    viewup=(-0.2696, -0.107, 0.957),
)

pv.plot_compare(
    datasets,
    show_edges=True,
    cpos=cpos,
)

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
