Converting MSVC++ from radians to degrees
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
You post has nuked this thread (I''m not sure what''s wrong). However: When does MSVC ask for degrees or radians? The math libraries aren''t part of MSVC if that''s what you mean. Maybe there''s something I''ve missed in MSVC...
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
Sorry about the nuke, it was my sig that i messed up.
Yeah, i guess your right about it being in the math files so theres really no way to change it
Yeah, i guess your right about it being in the math files so theres really no way to change it
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
- Kevin "BaShildy" King
Game Programmer: DigiPen
www.mpogd.com
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!
#define DEG2RAD(deg) (PI/180 * deg)
someFunctionDegrees(DEG2RAD(360));
Hope this helps!
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]
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]
Double precision?
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
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.
Trying is the first step towards failure.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement