A linear transformation maps each output coordinate to a linear combination of input coordinates. In two dimensions, a square matrix performs this mapping: it can rotate, scale, or skew shapes, but it always leaves the origin fixed. Translation therefore lies outside the linear case. section 4.2.1
Matrix representation makes several useful operations straightforward:
- Compose transformations by multiplying their matrices. section 4.2.1
- Reverse an invertible transformation by computing its inverse matrix. section 4.2.1
- Use affine transformations when translation is required, or projective transformations when shear is also needed. section 4.2.5
Recovering a transformation with SymPy
Given two input points and their transformed coordinates, solve four coordinate equations for the four matrix entries. SymPy can produce symbolic expressions for a11, a12, a21, and a22, turning point correspondences into an explicit transformation matrix.
