# Projection of a point along a vector on a 3D plane given by two vectors

I would like to know how to calculate the projection of a point along a specified vector (directional vector) onto a plane given by two (non collinear) vectors in 3D space. Specifically, I would like to determine the scalars a and b which define the point P in $\vec {OP} = a\cdot\vec {OA} + b\cdot\vec {OB}$ where P is the projection of C along the directional vector $\vec v$ onto that plane. The coordinates in 3D space of O, A, B, C and $\vec v$ are given.

• In effect, you want to express your point $C$ in the basis $(\vec {OA},\vec {OB},\vec v)$ as $\vec{OC}=a\cdot\vec {OA} + b\cdot\vec {OB} + c\cdot\vec v$, and then just throw out the third part. – Ivan Neretin Jun 6 '16 at 20:20
• Yes, that is correct. But how do I calculate the scalars a, b and c in that basis? – Tamori Jun 6 '16 at 21:07
• By inverting certain matrix. That's already covered by Omnomnomnom's answer. – Ivan Neretin Jun 7 '16 at 4:42

## 2 Answers

Let $u = \vec{OA}, w = \vec{OB}$. Let $b = \vec {OC}$, and $x = \vec{OP}$.

Let $S = [u \quad w \quad v]$. We note that $S^{-1}x$ is simply the projection of $S^{-1}b$ onto the $xy$-plane.

However, projecting onto the $xy$-plane is easy. So, all together, we can simply compute $$x = P_{uw}b = S P_{xy} S^{-1}b = S \pmatrix{1&0&0\\0&1&0\\0&0&0} S^{-1}b$$

• Can't edit my original comment so I'll add a new one. Thanks for answering. I don't quite understand how I am to obtain the scalars a and b (as defined in my question) from your result, though. It seems like you have $\vec{OP}$ determined as $\vec{OC}$ multitplied by a matrix. – Tamori Jun 6 '16 at 21:04
• Oh, whoops! That's even easier: just take the first two components of $S^{-1}b$. – Omnomnomnom Jun 6 '16 at 21:10
• Ok. Will see if that works and if it does I'll mark your answer as correct. – Tamori Jun 6 '16 at 21:25

if the vectors $\overrightarrow{OA}$ and $\overrightarrow{OB}$ are collinear vectors then two possible cases:

a) $P$ is on the same line as $\overrightarrow{OA}$ and $\overrightarrow{OB}$, then there are infinitely many solutions.

b) $P$ does not belong to this line, then it does not solutions.

if the vectors $\overrightarrow{OA}$ and $\overrightarrow{OB}$ are not collinear, then the solution is unique given by: (after we made a good choice of landmark).

Let $\overrightarrow{OA} = (x_1, y_1,0), \overrightarrow{OB} = (x_2, y_2,0)$ and $\overrightarrow{OP} = (x, y, 0)$ then we have the matrix equation $M (\begin{array}{c} a\\ b\end{array}) = (\begin{array}{c}x \\y\end{array})$ , where $M=\left( \begin{array}{cc} x_1 & x_2 \\ y_1& y_2 \end{array} \right)$, with nonzero $det(M)$ as the vector product of $\overrightarrow{OA}$ and $\overrightarrow{OB}$ is not null vector. so the solution $(\begin{array}{c} a\\ b\end{array})$ is $M^{-1} (\begin{array}{c} x\\ y\end{array})$.

• Thanks for your answer. As specified in my question, $\vec{OA}$ and $\vec{OB}$ arent't collinear. Otherwise, you don't have the complete solution as basically you're just expressing $\vec{OP}$ another way. Besides, you're not using C or $\vec{v}$. – Tamori Jun 6 '16 at 22:35
• I think there is infinity point $C$ whose projection in the direction $\overrightarrow{v}$ is the point $P$, this points $C$ are determined by the equation $\overrightarrow{OC}=\overrightarrow{OP}+\lambda\overrightarrow{v}$. Thanks – m.idaya Jun 7 '16 at 0:06