CS4102 Computer Graphics Practical 1: Graphics theory
The task is split into several parts, increasing in complexity. Each task is defined in terms of
parameters that will be different for each student, and which can be found together with this
specification on studres.
You should provide your solution in a PDF document (this can be computer-based or a
scanned hand-written document). There is no programming component to this practical. You
are welcome to use tools such as R, Matlab, Octave, or IPython/numpy to help you multiply
matrices and points, but your answers should clearly show all steps of the process, not only
the final result. Transformations are easily computed if points are represented as a 2D matrix
where each column represents one vertex, as shown in lecture 6, slide 44. You can find an
example of what a clear answer looks like at the end of this specfication.
Part 1: Object manipulation
In this part, you should define a model matrix to transform the object in the following way.
Translate the object by the vector δ, scale the object by the vector σ, rotate around the x, y,
and z axes by the angles given by ✓. The values for δ, σ, ✓ are given on studres in the file
students.html (there is a JSON version if you prefer that). These operations should be
performed in the specified order, including the sequence of rotations: first rotation is around
the x axis, then around y, and finally around z. Your answer should clearly show:
(a) The 4 ⇥ 4 transformation matrix for each operation listed above.
(b) The sequence of matrix multiplications showing the concatenation of the transforma
tions. These should be expressed in terms of variables δ, σ, etc.
(c) The combined 4 ⇥ 4 transformation matrix Mmodel that performs all operations in the
specified order. This should be expressed in terms of real-valued numbers.
(d) The homogeneous coordinates P10
, P20
,...,P100 of all points P1, P2,...,P10 after the
combined transformation.
Part 2: Geometry
In this part, you should use 3D vectors to represent points and (geometric) vectors using Carte
sian coordinates in the form v1=[xyz]
T . You should then make use of vector operations such
as addition, subtraction, and inner and outer products to answer the following four questions.
(a) Express the transformed points P10
, P20
, P30
, P40
, and P50 as vectors of the type [xyz]
T .
(b) Express the three lines which connect P10 to points P20
, P40
, and P50 as vectors v1, v2, v3
of the type [xyz]
T .
(c) Show (by calculation) that vectors v1, v2, v3 are all orthogonal to each other.
(d) Show (by calculation) that transformed points P10
, P20
, P30
, and P40 all lie on the same plane.
Part 3: Camera positioning
In this part, you should position a camera in the scene. To do this, you will need to define
the camera matrix that moves the camera away from the origin along the z axis by an offset
distance dc, and then rotates the camera based on angle ✓c (which defines the angle of rotation
around the x axis), and angle φc (which defines the rotation around the y axis). The positioning
of the camera in world coordinates can then be expressed in terms of one translation and two
rotations, in the stated order. The camera matrix will then allow you to calculate the view matrix.
(a) Show the individual transformations required by your approach (e.g. translation, rota
tion, etc.). These should be expressed in terms of variable names and angles.
(b) Show the combined 4⇥4 transformation matrix Mview that performs all operations in the
correct order. This should be expressed in terms of real-valued numbers.
(c) Show the combined 4 ⇥ 4 model-view matrix that combines Mmodel and Mview. This
should also be expressed in terms of real-valued numbers.
(d) Transform all points P1 ...P10 by the resulting model-view matrix Mmodel−view.
Part 4: In-place manipulation
Starting with the points you calculated in Part 3, your task is now to change the object in
place, to make it twice as wide as it is. For our object, this means that the distance between
points P1 and P2 will double, but distance between P1 and P4 will stay the same. Note that
a simple scaling matrix will no longer suffice because the object has already been moved and
rotated. You will need to derive a transformation matrix that will take points from Part 3 and
transform them so that the object is in the same place, with same orientation, but stretched
horizontally (with respect to the object coordinates). As before, show the concatenation of
individual matrices and the final form of the matrix.
Part 5: Advanced tasks
These tasks should only be attempted once you are happy with your solution to parts 1-4. A
competent attempt to solve at least one of the advanced tasks is necessary to gain a mark of 17
and above.
(a) The axes of the camera coordinate system v can be expressed in terms of the axes
of the world coordinate system v1
w ...v3
w. Express the camera axes in terms of the world
axes and show mathematically how they map to each other. Make sure to reference the
sources you used.
(b) Calculate a suitable perspective matrix P and apply it to the object. You will need to fully
explain how you obtained the perspective matrix. Check that the entire object is visible
on camera after applying this transformation and make any necessary adjustments if it
is not. A sketch of the objects as seen by the camera after the perspective projection will
be helpful to verify that your transformation is correct.
Report formatting
Your submission should not be a classical report; simply answering each question clearly is sufficient.