Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trig angle detection
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mayb123




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: