2D Rotation

The Rotation of any object depends upon the two points.

Rotation Point: It is also called the Pivot point.

Rotation Angle: It is denoted by Theta (2D Rotation).

We can rotate an object in two ways-

Clockwise: An object rotates clockwise if the value of the Rotation angle is negative (-).

Anti-Clockwise: An object rotates anti-clockwise if the value of the Rotation angle is positive (+).

We can apply Rotation on following objects-

  • Straight Lines
  • Curved Lines
  • Polygon
  • Circle

For Example-

Rotation of a Point: If we want to Rotate a point A (P0, Q0) that has a Rotation angle 2d Rotation with distance r from origin to A` (P1, Q1) that has a Rotation angle 2d Rotation. Then, we can rotate by following Rotation equation-

2D Rotation 2D Rotation

We can represent the coordinates of point A (P0, Q0) by using standard trigonometry-

2D Rotation

We can also define point A` (P1, Q1) in the same way-

2D Rotation

By using equation (1) (2) (3) (4), we will get-

2D Rotation

We can also represent the Rotation in the form of matrix-

2D Rotation

Homogeneous Coordinates Representation: The Rotation can also be represented in the form of 3 x 3 Rotation matrix-

2D Rotation

Example- A line segment with the starting point (0, 0) and ending points (5, 5). Apply 30-degree rotation anticlockwise direction on the line. Find the new coordinates of the line?

Solution- We can rotate the straight line by its endpoints with the same angle.

2D Rotation

We have,

(P0, Q0) = (0, 0)

Rotation Angle () = 30°

Let the new coordinates of line = (P1, Q1)

We can apply the rotation matrix, then,

2D Rotation

Thus, the new endpoint coordinates of the line are = (P1, Q1) = (1.83, 6.83)