# Project to a Plane
# ==================

# Project a `PolyData` surface or pointset to a plane.
# Uses `project_points_to_plane()` with a normal
# and origin.
import pyvista as pv
from pyvista import examples

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

# Project that surface to a plane underneath the surface
origin = list(poly.center)
origin[-1] -= poly.length / 3.0
projected = poly.project_points_to_plane(origin=origin)

# Display the results
pl = pv.Plotter()
pl.add_mesh(poly)
pl.add_mesh(projected)
pl.show()

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
