34 operator double()
const {
return phi; }
41 int operator== (
const StAngle&)
const;
58 inline StAngle::StAngle()
63 inline StAngle::StAngle(
const StAngle& val)
68 inline StAngle::StAngle(
double val)
71 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
78 inline StAngle StAngle::operator= (
double val)
81 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
88 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
95 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
99 inline StAngle StAngle::operator*= (
double val)
102 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
106 inline StAngle StAngle::operator/= (
double val)
109 if (fabs(phi) > M_PI) phi = atan2(sin(phi), cos(phi));
113 inline int StAngle::operator== (
const StAngle& a)
const
115 return (fabs(
StAngle(phi-a.phi)) < FLT_EPSILON);
124 double res = angle.phi + val.phi;
125 if (fabs(res) > M_PI) res = atan2(sin(res), cos(res));
131 double res = angle.phi - val.phi;
132 if (fabs(res) > M_PI) res = atan2(sin(res), cos(res));
138 double res = angle.phi * val;
139 if (fabs(res) > M_PI) res = atan2(sin(res), cos(res));
145 double res = angle.phi / val;
146 if (fabs(res) > M_PI) res = atan2(sin(res), cos(res));
159 inline double StAngle::degree()
161 double val = phi*180./M_PI;
162 return (val < 0) ? val += 360 : val;