Lecture 10&11
Lecture 10&11
Chapter 5: 2-D
x’ = xf + (x – xf)cosθ – (y – yf)sin θ
Geometric y’ = yf + (x – xf)sinθ + (y – yf)cos θ
( x' , y ' )
Transformations The basic concept is to:
Align the coordinate to be r
( x, y )
Homogeneous coordinates & transformed according to θ r
the fixed point.
reflection φ
Rotate it. (xf, yf)
Move it back w.r.t. the
original position by adding
the fixed point in x’ and y’.
SCALING WRT A FIXED POINT - ?
x ' 1 0 t x x
y ' = 0 1 t ⋅ y
Homogeneous Coordinates y
1 0 0 1 1
General matrix form for TRANSLATION
P ' = T (t x , t y ) ⋅ P
translation/rotation/scale:
x' cos θ − sin θ 0 x
P' = M 1 ⋅ P + M 2 y ' = sin θ
cos θ 0 ⋅ y
How can we eliminate addition? 1 0 0 1 1
ROTATION
Homogeneous coordinates P ' = R (θ ) ⋅ P
xh y x ' s x 0 0 x
( xh , y h , h ) x= , y= h
h h y ' = 0 s 0 ⋅ y
y
1 0 0 1 1
Easiest: h =1 SCALING
P' = S (s x , s y ) ⋅ P
1
Inverse Transformations Reflection
Accomplished by the inverse of the matrix
Translation: Reflection is a transformation that
1 0 − t x produces a mirror image of an object.
T −1 = 0 1 − t y
This mirror image is generated
0 0 1
relative to an axis of reflection by
Rotation: rotating the object 180o about the
cos θ sin θ 0
R −1 = − sin θ cos θ 0 reflection axis.
0 0 1 Axis of reflection can be any line
Scale: y = 0.
1
s 0 0 x = 0.
x
1 x = y.
S −1 = 0 0
sy
0 0 1
x=-y.
Reflection y = 0 Reflection x = 0
y
1 y
2 2'
x' 1 0 0 x x ' − 1 0 0 x
2 3
x y ' = 0 − 1 0 ⋅ y y ' = 0 1 0 y
3 3'
1 0 0 1 1 1 0 0 1 1
2' 3'
1 1'
1'
2
Reflection about the origin Reflection about y = x
y
3
3'
y
x' 0 1 0 x
y' = 1 0 0 ⋅ y
2'
2
1 0 0 1 1
1' x ' − 1 0 0 x
y ' = 0 − 1 0 ⋅ y 1 Can also be done by a
x
1'
sequence of rotations and
1
1 0 0 1 1 3'
reflections:
2
C rotation 45o.
2'
x
Reflection wrt x-axis.
3
CC rotation 45o.