Agenda• Definition & Motivation• 2D Geometric Transformation
– Translation– Rotation– Scaling
• Matrix Representation• Homogeneous Coordinates• Matrix Composition• Composite Transformations
– Pivot-Point Rotation– General Fixed-Point Scaling – Reflection and Shearing– Transformations Between Coordinate Systems
Geometric Transformation
• Definition – Translation, Rotation, Scaling
• Motivation – Why do we need geometric
transformations in CG?– As a viewing aid– As a modeling tool– As an image manipulation tool
Basic 2D Transformations• Translation
– –
• Scale– –
• Rotation– –
• Shear– –
txxx tyyy
sxxx syyy
sinθy-cosθxx
cosθysinθxy
yhxxx S
xhyyy S
Matrix NotationsTransformation
NameTransformation Matrix Notation
Inverse Transformation
Matrix
Translation T(a, b) T-1(a,b) = T(-a, -b)
Rotation R(θ) R-1(θ) = R(-θ)
Scaling S(sx, sy) S-1 (sx, sy) =()
Reflection About x-axis
Mx(a, b) Mx-1 (a, b) = Mx(a, -b)
Reflection About y-axis
My(a, b) My-1 (a, b) = My(-a, b)
Reflection About the origin
Mo(a, b) Mo-1 (a, b) = Mo(-a, -b)
Matrix Representation• Represent a 2D Transformation by a Matrix
• Apply the Transformation to a Point
y
x
dc
ba
y
x
dycxy
byaxx
dc
ba
TransformationMatrix Point
Matrix Representation• Transformations can be combined by matrix
multiplication
y
x
lk
ji
hg
fe
dc
ba
y
x
Matrices are a convenient and efficient way
to represent a sequence of transformations
TransformationMatrix
2×2 Matrix (2D Rotation & Shearing)
2D Rotation
2D Shearing
y
x
y
x
cossin
sincos
y
x
shy
shx
y
x
1
1
yxy
yxx
cossin
sincos
yxshyy
yshxxx
2×2 Matrix (2D Reflection)
2D Mirror over Y axis
2D Mirror over (0,0)
yy
xx
yy
xx
y
x
y
x
10
01
y
x
y
x
10
01
2×2 Matrix (2D Translation)• This transformation cannot be represented with
a 2×2 matrix?
2D Translation
txxx tyyy
NO!!
Only linear 2D transformationscan be Represented with 2x2 matrix
Homogeneous coordinates• Reason?
– Unification and extension of concepts– Best way to represent a sequence of
transformations
• 2D translation can be represented by a 3×3 matrix– Point represented with homogeneous coordinates
txxx tyyy
1
y
x
100
ty10
tx01
1
y
x
Basic 2D Translation
A translation moves all points of an object a fixed distance in a specified direction.
txxx
tyyy
1
y
x
100
ty10
tx01
1
y
x
Basic 2D RotationIt rotates points in the xy-Cartesian plane counterclockwise through an angle θ about the origin of the Cartesian coordinate system.
1
y
x
100
0cossin
0sincos
1
y
x
θ siny-θ cosxx
θ cosyθ sinxy
Basic 2D ScalingIt is a linear transformation that enlarges (increases) or shrinks (diminishes) objects by a scale factor that is the same in all directions.
1
y
x
100
0sy0
00sx
1
y
x
syyy sxxx
Basic 2D Shearing• A transformation that distorts the shape of an
object.• Two types of shearing transformations are
there about X values and about Y values
yshxxx xshy yy
1
y
x
100
01shy
0shx1
1
y
x
Basic 2D Transformations• Basic 2D transformations as 3x3 Matrices
1100
10
01
1
y
x
ty
tx
y
x
1100
0cossin
0sincos
1
y
x
y
x
1100
00
00
1
y
x
sy
sx
y
x
1100
01
01
1
y
x
shy
shx
y
x
Translate
Shear
Scale
Rotate
Matrix Composition• Transformations can be combined by matrix
multiplication
– Matrix multiplication is associative
w
y
x
1 0 0
0sy0
00sx
1 0 0
0cosθinθ
0 sinθ- θ
s
cos
100
ty10
tx01
w
y
x
p ty)T(tx, )R( sy)S(sx, p
p)))SRTp ((( pS)RTp (
Matrix Composition• Rotate by around arbitrary point (a,b)
• Scale by sx, sy around arbitrary point (a,b)
T(-a,-b))R(b)T(a,M θ
T(-a,-b)sy)S(sx,b)T(a,M
(a,b)
(a,b)
Pivot-Point Rotation
100
sin)cos1(cossin
sin)cos1(sincos
100
10
01
100
0cossin
0sincos
100
10
01
rr
rr
r
r
r
r
xy
yx
y
x
y
x
,,,, rrrrrr yxRyxTRyxT
Translate Rotate Translate
(xr,yr) (xr,yr) (xr,yr)(xr,yr)
General Fixed-Point Scaling
100
)1(0
)1(0
100
10
01
100
00
00
100
10
01
yfy
xfx
f
fx
f
f
sys
sxs
y
x
s
s
y
x
y
Translate Scale Translate
(xf,yf) (xf,yf) (xf,yf) (xf,yf)
yxffffyxff ssyxSyxTssSyxT ,,,, ,,
Translate-Rotate-Translate
Original position
Final position
1
y
x
1 0 0
10
01
1 0 0
0cosθinθ
0 sinθ- θcos
100
10
01
1
y-
x- r
rr
r
sy
x
y
x
Reflection• Reflection about x-axis (y=0)• Reflection about y-axis (x=0)• Refection about the origin (0, 0)• Reflection about the line y = x• Reflection about the line y = ax + b
Reflection with respect to a Line
Clockwise rotation of 45 Reflection about the x axis Counterclockwise rotation of 45
Reflection about the line y = x
100
001
010
x
y 1
32
1’
3’2’x
y
x
y
x
y
Top Related