calculation of angles

Mark gatfix at hotmail.com
Fri Dec 17 06:41:39 EST 1999


I see that in many modelling programs
where an angle theta is to be calculated, it is very often
calculated as atan2(sin(theta),cos(theta)), where atan2,
according to the manual,
is a FORTRAN function approximately equal to
atan(sin(theta/cos(theta)).
I don't understand:

(a) why atan2(y,x) is preferred to atan(y/x);

(b) why one couldn't directly take acos(cos(theta)) or
asin(sin(theta)), instead of having to obtain both sine and cosine.
(the cosine of angle is easy to obtain, but sine is not).

Any help appreciated.                           Mark




Sent via Deja.com http://www.deja.com/
Before you buy.




More information about the Molmodel mailing list