What Is Coordinate Rotation?
Coordinate rotation transforms a point's position by rotating it around the origin by a specified angle. The new coordinates are calculated using the 2D rotation matrix, which preserves the point's distance from the origin while changing its angular position.
The standard rotation formulas (counterclockwise by angle θ) are:
- x' = x · cos(θ) - y · sin(θ)
- y' = x · sin(θ) + y · cos(θ)
The Rotation Matrix
The 2D rotation matrix for an angle θ counterclockwise is:
R(θ) = [ [cosθ, -sinθ], [sinθ, cosθ] ]
When you multiply this matrix by a coordinate vector [x, y], you get the rotated point [x', y']. This is a linear transformation that preserves distances and angles.
Common Rotation Angles
90° Rotation
Rotates a quarter turn. cos(90°) = 0, sin(90°) = 1.
180° Rotation
Half turn. cos(180°) = -1, sin(180°) = 0.
270° Rotation
Three-quarter turn. cos(270°) = 0, sin(270°) = -1.
45° Rotation
Eighth turn. cos(45°) = sin(45°) = sqrt(2)/2.
Clockwise vs. Counterclockwise
The standard convention in mathematics uses counterclockwise (CCW) as the positive rotation direction. A clockwise rotation by angle θ is equivalent to a counterclockwise rotation by -θ, which changes the signs of the sine terms in the rotation matrix.
Key Properties of Rotation
- Distance preservation: The distance from the origin remains the same after rotation.
- Angle addition: Rotating by α then by β is the same as rotating by α + β.
- Inverse: The inverse of a rotation by θ is a rotation by -θ.
- Determinant: The rotation matrix always has determinant 1 (area is preserved).
Applications
- Computer Graphics: Rotating sprites, 3D models, and UI elements.
- Robotics: Joint angle calculations and coordinate frame transformations.
- Physics: Transforming between reference frames, analyzing circular motion.
- Navigation: Converting between compass bearings and map coordinates.
- Image Processing: Rotating images by arbitrary angles.