javascript - Find angle between hour and minute hands in an analog clock
Development/JavaScript 2014. 4. 1. 11:00Find angle between hour and minute hands in an analog clock
21 12 | I was given this interview question recently:
I'm wondering what's the simplest, most readable, most precise algorithm is. Solution in any language is welcome (but do explain it a bit if you think it's necessary). | ||||||||
|
20 | It turns out that Wikipedia does have the best answer.
Basically:
Problem solved. And precision isn't a concern because the fractional part is either | ||||||||||||
|
4 | For finding the angle between the hands of a clock is ,
| ||||||||
1 | The java code that polygenlubricants is similar than mine. Let's assume that the clock is 12 hour instead of 24. If it's 24 hours, then that's a different story. Also, another assumption, assume if the clock is stopped while we calculate this. One clock cycle is 360 degree.
Since it's easier to calculate in the unit, "minute", let's get
30 / 60 = 0.5 degree per minute. So, if you know how to get those numbers, the problem is pretty much done with solution. | |||
add comment |
1 | Try this code :
| |||
add comment |
0 | for finding the angle between the hour hand and the minute hand is
| |||
add comment |
-1 | I tried to solve this problem but I don't think it can be solved mathematics. | ||
add comment |
-2 | I do not know if it's right, .something like this?
| ||||||||||||
|
출처 - http://stackoverflow.com/questions/2748965/fnd-angle-between-hour-and-minute-hands-in-an-analog-clock
'Development > JavaScript' 카테고리의 다른 글
javascript - requestAnimationFrame (0) | 2014.04.02 |
---|---|
javascript - 초에서 시간, 분 구하기 (0) | 2014.04.01 |
javascript - iife setTimeout (0) | 2014.04.01 |
javascript - window.JSON 객체 (0) | 2014.03.27 |
javascript - DocumentFragment (0) | 2014.02.01 |