2D Geometric Transformations
Transformations are operations that change the position, orientation, size, or shape of geometric objects. In computer graphics, they are the mathematical workhorse that allows objects to be moved through a scene, animated, and projected onto the screen. Two-dimensional transformations operate on points in the plane and form the conceptual foundation for the three-dimensional transformations used in modern 3D graphics.
Basic Transformations
The three basic 2D transformations are translation, rotation, and scaling. Translation moves every point of an object by the same displacement vector (tx, ty): x' = x + tx, y' = y + ty. Rotation about the origin through an angle θ sends (x, y) to (x cos θ − y sin θ, x sin θ + y cos θ). Scaling multiplies each coordinate by a scale factor: x' = x·sx, y' = y·sy. Uniform scaling uses sx = sy; non-uniform scaling produces stretching or squashing.
Homogeneous Coordinates
Translation is an additive operation, while rotation and scaling are multiplicative. To express all three uniformly as matrix multiplications, computer graphics uses homogeneous coordinates. A 2D point (x, y) is represented as the 3-vector (x, y, 1), and each transformation is represented by a 3×3 matrix. Multiplication of a point by a translation matrix adds the desired displacement because of the non-trivial entries in the third column.
Composite Transformations
Complex motions are obtained by multiplying transformation matrices. Because matrix multiplication is associative but not commutative, the order in which transformations are applied is critical. For example, rotating and then translating generally yields a different result than translating and then rotating. A common technique is to compose many individual matrices into a single transformation matrix that is applied once per vertex, improving performance.
Rotation About an Arbitrary Point
Rotation about a point other than the origin is achieved by a three-step composite transformation: translate the pivot point to the origin, perform the rotation, and translate back. Symbolically, the composite matrix is T(−px, −py) · R(θ) · T(px, py), where T and R are translation and rotation matrices respectively.
Scaling About a Fixed Point
Similarly, scaling about a fixed point (fx, fy) requires translating the fixed point to the origin, scaling, and translating back. Without the translations, scaling moves objects toward or away from the origin, which is rarely the desired behaviour.
Reflection and Shear
Reflection creates a mirror image about an axis or line. Reflection across the x-axis negates y; reflection across the y-axis negates x; reflection across the line y = x swaps coordinates. Shearing distorts an object by shifting one coordinate in proportion to the other. A horizontal shear of amount shx leaves y unchanged and sets x' = x + shx·y. Shearing preserves area but not angles.
Coordinate-System Transformations
Sometimes it is more convenient to transform the coordinate system rather than the object. Moving from one Cartesian frame to another rotated and translated relative to it is equivalent to applying the inverse of the corresponding object transformation. This viewpoint is essential in hierarchical modelling and viewing transformations.
Matrix Representation and Efficiency
The 3×3 homogeneous matrix representation is not only uniform but also efficient on modern hardware. GPUs are optimized to perform matrix-vector multiplications in parallel on thousands of vertices. Storing transformations as matrices also enables easy inversion (essential for viewing) and concatenation. Care must be taken with numerical precision when composing many transformations, particularly rotations, where small errors can accumulate.
Affine and Projective Transformations
All 2D transformations described above are affine transformations—they preserve lines and parallelism. Affine transformations can be written in the form x' = Ax + b, where A is a 2×2 matrix and b is a 2-vector. Projective transformations further include perspective and require all entries of the homogeneous matrix to be general. Perspective projection is essential in 3D graphics.
Summary
Two-dimensional transformations—translation, rotation, scaling, reflection, and shearing—form the core operations of computer graphics. Homogeneous coordinates unify these transformations into matrix multiplications, enabling efficient composition and hardware acceleration. Mastery of these transformations is a prerequisite for understanding 3D graphics, animation, and viewing pipelines.