Skip to main content

3D rotation about axis (1,2,3)-(10,20,30)

Short answer

Translate by (−1,−2,−3). Rotate about x by α (cosα=0.8321, sinα=0.5547) to lay axis in xz-plane. Rotate about y by β (cosβ=0.9636, sinβ=0.2673) to align with z. Rotate 90° about z, then reverse Ry and Rx, translate back. Final matrix: [0.0714 −0.6589 0.7488 0; 0.9446 0.2857 0.1613 0; −0.3202 0.6958 0.6429 0; 0 0 0 1].

List down the steps for rotating a 3D object by 90° in counter clockwise direction about an axis joining end points (1,2,3) and (10,20,30). Also derive the final transformation matrix.

Axis through P1(1,2,3) and P2(10,20,30). Rotation θ = 90° counter-clockwise.

Steps

  1. Translate P1 to the origin: T(−1, −2, −3).
  2. Rotate about x by α to put the axis in the xz plane.
  3. Rotate about y by β to put the axis on the z-axis.
  4. Rotate about z by 90°.
  5. Apply Ry(−β), then Rx(−α).
  6. Translate back with T(1, 2, 3).

M = T(P1)·Rx(−α)·Ry(−β)·Rz(90°)·Ry(β)·Rx(α)·T(−P1)

Numbers

V = P2 − P1 = (9, 18, 27), L = √(81 + 324 + 729) = √1134 = 33.675

Unit vector (a, b, c) = (0.2673, 0.5345, 0.8018) (this equals (1, 2, 3)/√14)

d = √(b² + c²) = √(0.2857 + 0.6429) = 0.9636

cosα = c/d = 0.8321, sinα = b/d = 0.5547; cosβ = d = 0.9636, sinβ = a = 0.2673

Rx(α) = | 1  0       0      0 |     Ry(β) = | 0.9636 0 -0.2673 0 |
        | 0  0.8321 -0.5547 0 |             | 0      1  0      0 |
        | 0  0.5547  0.8321 0 |             | 0.2673 0  0.9636 0 |
        | 0  0       0      1 |             | 0      0  0      1 |

Rz(90°) = | 0 -1 0 0 |
          | 1  0 0 0 |
          | 0  0 1 0 |
          | 0  0 0 1 |

Final matrix

The axis line passes through the origin (P1 = (1,2,3) and P2 = 10·P1), so the translation part of M is zero. Multiplying all matrices gives

M = |  0.0714 -0.6589  0.7488  0 |
    |  0.9446  0.2857  0.1613  0 |
    | -0.3202  0.6958  0.6429  0 |
    |  0       0       0       1 |

Exact entries: 1/14, 2/7 and 9/14 on the diagonal (0.0714, 0.2857, 0.6429). The matrix agrees with the Rodrigues formula R = I + sinθ·K + (1 − cosθ)·K² for u = (1,2,3)/√14 (K is the cross-product matrix of u). Applying M to any point on the axis, e.g. (1,2,3), leaves it unchanged.

Answer: M above.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 4 questions →