Computer Graphics Assignment 4: Transformations and Barycentric Coordinates


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (9 votes)

Exercise 1 [5 points]
Let us consider a 2D coordinate system with points p1 = (1, 1)T
, and p = (1.5, 2.5)T
. Additionally, let’s define
a vector u = p − p1. Perform the following tasks:
Task 1 [1 points] Construct two matrices, R90, T ∈ R3×3
, such that the first one performs counter-clockwise
rotation around the center of the coordinates system by angle 90◦
, and the second one performs translation
by vector t = (1, −2)T
, in homogeneous coordinates.
Task 2 [1 points] Represent the points p1 and p as well as the vector u using homogeneous coordinates and
transform them first using the R90, and then T matrices. Convert the obtained points and vector back into
Cartesian coordinates and denote them by p
, p0
, and u
. Draw all the points and vectors before and after the
transformation, and verify that u
0 = p
0 − p
. What influence did the matrix T have on the u
Task 3 [1 points] Construct a scaling matrix, S ∈ R3×3
, which scales everything in x and y direction by a
factor of 2. Compute new points p
, p00 and vector u
00 by transforming p
, p0
, and u
0 using matrix S. Again
perform the operation in homogeneous coordinates, and then, convert the results to Cartesian coordinates
and visualize them.
Task 4 [2 points] Construct matrices R
90 , T −1
, S−1 ∈ R3×3
, which perform inverse transformations to
R90, T, S,, i.e., clockwise rotation by 90◦
, translation by vector t
0 = (−1, 2)T
, and scaling by factor 0.5. Compute matrix M = R
90 T
, and verify that transforming points p
, p00, and u
00 with this matrix results in
the initial values of p1, p, and u .
Exercise 2 [4 points]
Consider a triangle made of three points p1 = (6, 0, 4), p2 = (2, 0, 0), and p3 = (2, 4, 4). Verify whether point
p = (4, 1, 3) belongs to the interior of the triangle.
Exercise 3 [3 points]
Using barycentric coordinates, prove that the centroid of a triangle divides its medians in ratio 2:1.
Exercise 4 [3 points]
Consider a transformation that projects all the points pi ∈ R2 onto
the line x = 1. For each point, the projection is performed along
the line that passes through the center of the coordinate system
and the point (see the image on the right). Each point p
is a
result of applying this transformation to point pi
. Construct a
matrix M ∈ R3×3 which realizes this transformation using homogeneous coordinates. More specifically, after converting a point
into the homogeneous coordinates, multiplying it with the matrix M, and transforming it back to the Cartesian coordinates, you
should obtain point p
. Note that this is not an affine transformation. Comment on how the matrix M transforms the points lying
on the y-axis. Interpret the results both in the homogeneous and
Cartesian coordinates.
Bonus exercise 5 [2 points]
Consider the same task as in Exercise 4, but the line onto which the points are projected can be now arbitrary,
and it is defined by a line equation y = ax + b, where a, b ∈ R are constants. Derive the matrix M for this
more general case.
Submit a single PDF including all the calculations you did to solve the assignments to iCorsi. You should not
use any external tools, other than a simple calculator, which can provide intermediate or final results.
Solutions must be returned on October 20 2022 via iCorsi3