Calculating the position of points in a circle

JoeBrown picture JoeBrown · Mar 14, 2011 · Viewed 112.6k times · Source

I'm having a bit of a mind blank on this at the moment. I've got a problem where I need to calculate the position of points around a central point, assuming they're all equidistant from the center and from each other.

The number of points is variable so it's DrawCirclePoints(int x) I'm sure there's a simple solution, but for the life of me, I just can't see it :)

Answer

Brian Driscoll picture Brian Driscoll · Mar 14, 2011

Given a radius length r and an angle t in radians and a circle's center (h,k), you can calculate the coordinates of a point on the circumference as follows (this is pseudo-code, you'll have to adapt it to your language):

float x = r*cos(t) + h;
float y = r*sin(t) + k;