-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|554|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Advanced Techniques


 
shroom_monk
Created : 18 September 2013
Edited : 18 September 2013

Maths 101 - Episode 0: Degrees and Radians

An introduction to a series of maths articles, starting with an overview of degrees and radians

Hello everyone! So, I've decided to write a few articles on various interesting bits of maths, most of which will probably be applicable to some coding task or another, as well as for general interest. Different topics will be split across different posts, and we'll see how it goes! I'm open to any questions or requests.

Degrees

Chances are you already know what degrees are, but I'm going to briefly define them here for ease of comparison to radians in a minute.

Degrees are a unit, but rather than measuring length, weight or time, they measure angles. A full rotation is defined to be 360 degrees. Why 360? It's a hang-on from the base-60 counting methods of old, and is useful because 360 is actually divisible by quite a lot of numbers.



We use degrees because they're easy for us to deal with. But if you've ever done any coding with trigonometric functions (sin, cos, etc, which I'll cover next time), you may have found, depending on the language you're using, that the functions do not give the results you expect. This is probably because those functions were set to use radians rather than degrees.

Radians

Radians are a different unit for measuring angles, like how metres and feet are different measures for length. One radian is approximately equal to 57.3 degrees, but this is not a good definition.

The true definition of a radian is this: imagine you have a sector of a circle (shown below). This sector will enclose an angle, which we shall call theta (theta, written θ, is the Greek letter often used to represent angles), and will also have a radius, which we shall call r.

The angle theta will have a value of 1 radian if the length of the arc that encloses the sector is equal to r, the radius.



Simple! But why should we care? Surely degrees are a much more intuitive way of measuring angles? Well, it turns out that the radian has lots of interesting mathematical properties that make it much easier to do maths if we use radians instead of degrees.

For instance: the ratio of the radius of a sector to the length of its arc is constant, so if we have a sector with angle theta radians, then the length of the arc is equal to theta * r. Now, there are exactly 2*pi radians in a complete rotation, so as a consequence of this, the circumference of a circle is the angle it encloses multiplied by its radius - so 2 * pi * r!

Summary

  • We usually use degrees to measure angles because they're easy to comprehend.
  • Radians are an alternative unit, where a circle sector whose arc is the same length as its radius is said to enclose an angle of 1 radian.
  • The length of a circle sector's arc is the angle it encloses multiplied by its radius.
  • There are 2PI radians in a circle, so 180 degrees = PI radians.
  • Different programming languages will have their maths libraries set to use either radians or degrees, but many will use radians because they have many useful mathematical properties. Usually, maths libraries will provide a conversion function between the two units.

So, that's degrees and radians. I thought it would be useful to get this out of the way now, to avoid problems for next time, when we will look at some trigonometry.

BONUS ROUND: Gradians

This section is something of an extended footnote for those who are interested, and can happily be ignored. Gradians (or grads) are a third unit for angles, which you may have noticed floating around if you've ever played about with a scientific calculator.

Gradians were invented by the French back when the metric system was gaining popularity. They figured it would be good to measure our angles in metric as well, so invented grads, where one right angle was equal to 100 grads (rather than 90 degrees), making one full rotation equal to 400 grads.

Of course, 360 is divisible by many more numbers than 400 (for instance, the very useful 30 degrees is an awkward 33â…“ grads), so it never caught on. They're all but forgotten now, and serve no particularly useful purpose.

 

Comments