PDA

View Full Version : trig. equations needed



Templarian
February 19th, 2005, 11:05 PM
I know some basic trig. but how do i find an angle from an anchor point and a mving point? To help you off ...

adjecent = _root.anchor._x-_root._xmouse;
opposite = _root.anchor._y-_root._ymouse;
hypotenuse = ((adjacent ^ 2)+(opposite ^ 2)) ^ 0.5;

If anyone knows thx in advance.

senocular
February 19th, 2005, 11:30 PM
use Math.atan2(opposite, adjacent); That will give you an angle in radians. Multiply it by 180/Math.PI to get degrees.

Templarian
February 20th, 2005, 12:08 AM
thx I was thinking really hard and figured out the atan 2 part and was thinking i need to have that 180/pi part somewhere thx again