The plane is given by the equation $Ax+By+Cz+d = 0$. Can you tell me how can I figure out the 4x4 matrix which orthogonally projects any point given by homogeneous coordinates onto this plane?

I am using homogeneous coordinates, so a point is given by 4 values: $\vec{Q} = [xh,yh,zh,w]$, which in 3D space is $[xh/w, yh/w, zh/w]$.

  • $\begingroup$ Wouldn't that be a $3 \times 3$ matrix? $\endgroup$ – Joachim Jan 21 '14 at 10:35
  • $\begingroup$ I am using homogeneous coordinates, so a point in the 3D space is represented by 4 values instead of 3. Transforming these [xh,yh,zh,w] vectors, I have to use 4x4 matrices. $\endgroup$ – Kalevi Jan 21 '14 at 10:37
  • $\begingroup$ But the equation for your plane is in affine (i.e. not homogeneous) coordinates! $\endgroup$ – Joachim Jan 21 '14 at 10:39
  • $\begingroup$ Yes. But I can't see why this is a problem. Both the point and the plane are in the 3D space. [xh,yh,zh,w] in 3D space is [xh/w, yh/w, zh/w]. $\endgroup$ – Kalevi Jan 21 '14 at 10:41
  • $\begingroup$ There's nothing wrong with it, per se. However, when posting a question it is best to include all information and to be as clear as possible, so you get the best answer the fastest.. =) $\endgroup$ – Joachim Jan 21 '14 at 10:48

I'll start by looking about how you can describe the projection of an arbitrary point $Q$ onto your plane, then derive a matrix notation from that.

Projecting a single point

The point $Q$ and its projection form a line which is perpendicular to the plane. All these perpendicular lines meet in a point $F=(A,B,C,0)^T$, which is the point at infinity orthogonal to your plane. A generic point on the line connecting $Q$ and $F$ can be described as a linear combination $Q+\lambda F$. (This inhomogenous formulation using a single parameter excludes $F$ itself, which is all right since $F$ will not be the projected point in any case.) Now you are looking for the point where this line connecting $F$ and $Q$ intersects the plane, i.e. $\left<Q+\lambda F,h\right>=0$, where $h=(A,B,C,D)^T$ is the vector describing your plane. This you can solve for $\lambda$:

$$\left<Q+\lambda F,h\right>=\left<Q,h\right> + \lambda\,\left<F,h\right>=0\\ \lambda=-\frac{\left<Q,h\right>}{\left<F,h\right>}$$

To avoid the division, you can also use a multiple of that point:

$$Q+\lambda F\;\sim\; \left<F,h\right>\,Q - \left<Q,h\right>F $$

This is the projection of a generic point $Q$.

Finding the matrix

If you assume the coordinates of $Q$ to be variables, then the coordinates of the result will be linear in these variables, so you can interpret the whole operation as a linear map and therefore write it as a matrix. You can also find the formula of that matrix like this:

$$ \left<F,h\right>\,Q - \left<Q,h\right>F = \left<F,h\right>\mathbb 1\cdot Q - Fh^T\cdot Q = \left(\left<F,h\right>\mathbb 1 - Fh^T\right)Q \\ = \begin{pmatrix} B^{2} + C^{2} & -A B & -A C & -A D \\ -A B & A^{2} + C^{2} & -B C & -B D \\ -A C & -B C & A^{2} + B^{2} & -C D \\ 0 & 0 & 0 & A^{2} + B^{2} + C^{2} \end{pmatrix}\cdot Q $$

If anyone reading this post should be interested in central instead of orthogonal projection, simply use that center of projection as $F$, and the above formula will help you compute the matrix for that as well.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.