Vector-Plane ProjectionΒΆ

Project a vector onto a plane.

plot vector plane

Out:

(-1.0, 1.0)

from skspatial.objects import Plane, Vector
from skspatial.plotting import plot_3d


plane = Plane([0, 0, 0], [0, 0, 1])
vector = Vector([1, 1, 1])

vector_projected = plane.project_vector(vector)


_, ax = plot_3d(
    plane.plotter(lims_x=(-5, 5), lims_y=(-5, 5), alpha=0.3),
    vector.plotter(point=plane.point, color='k'),
    vector_projected.plotter(point=plane.point, color='r', linewidth=2, zorder=3),
)

ax.set_zlim([-1, 1])

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

Gallery generated by Sphinx-Gallery