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.

Davebakedpotato said…
Love it! One further reason for using 10:10 (especially vs 1:50) is that the hour and minute hands form a 'tick' - another positive affirmation that you should definitely buy the watch. :)
Emma Jasmine said…
Good post..

Making an old USB printer support Apple AirPrint using a Raspberry Pi

There are longer tutorials on how to connect a USB printer to a Raspberry Pi and make it accessible via AirPrint but here's the minimal one that's just a list of commands and simple instructions. 1. Install Raspbian on a SD card 2. Mount SD card on some machine and navigate to / . Add a file called ssh and set up wpa_supplicant.conf for WiFi access. Now you have headless and don't need a keyboard or monitor. 3. Boot. Login. sudo raspi-config . Change password. 4. Connect printer via USB cable 5. Then execute the following sequence of commands to set up CUPS and make it accessible on the network. sudo apt-get update sudo apt-get full-upgrade sudo apt-get install cups sudo usermod -a -G lpadmin pi sudo cupsctl --remote-any sudo systemctl restart cups 6. Visit http://raspberrypi:631/admin and add the local printer. Make sure "sharing" is enabled on the printer. 7. Then make sure AirPrint is set up sudo apt-get install avahi-daemon sudo reboot Printer should work