-
-
Save joepol/0a5552744c2aefe23da0ce72692b7d17 to your computer and use it in GitHub Desktop.
Convert degrees <-> radians [C++]
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
#include<math.h> | |
const double DEG_TO_RAD = (M_PI / 180.0); | |
const double RAD_TO_DEG = (180.0 / M_PI); | |
inline double DegreesToRadians(double angleDegrees){ | |
return angleDegrees * DEG_TO_RAD; | |
} | |
inline double RadiansToDegrees(double angleRadians){ | |
return angleRadians * RAD_TO_DEG; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment