- PolyData.subdivide_adaptive(max_edge_len=None, max_tri_area=None, max_n_tris=None, max_n_passes=None, inplace=False, progress_bar=False)#
Increase the number of triangles in a triangular mesh based on edge and/or area metrics.
This filter uses a simple case-based, multi-pass approach to repeatedly subdivide the input triangle mesh to meet the area and/or edge length criteria. New points may be inserted only on edges; depending on the number of edges to be subdivided a different number of triangles are inserted ranging from two (i.e., two triangles replace the original one) to four.
Point and cell data is treated as follows: The cell data from a parent triangle is assigned to its subdivided children. Point data is interpolated along edges as the edges are subdivided.
This filter retains mesh watertightness if the mesh was originally watertight; and the area and max triangles criteria are not used.
The maximum edge length that a triangle may have. Edges longer than this value are split in half and the associated triangles are modified accordingly.
The maximum area that a triangle may have. Triangles larger than this value are subdivided to meet this threshold. Note that if this criterion is used it may produce non-watertight meshes as a result.
The maximum number of triangles that can be created. If the limit is hit, it may result in premature termination of the algorithm and the results may be less than satisfactory (for example non-watertight meshes may be created). By default, the limit is set to a very large number (i.e., no effective limit).
The maximum number of passes (i.e., levels of subdivision). If the limit is hit, then the subdivision process stops and additional passes (needed to meet other criteria) are aborted. The default limit is set to a very large number (i.e., no effective limit).
Updates mesh in-place.
Display a progress bar to indicate progress.
First, load the example airplane mesh and plot it.
>>> import pyvista >>> from pyvista import examples >>> mesh = pyvista.PolyData(examples.planefile) >>> mesh.plot(show_edges=True, line_width=3)
Subdivide the mesh
>>> submesh = mesh.subdivide_adaptive(max_n_passes=2) >>> submesh.plot(show_edges=True)