TITLE: Calculating point on a circle, given an offset?
QUESTION [6 upvotes]: I have what seemed like a very simple issue, but I just cannot figure it out.  I have the following circles around a common point:

The Green and Blue circles represent circles that orbit the center point.  I have been able to calculate the distance/radius from the point to the individual circles, but I am unable to plot the next point on either circle, given an angle from the center point.  Presently, my calculation looks like the following:
The coordinates of one of my circles is:
y1 = 152
x1 = 140.5

And my calculation for the next point, 1 degree from the starting point (140.5,152) is:
distance = SQRT((160-x1)^2 + (240-y1)^2) = 90.13
new x = 160 - (distance x COS(1 degree x (PI / 180)))
new y = 240 - (distance x SIN(1 degree x (PI / 180)))

My new x and y give me crazy results, nothing even close to my circle.
I can't figure out how to calculate the new position, given the offset of 160, 240 being my center, and what I want to rotate around.  Where am I going wrong?
Update:
I have implemented what I believe to be the correct formula, but I'm only getting a half circle, e.g.
x1 = starting x coordinate, or updated coordinate
y1 = starting y coordinate, or updated y coordinate    
cx = 100 (horizontal center)
cy = 100 (vertical center)

radius = SQRT((cx - x1)^2 + (cy - y1)^2)
arc = ATAN((y1 - cy) / (x1 - cx))
newX = cx + radius * COS(arc - PI - (PI / 180.0))
newY = cy + radius * SIN(arc - PI - (PI / 180.0))

Set the values so next iteration of drawing, x1 and y1 will be the new
base for the calculation.
x1 = newX
y1 = newY


The circle begins to draw at the correct coordinates, but once it hits 180 degrees, it jumps back up to zero degrees.  The dot represents the starting point.  Also, the coordinates are going counterclockwise, when they need to go clockwise.  Any ideas?

REPLY [2 votes]: We can modify 6312's suggestion a bit to reduce the trigonometric effort. The key idea is that the trigonometric functions satisfy a recurrence relation when integer multiples of angles are considered.
In particular, we have the relations
$$\cos(\phi-\epsilon)=\cos\,\phi-(\mu\cos\,\phi-\nu\sin\,\phi)$$
$$\sin(\phi-\epsilon)=\sin\,\phi-(\mu\sin\,\phi+\nu\cos\,\phi)$$
where $\mu=2\sin^2\frac{\epsilon}{2}$ and $\nu=\sin\,\epsilon$. (These are easily derived through complex exponentials...)
In any event, since you're moving by constant increments of $1^\circ$; you merely have to cache the values of $\mu=2\sin^2\frac{\pi}{360}\approx 1.523048436087608\times10^{-4}$ and $\nu=\sin\frac{\pi}{180}\approx 1.745240643728351\times 10^{-2}$ and apply the updating formulae I gave, where your starting point is $\cos\,\phi=\frac{140.5-160}{\sqrt{(140.5-160) ^2+(152-240)^2}}\approx-0.2163430618226664$ and $\sin\,\phi=\frac{152-240}{\sqrt{(140.5-160) ^2+(152-240)^2}}\approx-0.9763174071997252$