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 numpy as np
import pyvista as pv
from pyvista import examples


poly = examples.load_random_hills()
poly.plot()
../../_images/sphx_glr_project-plane_001.png

Out:

[(32.59238058247114, 42.59238058247112, 36.404715418000464), (0.0, 9.99999999999999, 3.8123348355293274), (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()
../../_images/sphx_glr_project-plane_002.png

Out:

[(34.91367839953717, 44.91367839953716, 35.69113563678082), (0.0, 9.99999999999999, 0.7774572372436523), (0.0, 0.0, 1.0)]

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

Gallery generated by Sphinx-Gallery