0x686169 0x686169 - 13 days ago 11
Objective-C Question

How to convert from clock hour/minute to Degree inObjective-C?

1.30 AM -> 45 Degree
0 AM -> 90 Degree
3 AM or 15 PM -> 0 Degree
9:00 AM -> 180 Degree


Cound you please show me formular to calculate NSDate to Degree ?

Answer

I think the convention is that every 1 hour corresponds to 360/24 = 15 degrees. So 3AM * 15 = 45degrees. 2pm * 15 = 30 degrees. However, if you set your zero at 3AM as you are doing with your numbers, then your formula would be (3-hours)*360/12. So 3AM = 0 degrees. 1.5 = 45 degrees. 0am = 90degrees. 9am = -180degrees.

Comments