Having a circle $\circ A(x_a, y_a)$ of radius $R$ and a point on the circle $B(x_b, y_b)$, how can we rotate the point with a known angle $\alpha$ (radians or degrees, it doesn't really matter) on the circle so we will obtain a new point on the circle $C(x_c, y_c)$, like in the image below?
How to calculate the $C$ coordinates?
Here the rotation angle is $90 ^ {\circ}$. In this example, $x_b = x_a$, $y_b = R$, $\alpha = 90 ^ \circ$. From the image we see that $x_c = R$ and $y_c = y_a$.
However, I want a general solution for any $A, B, R$ and $\alpha$.
Best Answer
Let's look at a simpler problem. Suppose you have the situation depicted in the figure below:
Then, given the angle $\alpha$, the coordinates of the point $C''$ are:
$$ C''_x = r\cos\alpha \qquad\mbox{and}\qquad C''_y = r\sin\alpha $$
where $r$ is the radius of the circle.
Now let's look at a slightly more complicated problem, depicted below:
This is very similar to the situation above. In fact,
$$ C'_x = r\cos(\alpha+\beta) \qquad\mbox{and}\qquad C'_y = r\sin(\alpha+\beta) $$
By using the trigonometric relations $\sin(\alpha+\beta) = \sin\alpha\cos\beta + \sin\beta\cos\alpha$ and $\cos(\alpha+\beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta$, we can write the above as follows:
$$ C'_x = r\cos\alpha\cos\beta - r\sin\alpha\sin\beta \qquad\mbox{and}\qquad C'_y = r\sin\alpha\cos\beta + r\sin\beta\cos\alpha $$
But, wait... By looking at the previous situation and replacing $C''$ with $B'$ and $\alpha$ with $\beta$, we see that
$$ B'_x = r\cos\beta \qquad\mbox{and}\qquad B'_y = r\sin\beta $$
Therefore, we can write
$$ C'_x = B'_x\cos\alpha - B'_y\sin\alpha \qquad\mbox{and}\qquad C'_y = B'_x\sin\alpha + B'_y\cos\alpha $$
But what you want is this, instead:
Well, we can just move everything rigidly by the vector $-\vec{OA}$ so that $A$ is now the origin of the coordinate system and we get the situation just above. This amounts to subtracting $A$ from both $B$ and $C$ to get $B'$ and $C'$ in the above, and we find
$$ C_x - A_x = (B_x-A_x)\cos\alpha - (B_y-A_y)\sin\alpha $$ $$ C_y - A_y = (B_x-A_x)\sin\alpha + (B_y-A_y)\cos\alpha $$
Then, finally,
$$ C_x = A_x + (B_x-A_x)\cos\alpha - (B_y-A_y)\sin\alpha $$ $$ C_y = A_y + (B_x-A_x)\sin\alpha + (B_y-A_y)\cos\alpha $$