Elements of Computer Graphics CS 174, Spring 2002: Assignment 2

Name: ______________________________________

Student ID: _________________________________

Due date:  May 6, 2002 at 4:00pm.

Weight: 15 %.

Collaboration: None. If you discuss this assignment with others you should submit their names along with the assignment material.

Instructions: Submit your assignment at SEASNET. Make sure you use the following file names: cie.cpp, cie.dsp for question 1 and scene.cpp, scene.dsp for question 2. If you program on unix submit ONE Makefile for both.

Submit a printed version too.

Start working on it early. You will not have time to do it at the  last minute.

1.      Colour [6 marks] Write a program that displays the CIE chromaticity diagram, as an image made up of pixels. The diagram should show the following:

a.       [3 marks] The triangular gamut of colours that can be displayed by a monitor whose RGB phosphors have the following chromaticities:

Phosphor

x

y

R

0.628

0.330

G

0.258

0.590

B

0.1507

0.060

Colors outside this gamut should appear black.

b.      [3 marks] The curve of pure spectral colors, with a white pixel at each 5-nm wavelength increment.

Use the template code found at www.cs.ucla.edu/~pfal/courses/cs174/2002s/coursework/

2.      Animation [20 marks] Write a program that shows an animated scene. Your scene should include a combination of hierarchical objects that move around. Required elements:

a.       [4 marks] At least one two-level hierarchical object (e.g. human arm).

b.      [4 marks] At least one polygonal object modeled vertex by vertex (i.e. you provide the vertices, and normals directly).

c.       [4 marks] At least one procedural texture.

d.      [4 marks] 360 degrees camera fly around.

e.       [4 marks] Creativity. (Story, colors etc).

Use the template code found at www.cs.ucla.edu/~pfal/courses/cs174/2002s/coursework/

3.      Clipping [5 marks]

a.       [3 marks] Use the Sutherland-Hodgman algorithm to clip this polygon on this rectangular window:

Vertex

x

y

1

50

80

2

250

150

3

50

220

4

210

150

Clip Line

Value

B

y=100

T

y=200

L

x=0

R

x=200

    1. [2 marks] What shortcomings in the algorithm are evident? How can you overcome them?