[Math] Find projection vector on a plane

projective-spacevectors

I have three 3D vectors. Two of them define an (imaginary) plane (the green and red arrow in the picture). The third vector (the darker blue) can point anywhere it wants. All them have the same origin (lets say [0, 0, 0]) and the same length (say |1|).

How to get a vector that is the (shortest) projection of the dark blue one on that plane (in the image the lighter blue one) and should have the same length afterwards? It must also work when the dark blue vector stands perpendicular on the plane.

project to plane

Best Answer

Let $a_1$ and $a_2$ be the two vectors which form your plane, and $\nu$ be the vector you want to project. Assuming that they all have length 1, the projection will be $$ \nu_{\text{proj}} = a_1(a_1\cdot \nu) + a_2(a_2\cdot \nu) $$ If you want that $\nu_{\text{proj}}$ has the same length then $\nu$, just multiply by $^{\mid \nu \mid}/_{\mid \nu_{ \text{proj}} \mid}$

Related Question