Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Rotation about an arbitrary axis

Rotation about an arbitrary axis: how to rotate a 3D point or object around any straight line using translation + rotation or Rodrigues' formula, with derivation, formulas and worked numerical examples.

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 axis is required whenever you must turn an object in 3D around a line that is not one of the coordinate axes. Engineers use it in 3D modelling, CAD, robotics (joint rotations), camera manipulation and computer graphics pipelines (after 3D transformations and before projections).

Key ideas

  • Unit vector: a vector with length 1. For the axis direction we always convert d to a unit vector u = d/||d|| before using formulas. The axis direction must be nonzero; if d = 0 the rotation is undefined.
  • Dot product (u·v): scalar product of two vectors; physically the projection of one vector on another. Defined u·v = ux vx + uy vy + uz vz.
  • Cross product (u × v): a vector perpendicular to both u and v. Use the right-hand rule for sign.
  • Decomposition of a vector: any vector v can be split into the component parallel to u and the component perpendicular to u: v_parallel = (u·v) u, v_perp = v - v_parallel.

Rodrigues' derivation (exam-style, step-by-step):

  1. Place the rotation axis through the origin (if the axis does not pass through origin, translate first; we will cover translation later).
  2. Let u be the unit vector along the axis, and let v be the position vector of the point to rotate.
  3. Decompose v into parallel and perpendicular parts: v = v_parallel + v_perp, where v_parallel = (u·v) u and v_perp = v - v_parallel.
  4. The parallel component is unchanged by rotation about u: v_parallel' = v_parallel.
  5. The perpendicular part lies in a plane orthogonal to u. In that plane, rotation by angle θ behaves like a 2D rotation: v_perp rotates into v_perp cosθ + (n) sinθ, where n is a vector in the plane perpendicular to v_perp and of length ||v_perp||. Observing that u × v (not normalized) is perpendicular to v_perp and has magnitude ||u||·||v_perp|| = ||v_perp|| (since ||u||=1), we can take n = u × v.
  6. Combine: v' = v_parallel + v_perp cosθ + (u × v) sinθ. This is Rodrigues' vector form.
  7. Put into matrix form: R(u,θ) = I cosθ + (1 - cosθ) u u^T + [u]_x sinθ, where [u]_x is the skew-symmetric matrix for cross product.

Rotation about an axis not through origin:

  • Translate the space so that a chosen point P on the axis moves to the origin: T(-P).
  • Apply R(u,θ) computed as above.
  • Translate back: T(P).
  • For homogeneous coordinates (4×4 matrices used in graphics): M = T(P) · R_homogeneous(u,θ) · T(-P).

What to draw (for exam diagrams):

  • Draw 3D coordinate axes (x, y, z). Draw the axis line (label two points A and B on it, or point P and direction arrow d). Mark point Q to be rotated. Draw vector from P (or origin after translation) to Q and angle θ between its projection in the plane orthogonal to the axis and its rotated position. Label u, v, v_parallel and v_perp on the figure.

Formulas

u = d / ||d|| — u is the unit direction vector of axis; d is axis direction vector; ||d|| is its Euclidean norm (dimensionless).

v_parallel = (u · v) u — projection of v on u; v and u are position/direction vectors (dimensionless).

v_perp = v - v_parallel — perpendicular component of v to axis (dimensionless).

v' = v_parallel + v_perp * cos(θ) + (u × v) * sin(θ) — Rodrigues' vector formula; v and v' are position vectors; θ is rotation angle in radians.

[u]_x = [[ 0, -uz, uy], [ uz, 0, -ux], [-uy, ux, 0]] — skew-symmetric matrix for u = (ux,uy,uz).

R(u,θ) = I * cos(θ) + (1 - cos(θ)) * (u u^T) + [u]_x * sin(θ) — 3×3 rotation matrix about axis u through origin. Equivalently, for u = (ux, uy, uz), c = cos(θ), s = sin(θ): R = [[c + ux^2 (1 - c), ux uy (1 - c) - uz s, ux uz (1 - c) + uy s], [uy ux (1 - c) + uz s, c + uy^2 (1 - c), uy uz (1 - c) - ux s], [uz ux (1 - c) - uy s, uz uy (1 - c) + ux s, c + uz^2 (1 - c)]].

M_total = T(P) · R_homogeneous(u,θ) · T(-P) — homogeneous 4×4 transform that rotates about axis through point P. T is translation matrix. Here R_homogeneous(u,θ) embeds the 3×3 R in the top-left of a 4×4 with last row/column [0,0,0,1] (i.e., [[R, 0], [0^T, 1]]). Assuming column vectors (post-multiplying); for row-vector (pre-multiplying) convention the composition order is T(-P) · R_homogeneous(u,θ) · T(P).

Notes: angles in formulas must be in radians when using standard math libraries. Coordinates are unitless; in geometry they inherit the unit of the coordinate system (e.g., metres). Rotation matrices are orthogonal (R^T R = I) with determinant +1 (proper rotations).

Worked examples

Example 1 — rotate a point about axis through origin Question: Rotate point v = (1,0,0) about axis in direction d = (1,1,0) through the origin by θ = 90°. Steps:

  1. Normalize axis: u = d/||d|| = (1,1,0)/√2 = (1/√2, 1/√2, 0).
  2. Compute v_parallel = (u·v) u. u·v = 1/√2. So v_parallel = (1/√2) u = (1/2, 1/2, 0).
  3. Compute v_perp = v - v_parallel = (1,0,0) - (0.5,0.5,0) = (0.5, -0.5, 0).
  4. Compute u × v = (0,0,-1/√2).
  5. Use Rodrigues: cos90° = 0, sin90° = 1. v' = v_parallel + v_perp * 0 + (u × v) * 1 = (0.5, 0.5, 0) + (0,0,-1/√2).
  6. Final numeric v' = (0.5, 0.5, -0.70710678). Answer: (0.5, 0.5, -0.7071).

Example 2 — rotate a point about axis that does not pass through origin (full translation + Rodrigues) Question: Rotate Q = (2,1,3) about axis that passes through P = (1,0,0) with direction d = (0,1,1) by θ = 60°. Steps:

  1. Translate so axis passes through origin: v = Q - P = (1,1,3).
  2. Normalize axis: u = d/||d|| = (0,1,1)/√2 = (0, 1/√2, 1/√2).
  3. Compute v_parallel = (u·v) u. u·v = 0*1 + (1/√2)*1 + (1/√2)*3 = 2√2 ≈ 2.82842712. Then v_parallel = 2.82842712 * (0,0.70710678,0.70710678) = (0, 2, 2).
  4. v_perp = v - v_parallel = (1,1,3) - (0,2,2) = (1, -1, 1).
  5. u × v = (√2, 1/√2, -1/√2) ≈ (1.41421356, 0.70710678, -0.70710678).
  6. cos60° = 0.5, sin60° = √3/2 ≈ 0.8660254. v' = v_parallel + v_perp * 0.5 + (u × v) * 0.8660254. v_perp * 0.5 = (0.5, -0.5, 0.5). (u × v) * 0.8660254 ≈ (1.2247449, 0.6123724, -0.6123724). Sum = (0.5+1.2247449, 1.5+0.6123724, 2.5-0.6123724) = (1.7247449, 2.1123724, 1.8876276).
  7. Translate back: Q' = v' + P = (1 + 1.7247449, 0 + 2.1123724, 0 + 1.8876276) ≈ (2.724745, 2.112372, 1.887628). Answer: (2.724745, 2.112372, 1.887628) (rounded).

Check units: coordinates are unitless or in same units as input (e.g., metres).

Common mistakes

  • Forgetting to translate when the axis does not pass through the origin, or using wrong order of translate/rotate (order matters).
  • Confusing sign of angle or cross-product convention (right-hand rule must be consistent with coordinate system and matrix/vector convention). Positive θ follows the right-hand rule about u (counter-clockwise when looking in the direction of u).
  • Forgetting to use homogeneous coordinates (4×4) when combining rotation with translation in a graphics pipeline.
  • Using the skew matrix [u]_x incorrectly (wrong sign placement) — check the pattern carefully.

For your exam

Question types you can expect: definitions (unit vector, Rodrigues' formula), derivations (derive Rodrigues' formula from vector decomposition), diagram questions (draw axis, components and rotated vector), numerical problems (rotate given point around given axis), and matrix construction problems (write 3×3 rotation matrix or 4×4 homogeneous matrix for rotation about arbitrary axis through a point).

What full-mark answers must include:

  • Clear definitions of axis, unit vector and rotation angle.
  • Correct derivation steps (decomposition into parallel & perpendicular, behaviour of perpendicular part, use of cross product).
  • Correct normalization and translation steps if axis not through origin.
  • Correct numeric evaluation with units and rounding, or correct final matrices in correct order (T(P) · R · T(-P)).

Quick check

  1. Why must the axis direction be normalized before using Rodrigues' formula?
  2. Give Rodrigues' vector formula for rotating v about unit axis u by θ.
  3. If you rotate point (1,0,0) by 180° about axis (0,0,1) through origin, what is the result?

Answers: 1) Because u must have length 1 so projections and cross-product magnitude work out; otherwise v_parallel and cross terms scale wrongly. 2) v' = (u·v) u + (v - (u·v) u) cosθ + (u × v) sinθ. 3) (-1,0,0).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?