Archived

This topic is now archived and is closed to further replies.

Vector to degrees

This topic is 5650 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I''ve got a (hopefully) simple question: How can I convert a unified 2D Vector into a single degree-value? e.g. (just estimated) 0,1 -> 0 1,1 -> 45 1,0 -> 90 1,-1 -> 135 0,-1 -> 180 ...... Do you have any ideas? Thanks!!!!!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
use arctan(), which converts x/y values into degrees. This should be standard in your compiler''s math library.

------------------------------------------------
The wind shear alone from a pink golfball can take the head off a 90-pound midget from 300 yards.

-Six String Samurai

Share this post


Link to post
Share on other sites
This might also help:

if v is your vector and & the angle from initial position

sin& = y/|v|
and
cos& = x/|v|

since your vector is a unit

sin& = y
cos& = x

Usually, however, there are ways to avoid trig if you are using vectors.


"Free advice is seldom cheap."

Share this post


Link to post
Share on other sites