COM 3370 Graduate Computer Graphics Midterm Exam

Professor Fell Monday, April 22, 1996

You may use one 8.5" by 11", two-sided sheet of notes.

1. Ray Tracing (40 points)
The equation of an infinite cylinder G of radius R about the y-axis is given by:

x2 + z2 = R2

The line segment L from P = (Px, Py, Pz) to Q = (Qx, Qy, 0) is given by:

x = (1-t)Px + tQx

y = (1-t)Py + tQy

z = (1-t)Pz

0 <= t <= 1

a. Show the quadratic equation At2 + Bt + C = 0 that you would use to find the intersection of L with G.

A =

B =

C =

b. In terms of A, B, and,C, explain how to tell whether or not L and G intersect. Remember that L is a line segment, not an infinite line. If L and G intersect twice, which intersection is nearer to P?

d. What is the unit normal vector N to G at a point (x, y) that lies on G?

e. The quantity N.L plays an important role in our ray tracing computations. What angle is N.L related to? How is it used in the ray tracing computation?


2. Line Drawing (32 points)
We can draw the line segment from P = (Px, Py) to Q = (Qx, Qy) by using the parametric equations:

x = (1-t)Px + tQx

y = (1-t)Py + tQy

0 <= t <= 1

as follows:

	double t = 0;
	double deltat = 1/sqrt((Qx-Px)*(Qx-Px) + (Qy-Py)*(Qy-Py));
	while (t <= 1) {
		  int x = (1-t)*Px + t* Qx;
		  int y = (1-t)*Py + t* Qy;
		
		  SetPixel(x, y);  
		
		  t += deltat;
	}

For P = (0, 2) and Q = (3, 0), deltat = 0.277350098, and t takes on the values below:
t 1-t (1-t)Px+tQx (1-t)Py+tQy (1-t)Qx+tPx (1-t)Qy+tPy
0 1 0 2 3 0
0.277350098 0.722649902 0.832050294 1.445299804 2.167949706 0.554700196
0.554700196 0.445299804 1.664100589 0.890599608 1.335899411 1.109400392
0.832050294 0.167949706 2.496150883 0.335899411 0.503849117 1.664100589
1.109400392 -0.109400392 3.328201177 -0.218800785 -0.328201177 2.218800785

a. On the grids below, use dots to show which pixels will be set for the line from P to Q and for the line from Q to P.

Discuss how this algorithm meets the following criteria. Give some justification for your answers.

b. The line segment should be as straight as possible

c. The line segment should start at P and end at Q.

d. The line segment should be of constant intensity (thickness).

e. The intensity (thickness) of the line segment should be independent of slope.

f. The algorithm should be efficient.

g. The pixels we set should be symmetric in the sense that if we draw the line from A to B then we should set the same pixels when we draw from B to A.


3. Clipping (11 points)
a. Explain fully the relevance of the following diagram to 2D clipping:

1001 1000 1010
0001 0000 0010
0101 0100 0110

b. What constitutes a test for trivial acceptance? For trivial rejection?

4. RGB Color (17 Points)
a. If the values of R, G, and B can range from 0 to 255, what RGB values describe:
color  Red  Green Blue 
white    
black    
brightest green    
brightest yellow    
a pale blue    

b. Suppose we are asked to design a program that will model accurately the appearance of the paintings in the Museum of Fine Arts. Explain why representing color by RGB triplets would probably not be satisfactory.


Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121

Last Updated: January 24, 1997 5:27 pm
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM3370/midtermSp96.html