Skip to main content

3D rotation steps and perspective projection

Short answer

For arbitrary axis rotation: translate to origin, rotate about x-axis by α to put axis in xz-plane, rotate about y by β to align with z, rotate by θ about z, then reverse Ry and Rx and translate back. Perspective projection: projectors converge at COP; distant objects appear smaller. With COP (0,0,zprp) and view plane z=zvp, xp = x·dp/(zprp−z), yp = y·dp/(zprp−z), dp = zprp−zvp.

Write the steps required to rotate an object in 3D about arbitrary axis. Explain about the perspective projection.

Steps to rotate about an arbitrary axis

Let the axis pass through P1(x1, y1, z1) and P2(x2, y2, z2). Unit vector u = (a, b, c) = (P2 − P1)/|P2 − P1|, d = √(b² + c²).

  1. Translate P1 to the origin: T(−x1, −y1, −z1).
  2. Rotate about the x-axis by α (cosα = c/d, sinα = b/d) so the axis lies in the xz plane.
  3. Rotate about the y-axis by β (cosβ = d, sinβ = a) so the axis coincides with the z-axis.
  4. Rotate about the z-axis by the required angle θ.
  5. Apply the inverse rotations in reverse order: Ry(−β), then Rx(−α).
  6. Translate back: T(x1, y1, z1).

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

Perspective projection

Perspective projection projects 3D points onto a view plane along lines that meet at the centre of projection (COP). Distant objects appear smaller, which gives a realistic picture.

With the COP at (0, 0, zprp) and the view plane at z = zvp, dp = zprp − zvp:

xp = x·dp/(zprp − z), yp = y·dp/(zprp − z), zp = zvp

| 1 0  0        0           |
| 0 1  0        0           |
| 0 0 -zvp/dp   zvp·zprp/dp |
| 0 0 -1/dp     zprp/dp     |

The result is divided by the homogeneous factor h = (zprp − z)/dp.

Features:

  • Parallel lines that are not parallel to the view plane converge at vanishing points.
  • Types: one-point, two-point and three-point perspective.
  • Size is not preserved, so it is not used for measurements.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Computer Graphics chapter 4 questions →