Professional Documents
Culture Documents
Compositetransformations
Compositetransformations
2D Composite Transformations
Overview
Homogeneous Coordinates
Reflection
Shearing
Graphics applications involves sequences of geometric transformations.
Efficient approach is needed to combine the transformations so that the
final coordinates are obtained directly.
Combine the multiplicative and the translational terms for 2d geometric
transformations into single matrix multiplication by homogenous
coordinates.
Homogeneous coordinates seem unintuitive, but they make graphics
operations much easier
Represent each 2D coordinate position (x, y) with the homogenous
coordinate triple (xh, yh, h).
Represent each 2D coordinate position (x, y) with the homogenous
coordinate triple (xh, yh, h). Where
xh h x
xh yh
x= y= P = yh = h y
h h
h h
s x 0 0
Scaling S s x , s y = 0 s y 0
0 0 1
P = S s x , s y P
Composite Transformations
Application of a sequence of transformations to a point:
P M 2 M 1 P
MP
P T(t 2 x , t 2 y ) {T(t1x , t1 y ) P}
{T(t 2 x , t 2 y ) T(t1x , t1 y )} P
P AND P’ are represented as homogenous coordinate values.
1 0 t 2 x 1 0 t1x 1 0 t1x t 2 x
T t 2 x ,t 2 y T t1x ,t1 y = 0 1 t 2 y 0 1 t1 y = 0 1 t1 y t 2 y = T t1x + t 2 x ,t1 y + t 2 y
0 0 1 0 0 1 0 0 1
0 0 1 0 0 1 0 0 1
T xr , y r
cosθ sinθ xr 1 cosθ + yr sinθ
sinθ cosθ y 1 cosθ x sinθ
r r
0 0 1
Scaling with respect to a Fixed Point
0 0 1
Concatenation Properties
Matrix multiplication is associative, evaluate matrix products using
left-to-right or right-to-left associative grouping.
Matrix composition is not commutative. So careful when applying
a sequence of transformations.
Reversing the order in which the sequence of transformations is
performed may affect the transformed position of an object.
pivot same pivot
REFLECTION
14
2D REFLECTION
x-axis y-axis
Reflection about the line Reflection about the line
y=0 x=0
1 0 0 1 0 0
0 1 0 0 1 0
0 0 1 0 0 1
Transformation keeps x values but
Transformation keeps y values but flips
flips the y values
the x values
15
2D REFLECTION
Reflection relative to Reflection axis as the
the coordinate origin diagonal line x=y
0 1 0
1 0 0
0 0 1
1 0 0
0 1 0
0 0 1
Transformation flips both x values
and y values by Reflecting relative
to the coordinate origin 16
2D REFLECTION
Elements of the reflection matrix can be set to values other than ±1.
Reflection parameter:
◦ >1 – shifts the mirror image of a point farther from the reflection axis.
◦ <1 – brings the mirror image of a point closer to the reflection axis.
17
2D SHEAR
Transformation that distort the shape of an
object.
18
2D SHEAR
19
2D SHEAR
Any real number can be assigned to the shear parameter shx.
y y
shx = 2
x x
(0, 0) (1, 0) (0, 0) (1, 0)
20
2D SHEAR
x’ = x + shx( y – yref) , y’ = y
21
EXAMPLE
y y
x x
(0, 0) (1, 0) (1/2, 0) (3/2, 0)
yref = -1 yref = -1
22
2D SHEAR
x’ = x, y’ = y + shy( x – xref)
23
EXAMPLE
y y
(1, 2)
(0, 3/2)
(0, 1) (1, 1)
(1, 1)
(0, 1/2)
x x
(0, 0) (1, 0) xref = -1
xref = -1
24
Transformations Between the
Coordinate Systems
Between different systems: Polar coordinates to cartesian
coordinates
Between two cartesian coordinate systems. For example,
relative coordinates or window to viewport transformation.
Transformations Between the
Coordinate Systems
How to transform from x,y
to x',y' ?
y
Superimpose x',y' to x,y
Transformation:
◦ Translate so that (x0,y0) y0
moves to (0,0) of x,y
◦ Rotate x' axis onto x axis x0 x
y
R θ T x0, y0
x
Transformations Between the
Coordinate Systems
Alternate method for rotation: y
Specify a vector V for positive
y' axis:
u x uy 0 v y vx 0
R = v x vy 0 = v x vy 0
0 0 1 0 0 1 y
Choose the directions for v relative to P
position P0 .
The components of v calculated as P0
P P0 x
v=
P P0 U is obtained as perpendicular to v
Affine Transformations
•An affine transformation is an important class of linear 2-D geometric
transformations which maps variables (e.g. pixel intensity values
located at position (x,y) in an input image) into new variables (e.g.
in an output image (x’,y’) by applying a linear combination of
translation, rotation, scaling and/or shearing (i.e. non-uniform
scaling in some directions) operations.
•Coordinate transformations of the form:
x' = a xx x + a xy y + bx
y' = a yx x + a yy y + by
Translation, rotation, scaling, reflection, shear. Any affine
transformation can be expressed as the combination of these.
Summary
Homogeneous coordinates
Reflection and shearing – w.r.t origin and fixed point
Transformation between systems
Affine transformations