Graphics / Reference / Deriving the rotation equations
Deriving the rotation equations
The 2D rotation equations follow from expressing a point by its length and angle, adding the rotation angle, then expanding the resulting sine and cosine expressions back into x and y.
Let p = (x,y) have length |p| and make angle α with the positive x axis. Its Cartesian components are:
x = |p| cos α y = |p| sin α
so p = (|p| cos α, |p| sin α).
After rotating p by angle θ about the origin, its length remains |p| and its angle becomes θ + α:
x' = |p| cos(θ + α) y' = |p| sin(θ + α)
Use the identities:
cos(θ + α) = cos α cos θ - sin α sin θ
sin(θ + α) = cos α sin θ + sin α cos θ
Then:
x' = |p| cos α cos θ - |p| sin α sin θ = x cos θ - y sin θ
y' = |p| cos α sin θ + |p| sin α cos θ = x sin θ + y cos θ
The associated diagrams show p and p' with equal length, their angles from the x axis, and their horizontal and vertical projections.
Builds on
Read
- Read the chapter: Deriving the rotation equations