Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: A Simple Question about Projection

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    152

    A Simple Question about Projection

    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.

  2. #2
    Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    352

    Re: A Simple Question about Projection

    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
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    152

    Re: A Simple Question about Projection

    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.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jun 2010
    Posts
    152

    Re: A Simple Question about Projection

    Sorry for the above posting. Both work the same way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •