Docsity

Answer Key for Midterm Exam - Computer Graphics | CSE 167, Exams of Computer Graphics

Toggle sidebar
bg1
CSE 167 - Intro to Computer Graphics
ANSWER KEY: Midterm Examination
November 18, 2003
Instructor: Sam Buss, UC San Diego
Write your name or initials on every page before beginning the exam.
You have 75 minutes. There are eight problems. You may not use โ€œcheatโ€
sheets, calculators, notes, textbooks, or other materials during this exam. You
must show your work in order to get credit. Good luck!
Name:
Student ID:
1
2
3
4
5
6
7
8
Total
pf3
pf4
pf5

Partial preview of the text

Download Answer Key for Midterm Exam - Computer Graphics | CSE 167 and more Exams Computer Graphics in PDF only on Docsity!

CSE 167 - Intro to Computer Graphics

ANSWER KEY: Midterm Examination

November 18, 2003

Instructor: Sam Buss, UC San Diego

Write your name or initials on every page before beginning the exam.

You have 75 minutes. There are eight problems. You may not use โ€œcheatโ€ sheets, calculators, notes, textbooks, or other materials during this exam. You must show your work in order to get credit. Good luck!

Name:

Student ID:

Total

  1. An affine transformation A(x) : R^2 โ†’ R^2 maps the โ€œFโ€-shape on the left to the โ€œFโ€ on the right.

ใ€ˆ 1 , 0 ใ€‰

ใ€ˆ 1 , 1 ใ€‰

ใ€ˆ 0 , โˆ’ 1 ใ€‰

ใ€ˆ 0 , 0 ใ€‰

ใ€ˆ 0 , 1 ใ€‰

y

x (^) =โ‡’ ใ€ˆโˆ’ 2 , 0 ใ€‰ ใ€ˆ 0 , 0 ใ€‰

ใ€ˆโˆ’ 1 , 1 ใ€‰ ใ€ˆ 0 , 1 ใ€‰

ใ€ˆโˆ’ 1 , 0 ใ€‰

y

x

a. Give a 3 ร— 3 matrix that represents A over homogeneous coordinates.

ANSWER: A =

b. Give a 3 ร— 3 matrix that represents Aโˆ’^1 over homogeneous coordinates.

ANSWER: Aโˆ’^1 =

  1. Consider the following sequence of OpenGL commands:

glMatrixMode(GL MODELVIEW); glLoadIdentity(); glRotatef( 90.0, 0, 1, 0 ); glRotatef( 90.0, 0, 0, 1 ); glRotatef( -90.0, 0, 1, 0 ); // Watch out: negative sign! glTranslatef( 3, 4, 5 );

Show explicitly the contents of the 4 ร— 4 ModelView matrix after these commands have been executed.

ANSWER:

You must be careful here to note that the glTranslatef comes after the glRotatefโ€™s.

  1. The hyperboloid H is the set of points defined by

H = {ใ€ˆx, y, zใ€‰ : x^2 โˆ’ y^2 โˆ’ z^2 = 1, x > 0 }.

Suppose p = ใ€ˆp 0 , p 1 , p 2 ใ€‰ is a point on H. Give a formula for a unit vector normal to the surface H at the point p.

ANSWER: Let f (x, y, z) = x^2 โˆ’ y^2 โˆ’ z^2. Then โˆ‡f = ใ€ˆ 2 x, โˆ’ 2 y, โˆ’ 2 zใ€‰. A unit vector normal to the surface p = ใ€ˆp 0 , p 1 , p 2 ใ€‰ is given by

โˆ‡f (p) ||โˆ‡f (p)||

ใ€ˆp 0 , โˆ’p 1 , โˆ’p 2 ใ€‰ โˆš p^20 + p^21 + p^22

  1. Describe the difference between Gouraud shading and Phong shading. Which one is commonly used by OpenGL? What are the relative advantages of Gouraud shading over Phong shading? What are the relative advantages of Phong shading over Gouraud shading?

ANSWER: Gouraud shading computes the colors at each vertex of a triangle (or quad or polygon) with the Phong lighting model and interpolates their colors into the interior of the shape. Phong shading interpolates normal vectors from the vertices into the interior of the shape, and recomputes illumination levels (i.e., color values) of each pixel with the Phong lighting model.

Gouraud shading is commonly used by OpenGL.

Advantages of Gouraud shading are speed, simplicity and ease of implementa- tion.

Advantages of the Phong shading: Much better at catching specular highlights and spotlights. Better results with rendering with large polygons and when animating a scene.

The disadvantage of Phong lighting is that infomation about the lights, and the material propertes, etc., must be remembered until late in the graphics rendering pipeline.

  1. Let x = ใ€ˆ 2 , โˆ’ 2 ใ€‰ and y = ใ€ˆโˆ’ 1 , 1 ใ€‰.

(a) What is the point u 1 = Lerp(x, y, 1)?

ANSWER: ใ€ˆโˆ’ 1 , 1 ใ€‰.

(b) What is the point u 2 = Lerp(x, y, 12 )?

ANSWER: ใ€ˆ 12 , โˆ’ 12 ใ€‰.

(c) What is the point u 3 = Lerp(x, y, โˆ’2)?

ANSWER: ใ€ˆ 8 , โˆ’ 8 ใ€‰.

(d) Let u 4 = ใ€ˆ 1 , โˆ’ 1 ใ€‰. Find the value of ฮฑ such that Lerp(x, y, ฮฑ) = u 4.

ANSWER: ฮฑ = 13.

  1. Let x = ใ€ˆโˆ’ 1 , 0 , 5 ใ€‰ and y = ใ€ˆ 0 , 5 , โˆ’ 1 ใ€‰ and z = ใ€ˆ 4 , 1 , โˆ’ 2 ใ€‰ be the vertices of triangle. Consider barycentric coordinates relative to this triangle.

(a) What point v 1 has barycentric coordinates ใ€ˆ 13 , 13 , 13 ใ€‰?

ANSWER: ใ€ˆ 1 , 2 , 23 ใ€‰.

(b) What point v 2 has barycentric coordinates ใ€ˆ 1 , 0 , 0 ใ€‰?

ANSWER: ใ€ˆโˆ’ 1 , 0 , 5 ใ€‰.

(c) What point v 3 has barycentric coordinates ใ€ˆ 14 , 14 , 12 ใ€‰?

ANSWER: ใ€ˆ 74 , 32 , 0 ใ€‰.

(d) What point v 4 has barycentric coordinates ใ€ˆ 13 , 23 , 0 ใ€‰?

ANSWER: ใ€ˆ โˆ’ 31 , 103 , 1 ใ€‰.

(e) What are the barycentric coordinates of the point y?

ANSWER: ใ€ˆ 0 , 1 , 0 ใ€‰.