CSC418/2504F: Fall 2003 Assignment 1 (30 marks)
Sept. 17, 2003. Due: Oct. 1, 2003 in class.
Frequently-asked questions.
Solutions! (you wish)
Questions about marking.
- Realism [3 marks] Look at the scenes from the movies Shrek,
Matrix and Lord of the Rings in the 5th slide of lecture 1 on the
course web site. Can you tell by looking that they are computer
generated? List at least 6 reasons to explain your answer.
- Camera Models
[3 marks] The f-number of a camera is the
focal length of the lens divided by the aperture. How can the f-number
of a camera be changed? How does changing the f-number affect the
required exposure time? Do the camera models commonly used in computer
graphics have f-numbers? Explain briefly. - Vectors [4 marks] Snoopy's pirate friend has buried a juicy
bone on an island with five trees located at the following points:
A(20.0 m, -10 m), B(70.0 m, 90.0 m), C(-20.0 m, -20.0 m), D(50.0 m,
-40.0 m), and E(-80.0 m, 70.0 m). He gave Snoopy the following
instruction. Start at A and move toward B, but to cover only one-half
of the distance between A and B. Then move toward C, covering one-third
the distance between your current location and C. Next, move toward D,
covering one-fourth the distance between where you are and D. Finally,
move toward E, covering one-fifth the distance between you and E, stop,
and dig.
- Where is the juicy bone buried? Give your answer in coordinates.
- Suppose there are n trees located at A1, A2, ..., and An. The
pirate's instruction is extended to involve all n trees in a similar
fashion, i.e. after moving toward Ak, covering 1/k the distance between
your current position and Ak, move toward A(k+1), covering 1/(k+1) the
distance between where you are and A(k+1). Let a1, a2, ..., and an be
the position vectors of A1, A2, ..., and An. Express the position
vector of your final location in terms of the position vectors of the
trees.
- Prove that changing the order of the trees in the instruction while
keeping the order of the portions of the distance the same does not
change the final location.
- Gamma-correction [3 marks] The intensity I of an image is related to the voltage V of the control-grid of monitor A and monitor B according to the following equations respectively.
Ia = Ka Va ga
Ib = Kb Vb gb , where Ka, Kb, ga, and gb are constants that are specific to the monitors.
Suppose the intensity of an image shown on monitor A is I1 when the voltage is V1.
- In order to display the image with the same intensity on monitor B, what should the voltage be in terms of V1?
- Let I2 be the intensity of an image on monitor B when the voltage V1 was applied to it. What would the intensity of the image viewed on monitor A be in terms of I1 if the voltage V2 = K I2 is applied to it?
- Transformations
[5 marks] Given a unit cube with one
corner at (0, 0, 0) and the opposite corner at (1, 1, 1), derive the
transformations necessary to rotate the cube by q
degrees about the main diagonal from (0, 0, 0) to (1, 1, 1) in the
counterclockwise direction when looking along the diagonal toward the
origin. - [12 marks] Write a program using OpenGL that:
- [2 marks] Allows you to plot a sequence of 6 points on the screen
by clicking the mouse 6 times. Treat the sequence of points as a
polygon. Connect the points with yellow line segments according to the
order of entry. Also connect the last point to the first to complete
the polygon.
- [6 marks] A fixed viewport will be drawn on the screen in red. Its
coordinates are (-1.5,-1.5), (-1.5,1.5), (1.5,1.5), (1.5,-1.5). Clip
the polygon to lie inside the viewport.
- [4 marks] Determine whether the polygon is convex. If so, colour
the portion of the polygon within the viewport green. Otherwise, fill
each portion not divided by an edge with a different colour. Note that
you do not have to write a scan conversion algorithm to colour the
inside of a polygon.
Use the template code provided at:
Submit your code electronically on CDF, using one of the following commands:
- submit -N a1q6 csc418h poly.cpp ui.cpp
- submit -N a1q6 csc2504h poly.cpp ui.cpp
Submit a printed copy as well.