Project to a Plane

pyvista.PolyData surfaces and pointsets can easily be projected to a plane defined by a normal and origin

# sphinx_gallery_thumbnail_number = 2
import pyvista as pv
from pyvista import examples


poly = examples.load_random_hills()
poly.plot()
project plane

Out:

[(32.59238063266725, 42.5923804083449, 36.404716943411536),
 (0.0, 9.99999977567765, 3.8123363107442856),
 (0.0, 0.0, 1.0)]

Project that surface to a plane underneath the surface

origin = poly.center
origin[-1] -= poly.length / 3.0
projected = poly.project_points_to_plane(origin=origin)

# Display the results
p = pv.Plotter()
p.add_mesh(poly)
p.add_mesh(projected)
p.show()
project plane

Out:

[(34.913678491391046, 44.9136782670687, 35.691136920727594),
 (0.0, 9.99999977567765, 0.7774584293365479),
 (0.0, 0.0, 1.0)]

Total running time of the script: ( 0 minutes 1.819 seconds)

Gallery generated by Sphinx-Gallery