/** * Rotates a point the specified angle. An optional origin about * which to rotate the point can also be specified. * @param angle (input) Angle of rotation, measure +CCW/-CW from the * x axis in degrees. * @param origin (optional input) An alternate point about which to * rotate the point. * @return Rotated point */ Point Point::RotateDegrees( double angle, const Point& origin) { return(RotateRadians((angle * (double) MATH_PI)/ (double) 180.0, origin)); }
/** * Rotates a point the specified angle. An optional origin about * which to rotate the point can also be specified. * @param angle (input) Angle of rotation, measure +CCW/-CW from the * x axis. Degrees/Radians determined by angleMode value. * @param origin (optional input) An alternate point about which to * rotate the point. * @return Rotated point */ Point Point::Rotate( double angle , const Point& origin) { if(Point::GetAngleMode() == MATH_ANGLES_IN_DEGREES) { return RotateDegrees(angle, origin); } else { return RotateRadians(angle, origin); } }
//Rotation // void Vector2::RotateDegrees( float degreesToRotateBy ) { float radiansToRotateBy = degreesToRotateBy * ( PI / 180.f ); RotateRadians( x, y, radiansToRotateBy ); }
void Vector2::RotateRadians( float radiansToRotateBy ) { RotateRadians( x, y, radiansToRotateBy ); }