CS100, Spring 1995: Answers to Quiz 7

This page contains questions and answers for the seventh and final quiz in CS100: Principles of Computer Science, a course based on the book The Most Comples Machine. The answers given here are sample answers only. There is always some variation in the answers that would receive full credit.


Question 1: Explain what it means to render a computer graphics image. What are some of the considerations that have to be taken into account when an image is rendered.

Answer: Rendering is the process of producing an actual two-dimensional image of a scene by coloring individual pixels. During this process, various attributes of the objects in the scene, such as color, surface texture and reflectivity, have to be taken into account. The "lighting of the scene", including both difuse lighting and light sources, must be taken into consideration, along with shadows cast by the light sources. And, of course, the scene must be drawn so that objects or parts of objects that are hidden from view do not appear in the image.


Question 2: In the scene description language that you used in the lab this week, it is possible to define new objects. Explain how such object definitions are similar to subroutines in a programming language.

Answer: Like a subroutine, an object definition is a "black box" that can be defined once to perform a certain task, and later can simply be referred to by name, whenever that task needs to be performed. Therefore, once defined, an object can be used as a building block in the construction of higher levels of structured complexity.


Question 3: Draw the image that would be produced by the following "scene description" written in the language that you used in the lab:

                 square scale 6,2
                 square scale 2 rotate 45
                 circle scale 2 translate 1.5,0
                 circle scale 2 translate -1.5,0
                 circle scale 2

Answer: The "scene" contains a 6-by-2 rectangle, a rotated 2-by-2 square and three circles of diameter 2. The rectangle, the square, and one of the circles are all centered at the point (0,0). The other two circles have been moved 1.5 units to the left and right respectively. The result looks like the group of figures on the left of the following picture:

Note: I actually wanted to draw the picture shown on the right above, but when I looked back at what the question actually says, it turns out that I didn't move the two circles far enough. They should have been translated by 2 units, not 1.5. (I graded the quizzes on what I thought the problem said, so I may have cheated some people out of one point on the quiz.)


(by David Eck)