PDA

View Full Version : A Simple Question about Projection



jenny_wui
09-26-2010, 06:18 AM
Suppose, I have two points A(x1, y1, z1) and B(x2, y2, z2). Vector from A to B is {(x2-x1), (y2-y1), (z2-z1)}.

Now I have another vector from point A towards another point C. I only know the direction of AC.

Now I want to project vector AB on AC and try to find out the point B1 on AC resulting from this projection.

Could anyone tell me how to find point B1?

Thanks everybody in advance.

Rosario Leonardi
09-26-2010, 07:35 AM
Assuming that AC is normalized you can compute the dot product of AB and AC to find the cos(theta)*modulus(AB). Where theta is the angle between AB and AC.

So the final point will be:
B1= A+(AB dot AC)*AC

jenny_wui
09-26-2010, 08:28 PM
Thank you very much for your answer. Just to clarify, won't it be like this:

B1 = A + (ABcos(theta))*AC where AB is the length and AC is unit normal. And cos(theta) should be found out as follows:

cos(theta) = AB*AC/|AB| as AC is already normalized?

Thanks again in advance.

jenny_wui
09-27-2010, 12:11 AM
Sorry for the above posting. Both work the same way.