Finding Angles

BlitzMax Forums/BlitzMax Programming/Finding Angles

Hello. I need to find an angle to the top-left part of my screen from a random point on the screen. I believe that this should work:

Angle = PosY/PosX
Angle = 180-ATan(Angle)


but doesnt :(

The reason for what i have done is that i worked out from anywhere on the screen i have a triangle like:

____
\   |
 \  |
  \x|
   \|


And the opposite and adjacent sides are my x and y co-ords. So i use the Tan-1 funtion to work out angle x which is the angle if you start at the top of the screen anti-clockwise. So as angles start from the bottom of the screen clockwise i get the angle i need (y) by taking the angle away from 180:

   \x|
    \|
    y|
     |


But this doesn't work. I'm not very good at this sort of stuff so there may be something i've done wrong in he calculations.

If there is anyone good at maths out at there that can help me i'd be very grateful. (and i hoped my diagrams helped :))