Transformations

Learn how to apply translation, rotation, and scaling to 3D data.

Overview

A transformation is any function that we can apply to a set of geometric primitives, such as points or edges. Some examples of transformations include moving points by a scalar value, scaling them by a value, rotating, mirroring them across an axis, and more.

Translation, rotation, and scaling are three types of transformations with great importance in the world of 3D design. They belong to a special set of transformations called affine transformations. They’re essential in assembling 3D scenes, and nearly every major 3D design software has tools for these three transformations.

The affine transformations

Any transformation that preserves parallel lines is said to be an affine transformation. When we apply transformations to an object, those transformations are said to be affine if parallel lines on the object remain parallel after the transformation.

Affine transformations preserve two properties:

  • Collinearity: When we transform an object, all points along a line must remain along that line, regardless of whether that line is rotated, translated, stretched, etc.

  • Ratios of distances: All points must maintain the same relative distance from one another following the transform. For example, if a set of points in a line are all scaled by the same amount, then the relative distance between points should not change.

Press + to interact
Example of an affine transformation
Example of an affine transformation

Technically speaking, projection is a type of transformation but it is not affine since it doesn’t preserve the properties of collinearity and ratios of distances. Some examples of affine transformations include the following:

  • Translation

  • Rotation

  • Scaling

Affine transformations are most often expressed as matrix multiplications between an affine transformation matrix such as AA and a point vector like xx. In other words, applying an affine transformation is stated as the simple formula:

Translation, rotation, and scale form a subset of affine transformations called similarity transformation. We focus on similarity transformations because they preserve the shape of the objects as a whole.

Translation

Translation simply means to shift all points in an object by a scalar value along a single axis. The simplest way to execute a translation is to use addition. To move an object by 22 units along the +Z+Z direction, simply add 22 to the zz coordinate of every point. Translation in 3D most often comes in two forms: either as an (x,y,z)(x, y, z) vector or as a transformation matrix.

Press + to interact
Example of translation
Example of translation

Vector form

The vector simply contains scalar terms corresponding to orthogonal shifts in each axis. For instance, the tuple to shift an object by 22 units in the +Z+Z direction is (0,0,2)(0, 0, 2). The generic vector form for translation is as follows:

Matrix form

The transformation matrix form appears a bit more cumbersome but is valuable for cascading several transformations together. The camera extrinsic matrix can be represented in the following homogeneous form:

where tt is the 1×31 \times 3 ...