Rotation about an arbitrary point
How to rotate 2D points, shapes or coordinates about any chosen pivot by translating to the origin, applying the rotation matrix, and translating back — using homogeneous 3×3 matrices for composition.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Rotation about an arbitrary point is used any time we must spin an object around a chosen pivot that is not the origin: for example, rotating a wheel around its axle, rotating a sprite around its center in a game, or aligning parts in CAD. Engineers use the method in 2D graphics pipelines (after learning 2D transformations) and when building composite transforms with homogeneous matrices.
Key ideas
Angle: the amount of rotation. By convention in these notes a positive angle means counter-clockwise (CCW) rotation. State this assumption in your answer: if a question uses clockwise positive, change signs accordingly. In screen coordinates where y increases downward, this CCW mathematical convention will appear clockwise on the display; be explicit about the axis orientation.
Translation: a displacement of all points by a vector (tx, ty). In matrix form we use a 3×3 homogeneous translation matrix so translations combine cleanly with rotations.
Homogeneous coordinates: a representation [x y 1]^T that lets us represent translation and rotation as 3×3 matrices; this is essential to combine transformations by matrix multiplication.
Procedure (the standard exam derivation — state assumptions):
- Given a point P(x,y) and pivot C(cx,cy), first translate P so C becomes the origin: P1 = P − C = (x − cx, y − cy).
- Rotate the translated point by angle θ about the origin using the rotation matrix R(θ): P2 = R(θ)·P1.
- Translate back by +C to restore the original frame: P′ = P2 + C.
This three-step procedure is usually combined into one homogeneous matrix: M = T(cx,cy) · R_h(θ) · T(−cx,−cy), where multiplication is left-acting on column vectors [x y 1]^T. Always state whether you are using column-vector convention (this one) or row-vector convention (order reverses).
Properties to mention (prove if asked):
- Rotation about a point is an isometry: it preserves distances and angles.
- The 2×2 rotation matrix is orthogonal and its determinant is +1 (so it preserves orientation). These assume Euclidean 2D space and real angle θ. Also, R(θ)^T = R(−θ) = R(θ)^{-1}.
Diagram to draw (exam answers often require this):
- Draw two perpendicular axes labelled x and y. Mark the pivot C(cx,cy). Mark the original point P(x,y).
- Draw the vector from C to P and label its components dx = x − cx and dy = y − cy.
- Draw the rotated vector P′ − C and an arrow showing angle θ from the original vector to the rotated vector (label θ as CCW positive).
- Optionally annotate the rotated vector’s components: x-component = dx·cosθ − dy·sinθ and y-component = dx·sinθ + dy·cosθ, so the reader sees where cos and sin appear in the formulas.
Formulas
x' = cx + (x - cx)·cosθ - (y - cy)·sinθ where x' is rotated x-coordinate, x and cx in length units (pixels or metres), θ in radians (or degrees but convert to radians for cos/sin).
y' = cy + (x - cx)·sinθ + (y - cy)·cosθ where y' is rotated y-coordinate; same units as above.
R(θ) = [ [cosθ, -sinθ], [sinθ, cosθ] ] 2×2 rotation matrix; entries are dimensionless.
T(tx,ty) (homogeneous) = [ [1, 0, tx], [0, 1, ty], [0, 0, 1] ] 3×3 translation matrix; tx, ty in length units.
R_h(θ) (homogeneous) = [ [cosθ, -sinθ, 0], [sinθ, cosθ, 0], [0, 0, 1] ] 3×3 homogeneous rotation about origin.
M = T(cx,cy) · R_h(θ) · T(−cx,−cy) Combined 3×3 homogeneous matrix for rotation about (cx,cy). Use column-vector convention: [x' y' 1]^T = M · [x y 1]^T. Expanded explicitly, M = [ [cosθ, -sinθ, cx - cx·cosθ + cy·sinθ], [sinθ, cosθ, cy - cx·sinθ - cy·cosθ], [0, 0, 1] ].
Explain symbols: x,y,x',y',cx,cy,tx,ty are coordinates; units are typically pixels in computer graphics (discrete units) or metres for physical models. θ is an angle measured in radians for trigonometric functions; cosθ and sinθ are dimensionless.
Worked examples
Example 1 — Single point (university numerical): Rotate P(5, 2) about pivot C(2, 1) by 90° CCW. Units: pixels. Steps:
- Convert angle: θ = 90° = π/2 radians. cosθ = 0, sinθ = 1.
- Use formula: x' = cx + (x − cx)·cosθ − (y − cy)·sinθ.
x' = 2 + (5 − 2)·0 − (2 − 1)·1 = 2 + 0 − 1 = 1pixels. - y' = cy + (x − cx)·sinθ + (y − cy)·cosθ.
y' = 1 + (5 − 2)·1 + (2 − 1)·0 = 1 + 3 + 0 = 4pixels. Final answer: P' = (1, 4) pixels.
Example 2 — Small polygon: Rotate triangle A(1,1), B(4,1), C(1,3) about pivot P(2,2) by 45° CCW. Units: pixels. Constants: θ = 45° = π/4, cosθ = sinθ = √2/2 ≈ 0.70710678. Compute A' (start with dx = x − cx, dy = y − cy):
- For A: dx = 1 − 2 = −1, dy = 1 − 2 = −1. x'_A = 2 + (−1)·0.70710678 − (−1)·0.70710678 = 2 + (−0.70710678) + 0.70710678 = 2.00000000. y'_A = 2 + (−1)·0.70710678 + (−1)·0.70710678 = 2 − 0.70710678 − 0.70710678 = 0.58578644. A' ≈ (2.0000, 0.5858) pixels.
- For B(4,1): dx = 2, dy = −1. x'_B = 2 + 2·0.70710678 − (−1)·0.70710678 = 2 + 1.41421356 + 0.70710678 = 4.12132034. y'_B = 2 + 2·0.70710678 + (−1)·0.70710678 = 2 + 1.41421356 − 0.70710678 = 2.70710678. B' ≈ (4.1213, 2.7071) pixels.
- For C(1,3): dx = −1, dy = 1. x'_C = 2 + (−1)·0.70710678 − 1·0.70710678 = 2 − 0.70710678 − 0.70710678 = 0.58578644. y'_C = 2 + (−1)·0.70710678 + 1·0.70710678 = 2 + 0 = 2.00000000. C' ≈ (0.5858, 2.0000) pixels.
(When writing up, show the three-step translate-rotate-translate algebraically before substituting numbers. Keep 4–6 significant digits for readability.)
Common mistakes
- Mixing degrees and radians: most math libraries expect radians; always convert degrees to radians when evaluating cos and sin.
- Using row-vector convention but applying matrix order for column vectors (matrix multiplication order reverses depending on convention).
- Forgetting homogeneous coordinate w = 1 for translation or accidentally setting w = 0.
- Rounding too early in a step; keep accuracy until the end.
For your exam
Types of questions you will see:
- Definitions and properties (define rotation, pivot, homogeneous coordinates; prove rotation preserves length).
- Derivations: show the composite matrix M = T(cx,cy)·R(θ)·T(−cx,−cy) and derive the explicit x', y' formulas.
- Numerical problems: rotate given points or polygons and give final coordinates with units.
- Diagrams: draw axes, pivot, point(s), angle arrow and labelled components dx, dy and show cos/sin projections.
What full-marks answers include:
- State assumptions (coordinate convention, CCW positive or not, units for angle).
- Show each algebraic step: translate, rotate, translate back.
- Give the homogeneous matrix if asked and state how it multiplies a column vector [x y 1]^T.
- Draw a clear labelled diagram where required and annotate intermediate values for numericals.
Quick check
- Write the formula for rotating point P(x,y) by θ about pivot C(cx,cy).
- What is the homogeneous 3×3 matrix M that implements rotation about (cx,cy)?
- What two geometric quantities does rotation preserve? Answers: 1) x' = cx + (x−cx)·cosθ − (y−cy)·sinθ, y' = cy + (x−cx)·sinθ + (y−cy)·cosθ. 2) M = T(cx,cy)·R_h(θ)·T(−cx,−cy) with T and R_h as given above. 3) Distances and angles (rotation is an isometry and preserves orientation if det=+1).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?