Drawing a Line, Generating the point co-ordinates

S

sravan_reddy001

I am creating an analog clock. so i hav to draw the line from center
to a point in the circle. How can i get the co-ordinates of the points
on the circle i fmention the radius and the center of the circle.
 
P

Peter Duniho

I am creating an analog clock. so i hav to draw the line from center
to a point in the circle. How can i get the co-ordinates of the points
on the circle i fmention the radius and the center of the circle.

Assuming the clock is a normal circle, the standard trigonometric formulae
apply:

x = r * cos(t);
y = r * sin(t);

where "t" is the angle of the line (keeping in mind that screen displays
usually have the Y axis reversed from the standard mathematical coordinate
systems).

You do, of course, need to map your time values (hours, minutes, seconds)
to degrees. But that should not be difficult for you to figure out.

If you want an elliptical clock, you might check this thread I was just
involved in:

http://groups.google.com/group/micr...read/thread/b2b38fa89babd27a/28b8ec877ef6e1b5

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top