Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Midterm Exam - Introduction to Computer Graphics | COMP 575, Exams of Computer Graphics

Material Type: Exam; Professor: Merrell; Class: Introduction to Computer Graphics; Subject: COMPUTER SCIENCE; University: University of North Carolina - Chapel Hill; Term: Unknown 1989;

Typology: Exams

Pre 2010

Uploaded on 03/16/2009

koofers-user-oql
koofers-user-oql 🇺🇸

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMP 575 Midterm Exam
Name:
General Advice
Partial credit will be given, so even if you can not solve the problem get as close as you can to the solution
and show your work. Since you have limited time, I would suggest getting all the easier questions out of
the way first. Skip questions that look hard and come back to them later if you have time.
pf3
pf4
pf5

Partial preview of the text

Download Midterm Exam - Introduction to Computer Graphics | COMP 575 and more Exams Computer Graphics in PDF only on Docsity!

COMP 575 Midterm Exam

Name: General Advice Partial credit will be given, so even if you can not solve the problem get as close as you can to the solution and show your work. Since you have limited time, I would suggest getting all the easier questions out of the way first. Skip questions that look hard and come back to them later if you have time.

  1. Circle True or False (9 points) a. True False Aliasing may occur when a high frequency signal is not sampled enough. b. True False Parallel lines always remain parallel under a Euclidean transformation. c. True False A sphere always remains a sphere under a projective transformation.
  2. Fill in the blank (6 points) The illumination equation computes the amount of ambient, diffuse, and specular light that is reflected. a. In Gouraud shading, the illumination equation is calculated once per vertex. b. In flat shading, the illumination equation is calculated once per polygon. c. In Phong shading, the illumination equation is calculated once per visible pixel.
  3. Short Answer - Clipping (7 points) In the Cohen-Sutherland line clipping algorithm, each line segment can either be immediately rejected, immediately accepted, or clipped and processed further. Briefly explain how to decide which line segments should be immediately rejected.

If and only if both endpoints of the line segment are to the left of the drawing area or both endpoints are to the right of the drawing area or both endpoints are above the drawing area or both endpoints are below the drawing area the line segment should be immediately rejected.

  1. Short Answer - 2D Transformations (9 points) Suppose that R and S are both two-dimensional transformations. Let R be a rotation matrix and let S be a uniform scaling matrix which scales the x and y coordinates the same sx = sy. Is the product of R and S commutative? Show that the matrices do or do not commute.

RS =

cos θ − sin θ 0 sin θ cos θ 0 0 0 1

s 0 0 0 s 0 0 0 1

s cos θ −s sin θ 0 s sin θ s cos θ 0 0 0 1

SR =

s 0 0 0 s 0 0 0 1

cos θ − sin θ 0 sin θ cos θ 0 0 0 1

s cos θ −s sin θ 0 s sin θ s cos θ 0 0 0 1

RS = SR

Yes, the matrices commute.

  1. 3D Transformations (29 points) In this section, you will be asked to find matrices which will transform a point p into another point p′. Assume p and p′^ are given in homogeneous coordinates. Your answers do not need to be simplified. To save time, you may leave your answers as a product of several matrices instead of simplifying them to one matrix. a. The equation (^)  

t

defines a line in parametric form. What is the 4 × 4 matrix that will rotate a point about the line by θ degrees? Assume the right hand rule when rotating about the positive y-axis. (7 points)

cos θ 0 sin θ 0 0 1 0 0 − sin θ 0 cos θ 0 0 0 0 1

b. Suppose the center of an object is located at the point (− 1 , 4 , 2 ). What is the 4 × 4 matrix that will scale down an object by 50% in towards the object’s center? (7 points)

c. Let p be any point in space. Let p′^ be the closest point to p on the plane defined by

ax + by + cz + d = 0 (14)

To make things simpler, you may assume that a^2 + b^2 + c^2 = 1, if you wish. What is the 4 × 4 matrix that will transform p to p′? (12 points)

p′^ = p + sn (15)

=

px py pz 1

 +^ s

a b c 0

a(px + sa) + b(py + sb) + c(pz + sc) + d = 0 (17)

apx + sa^2 + bpy + sb^2 + cpz + sc^2 + d = 0 (18)

s(a^2 + b^2 + c^2 ) = −(apx + bpy + cpz + d) (19)

s = −(apx + bpy + cpz + d) (20)

p′^ = p − (apx + bpy + cpz + d)n (21)

= p −

a b c 0

[ (^) a b c d ]

px py pz 1

I^ −

a^2 ab ac ad ab b^2 bc bd ac bc c^2 cd 0 0 0 1

 p^ (23)

d. True or False The matrix given in response to the previous question is a projection matrix? ( points) True, the matrix projects the point onto a plane, P^2 = P.

c. Suppose that the E pixel (xp + 1 , yp) is drawn. How do we efficiently decide which is the next pixel to draw? Like the midpoint line algorithm, you should use information obtained in the first decision to help in making this next decision. You should update some kind of decision variable d. You should not recompute f (x, y) in its entirety. (7 points)

dold = (xp + 1 )^2 + (yp + 12 )^2 − R^2 (25) = x^2 p + 2 xp + 1 + y^2 p − yp + 14 − R^2 (26)

The new midpoint is one greater in x.

dnew = (xp + 1 )^2 + 2 (xp + 1 ) + 1 + y^2 p − yp + 14 − R^2 (27) = x^2 p + 2 xp + 1 + 2 xp + 2 + 1 + y^2 p − yp + 14 − R^2 (28)

dnew − dold = 2 xp + 3 (29) Update the decision variable by 2 xp + 3 and check if it is greater or less than 0. d. Same question as part c, but now assume the SE pixel (xp + 1 , yp − 1 ) was drawn initially. How do we efficiently decide which is the next pixel to draw? (7 points)

The new midpoint is now one greater in x and one less in y.

dnew = (xp + 1 )^2 + 2 (xp + 1 ) + 1 + (yp − 1 )^2 − (yp − 1 ) + 14 − R^2 (30) = x^2 p + 2 xp + 1 + 2 xp + 2 + 1 + y^2 p − 2 yp + 1 − yp + +^14 − R^2 (31)

dnew − dold = 2 (xp − yp) + 5 (32) Update the decision variable by 2 (xp − yp) + 5 and check if it is greater or less than 0.