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