Graphics / Reference / Transformation non-commutativity
Transformation non-commutativity
Transformation matrices generally do not commute: changing their multiplication order can change both the composite matrix and the resulting geometry. Applied order must therefore be preserved explicitly.
Matrix multiplication is generally not commutative:
A*B != B*A
For column vectors, the rightmost matrix acts first.
Let x-scale by 2 be:
S = [2,0,0;0,1,0;0,0,1]
and approximate a 45-degree rotation by:
R = [0.71,-0.71,0;0.71,0.71,0;0,0,1]
Rotate first, then scale:
p' = S*R*p
S*R = [1.42,-1.42,0;0.71,0.71,0;0,0,1]
Scale first, then rotate:
p' = R*S*p
R*S = [1.42,-0.71,0;1.42,0.71,0;0,0,1]
The products differ, so the transformed points and shapes can differ. The standard diagram uses an asymmetric F shape to make the distinction visible.
The same ordering rule applies to longer products. For rotation, then uniform scale by sqrt(2), then translation by (-2,2), the column-vector composite is T*S*R, with the first applied transform R as the rightmost factor.
Builds on
Read
- Read the chapter: Transformation non-commutativity