decimate_pro

PolyDataFilters.decimate_pro(reduction, feature_angle=45.0, split_angle=75.0, splitting=True, pre_split_mesh=False, preserve_topology=False, inplace=False, progress_bar=False)

Reduce the number of triangles in a triangular mesh.

It forms a good approximation to the original geometry. Based on the algorithm originally described in “Decimation of Triangle Meshes”, Proc Siggraph 92 (https://doi.org/10.1145/133994.134010).

Parameters
reductionfloat

Reduction factor. A value of 0.9 will leave 10% of the original number of vertices.

feature_anglefloat, optional

Angle used to define what an edge is (i.e., if the surface normal between two adjacent triangles is >= feature_angle, an edge exists).

split_anglefloat, optional

Angle used to control the splitting of the mesh. A split line exists when the surface normals between two edge connected triangles are >= split_angle.

splittingbool, optional

Controls the splitting of the mesh at corners, along edges, at non-manifold points, or anywhere else a split is required. Turning splitting off will better preserve the original topology of the mesh, but may not necessarily give the exact requested decimation.

pre_split_meshbool, optional

Separates the mesh into semi-planar patches, which are disconnected from each other. This can give superior results in some cases. If pre_split_mesh is set to True, the mesh is split with the specified split_angle. Otherwise mesh splitting is deferred as long as possible.

preserve_topologybool, optional

Controls topology preservation. If on, mesh splitting and hole elimination will not occur. This may limit the maximum reduction that may be achieved.

inplacebool, optional

Whether to update the mesh in-place.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Decimated mesh.

Examples

Decimate a sphere. First plot the sphere.

>>> import pyvista
>>> sphere = pyvista.Sphere(phi_resolution=60, theta_resolution=60)
>>> sphere.plot(show_edges=True, line_width=2)
../../../_images/pyvista-PolyDataFilters-decimate_pro-1_00_00.png

Now decimate it and plot it.

>>> decimated = sphere.decimate_pro(0.75)
>>> decimated.plot(show_edges=True, line_width=2)
../../../_images/pyvista-PolyDataFilters-decimate_pro-1_01_00.png

See Decimation for more examples using this filter.