/* * a n g l e . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title angle index synopsis int description bugs author Machiavelli Systems #endif/* * A N G L E ( ) - Given a directional cosine & a sine return an angle (radians) * * PLEASE MOVE ME TO A LIBRARY * * MOD LOG: * 9-FEB-85 TG Conversion from B4S. * * LIBRARIES: CMATH (PML or equivalent) * */ #define PI 3.1415927 /* PI */ #define PIX2 PI * 2.0 double angle(cs, sn) double cs, sn; { double angl, datan(); angl = datan(sn/cs); if (angl < 0.0) angl = angl + PIX2; if ((angl > PI) && (sn > 0.0)) angl = angl - PI; if ((angl < PI) && (sn < 0.0)) angl = angl + PI; if ((angl == 0.0) && (cs < 0.0)) angl = PI; return(angl); }