Angle &Angle::clampDegrees(float mag) { _degrees = getDegrees(-180.f); if (_degrees >= mag) setDegrees(mag); if (_degrees <= -mag) setDegrees(-mag); return *this; }
/** \brief Constructor - sets the initial angle. * \param angle Accepts either radians or degrees * \param rad If true, the constructor sets the angle as radians. Else, degrees. */ Angle::Angle(double angle, bool rad) { if (!rad) setDegrees(angle); else setRadians(angle); }
Angle &Angle::operator=(float degrees) { setDegrees(degrees); return *this; }
Angle &Angle::operator-=(float degrees) { setDegrees(_degrees - degrees); return *this; }
Angle &Angle::operator-=(const Angle &a) { setDegrees(_degrees - a._degrees); return *this; }
/// Set angle by radians void Angle::setRadians(qreal _angle) { setDegrees(_angle * 180.0 / M_PI); }
Angle::Angle(qreal _angle) { setDegrees(_angle); }
AMAngle::AMAngle(const AMAngle& angle) { setDegrees(angle.getDegrees()); }
/// sets the angle from another AMAngle void AMAngle::setAngle(AMAngle &angle) { setDegrees(angle.degrees());// arbitarary, could do radians as well }