Posted by & filed under Coding.

There are two ways to measure angles.

You probably learned to measure angles in degrees early in school. A circle has 360 degrees, a perfect corner is a 90 degree angle, and 180 degrees forms a straight line.

1 radian is when the radius is equal to the arc created

1 radian is when the radius is equal to the arc created

But then you took trigonometry or pre-calculus and were introduced to a radian. A radian does the same thing as a degree. It’s a way to measure an angle. But instead of going 0 to 360 like degrees, radians go from 0 to [latex]2 \pi[/latex].

The image to the right, sourced from Wikipedia, shows that 1 radian is the angle created when the ratio between the radius and arc along the circle is 1.

What happens with most people is that a degree makes more sense than a radian because degree was learned first. Similar idea to going between imperial and metric measurements. If you grew up in the US, measuring in inches probably makes more sense than centimeters. Can’t speak for everybody, but I have the same vibe measuring in centimeters and radians compared to inches and degrees.

Why?

The catch is that much of what we need to do with angles involves trigonometry, and trig uses radians. So we can work in radians, but there will also be times when we have to convert back and forth between radians and degrees.

Formulas

The conversion formulas to go from radians to degrees or degrees to radians are inverses of each other.

[latex]\LARGE \mbox{radians} = \mbox{degrees} \times \frac {\pi}{180}[/latex]

 

[latex]\LARGE \mbox{degrees} = \mbox{radians} \times \frac{180}{\pi}[/latex]

With Code

Since you can’t type [latex]\pi[/latex] into your IDE, you’ll need to use something else. For most cases, using an approximation of [latex]\pi[/latex] like 3.1415 is probably close enough.

Most languages do have a constant for [latex]\pi[/latex]. For Java and ActionScript it’s Math.PI. Python uses math.pi.

So in ActionScript, we could use the following two conversions.

radians = degrees * Math.PI / 180;
degrees = radians * 180 / Math.PI;

Leave a Reply

Your email address will not be published. Required fields are marked *