Week 5 Tutorial

Question 1

Consider the following x-y pairs.

Assuming x and y were two axes in a right handed coordinate system, would the z axis for each of these point into the page or out of the page?

Question 2

You have two vectors v1=(-1, -1, 0) and v2=(4, 2, 0).

(a) What is the dot product of the two vectors?
(b) Normalise the two vectors.
(c) what is the cosine of the angle between the two vectors?
(d) What is the cross product of the two vectors?

Question 3

(a) The old CSE logo is made from 35 small 3D cubes. Each of these cubes has a side length of 0.7 units. Find the transformation that transforms a basic cube with centre (0,0,0) and a side length of 2 (such that corners are (1,1,1) and (-1,-1,-1)) to the small cube with centre (0,4,2) (one of the cubes in the logo).
(b) Consider a local to world transformation, with the basis (0.35,0,0), (0,0.35, 0) and (0,0,0.35) for u,v and n respectively, and with offset (0, 4, 2). Is this an orthogonal basis? Orthornormal? What is the matrix for the local to world transformation in this case?

Question 4

Consider the following sequence of matrix operations in OpenGL. Show what happens to the modelview matrix stack after each operation, and calculate where the points A, B, C and D get transformed to in world space (NOTE: For convenience, the usual jogl “gl.” has been removed). In other words, where do A, B, C and D end up?

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glScalef(3,3,3);
glBegin(GL_POINTS); <-- A
glVertex3f(1,2,1); 
glEnd(); 
glRotatef(90, 0, 1, 0);
glBegin(GL_POINTS);
glVertex3f(2,1,3); <-- B
glEnd();
glPushMatrix();
glTranslatef(1,0,0);
glMultMatrix(1,0,0,0,0,2,0,0,0,0,1,0,0,0,0,1);
glPopMatrix();
glBegin(GL_POINTS);
glVertex3f(0,2,0); <-- C
glEnd(); 
glTranslatef(0,1,0);
glBegin(GL_POINTS); 
glVertex3f(1,0,0); <-- D
glEnd();

Comments are closed.


Bad Behavior has blocked 50 access attempts in the last 7 days.