Projection of a 3d vector on a plane

I have the x,y,z coordinats of a vector. X goes from left to right, Y from bottom to up and z into the screen. How can I calculate the projection of the vector on the screen?

In general, when you want the projection of a vector
on a plane, all you need to do is construct a new
vector that is the sum of the vector you have, and
the negative of the projection of the vector you have
to the plane’s normal vector. Does this make sense?
So if you have a vector A and a plane with normal
N, the vector that is resulted by projecting A on
the plane will be B = A - (A.dor.N)N, where B is the
new vector, .dot. represents a dot product operation,
and the quantity in parentheses is multiplying N.

To graphically project the vector you need to know
where the vector is located (assuming the origin of the
vector is not the (0,0,0) point), and you will need
to calculate the coordinates of the point on the
plane where the origin on the vector is projected.
To do this, write the equation of a line in 3D space
that has for slopes the direction cosines of the N
vector. Then, find the fourth coefficient of the
equation by substituting the coordinates of the
origin of the vector for the values x,y,z in the
equation of the line. Now you have all four coefficients,
and thus you have the equation of the line that goes
through the origin of the vector and is perpendicular
to the plane. Use this equation and the equation
of the plane to get the point on the plane where
the origin of the vector is projected (something
like that). It should be easy. Then, with vector
math you can display it.

Lengthy response, but it is all easy stuff!

I assume you know the plane formula, but I’ll post it anyway.

P is the point being evaluated, N is the normalized vector perpendicular to the plane.

//POP means Point On Plane

Plane formula:
//Multiply vectors P and N then add D
P*N+D = DistanceFromPlane;

If you were to add (POPN) to D instead of (PN) you would get zero, because D is actualy the negated version of (POP*N).

Now that you have the distance from the plane, all you have to do to project P onto the plane is this:

//create a new vector the length of
//DistanceFromPlane(DFP) in the direction of
//the normal on the plane
ProjVec=N.xDFP + N.yDFP + N.z*DFP

//subtracting ProjVec from P will place P on your plane

Let me know if you have any questions.


Thank you very much for your replies. I will study them all thouroughly. Of course more replies may come.

There is also always:
(X,Y,Z) -> (X,Y),
which is the orthographic projection; simple to code, easy to get started with.