SFML community forums

General => General discussions => Topic started by: Cornstalks on September 21, 2014, 10:07:24 pm

Title: Do you use radians or degrees?
Post by: Cornstalks on September 21, 2014, 10:07:24 pm
SFML uses degrees. In my experience, it's the only thing that uses degrees (except for old, deprecated, and removed OpenGL stuff, which I ignore in this modern era).

I always use radians for things. Standard C and C++ trig functions take radians. OpenGL shader trig functions take radians. HLSL trig functions take radians. Whenever I do various geometric things I use radians. Honestly, the only time I ever "use" degrees is when I'm reporting them to the user; but even then I'm not really using radians; I'm just formatting the number as degrees for printing to screen. Whenever I actually use an angle, I use radians.

What about others? When do you use radians? When do you use degrees? How often do you need one or the other?

Side note: this isn't a "SFML should use radians" feature request, so I'm not looking to debate whether SFML should be radians/degrees. That kind of debate can happen in another thread. I'm trying to understand what users of SFML use, in real life.
Title: Re: Do you use radians or degrees?
Post by: Nexus on September 21, 2014, 10:31:41 pm
For game development, I use degrees. All the trigonometric operations are abstracted in Thor.Vectors (http://www.bromeon.ch/libraries/thor/v2.0/doc/group___vectors.html) so that I never have to convert anything. In fact, cases where I need to call sin, cos or atan2 directly have become extremely rare.

When talking about high-level logic, i.e. angles applied in geometric scenarios rather than pure mathematics, I find it much simpler and expressive to rotate something by 45 than by Pi/4, where Pi is a constant that requires another header.
Title: Re: Do you use radians or degrees?
Post by: Tex Killer on September 21, 2014, 10:38:46 pm
The content code for my engine always uses angles as degrees. I think some time or another I have to use radians on my engine's internal code to compute some geometric stuff, but never on content code. Degrees are just easier to understand and to deal with, even though radians are a little easier to use on computations.
Title: Re: Do you use radians or degrees?
Post by: wintertime on September 22, 2014, 12:33:30 pm
I think its best to try to avoid angles using vector math, because angles get nearly always fed to some trig. functions and only the result of these is needed. Doesn't apply here, but gimbal lock can be a problem sometimes.
If it cant be avoided then radians are better, because most libraries are using them (following one standard makes it less complicated and needs less unnecessary conversions or even double conversions that would reduce accuracy). They are also not any more difficult to understand than degrees for a programmer.
Title: Re: Do you use radians or degrees?
Post by: deathes on September 25, 2014, 02:16:24 pm
I too use degrees for game development.