Jump to content
  • Advertisement

Archived

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

TheBlackJester

Converting MSVC++ from radians to degrees

This topic is 6002 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

Hey, It seems as though MSVC++ works in radians rather than degrees. I know i can get around it by using DegToRadian functions and stuff but i'll lose accuracy in my calculations that way. Is there any way to set MSVC++ to read it in degrees instead? 'Very funny, Scotty. Now beam down my clothes.' - Edited by - TheBlackJester on January 13, 2002 1:59:16 AM

Share this post


Link to post
Share on other sites
Advertisement
Use a preprocessor macro (#define) to convert it for you at compile time so there is no loss in performance, and you gain the readability you want.

- Kevin "BaShildy" King
Game Programmer: DigiPen
www.mpogd.com

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Remember, there are 2*PI radians in a circle. So 360 degrees ~= 2 * PI radians. So to convert degrees to radians, just do this:

#define DEG2RAD(deg) (PI/180 * deg)

someFunctionDegrees(DEG2RAD(360));

Hope this helps!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Using radians is more accurate than degrees since they''re expressed with floats.

Share this post


Link to post
Share on other sites
Thnx,

Its true that they are expressed with floats, but if my angle is some number in degrees and I then convert that to radians, I lose data because of the non-exactness of conversion. In my case i need my camera to not be moving on the X axis if a given angle is 0, but since it was converted to radians its actually 0.010221 and is causing my cam to "float". This is un acceptable

''Very funny, Scotty. Now beam down my clothes.'' -

[TheBlackJester]

Share this post


Link to post
Share on other sites
Why not just use radians everywhere and not bother about conversions anywhere? Unless you have to have the user entering angles or reading angles, then I see no reason to use degrees.

Trying is the first step towards failure.

Share this post


Link to post
Share on other sites
There''s also no rule saying that you need an integer number of degrees! You can use floating points for radian angles AND degree angles.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!