Linear Mapping & Image Transformation
The math behind it
A linear map is a function that takes a 3D point and returns another 3D point, while preserving two simple rules:
Every such map can be represented by a matrix , and applying the map to a point is just matrix–vector multiplication:
A 3D mesh — like the cats above — is just a big collection of vertices. To transform the whole cat, we apply the same matrix to every vertex. Different choices of produce strikingly different effects.
1. Rotation
The first cat spins around the y-axis. The matrix is
The middle row and column are fixed because the y-coordinate doesn’t change — points just swap between the x- and z-axes as grows. This matrix is orthogonal () and has , which is the formal way of saying “rotations preserve lengths, angles, and orientation.” The cat doesn’t deform — it only turns.
2. Scaling
The second cat is driven by a diagonal matrix
where each oscillate independently. Diagonal matrices act on each axis separately: the -coordinate of every vertex is multiplied by , the by , and so on. When all three are equal we get a uniform scale (the cat just gets bigger or smaller); when they differ the cat squashes and stretches non-uniformly. The determinant tells you exactly how its volume changes.
3. Shear
The third cat uses
The diagonal is left alone, but the lone off-diagonal entry shifts the -coordinate by an amount proportional to :
Points high on the -axis slide one way, points on the opposite side slide the other. The result is a shear — the cat tilts as if pushed sideways. Notice , so volume is preserved even though shape isn’t: shearing rearranges material without compressing it.
Why this matters
Rotation, scaling, and shear are three of the basic building blocks of linear algebra, and any linear transformation in 3D can be decomposed into combinations of them (this is essentially the content of the singular value decomposition: , where and are rotations and is a scaling). Linear mapping is one of the foundations of computer graphics, image processing, neural network layers and etc.