Results 1 to 4 of 4

Thread: Quickie Vector question

  1. #1
    Zaei
    Guest
    If i have a 2D direction vector, how can I get the facing in degrees? Thanks.

    Z.

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    "facing"?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    VirtuallyVB
    Guest
    tangent Theta = deltaY / deltaX

    So, your vector may be in the form (Xstart,Ystart) to (Xend,Yend)

    So
    Theta = ArcTan ( (Yend-Ystart) / (Xend-Xstart) )

    Watch your quadrant and radians/degrees
    "atan2" can handle the the quadrant issue.

    Degrees * PI / 180 = Radians

  4. #4
    Zaei
    Guest
    Much thanks =).

    Z.

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