CompSci 373

CompSci 373
Tutorial 2 (week 3)
Welcome
●
Tutorial Time & Location
Tuesday
Wednesday
Thursday
●
Useful websites:
Canvas:
Coderunner 1:
Facebook:
●
5pm-6pm @ 201N-352
4pm-5pm @ 206-220
3pm-4pm @ 206-220
https://canvas.auckland.ac.nz/courses/22069
https://www.coderunner.auckland.ac.nz/moodle/course/view.php?id=1284
https://www.facebook.com/groups/166240733884944/
Tutor:
Yang Chen
Office hour:
Location:
[email protected]
Tuesday 4-5pm, Wednesday 3-4pm, Thursday 2-3pm ( 1 hr before tutorial )
open area at level 4 of 303S building.
Determinant
1. Find determinant of M where:
Determinant
1. Find determinant of M where:
Answer: 3 x 6 - 4 x 7 = -10
Homogeneous coordinates
2. Convert homogeneous points to Cartesian coordinates:
(a) [ 2, 6, 2 ]T
(b) [ 2, 3, 0 ]T
Homogeneous coordinates
2. Convert homogeneous points to Cartesian coordinates:
(a) [ 2, 6, 2 ]T
(b) [ 2, 3, 0 ]T
Answer:
(a) [1, 3]T
(b) Point at infinity
Affine Transform Matrix
Rotation matrix in 2D
Matrix R represents a rotation of degree anti-clockwise.
Note: 2D Rotation matrix in homogeneous system is 3x3.
x
-90
0
90
180
sin(x)
-1
0
1
0
cos(x)
0
1
0
-1
Affine Transform Matrix
x
-90
0
90
180
sin(x)
-1
0
1
0
cos(x)
0
1
0
-1
3. What is the 2D rotation matrix R representing the rotation of 90 degree
clockwise?
Affine Transform Matrix
x
-90
0
90
180
sin(x)
-1
0
1
0
cos(x)
0
1
0
-1
3. What is the 2D rotation matrix R representing the rotation of 90 degree
clockwise?
Answer: R is equivalent to a rotation matrix of -90 degree anti-clockwise.
Affine Transform Matrix
Translation matrix in 2D
Matrix T represents a translation vector [ x, y ]T
Note: Translation operation is represented by a transform matrix in homogeneous
system.
Affine Transform Matrix
Scaling matrix in 2D
Matrix T represents a scaling with parameter [ α, β ]T
Affine Transform Matrix
Shearing matrix in 2D
Matrix H represents a shearing with parameter [ Sx, Sy ]T
Sx represents horizontal shearing parameter
Sy represents vertical shearing parameter
Affine Transform Matrix
Shearing matrix in 2D
4. What is the homogeneous coordinate of point [ -1, 3 ]T after shearing with
parameter [ 2, -1 ]T ?
Affine Transform Matrix
Shearing matrix in 2D
4. What is the homogeneous coordinate of point [ -1, 3 ]T after shearing with
parameter [ 2, -1 ]T ?
Answer: [ 5, 4 ]T
Affine Transform Matrix
Consider a Rotation matrix R and a Translation matrix T:
In homogeneous world, matrix R and T can be combined into one matrix:
Affine Transform Matrix
5. Describe the affine transformation matrix M
Affine Transform Matrix
5. Describe the affine transformation matrix M
Answer: It’s a combination of rotation matrix and translation matrix.
Rotation -90 degrees anti-clockwise, followed by translation of vector [1, 0]T
Affine Transform Matrix
6. What is the affine transformation matrix M, which represents a translation of
parameter ( -3, 3 ), followed by a shearing of parameter ( 3, -2 ), followed by a
scaling with parameter ( 3, 4 )?
Affine Transform Matrix
6. What is the affine transformation matrix M, which represents a translation of
parameter ( -3, 3 ), followed by a shearing of parameter ( 3, -2 ), followed by a
scaling with parameter ( 3, 4 )?
Answer:
Planes
7. What is the orthonormal vector of plane 2x + 2y + z = 4?
Planes
7. What is the orthonormal vector of plane 2x + 2y + z = 4?
Answer: One of the orthogonal vector is [2, 2, 1]T
Normalized it, we get [ ⅔, ⅔, ⅓ ]T
Plane
8. What is the equation of the plane, which contains the intersection line between
plane x + 2y + z = 1 and plane 2x + y + z = 0, as well as the point [1, 1, 1]T?
Plane
8. What is the equation of the plane, which contains the intersection line between
plane x + 2y + z = 1 and plane 2x + y + z = 0, as well as the point [1, 1, 1]T?
Answer: -2x + 5y + z = 4
Steps: a) find 2 arbitrary points on the intersection line.
i.e. solve plane equations, get [0, 1,-1]T and [1, 2,-4]T
b) find orthogonal vector of the target plane, which is the cross product
of 2 vectors between 3 points
i.e. get 2 vectors [1, 1,-3]T and [-1, 0,-2]T, cross product is [-2,5,1]T
c) substitute any point into the equation to get d.
i.e. substitute [1, 1, 1]T into -2x + 5y + z = d, get d = 4