- PolyData.intersection(mesh, split_first=True, split_second=True, progress_bar=False)#
Compute the intersection between two meshes.
This method returns the surface intersection from two meshes (which often resolves as a line), whereas the
PolyDataFilters.boolean_intersection()filter returns the “volume” intersection between two closed (manifold) meshes.
The mesh to intersect with.
True, return the first input mesh split by the intersection with the second input mesh.
True, return the second input mesh split by the intersection with the first input mesh.
Display a progress bar to indicate progress.
Intersect two spheres, returning the intersection and both spheres which have new points/cells along the intersection line.
>>> import pyvista as pv >>> import numpy as np >>> s1 = pv.Sphere(phi_resolution=15, theta_resolution=15) >>> s2 = s1.copy() >>> s2.points += np.array([0.25, 0, 0]) >>> intersection, s1_split, s2_split = s1.intersection(s2) >>> pl = pv.Plotter() >>> _ = pl.add_mesh(s1, style='wireframe') >>> _ = pl.add_mesh(s2, style='wireframe') >>> _ = pl.add_mesh(intersection, color='r', line_width=10) >>> pl.show()
The mesh splitting takes additional time and can be turned off for either mesh individually.
>>> intersection, _, s2_split = s1.intersection(s2, ... split_first=False, ... split_second=True)