I am writing a program that displays an analog clock and I am a little confused on what equations to use in finding the x and y coordinates for the end of the hour and minute hands.

I know the equation for the upper right hand quadrant (12:00-3:00), but I don't know the other equations for the other three quadrants. Here is the code for the upper right hand quadrant;

double fHr // Hour is between 0.0 and 3.0

if (fHr <= 3.0) // Top right quadrant
double angle = ((3.0-fHr)/3.0) * (PI / 2.0);

tipx = (int) (cos(angle) * double(lenHourHand));
tipy = (int) (sin(angle) * double(lenHourHand));


This outputs the right angle for the hand if it is between 12:00 and 3:00, but not for other times. I think that there might just need to be minor changes to the equation for the other three quadrants. Please help me. This is all I have left to figure out for my homework.