Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: zz-x2580
COMP3170 Assignment 2
Transformations
Objective
The purpose of this assignment is to test your knowledge of:
• 2D & 3D transformations: translation, rotation, scale and shear
• Homogeneous coordinates & affine matrices
• Nested Coordinate frames
Instructions
Throughout this assignment, all diagrams that you draw should be carefully drawn to scale
using graph paper that you can download from the Internet. Sketches can be done by hand
(using a ruler) and scanned, or made using a suitable drawing program. Make sure there is
always a clear distinction between the object and the axes in your diagrams.
You will be submitting your solution as a PDF so ensure that you allow time for scanning
your work to prepare your final PDF submission. Also, make sure that your scanned
document will be clearly legible – easy to read and clear for marking.
In the following questions we will use this notation for basic transformations.
Please also use this notation in your answers. Incorrect notation may lose you marks.
2D Transformations
• (, ) – translate by units in the x direction and units in the y direction.
• () – rotate anticlockwise by angle .
• (, ) – scale by in the x direction and in the y direction.
• ℎℎ(ℎ) – shear by ℎ units horizontally.
• ℎ() – shear by units vertically.
3D Transformations
• (, , ) – translate by units in the x direction, units in the y direction and
units in the z direction.
• () – rotate about the x axis by angle .
• () – rotate about the y axis by angle .
• () – rotate about the z axis by angle .
• (, , ) – scale by units in the x direction, units in the y direction and units
in the z direction.
Note: All points should be expressed as column vectors, i.e.:
(
) for 2D points, and
(
) for 3D points.
This means that vector multiplication should be done on the right.
E.g., transforming point = (
1
) by translation matrix (, ) = [
1 0
0 1
0 0 1
] is
represented by the equation:
= (, )
= [
1 0
0 1
0 0 1
] (
1
)
= (
+
+
1
)
Question 1. Sketching Transformations in 2D [30 marks]
Figure 1 below shows a flag made up of four vertices with coordinates given in a local
coordinate frame.
Figure 1: A triangular flag with vertices (0,0), (0,1), (0,2), (1,2)
Draw the result of applying each of the following transformations to the flag.
Label the new coordinates for the four vertices labelled above. Show values to 1 decimal
place. [5 marks each]
a) = (−90°)
b) = (0, 1)
c) = (1, 0)(−1, 1)
d) = (90°)(−1, −2)
e) = (1, 0.5)(0, −1)
f) = (−45°)(1, 2)
Question 2: 2D Homogeneous Matrices [30 Marks]
For each of the homogeneous matrices in (a)-(e) below:
i. Draw (to scale) the inner (model) and outer (world) coordinate frames for the
transformation represented by , [2 marks]
ii. Write the decomposition of into two simple 2D transformations.
Answers should be specified in T,R,Sh,S order. [4 marks]
[6 Marks each]
For example, the matrix:
= [
2 0 1
0 1 2
0 0 1
]
Can be drawn as:
Figure 2: Example sketch of inner and outer coordinate frames for the matrix above.
And written as:
= (1,2)(2,1)
Note: Some questions have multiple correct answers. Any one correct answer is enough.
a) = [
0 −1 1
1 0 1
0 0 1
]
b) = [
0 −1 0
−1 0 0
0 0 1
]
c) = [
1 −1 2
0 1 0
0 0 1
]
d) = [
1
√2
1
√2
0
−1
√2
1
√2
−1
0 0 1
]
e) = [
1 −√3 0
√3 1 0
0 0 1
]
Question 3: 3D Transformations [40 Marks]
In the question below, give your answers as the product of simple transforms, e.g.
= (90°)(0,100,0)(45°)(2,1,1)
Transforms can be given in whatever order best suits the question.
Show your working. Incorrect answers with correct working may receive partial marks.
Do not calculate matrix values unless specifically requested (i.e. in part (e)).
Consider the following model aeroplane with origin and coordinate frame as indicated in
Figure 3:
Figure 3: Model aeroplane, viewed from the top, side and rear.
a) Is this a right-handed or left-handed coordinate system? [2 marks]
Figure 4 and Figure 5 show a scene (not to scale) containing a runway R at origin (0,0,0) in
world coordinates, and a tree T positioned 200 metres to the south-west of R. A plane P
starts on the runway facing west (along the x-axis in world coordinates). The plane takes off
and ascends at a pitch of 30°. It flies in a straight line for 500 metres.
b) What is the matrix → representing the plane P’s resulting coordinate frame
relative to the runway R, expressed as a product of simple 3D transformations
(T, Rx, Ry, Rz, S)? [6 marks]
Figure 4: Top-down view of the airport scene in Q3(b) showing runway R, tree T and plane P.
Figure 5: Side-on view of the airport scene in Q3(b) showing runway R, tree T and plane P.
A camera C is mounted on the back of the plane P positioned 20 metres directly behind the
origin, as shown in Figure 6. The camera points along its z-axis to the left side of the plane.
Figure 6: Top and side views showing the camera C on the back of plane P.
c) Draw a scene graph including R, T, P, and C, with runway R as the root. [4 marks]
d) What is the matrix → representing the camera C’s coordinate frame relative to
the plane P, expressed as a product of simple 3D transformations (T, Rx, Ry, Rz, S)?
[6 marks]
The plane P rolls 45 degrees to the left, as shown in Figure 7:
Figure 7: Rear view showing the plane rolling 45° to the left (before and after).
e) What is the homogeneous matrix representing this 45° rotation roll?
Write the matrix in full, using the trig functions sin() and cos().
You do not need to calculate a numerical result. [6 marks]
f) What is the matrix → representing the camera C’s coordinate frame relative to
the runway R, expressed as a product of simple 3D transformations (T, Rx, Ry, Rz, S)?
[6 marks]
g) What is the matrix → representing the tree T’s coordinate frame relative to the
camera C, expressed as a product of simple 3D transformations (T, Rx, Ry, Rz, S)?
[10 marks]