Transforms - lorentzo/IntroductionToComputerGraphics GitHub Wiki

Why we need transforms?

What transforms do?

  • Transform is operation that takes points, vectors or colors and converts them in some way.
  • Linear transform: transform that preserves vector addition and scalar multiplication.
    • Scaling
    • Rotation
  • Translation is not linear transform: use affine transforms (represented by 4x4 matrices)
    • homogeneous notation is used for vectors and points
    • Translation, rotation, scaling, reflection and shearing transforms are affine: preserve parallelism of lines but not (necessarily) lengths and angles

Basic transforms

Translation

  • Change point location from one to another
  • properties, inverse
  • rigid-body transform: preserve distance between points and headedness

Rotation

  • rotates vector/point by given angle around given axis passing through origin: 3 matrices: rotation of theta degrees around x, y, or z axis can be used for rotation around arbitrary axis
  • Pivot point is required for determining rotation: object is first translated so that pivot point in the center and then rotation is performed after which object is again transformed so that pivot point is in the same position as before.
  • rigid-body transform: preserve distance between points and headedness
  • useful for positioning and orienting objects: e.g., orientation matrix - rotation matrix associated with camera view or object that defines its orientation in space: directions for up and forward are needed to define this matrix.

Scaling

  • enlarging or diminishing objects
  • uniform/isotropic
  • non-uniform/anisotropic
  • reflection/mirror matrix

Shearing

  • 6 basic shearing

Concatenation of Transforms

  • Non-commutativity of matrix multiplication -> order of multiplication matters!
  • TRS

Rigid body transforms

Rigid body transforms - concatenation of rotation and translation matrices

  • Look At Matrix

Normal transform

  • Normal is geometrical property that can not be transformed using discussed transforms
  • Transpose of Matrix adjoint must be used!

Special transforms

Euler Transform

  • establish default view: negative z
  • head orient: along y
  • Euler matrix is concatenation of 3 rotation matrices around x,y and z axis
  • angles: head (y-roll), pitch (x-roll), roll (z-roll)
  • Problems: gimbal lock, two different sets of Euler angles can give same orientation and finally interpolation between two Euler angle sets is not as simple as interpolating each angle
  • Good: angles can be extracted from Euler matrix -> matrix decomposition

Rotation around arbitrary axis

  • transform to space where axis we want to rotate around is x, perform rotation, return to original space

Quaternions

  • represent rotations and orientations
  • 3D orientation can be represented as single rotation around particular axis
  • Interpolating between two quaternions is stable and constant
  • unit quaternion - any 3D rotation

Examples

  • Vertex blending
  • Morphing
  • Geometry cache playback

Projections