(For all Game Math Cookbook postings, click on the Game Math tag.)
When working with angles, I’m used to degrees. 90 degrees is a right angle, 360 degrees is a full circle. But in Game Math, Radians are commonly used. What are they, why do they exist and how would I use them?
Well, radians are derived from π (pi). 180 degrees would be 3.14…. radians, or more exactly, 180 degrees is exactly π radians. Thus, 360 degrees is 2*π, 90 degrees is π/2, 45 degrees is π/4 etc. There is a beautiful explanation (with pictures) on MathIsFun.com which should make it very clear what radians are.
What’s interesting is the fact that most people think of degrees as the normal way to measure angles (because that’s taught in schools) is due to some ancient way of using starts in the sky as a measurement. BetterExplained.com does a good way of explaining that.
Now, the question is: Why do Games tend to use radians instead of degrees? One explanation that I found is that the 80387 co-processor had hardware-operations for calculating sine and cosine, but it expected radians:
When complete, this function replaces the contents of ST with COS(ST). ST, expressed in radians, must lie in the range 3i3 < 2^(63) (for most practical purposes unrestricted). If ST is in range, C2 of the status word is cleared and the result of the operation is produced.
At that time, the x87 co-processors offered pretty significant speed boosts and from what I’ve seen, it’s still widely used (e.g., the .net JITter translated
Math.Sin() calls to an fsin instruction at least in 2004). I’ve opened a question on GameDev StackExchange and the answer (and DMGregory’s comment) seem to make a clear case for the question being wrong: We shouldn’t ask “Why use radians” but rather “Why would you ever use degrees?”.