Exercises 01: Intro to Computer Graphics

## Modeling with Meshes

In lecture we looked at one very basic way to digitally encode geometry: a list of vertex positions V, and a list of edges E given as pairs of vertices. For instance, we can encode a cube using vertices

    x  y  z
0: -1 -1 -1
1: +1 -1 -1
2: +1 -1 +1
3: -1 -1 +1
4: -1 +1 -1
5: +1 +1 -1
6: +1 +1 +1
7: -1 +1 +1


and faces

(3, 0, 1, 2)
(0, 4, 5, 1)
(1, 5, 6, 2)
(2, 6, 7, 3)
(3, 7, 4, 0)
(5, 4, 7, 6)

1. Suppose we want to describe a closed box (with all six faces) versus an open tube (with two faces missing). Can our vertex-edge encoding distinguish between these two shapes? If not, what could you do instead? What specific data structure(s) might you use to store this data?

2. Let's say we now want to encode a triangular prism rather than a cube. How would our encoding need to change? What data structure(s) might you use to store this data?

3. So far we can describe shape, but what about motion? Which part of the encoding do we need to augment? What additional data could we store? (There are many good answers to this question!)

## Through the Looking Glass

In lecture we gave a very basic explanation of perspective distortion using the "pinhole camera" model. Let's play with our pinhole camera to get a deeper understanding of this phenomenon. In particular, suppose the pinhole is at a point c, and the box containing our film has depth d and height h. The image is formed by light hitting a piece of film at the back of the box.

1. When we first develop our film, we notice the image is upside-down. Why? What other optical device flips an image? How might you "correct" the orientation of the image in your pinhole camera?
2. What happens to the image if we keep c where it is, but make h bigger? Smaller?
3. What happens to the image if we keep c where it is, but make d bigger? Smaller?
4. What happens to the image if we fix c, but make d and h bigger at the same rate. For instance, suppose we use a pinhole camera of depth 2d and height 2h.
5. What's the difference between moving the box forward vs. making d bigger? Do they result in an identical image? If not, what's the difference in appearance?
6. Compute the angle of view (theta). Does the formula you get for this angle agree with the observations above?