Jump to content
  • Advertisement

Archived

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

DuncanBojangles

Degrees to Radians

This topic is 5654 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, I just finished up the physics section of my current game and the reason it wasn''t working in the first place was because of degrees and radians. When I use the trigonometric functions(sine, cosine, tangent), they only work as I want them to when I change my degrees to radians. If I don''t change them, the math does not work properly. Could anyone tell me why this happens? We never encountered anything like this in Trigonometry class, except she said something about using degrees, you''re left with weird degrees in your formula dimensions. "Donkey, if it were me, you''d be dead." I cna ytpe 300 wrods pre mniute.

Share this post


Link to post
Share on other sites
Advertisement
degrees to radians? I have to change from radians to degrees. This is because the trigonometric functions return in radians as opposed to degrees.

Share this post


Link to post
Share on other sites
quote:
Original post by tHiSiSbOb
degrees to radians? I have to change from radians to degrees. This is because the trigonometric functions return in radians as opposed to degrees.


No, he''s right. sin() accepts radians and not degrees. That''s why it only works with radians.




-~-The Cow of Darkness-~-

If you see the image I am online

Check out PGNet.tk

Share this post


Link to post
Share on other sites
Well if your function is expecting radians then then the input passed in needs to be radians. if it is expecting degrees then degrees have to be passed. This would explain the odd behavior as a function designed for one is not compatible with the other unless a conversion is made.

Share this post


Link to post
Share on other sites
DuncanBojangles, I think you will find that in almost all real world applications (from trig to calculus and beyond where calculations are concerned) you will find radians used over "degrees". Computing is no exception either. Though it is easier to visualize degrees in angles than some not so common radian measures.

Share this post


Link to post
Share on other sites
Multiply your degree by PI over 180. Better yet, make it a constant:
#define RADIAN ((float) 0.017453292f);

And an example: sin(angle*RADIAN);

Share this post


Link to post
Share on other sites
Radians aren''t too hard to work with, if you think in terms of multiples of pi so you don''t have to look at all those irrational numbers.


45 degrees = 1/4 pi radians = 0.7853... radians
90 degrees = 1/2 pi radians = 1.5708... radians
180 degrees = pi radians = 3.1416... radians
360 degrees = 2 pi radians = 6.2832... radians

Share this post


Link to post
Share on other sites
Thanks for telling me that the c++ trig functions only accept radians, cowsarenotevil. That is something I did not know.

"Donkey, if it were me, you''d be dead."
I cna ytpe 300 wrods pre mniute.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!