Graphics / Reference / Concatenating transformations
Concatenating transformations
Multiple transformations can be combined into one composite matrix by multiplying their matrices. With column vectors, the transformation applied first appears as the rightmost factor nearest the point.
If transformation A is applied to point p first and transformation B second, then:
p' = B*A*p
The product M = B*A can be computed once and then applied directly to every point instead of applying A and B separately to every point.
With column vectors, read applied order from right to left: the matrix nearest p acts first.
Example: x-shear H followed by uniform scale S, with H = [1,a,0;0,1,0;0,0,1] and S = [m,0,0;0,m,0;0,0,1], gives:
S*H = [m,m*a,0;0,m,0;0,0,1]
A source diamond centred near the origin can be converted to an axis-aligned square of side 2 at x in [-3,-1], y in [1,3] by applying a 45-degree rotation first, then uniform scale by sqrt(2), then translation by (-2,2). The matrices are R = [cos45,-sin45,0;sin45,cos45,0;0,0,1], S = [sqrt(2),0,0;0,sqrt(2),0;0,0,1], and T = [1,0,-2;0,1,2;0,0,1]. The composite is T*S*R.
The associated diagrams show one source object reused under several composite transforms and the diamond-to-square source and target grids.
Builds on
Read
- Read the chapter: Concatenating transformations