Results 1 to 3 of 3

Thread: Point, add a distance in a vector direction....

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved Point, add a distance in a vector direction....

    I am tooo tired for this....Well lets say that I have a point:


    1, 5, 20



    and a LOOK direction vector that is:


    250, 148, 120


    And I want to add 600 to the point in THAT direction.....what am I supposed to do again...


    PS:I hate to do math and 3D programming when I am drunk.....
    Last edited by NoteMe; Nov 18th, 2004 at 08:49 PM.

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    First off you need to work out how long the look vector is so we can normalise it:

    LookLen = sqrt(250^2 + 148^2 + 120^2)

    Lx = 250 / LookLen
    Ly = 148 / LookLen
    Lz = 120 / LookLen

    Now we add the 600 using the normalised vector to distrubute the 600 ...

    Nx = 1 + (Lx * 600)
    Ny = 5 + (Ly * 600)
    Nz = 20 + (Lz * 600)

    New Position is (Nx, Ny, Nz)
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    You are my drunken master.....glad I all ready have a Normalize function in my Math class..

    Thanks a bunch...glad you are still awayke or this would have taken me all night....I am even to drunk to find my math book...


    Thanks ØØ

Posting Permissions

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



Click Here to Expand Forum to Full Width