Graphics / Reference / 2D affine transformations
2D affine transformations
The basic 2D affine transformations used here are scaling, rotation, translation and shear. They let one predefined object be repositioned, reoriented or resized without rebuilding its geometry.
The basic 2D transformations are scale, rotation, translation and shear.
Uniform scaling about the origin by factor m:
x' = m*x y' = m*y
Rotation about the origin by angle θ:
x' = x cos θ - y sin θ y' = x sin θ + y cos θ
Translation by vector (xo,yo):
x' = x + xo y' = y + yo
Shear parallel to the x axis by factor a:
x' = x + a*y y' = y
Transformations allow the same stored geometry to be reused at arbitrary locations, orientations and sizes instead of creating separate coordinate data for every instance.
The standard comparison diagram shows one rectangle alongside scaled, rotated, translated and x-sheared versions so the geometric effect of each operation can be compared directly.
Read
- Read the chapter: 2D affine transformations