Lecture Notes 4: Affine Transformations and 3D Transformations

Review of Affine Transformations

  • Affine transformations have limitations when combined.

  • Homogeneous coordinates provide a solution to approximate linear transformations.

  • This involves representing transformations (including translation) using a single matrix.

  • The input vector's dimension increases by one (e.g., 2D becomes 3D).

  • Matrix multiplications are efficient for transformations.

Examples of Transformations with Homogeneous Coordinates

  • Rotation, scaling, and shear transformations.

  • Translation is represented by a specific matrix.

Examples of Combining Transformations

Rotation followed by Translation

  • If RR is the rotation matrix and TT is the translation matrix, then rotation followed by translation is represented as TRxT \cdot R \cdot x, where xx is the input.

  • The resulting matrix combines rotation and translation parameters.

Rotation followed by Shear

  • Rotation is applied first, then shear.

  • Order matters because changing the order can yield different results.

Translation followed by Rotation

  • The result differs from rotation followed by translation.

  • Translation followed by rotation is not the same as rotation followed by translation.

Reason for the Difference
  • Rotation is performed around the origin by default.

  • Translation shifts the origin, so subsequent rotation occurs around a new point.

Commutativity of Transformations

  • If AB=BAA \cdot B = B \cdot A, transformations are commutative.

  • Translation and rotation are generally not commutative.

  • However, translation followed by translation or rotation followed by rotation are commutative.

Properties of Transformations

  • Rotations in 2D commute.

  • Translations commute.

  • Scaling commutes.

  • Shear transformations commute.

  • In general, transformations are not always commutative

Rotation Around an Arbitrary Point

  • To rotate a shape around its center (not the origin):

    • Translate the shape so that the center is at the origin.

    • Perform the rotation.

    • Translate the shape back to its original position.

  • This involves TRT1T \cdot R \cdot T^{-1}, where TT is the translation matrix, RR is the rotation matrix, and T1T^{-1} translation inverse.

Applying Transformations to Primitives

Line Segment

  • Defined by two points.

  • Apply the transformation to both points.

Rectangle

  • Defined by two opposite corner points.

  • Apply the transformation to these two points.

  • This works because affine transformations preserve parallel lines and straight lines.

3D Transformations

  • Include scaling, translation, and rotation.

  • Also involve the pinhole model, perspective projection, and viewpoint transformation.

Homogeneous Coordinates in 3D

  • 3D coordinates become 4D in homogeneous form.

  • Linear transformations use 3x3 matrices.

  • Affine transformations use 4x4 matrices.

Scaling and Translation in 3D

  • Translation: T<em>xT<em>x, T</em>yT</em>y, TzT_z for three dimensions.

  • Scaling: Factors for x, y, and z directions.

Rotation in 3D

  • More complex due to axis and order of rotation.

  • Rotation around x, y, and z axes.

  • Order matters; rotations do not commute.

Rotation Around Z-Axis:
  • Similar to 2D rotation in the x-y plane.

Rotation Around X-Axis:
  • The y-z plane is rotated

Rotation Around Y-Axis:
  • Uses similar parameters but in different matrix positions.

  • The matrix element at [1,1][1,1] will be equal to one.

Rotation and Inverse Rotation

  • Inverse rotation reverses the effect of the original rotation.

  • Mathematically, if RR is the rotation matrix, the inverse is R1R^{-1}.

  • Geometrically, rotating by θ\theta degrees and then by θ-\theta degrees.

Properties of Rotation Matrices
  • Orthogonal matrices: RRT=IR \cdot R^T = I, where II is the identity matrix.

  • R1=RTR^{-1} = R^T

  • Transpose is faster to compute than the inverse.

Rotation Around an Arbitrary Vector

  • Rotate the vector to align with the x-axis, rotate, and then reverse the rotation.

  • Rotate the vector to align with the y-axis, rotate, and then reverse the rotation.

  • Multiple rotation and inverse rotations are required which makes this approach complicated.

Rodrigues' Rotation Formula
  • Alternative mathematical approach.

  • R=cos(θ)I+sin(θ)[u]x+(1cos(θ))(uuT)R = cos(\theta)I + sin(\theta)[u]_x + (1 - cos(\theta))(u \cdot u^T)

  • Rotation around vector uu, where uu is a unit vector.

  • Uses sine and cosine of the angle.

  • Involves cross product and dot product of vectors.

Normals and Transformations

Definition of Normal

  • A vector perpendicular to the surface at a point.

  • Changes with curvature.

Transformation of Normals

  • If a transformation AA is applied.

  • The new normal is calculated as n=(A1)Tnn' = (A^{-1})^T n.

  • Important for non-uniform scaling.

Proof (Key Points)
  • If two vectors are perpendicular, their dot product is zero.

  • The dot product of A and B can be written as ATBA^T B.

  • Transformation: x=Ax+tx' = Ax + t.

  • The new transformed normal equals to n=(A1)Tnn' = (A^{-1})^T n.

Lecture Summary

  • Modeling linear transformations.

  • Overcoming the complication of combining multiple affine transformations in 2D using Homogeneous coordinates.

  • 3D transformations.

  • Rotation around x, y, z axes or a random vector.