Name:
Midterm Exam: Solutions
COMP175: Computer Graphics Fall 2009 October 27, 2009
D. Transformations (25 points)
1. We wish to scale a triangle A(0, 0), B(1, 1), C(5, 2) to twice its size while keeping vertex C xed. This scaling can be expressed as a composite transformation. Describe and write the matrices for the component transformations. Solution: The transformation has three steps: 1 Translate the center of scaling, C(5, 2), to the origin. 2 Scale the triangle. 3 Translate back to the original location. We apply the series of transformations to triangle ABC as follows: 1 0 S T [ABC] = 0 1 0 0 2 0 5 2 0 2 0 0 1 1 0 0 0 0 1 0 5 1 2 [ABC] 0 1
[A B C ] = T 1
2. The matrix
1 a species a shearing transformation. In the special case of a = 0, we have shearing in the b 1 y direction, and when b = 0, we have shearing in the x direction. (a) Illustrate the eects of shearing in the x direction, shearing in the y direction, and simultaneous shearing on the square A(0, 0), B(1, 0), C(1, 1), D(0, 1).
D(0,1)
C(1,1)
D(0,1)
C(1,1)
D(0,1)
C(1,1)
A(0,0)
B(0,0)
A(0,0)
B(0,0)
A(0,0)
B(0,0)
Shearing in the x direction a = 2, b = 0
Shearing in the y direction a = 0, b = 3
Simultaneous shearing a = 2, b = 3
Name:
(b) Is a simultaneous shearing the same as a shearing in the x direction followed by a shearing in the y direction? Why or why not?
1 a 0 3. Show how to express the shearing transformation b 1 0 in terms of rotation and scaling transformations. 0 0 1 Solution: We have the rotation transformation and the scaling transformation sx 0 0 S= 0 0 1 0 0 1
cos R = sin 0 We can write their composite
sin cos 0
0 sy 0
sx cos SR = sy sin 0 Comparing this to the shearing matrix, we have
sx sin sy cos 0
0 0 1
= sx cos
a = sx sin b = sy sin 1 Substituting values of sx and sy , we get 1 sin = tan cos 1 sin = tan = cos scaling is then 0 0 1 = sy cos
a = b
The shearing transformation expressed in terms of rotation and 1 tan 1 Sh = tan 0 0 where is the angle of rotation.