Graphics / Reference / 3×3 transformation matrices
3×3 transformation matrices
Scale, rotation, identity and shear can all be written as 3 by 3 homogeneous matrices, placing the familiar 2 by 2 linear transform in the upper-left block and preserving w.
The standard homogeneous 3 by 3 matrices used here preserve the final homogeneous coordinate with the bottom row [0,0,1].
Non-uniform scale by mx along x and my along y:
[mx,0,0;0,my,0;0,0,1]
Uniform scaling is the special case mx = my.
Rotation about the origin by angle θ:
[cos θ,-sin θ,0;sin θ,cos θ,0;0,0,1]
Identity:
[1,0,0;0,1,0;0,0,1]
X-shear by factor a:
[1,a,0;0,1,0;0,0,1]
These matrices act on homogeneous column vectors [x;y;w]. For ordinary finite points represented with w = 1, their x and y effects match the corresponding 2D formulas. Translation uses the same 3 by 3 framework but places xo and yo in the third column rather than keeping that column zero.
Builds on
Read
- Read the chapter: 3×3 transformation matrices