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!

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.

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.

We can describe $${\bf v}$$ as a sum of two vectors; one that is perpendicular to the normal vector $${\bf w}$$ (denoted by $${\bf v}_\perp$$), and another that is parallel to the normal vector $${\bf w}$$ (denoted by $${\bf v}_\parallel$$).

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

$${\bf v}_\parallel$$ is given by $${\bf v}_\parallel = {{\bf v}\cdot{\bf w}\over\Vert{\bf w}\Vert^2} {\bf w}$$ Then $${\bf v}_\perp = {\bf v} - {{\bf v}\cdot{\bf w}\over\Vert{\bf w}\Vert^2} {\bf w}$$

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

• I know it's been a while, but why would w⊥v⊥ hold? Shouldn't that be w⊥(v⊥-(d,e,f))? Dec 31, 2018 at 17:55

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$ .

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.