in reply to algorithm help -- how to label a clock

The only "secret" is that you are determining the location of the center of the label ... not its upper-left edge ... and "zero degrees" points straight up. The numbers are 360 / 12 = 30 degrees apart. There are 2*pi radians in a circle. The diameter is some known quantity. The X and Y offsets are calculated by cos() and sin().
  • Comment on Re: algorithm help -- how to label a clock

Replies are listed 'Best First'.
Re^2: algorithm help -- how to label a clock
by Anonymous Monk on Jun 17, 2011 at 17:00 UTC
    When it comes down to it the only real difficulty is deciding how you are going to justify the labels -- and you aren't necessarily going to key off the center of the labels. It depends if you are placing the number inside the circle, with the hands sweeping over them, outside the circle, or something in between. The look and "best" spacing will also be affected by what labels you use (arabic, roman, etc...)