Homogenous Coordinates and Composite Transformations
Homogenous Coordinates and Composite Transformations
2D Geometric Transformations 1
Matrix Representations and Homogeneous
Coordinates
2D Geometric Transformations 2
Matrix Representations and Homogeneous
Coordinates
We will now consider how the matrix
representations discussed in the previous
sections can be reformulated so that
transformation sequences can be efficiently
processed
2D Geometric Transformations 3
Rotation - 𝑃′ = 𝑅. 𝑃
Scaling - 𝑃′ = 𝑆. 𝑃
Translation - 𝑃′ = 𝑃 + 𝑇
2D Geometric Transformations 4
Matrix Representations and
Homogeneous Coordinates (cont.)
P’ = M1 · P + M2
P and P’ are column vectors
𝑥′ 𝑎 𝑏 𝑥 𝑡1
P'= ′ , 𝑀1 = P= 𝑦 𝑀2 =
𝑦 𝑐 𝑑 𝑡2
M1 is a 2 by 2 array containing multiplicative
factors
M2 is a 2 element column matrix containing
translational terms
2D Geometric Transformations 5
Matrix Representations and Homogeneous
Coordinates (cont.)
P’ = M1 · P + M2
For translation M1 is the identity matrix
𝑥′ 1 0 𝑥 𝑡1
′ = . 𝑦 + 𝑡
𝑦 0 1 2
For rotation M2 is the pivot point
𝑥′ 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 𝑥 𝑥𝑟
′ = . 𝑦 + 𝑦
𝑦 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 𝑟
For scaling M2 is the fixed point
𝑥′ 𝑆𝑥 0 𝑥 𝑥𝑓
′ = 0 𝑆𝑦 . 𝑦 + 𝑦𝑓
𝑦
2D Geometric Transformations 6
Matrix Representations and
Homogeneous Coordinates (cont.)
All transformation equations can be expressed as
𝑎 𝑏 𝑡1
matrix multiplications. = 𝑐 𝑑 𝑡2
ℎ1 ℎ2 ℎ
It becomes the three element representations –
(𝑥ℎ , 𝑦ℎ ,ℎ) is the homogenous coordinates
ℎ is the homogenous parameter which is a non-
zero value.
h is the homogeneous parameter such that x =
xh/h, y = yh/h,
2D Geometric Transformations 7
Matrix Representations and Homogeneous
Coordinates (cont.)
𝑎 𝑏 𝑡1
Now M = 𝑐 𝑑 𝑡2 and P’ = M· P
ℎ1 ℎ2 ℎ
2D Geometric Transformations 8
Matrix Representations and
Homogeneous Coordinates (cont.)
To produce a sequence of operations, such
as scaling followed by rotation then
translation, we could calculate the
transformed coordinates one step at a time
A more efficient approach is to combine
transformations, without calculating
intermediate coordinate values
2D Geometric Transformations 9
Matrix Representations and
Homogeneous Coordinates (cont.)
Multiplicative and translational terms for a 2D
geometric transformation can be combined
into a single matrix if we expand the
representations to 3 by 3 matrices
We can use the third column for translation terms,
and all transformation equations can be
expressed as matrix multiplications
2D Geometric Transformations 10
Matrix Representations and
Homogeneous Coordinates (cont.)
2D Translation Matrix
x' 1 0 tx x
y ' 0 1 t y y
1 0 0 1 1
or, P’ = T(tx,ty)·P
2D Geometric Transformations 11
Matrix Representations and
Homogeneous Coordinates (cont.)
2D Rotation Matrix
or, P’ = R(θ)·P
2D Geometric Transformations 12
Matrix Representations and
Homogeneous Coordinates (cont.)
2D Scaling Matrix
x' s x 0 0 x
y ' 0 sy 0 y
1 0 0 1 1
or, P’ = S(sx,sy)·P
2D Geometric Transformations 13
Each point is now represented by a triple: (x, y, W)
x/W, y/W are called the Cartesian
coordinates of the homogeneous points.
Two homogeneous
coordinates (x1, y1, w1) & (x2,2y, w2)
may represent the same point, iff they are multiples of one
another: (1,2,3) & (3,6,9).
There is no unique homogeneous representation of a point.
Cartesian coordinates
are just the plane w=1 in
this space.
15
Inverse Transformations (cont.)
And also:
1
R *R I
2D Geometric Transformations 16
Inverse Transformations (cont.)
17
Inverse Transformations (cont.)
2D Geometric Transformations 19
2D Composite Transformations
(cont.)
Composite 2D Translations
If two successive translation are applied to a point P,
then the final transformed location P' is calculated as
1 0 t 2 x 1 0 t1x 1 0 t1x t 2 x
0 1 t 0 1 t 0 1 t t
2y 1y 1y 2y
2D Geometric Transformations 20
2D Composite Transformations
(cont.)
Composite 2D Rotations
P' R(1 2 ) P
2D Geometric Transformations 21
2D Composite Transformations
(cont.)
Composite 2D Scaling
s2 x 0 0 s1x 0 0 s1x s2 x 0 0
0 s2 y 0 0 s1 y 0 0 s1 y s2 y 0
0 0 1 0 0 1 0 0 1
2D Geometric Transformations 22
2D Composite Transformations
(cont.)
Don’t forget:
Successive translations are additive
Successive scalings are multiplicative
2D Geometric Transformations 23
General Pivot Point Rotation
Steps:
1. Translate the object so that the pivot point is
moved to the coordinate origin.
2. Rotate the object about the origin.
3. Translate the object so that the pivot point is
returned to its original position.
2D Geometric Transformations 24
General Pivot Point Rotation
2D Geometric Transformations 25
2D Composite Transformations
(cont.)
General 2D Pivot-Point Rotation
1 0 xr cos sin 0 1 0 xr
0 1 yr sin cos 0 0 1 yr
0 0 1 0 0 1 0 0 1
2D Geometric Transformations 26
General Fixed Point Scaling
Steps:
1. Translate the object so that the fixed point
coincides with the coordinate origin.
2. Scale the object about the origin.
3. Translate the object so that the pivot point is
returned to its original position.
2D Geometric Transformations 27
General Fixed Point Scaling
(cont.)
2D Geometric Transformations 28
General Fixed Point Scaling
(cont.)
• General 2D Fixed-Point Scaling:
1 0 𝑥𝑓 𝑠𝑥 0 0 1 0 − 𝑥𝑓 𝑠𝑥 0 𝑥𝑓 (1 − 𝑠𝑥 )
0 1 𝑦𝑓 . 0 𝑠𝑦 0 . 0 1 − 𝑦𝑓 = 0 𝑠𝑦 𝑦𝑓 (1 − 𝑠𝑦 )
001 0 0 1 00 1 0 0 1
2D Geometric Transformations 29
2D Composite Transformations
(cont.)
General 2D scaling directions:
Above: scaling parameters were along x and y
directions
What about arbitrary directions?
Answer: See next slides
2D Geometric Transformations 30
General 2D Scaling Directions
2D Geometric Transformations 32
2D Composite Transformations
(cont.)
Matrix Concatenation Properties:
Matrix multiplication is associative !
M3· M2· M1= (M3· M2 ) · M1 = M3· ( M2 · M1 )
A composite matrix can be created by multiplicating left-
to-right (premultiplication) or right-to-left
(postmultiplication)
Matrix multiplication is not commutative !
M2 · M1 ≠ M1 · M2
2D Geometric Transformations 33
2D Composite Transformations
(cont.)
Matrix Concatenation Properties:
But:
Two successive rotations
Two successive translations
Two successive scalings
are commutative!
2D Geometric Transformations 34
Reversing the order
1 0 0
sh
1 0
y
0 0 1 2D Geometric Transformations 36
Other 2D Transformations (cont.)
Shear
x-direction shear relative to other reference lines
1 shx shx * yref
0 1 0
0 0 1