[Nottingham] Trigonometry!

daveluff daveluff at ntlworld.com
Wed Jan 24 23:32:26 GMT 2007


Richard Hayes wrote:

> Hello guys.
>  
> Slightly off topic, but it's something I'm programming in PHP on a 
> Linux server so it kind of counts.
>  
> I'm writing some stuff in GD lib (php) which draws me nice graphs. 
> Except I can't remember a thing about trigonometry from school and I'm 
> struggling.
>  
> I have two set of coordinates, eg:
> 1. 0,0
> 2. 25,25
>  
> With a line drawn between them.
>  
> I know that this line is at 135 degrees from 0 (correct me if i'm 
> wrong!). What calculation can I do on these number to give this this 
> amount in degrees?
>  
> (Or, let's say my coords are 0,0 drawn to 50,0, then my angle is 90 
> degrees (a right angle).)
>  
> It's really as simple as that.
>  
> I've googled and googled and googled, but I'm beat.
>  
> Any help?
>
> Thanks!
>  
> Kind regards,
>  


I think what you're looking for would be atan2 in C/C++.  I would 
imagine there might be an equivalent in php.

Cheers - Dave



More information about the Nottingham mailing list