Meonardo - 11 months ago 87

Objective-C Question

Answer Source

From your comment you appear to want to determine the coordinates of the centres of your five circles for a given rotation. The centres will all lie on a circle. So your question boils down to what are the coordinates of a point on a circle of radius *r* for an angle *θ*. The parametric equations for a circle give you that:

x=rcosθ

y=rsinθ

The angle, *θ*, in these equations is measured in *radians* from the positive x-axis in an anti-clockwise direction. If your angle are in degrees you will find the `M_PI`

constant for *π* useful as:

360 degrees = 2

πradians

The rest is simple math, take your angle of rotation to give you the angle for A (remembering to adjust for 0 being the x-axis and measuring anti-clockwise if needed), the other centres are multiples of 72 degrees (0.4 *π* radians) from this.

HTH