Take the 2-minute tour ×

I can easily draw the projection of a 3D set of points onto the plane with normal vector (1,1,1), by using the matrix

    (-sqrt(3)/2   sqrt(3)/2   0)
    (-1/2         -1/2        1).

I want to do the same thing, but for a projection onto an arbitrary plane with normal vector (a,b,c) instead of (1,1,1). How to find the matrix?

Thanks in advance!

EDIT: rephrasing of the question:

When viewing from (1,1,1), the three unit vectors are projected to (-sqrt(3)/2, -1/3), (sqrt(3)/2, -1/2), (0,1). (Up to a scaling factor which doesn't matter.)

I want to find the projection of the three unit vectors when viewed from (a,b,c) instead of (1,1,1).

share|improve this question
possible duplicate of 3d to 2d Projection Matrix –  Joren May 21 '10 at 9:58
It is not, this other questions asks the same thing, but supposing he already knows the (x, y) coordinates of three projected points; I don't. –  leipäjuusto May 21 '10 at 10:02

2 Answers 2

Back when I wrote such a code, I simply used wikipedia's nice article on this topic.

There are additional ressources available here and here. There is also a related question on SO.

share|improve this answer
Thanks; I have read this article but it assumes that "the normal of the viewing plane (the camera direction) is parallel to one of the 3D axes", which is not my case. –  leipäjuusto May 21 '10 at 10:04
I recall having a similar issue, but it was rather easy to work around. How about first projecting (as described) then rotating the viewing plane so it becomes the XY plane? The rotation is quite simple code. Does that work for you? –  mafu May 21 '10 at 10:21
What projection do you mean? I would like to encode both the projection and the rotation in my 2*3 matrix. (2*3 is possible because I assume all the planes to lie on the origin, so there's no dependence on a base point or something.) –  leipäjuusto May 21 '10 at 13:24
I mean the projection on the viewing plane. –  mafu May 21 '10 at 14:59
OK, that sounds fine. I have done the projection part and I am very glad now it works; I achieved the main part of what I wanted. But now, the rotation would be a "bonus", to rescale my result nicely. Is it possible to encode the rotation in a 2*3 matrix to have the (x,y) coordinates from the (x,y,z) coordinates, starting from the normal vector (a,b,c)? –  leipäjuusto May 21 '10 at 16:35

I'm afraid you're can't stuck with 3x2 matrix in arbitrary plane case. Here is a great paper for exactly what you're looking for.

share|improve this answer

Your Answer


