Академический Документы
Профессиональный Документы
Культура Документы
Readings:
1) Hearn Donald, Baker Pauline, Computer Graphics with OpenGL, Third Edition,
Prentice Hall, 2004. Chapter 5
2) Hill, F. S., Kelly S. M., Computer Graphics Using OpenGL, Third Edition, Pearson
Education, 2007. Chapter 5
3) $ Szeliski R., Computer Vision - Algorithms and Applications, Springer, 2011.
Chapter 2
Geometry Processing
Geometry Model/View
Model/View Perspective
Perspective
Lighting Clipping
Database Transform.
Transform. Transform.
Transform.
Scan Depth
Depth Frame-
Frame-
Texturing Blending buffer
Conversion Test buffer
2D Transformations
• Basic 2D transformations
• Matrix representation
• Composite Transformation
• Computational Efficiency
• Homogeneous representation
• Matrix composition
Geometric Transformations 4
Linear Transformation
Euclidean Transformation
Affine Transformation
Projective Transformation
Linear Transformations 5
tx = 2
ty = 3
2D Translation 11
2
2D Scaling 13
x2
y 0.5
300
2D Rotation 17
(x, y)
x = r cos (f)
y = r sin (f)
x’ = r cos (f + )
y’ = r sin (f + )
(x’, y’)
Trig Identity…
(x, y) x’ = r cos(f) cos() – r sin(f) sin()
y’ = r sin(f) cos() + r cos(f) sin()
f Substitute…
x’ = x cos() - y sin()
y’ = x sin() + y cos()
2D Rotation 19
x’ = x cos() - y sin()
y’ = x sin() + y cos()
=>
a b
c d
Multiply matrix by column vector
apply transformation to point
x' a b x x' ax by
y ' c d y y ' cx dy
Composite Transformation 21
x' a b e f i j x
y ' c d g h k l y
Transformation in Matrix
Representation 22
x ' t x x
y ' t y Translation
y
x' s x 0 x
y ' 0
s y y
Scaling
x' cos sin x
y ' sin cos y
Rotation
http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/geometry/homo-coor.html
Homogeneous Coordinates 25
Convenient coordinate y
system to represent many 2
useful transformations (2,1,1) or (4,2,2) or (6,3,3)
1
1 2 x
2D Translation Matrix 26
x 1 0 t x x
x ' t x x y 0 1 t y
y ' t y => y
y
1 0 0 1 1
Transformation in Matrix
Representation 27
x 1 0 t x x
y 0 1 t y
y Translation
1 0 0 1 1
x s x 0 0 x
y 0 s 0 y Scaling
y
1 0 0 1 1
x cos sin 0 x
y sin cos 0 y Rotation
1 0 0 1 1
Ta Tb = Tb Ta, Ra Rb != Rb Ra and Ta Rb != Rb Ta
1 0 t x
T 1 0 1 t y
0 0 1
i.e.,
P = T-1.M.T
Transformation about a Pivot Point 35
p ( xc , yc )
FW
T (t x , t y ).R( xc , yc , ).S ( xc , yc , s x , s y )
needs a lot of
s x cos s y sin xc 1 s x cos yc s y sin t x
multiplications
s x sin s y cos yc 1 s y cos xc s x sin t y
0 0 1
and additions.
However, after matrix concatenation and simplification, we have
x a b c x
y d e f y
1 0 0 1 1
or x’ = a x + b y + c; y’ = d x + e y + f
having just 4 multiplications & 4 additions ,
which is the maximum number of computation required for any
transformation sequence.
Question 1 39
Sol.
Question 2 40
(3,0)
x
(0,-2)
Question 3 - Solution 43
(3,0)
x
(0,-2)
Sol.
1 0 0 1 / 2 0 0 Cos(90) Sin(90) 0 1 0 3
M 0 1 2 0 1 / 2 0 Sin(90) Cos(90) 0 0 1 0
0 0 1 0 0 1 0 0 1 0 0 1
Transformation about a Pivot Point 44
Exercise:
Find a general 2D composite matrix M for transformation of an
object about its centroid (xc, yc) by using the following
parameters:
Reading: HB5
Other 2D Transformations 45
Reflection
Shear
Reflection 46
1 0 0
Rf x 0 1 0
0 0 1
0 1 0
Rf x y
1 0 0
0 0 1
Shear 49
Shear 50
Shear 51
Shear 52
Shear 53
Find the transformation matrix for this transformation.
a b 0
Hint: Let T c d 0 1 h 0
0 0 1
Sol. T 0 1 0
and solve for a, b, c, d. 0 0 1
Question 5 55
Prove that we can transform a line by transforming its endpoints and then
constructing a new line between the transformed endpoints. Can you do the
same thing for circles by transforming the centre and a point on the circle?
Sol.
The parametric equation of a line segment joining a and b is