# Formula to project a vector onto a plane

I have a reference plane formed by 3 points in $\mathbb{R}^3$ – $A, B$ and $C$. I have a 4th point, $D$. I would like to project the vector $\vec{BD}$ onto the reference plane as well as project vector $\vec{BD}$ onto the plane orthogonal to the reference plane at vector $\vec{AB}$. Ultimately, I need the angle between $\vec{AB}$ and $\vec{BD}$ both when the vectors are projected on to the reference plane as well as the orthogonal plane. I have completed tutorials on projecting a vector onto a line in $\mathbb{R}^2$ but haven't figured out how to translate that to $\mathbb{R}^3$...

Please note the diagram only shows the reference plane as parallel to the $xy$ plane for the sake of convenience. In my examples, the reference plane could be at any orientation. I am using 3D coordinate data from an electromagnetic motion tracker and the reference plane will be constantly moving. I understand the cross product of the two vectors $\vec{AB} \times \vec{BC}$ results in the normal vector to their plane. I have 2 different methods to calculate that but am a little lost once I get to this point. I have seen both unit vector notation and column vector notation but am confused by moving between the different styles. It would be most helpful if you could tell me the formal name of the notation/equations you use. I know the scalar equation of a plane through point $(a,b,c)$ with normal $\hat{n} = [n_1, n_2, n_3]$ is:
$$n_1(x-a) + n_2(y-b) +n_3(z-c) = 0$$ and the standard linear equation definition is: $$Ax + By + Cz = D$$ but I could use some tips on when the equation is $=D$ and when it is $=0$ as well as any additional equations for a plane and in which circumstances the different forms are appropriate. I hope I've made sense here. Thanks for any help you can provide. ## 2 Answers

If $A$,$B$,$C$ are not on the same line, then $\vec{AB}\times \vec{BC}$ will give you the direction of your reference plane normal vector $\hat{n}_1$. I think you should know how to do the normalization so that $|\hat{n}_1|=1$

Then the projection of $\vec{BD}$ on the reference plane is $\vec{BD}-(\vec{BD}\cdot \hat{n}_1)\hat{n}_1$

Another plane $\hat{n}_2$ orthogonal to the reference plane ABC can be found as $\vec{AB}\times\hat{n}_1$ (again you need to normalize it). Then the projection of $\vec{BD}$ on that plane can alsow be found in a similar way as shown for the first plane.

• Thank you @MoonKnight - I had the inlaws staying for a few days so I'm just getting back to this. I'm a little fuzzy on normalizing - are you referring to the unit vector with length =1? I'm not sure how my results are supposed to look for that. I believe I'm supposed to multiple the inverse of the length of the vector by the vector itself. That would give me another vector with 3 components, correct? Again, notation is tripping me up. Can you confirm that your formula reads vector BD minus [the dot product of (BD⋅n) multiplied by n]? Thank you. – MsHF Jan 13 '14 at 20:24
• Another thing I'm hoping to clarify: Does your method first find the normal vector to the vectors formed by my sensor coordinates THEN find the actual reference plane created by the sensors? I'm confused by your saying in the 2nd paragraph "the projection of BD on the reference plane" when it seems you just had me find n1 as the normal vector, NOT the reference. To be clear, I am referring to the reference plane as the plane formed by points ABC and the plane orthogonal to that as the normal vector. But how do you get from a vector to a plane? Is it really just the same coefficients – MsHF Jan 13 '14 at 20:47
• @MsHF 1) Yes the normalization means to make your vector has a length of $1$. For example $\hat{n}_A=\vec{A}/|\vec{A}|$ is the normalized vector in the direction of vector $A$. – MoonKnight Jan 13 '14 at 21:27
• 2) your understanding about $\left( \vec{BD}\cdot\hat{n}_1 \right)\hat{n}_1$ is correct. – MoonKnight Jan 13 '14 at 21:28
• 3) No, the normal vector $\hat{n}_1$ is the vector normal to the reference plane $ABC$. Basically $\left(\vec{BD}\cdot\hat{n}_1\right)\hat{n}_1$ is the $\vec{BD}_\parallel$ mentioned in @Berci's post. And the projection on plane $ABC$ is the $\vec{BD}_\perp$ he mentioned. – MoonKnight Jan 13 '14 at 21:33

1. Obtain the equation of the reference plane by ${\bf n}:=\vec{AB}\times\vec{AC}$, the left hand side of equation will be the scalar product ${\bf n}\cdot{\bf v}$ where $\bf v$ is the (vector from origin to the) variable point of the equation, and the right hand side is a constant, such that e.g. ${\bf v}=A$ has to satisfy it, that is, the equation will be

${\bf n}\cdot{\bf v}={\bf n}\cdot A\,$.

2. Calculate orthogonal and parallel components of $\vec{BD}$ relative to $\bf n$: we look for vectors $\vec{BD}_\perp$ and $\vec{BD}_\|$ such that $\vec{BD}=\vec{BD}_\perp+\vec{BD}_\|$, $\ \vec{BD}_\perp\ \perp\ {\bf n}$ and $\ \vec{BD}_\| \,\parallel\,{\bf n}$.
That means, $\vec{BD}_\|=\lambda{\bf n}$ for some $\lambda\in\Bbb R$ and $\vec{BD}_\perp\cdot{\bf n}=0$. Using this and scalar multiplying by $\bf n$: $$\vec{BD}\cdot{\bf n}=0+\lambda\cdot{\bf n}^2$$ this enables you to compute $\lambda$, hence $\vec{BD}_\|$ then $\vec{BD}_\perp:=\vec{BD}-\vec{BD}_\|$.
3. Do the same for the other reference plane, (one of) its normal vector will be ${\bf n}\times\vec{AB}$.
4. The angle $\varphi$ of vectors ${\bf u}$ and ${\bf v}$ can be calculated by the following formula: $$\cos\varphi=\frac{{\bf u}\cdot{\bf v}}{|{\bf u}|\,|{\bf v}|} \,.$$

• Thank you for your answer @Berci. I had my in-laws here so I'm just returning to work. I'm having a hard time understanding. Here is what I can make sense of: First step is cross product of the two vectors on the reference plane. You then refer to the scalar product of position vector (from origin to point) by n - is this the same as a dot product? I'm lost once you say the right side is a constant such that v=A What is A??? What is lambda (λ)? Is n squared a dot product, cross product or simple multiplication of the length of vector n (which should just be 1 if normalized, yes?) by itself. – MsHF Jan 13 '14 at 20:38