Skip to content

Instantly share code, notes, and snippets.

@ryanbillingsley
Created April 22, 2014 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanbillingsley/11194199 to your computer and use it in GitHub Desktop.
Save ryanbillingsley/11194199 to your computer and use it in GitHub Desktop.
Finds a point on a circle with a given radius and degree
#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI))
#define DEGREES_TO_RADIANS(degrees) ((degrees) * (M_PI / 180.0))
- (CGPoint)determinePointOnCircleWithRadius:(int)radius Degree:(int)degree Center:(CGPoint)startPoint
{
float midX = startPoint.x + radius * cos(DEGREES_TO_RADIANS(degree));
float midY = startPoint.y + radius * sin(DEGREES_TO_RADIANS(degree));
return CGPointMake(midX, midY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment