Linear ALgebra
CS130 - Colors
Name: SID:
1. For each of the following RGB triples, identify the corresponding color.
(a) (0,0,0)
(b) (1,0,0)
(c) (0,1,0)
(d) (1,1,0)
(e) (0,0,1)
(f) (1,0,1)
(g) (0,1,1)
(h) (1,1,1)
2. For each of the following colors, give an approximate RGB value for the color, where each of R,G,B is 0, 1
2 , or 1. You must justify your answer.
(a) gray
(b) pink
(c) navy blue
(d) orange
(e) forest green
(f) dark purple
(g) light green
3. Imagine that you have a fourth type of color sensitive cell in your eye that nobody else has. (a) What would this allow you to do that others cannot? (b) Devise an experiment that would allow you to convince others that you actually have this ability?
∎
1
Ray tracing
4. In the figure, you are given the position of the camera (e), the location of the center of the image plane (c), an up vector (s), and the width w of the image plane (in 3D space). You are also given the number of pixels in height and width (H,W ) of the image.
s
u
v
p
n c
e
h
w
P1
Determine the height hp and width wp of a pixel. You may assume that the pixels are squares.
∎
5. Compute the height h of the image plane (in 3D space).
∎
6. The ray from e to c is assumed to be orthogonal to the image plane. Find the plane’s normal n.
∎
7. The up vector s we are given need not be orthogonal to n, so we cannot use it as our image’s up vector v. Instead, we must first compute û orthogonal to n and s. Then, we can compute v̂ from n and û. Both û and v̂ should be normalized. If we are standing at e and looking at c with s pointing roughly upwards, then û should be pointing to the right, and v̂ should be pointing upwards. Make sure you check that these two vectors point in the correct direction. Don’t worry about their length yet.
∎
8. Next, we scale û to u and v̂ to v so that ∥u∥ = wp and ∥v∥ = hp. In this way, adding u causes us to move right one pixel, and adding v causes us to move up one pixel.
∎
9. Find the bottom left corner p.
∎
2
10. Given a pixel index (i, j), find the corresponding point x on the image plane. Note that pixel index (i, j) refers to the center of pixel (i, j), with pixel (0,0) being the bottom left pixel and (W −1,H −1) being the top right pixel. Note that p is at the corner of the image, not the center of the lower left pixel.
∎
11. Find the endpoint and (normalized) direction of the ray that should be cast through pixel (i, j).
∎
3