1 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine
2 Chapter 5 Two Dimensional Geometric Transformations ITGD3107 Computer Graphics
3 Two Dimensional Geometric Transformations Some Basics 2D Translations. 2D Scaling from the origin. 2D Rotation about the origin. Transformations.
4 Some Basics Basic geometric types. –Scalars s –Vectors v –Points p Transformations –Types of transformation: rotation, translation, scale. –Matrix representation –Order P=T(P)
5 2D Translations. P P’
6 Component-wise addition of vectors v’ = v + t where and x’ = x + dx y’ = y + dy To move polygons: translate vertices (vectors) and redraw lines between them Preserves lengths (isometric) Preserves angles (conformal) dx = 2 dy = 3 Y X Example: 2D Translation (Note: Points are at object’s local coordinate system origin)
7 2D Scaling from the origin. P P’
8 Component-wise scalar multiplication of vectors v’ = Sv where and Y X Example: 2D Scaling
9 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y)
10 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y) y x
11 2D Rotation about the origin. y x r r P’(x’,y’) P(x,y) y x
12 2D Rotation about the origin. Substituting for r : Gives us :
13 2D Rotation about the origin. Rewriting in matrix form gives us :
14 Transformations. Translation. –P=T + P Scale –P=S P Rotation –P=R P We would like all transformations to be multiplications
15 Translate [1,3] by [7,9] Scale [2,3] by 5 in the X direction and 10 in the Y direction Rotate [2,2] by 90 ° ( π /2) Examples