## Friday, June 05, 2020

### All the symmetrical watch faces (and code to generate them)

If you ever look at pictures of clocks and watches in advertising they are set to roughly 10:10 which is meant to be the most attractive (smiling!) position for the hands. They are actually set to 10:09.14 if the hands are truly symmetrical.

I wanted to know what all the possible symmetrical watch faces are and so I wrote some code using Processing. Here's the output (there's one watch face missing, 00:00 or 12:00, because it's very boring):

The key to writing this is to figure out the relationship between the hour and minute hands when the watch face is symmetrical. In an hour the minute hand moves through 360° and the hour hand moves through 30° (12 hours are shown on the watch face and 360/12 = 30).

The core loop inside the program is this:
`  for (int h = 0; h <= 12; h++) {    float m = (360-30*float(h))*2/13;    int s = round(60*(m-floor(m)));    int col = h%6;    int row = floor(h/6);    draw_clock((r+f)*(2*col+1), (r+f)*(row*2+1), r, h, floor(m), s);  }`
h is the hour number, m the number of minutes past the hour and s the number of seconds past the minute. As you can see, the loop looks at the hours 0 to 12 and then calculates the minutes and seconds using this formula:
`    float m = (360-30*float(h))*2/13;    int s = round(60*(m-floor(m)));`
The s part is simple, it's just the decimal part of m turned into seconds. m is the interesting calculation and gives the number of minutes past the hour h (expressed as a decimal to also capture the seconds). Here are the details of how m is calculated from h.

If you look back at the watch face above it's not actually showing 10:09.14, it's showing 10:11.39. I think this is in part because it puts the second hand in a pleasing location. If I modify my program to show the location of the second hand you can see that perfect symmetry between hour and minute hands gets messed up by its presence.