# How do I find the projection of a point onto a plane

Lets say I have the point $(x, y, z)$ and the plane with normal $(a, b, c)$ with the point $(d, e, f)$. I am trying to use this in $3D$ programming. Thank you!

-

## 4 Answers

You want to find $t$ such that $(x+ta,y+tb,z+tc)$, $(x,y,z)$, and $(d,e,f)$ form a right angled triangle, with the first of these (the point you are looking for) being the right angle. You can do this with dot products, and this will give you

$$t = \frac{ad-ax+be-by+cf-cz}{a^2+b^2+c^2}.$$

Substitute this into $(x+ta,y+tb,z+tc)$ and you have your result.

-

You have to take the parallel line to the normal vector in the point $(x,y,z)$ and the projection will be the intersection of this line whit the plane.

-

Let us denote your point as $(x_0,y_0,z_0)$ instead of $(x,y,z)$ and projection as $(x'_0,y'_0,z'_0)$

Parametric equation of the line that passes through point and its projection is given by :

$x'_0=x_0+a\cdot t$

$y'_0=y_0+b\cdot t$

$z'_0=z_0+c\cdot t$

Equation of the plane is :

$a \cdot(x-d)+b\cdot(y-e)+c\cdot(z-f)=0$

Now , since point $(x'_0,y'_0,z'_0)$ belongs to the plane you have to substitute its coordinates into equation of the plane instead of $x,y,z$ and calculate parameter $t$ .

-

Take the displacement vector from the point in the plane to the given point: $${\bf v}=(x-d , y-e, z-f)$$ and let ${\bf w}$ be the normal vector to the plane.

If you set $${\bf v}_\parallel = {{\bf v}\cdot{\bf w}\over\Vert{\bf w}\Vert^2} {\bf w}$$ and $${\bf v}_\perp = {\bf v}-{\bf v}_\parallel$$ Then

$\ \ \ \ {\bf v}={\bf v}_\parallel +{\bf v}_\perp$,

$\ \ \ \ {\bf w}\perp{\bf v}_\perp$,

$\ \ \ \ {\bf w}\parallel {\bf v}_\parallel$.

From this, the required point is $(d,e,f)+{\bf v}_\perp$.

-