Re: trig
- Posted by akusaya at gmx.net Apr 19, 2004
- 608 views
Try this function: function angle(object x, object y) if x = 0 then return (y > 0) * 180 end if return arctan(y/x) * 180/PI + 90 + (x < 0) * 180 end function L> Howdy folks, L> It seems I always forget my trig when I need it. L> Quick question: L> How do I calculate an angle in degrees given an x,y vector. L> The vector for 0 deg being {0,-1} L> 90 deg would be {1,0}; 180 = {0,1}; etc... L> atom angle L> sequence vector L> vector = {-0.38,-0.92} L> angle = ? L> thanks for any help, L> Lewis Townsend L> BTW is there a website that has all the math formulas, trig esp?