Last active
April 29, 2018 01:41
-
-
Save erinxocon/f3d4670c036442e558e7fc34cf495d08 to your computer and use it in GitHub Desktop.
toRad and toDeg conversion functions
This file contains hidden or 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
interface Math { | |
toRadians(degrees: number): number; | |
toDegrees(radians: number): number; | |
} | |
// Converts from degrees to radians. | |
Math.radians = (degrees: number): number => { | |
return degrees * Math.PI / 180; | |
}; | |
// Converts from radians to degrees. | |
Math.degrees = (radians: number): number => { | |
return radians * 180 / Math.PI; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment