Sorry my math is very weak so it's difficult to research, this seems like it would be an obvious question that gets asked often.
I'm a budding software developer trying to write a watch face. The face is $240 \times 240$, for our purposes just consider $X(-120,+120)$ and $Y(-120,+120)$, easy enough to convert after.
Trying to derive $(X,Y)$ coordinates to draw hands based on hour/minute. Doing this case by case is easy enough. $\text{Minute} \times 6 = \theta$. This $\theta$ gets applied to $\sin / \cos$ depending on it's value.
The problem is writing it in a single function to derive. For example:
if(theta > 0 && theta <= 45) {
X = sin(theta) * 120;
Y = cos(theta) * 120;
}
else if (theta >= 45 && theta <= 90) {
X = cos(theta) * 120;
Y = sin(theta) * 120;
}
Then draw a line from [0,0] to $[X,Y]$.
Depending on the value the formula applied changes. This seems like it's surely a problem that somebody has had before. Any easy formula to account for this? Or it becomes 8 unique cases?
In clock the angle $\theta$ that you compute using $Minute\times6$ is the angle with respect you positive y axis in counter clockwise direction. For this theta you should write position of the minute hand which has a length $l$ as follows $$(x,y)= (l\sin\theta, l\cos\theta)$$ You don't have to worry which quadrant the minute hand is in, as that will be taken care of by the functions of $\sin$ and $\cos$. For example $$\theta=90 \implies(x,y)=(l,0)\\\theta=180 \implies(x,y)=(0,-l)\\\theta=270 \implies(x,y)=(-l,0)$$