Computer Science Canada

Trig angle detection

Author:  Mayb123 [ Tue Oct 02, 2007 5:25 pm ]
Post subject:  Trig angle detection

as the subject line says, and how, in relation to a set coordinate do i make the angle correspond to the mouse?
For example, if i have one point and then i want a line to extend through the mouse cursor, how do i use angles to draw the line directly to the cursor?

Author:  Cervantes [ Tue Oct 02, 2007 10:10 pm ]
Post subject:  RE:Trig angle detection

Your example doesn't require that you know the angle. You could just do
code:

Draw.Line(x,y, x + (mx - x) * lambda, y + (my - y) * lambda, black) % lambda is some positive real number. If lambda = 1, you get a line from the given point (x,y) to the mouse


But if you want to find the angle, you have to do little more than take the inverse tangent (arctan) of opposite over adjacent, plus some quadrant work.


: