1 (edited by elbekko 2006-05-08 20:50)

Topic: Goniometry in PHP

Hey guys,

I'm currently making an analogue clock in PHP with the GD library by using the standard gonimetric formulas to calculate the coordinates for my hour indicator lines smile

Now, it seems to me
a) My formula is messed up
or
b) PHP doesn't know how on earth to do this

I'll show you my formula then:
$m_x = ZX + (cos($m_angle) * $r_minute);

This line is to calculate the x value of the coordinate where my minute indicator line ends in.
ZX is the definition of the x value of the center's coordinate (400).
$m_angle is calculated with $min * 6 and $r_minute is the length of my minute indicator.
Seems fine to me =/ Now, you can see what PHP does:
Image
Now don't come around telling me this is correct... =P
I've added a little info on what line represents what angle too.

If anyone could help me sort this out... it would be appreciated =P

-- Bekko

Here's my current code, with all the information display and useless lines in it =P
Pastebin post


EDIT: I solved it smile The problem was because I didn't do a conversion to radians.
http://icstrategy.midgetforhire.com/tes … /Clock.php <== whee