Skip to content

Instantly share code, notes, and snippets.

@afrael
Created May 21, 2012 13:36
Show Gist options
  • Save afrael/2762366 to your computer and use it in GitHub Desktop.
Save afrael/2762366 to your computer and use it in GitHub Desktop.
Converting Radians to Degrees
#define RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__) * 57.29577951f) // PI * 180
-(float32) getRotatingAngle : (CGPoint)firstPoint secondPoint:(CGPoint)secondPoint
{
float dx = firstPoint.x - secondPoint.x;
float dy = firstPoint.y - secondPoint.y;
float angle = RADIANS_TO_DEGREES(atan2(dy, dx));
return angle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment