Created
February 12, 2013 21:43
-
-
Save dbrockman/4773655 to your computer and use it in GitHub Desktop.
Convert degrees <-> radians.
Taken from Google Closure lib.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts degrees to radians. | |
* @param {number} angleDegrees Angle in degrees. | |
* @return {number} Angle in radians. | |
**/ | |
function degreesToRadians(angleDegrees) { | |
return angleDegrees * Math.PI / 180; | |
} | |
/** | |
* Converts radians to degrees. | |
* @param {number} angleRadians Angle in radians. | |
* @return {number} Angle in degrees. | |
**/ | |
function radiansToDegrees(angleRadians) { | |
return angleRadians * 180 / Math.PI; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment