Skip to content

Instantly share code, notes, and snippets.

@erinxocon
Last active April 29, 2018 01:41
Show Gist options
  • Save erinxocon/f3d4670c036442e558e7fc34cf495d08 to your computer and use it in GitHub Desktop.
Save erinxocon/f3d4670c036442e558e7fc34cf495d08 to your computer and use it in GitHub Desktop.
toRad and toDeg conversion functions
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