Help me find the right angle!
November 9, 2007 10:42 AM   Subscribe

I'm looking for an online resource that will allow me to enter a time (in hours, minutes, seconds) and return a listing of the angles between the hands if that time was displayed on an analog clock. Can anyone point me in the right direction?
posted by langeNU to Computers & Internet (12 answers total) 3 users marked this as a favorite
 
paste this in your URL bar

javascript:$h = prompt("Hour",""); $m = prompt("Minute",""); $ha = $h*30; $hm = $m*6; alert($hm - $ha + ' degrees');
posted by BSummers at 10:49 AM on November 9, 2007 [4 favorites]


So for 10:46:33, for example, you're wanting the angles formed by hour & minute hands, hour and second hands, and minute and second hands? Do you want it to reflect the reality of an analog clock, such that at 4:30:00 the hour hand is halfway between 4 and 5?

(not that I know of a slew of resources and am asking to differentiate between them... just wondering for purposes of clarification)
posted by mumkin at 10:52 AM on November 9, 2007


This is an arithmetic problem. The angle of the hour hand, however, needs to include a correction for how many minutes between the hour marks: $h*30+$m*0.5
posted by vacapinta at 10:54 AM on November 9, 2007


with vacapintas update - ty!

javascript:$h = prompt("Hour",""); $m = prompt("Minute",""); $ha = $h*30+$m*0.5; $hm = $m*6; alert($hm - $ha + ' degrees');
posted by BSummers at 10:57 AM on November 9, 2007 [1 favorite]


Response by poster: To attempt to clarify some, assume the hour hand 'jumps' 0.5 degrees every minute on the minute (1/60th of the total 30 degree movement in an hour). Lets also have the minute hand move on the minute as well, so the minute hand would jump 6 degrees (1/60th of the total 360 degree movement in the hour). The second hand would jump 6 degrees every second.

Thus, at 12:00:00 there will be 0 degrees between the hour and the minute and the second hand, and at 12:01:00 there would be 5.5 degrees between the hour and the minute hand, 0.5 degrees between the second hand and the hour hand, and 6 degrees between the second and the minute hand.

Also, for clarity, lets have angles be calculated as positive when moving in a clockwise direction from any given 'reference' hand.
posted by langeNU at 11:04 AM on November 9, 2007


Best answer: BSummer's (on preview: his first) solution assumes that the hour hand points directly at its number for the entire hour; i.e., between 1:00:00 p.m. and 1:59:59 p.m. the hour hand is pointing directly at the "1," and at 2:00:00 p.m. it moves to point to the "2." That's not how most analog clocks work. Also, his formula (on preview: both) results in angles between -360 and +360 degrees. I'm assuming you want a more commonsense definition of angle, which would be 0-180 degrees.

It should be easy enough to set something like this up in Excel:

Enter hours in A1, minutes in A2, seconds in A3.

Intermediate calculations: these represent the number of degrees, clockwise from 12, you must go to get to each hand:

In B1, enter =MOD((A1+A2/60+A3/3600)*30,360)
In B2, enter =(A2+A3/60)*6
In B3, enter =A3*6

Angle between the hour and minute hands:
=ABS(MOD(B1-B2+180,360)-180)

Angle between the hour and second hands:
=ABS(MOD(B1-B3+180,360)-180)

Angle between the minute and second hands:
=ABS(MOD(B2-B3+180,360)-180)
posted by DevilsAdvocate at 11:05 AM on November 9, 2007


On further preview: my solution assumes continuous motion of all hands, not the "jumps" specified by langeNU's most recent comment.
posted by DevilsAdvocate at 11:06 AM on November 9, 2007


Also, for clarity, lets have angles be calculated as positive when moving in a clockwise direction from any given 'reference' hand.

So, in your example of 12:01:00, does that mean that the hour->minute angle should give a different result than the minute->hour angle? If so, should the latter return -5.5 degrees, or should it return 354.5 degrees?
posted by DevilsAdvocate at 11:09 AM on November 9, 2007


Response by poster: Continuous motion is fine as well!
posted by langeNU at 11:11 AM on November 9, 2007


Response by poster: And after forgetting to preview, it doesn't really matter which way the angle is presented, I was just trying to give a reference point so people didn't have to get confused with negative angles.
posted by langeNU at 11:12 AM on November 9, 2007


The solution DevilsAdvocate gave looks good. It would be fairly trivial to make this into some sort of online form-based application if you really needed such a thing.

I was interested in this problem and made a simple chart showing the relationship between the hours and minutes and the angle between the hand. You can view it here. The x axis is the hour; y axis is minutes.
posted by demiurge at 12:39 PM on November 9, 2007


Response by poster: Don't really need it to be online, I just figured that it might exist out there already.

I thought I remembered seeing a Java applets where you could drag the hands on the face of a clock at some point in the past.
posted by langeNU at 1:01 PM on November 9, 2007


« Older Best type of physician for medically-supervised...   |   Anatomy of a vintage appliance. Help me figure... Newer »
This thread is closed to new comments.