Jump to content
  • Advertisement

Archived

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

VanKurt

Vector to degrees

This topic is 5992 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
Advertisement
Guest Anonymous Poster
inverse tan

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
Whats the application ?
If you say what it is for, maybe we can help you avoid trig altogether.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!