Hans Kamp

Apr 2, 2013, 07:39 AM

A few days ago I decided to test my graphical and mathematical skills and decided to make an analogue clock (later on a digital clock).

A friend of mine is a professional programmer and was eager to see me and together we decided to spice up my analogue clock.

It is quite tricky but exactly because of that also challenging. The longer I work on that clock, the more features I want to add to it.

First I got the system date. I broke it up in hours, minutes and seconds. The position (angle) of the hands has to be calculated. The angle of the hour hand depends on the current hour, but also on the minutes that passed since the whole hour. If you want to display 1:30 the hour hand must be exactly between one and two, and not yet pointing to one. The minute hand must be exactly halfway of the clock. But I also decided to make the angle of the minute hand depend on the last whole minute and how many seconds that are passed.

To make the hand of the same length, you must also calculate the sine and the cosine of the angle.

This topic is not to discuss a problem, but to express the fun I have with graphical programing and the mathematical knowledge that I have to use it.

Who of you have done similar to the above?

The next challenge is to make a normal calculator, maybe followed by a scientific calculater or an easy game like Minesweeper or Solitaire game (a card game).

A friend of mine is a professional programmer and was eager to see me and together we decided to spice up my analogue clock.

It is quite tricky but exactly because of that also challenging. The longer I work on that clock, the more features I want to add to it.

First I got the system date. I broke it up in hours, minutes and seconds. The position (angle) of the hands has to be calculated. The angle of the hour hand depends on the current hour, but also on the minutes that passed since the whole hour. If you want to display 1:30 the hour hand must be exactly between one and two, and not yet pointing to one. The minute hand must be exactly halfway of the clock. But I also decided to make the angle of the minute hand depend on the last whole minute and how many seconds that are passed.

To make the hand of the same length, you must also calculate the sine and the cosine of the angle.

This topic is not to discuss a problem, but to express the fun I have with graphical programing and the mathematical knowledge that I have to use it.

Who of you have done similar to the above?

The next challenge is to make a normal calculator, maybe followed by a scientific calculater or an easy game like Minesweeper or Solitaire game (a card game).