Beispiel #1
0
 def test_download_face():
     data = examples.download_face()
     assert data.n_cells
Beispiel #2
0
"""
Decimation
~~~~~~~~~~

Decimate a mesh

"""
# sphinx_gallery_thumbnail_number = 4
import pyvista as pv
from pyvista import examples

mesh = examples.download_face()

# Define a camera potion the shows this mesh properly
cpos = [(0.4, -0.07, -0.31), (0.05, -0.13, -0.06), (-0.1, 1, 0.08)]
dargs = dict(show_edges=True, color=True)

# Preview the mesh
mesh.plot(cpos=cpos, **dargs)

###############################################################################
#  Now let's define a target reduction and compare the
# :func:`pyvista.PolyData.decimate` and :func:`pyvista.PolyData.decimate_pro`
# filters.
target_reduction = 0.7
print(f"Reducing {target_reduction * 100.0} percent out of the original mesh")

###############################################################################
decimated = mesh.decimate(target_reduction)

decimated.plot(cpos=cpos, **dargs)