


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Professor: Jacobs; Class: Computer Graphics; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Practice Midterm Solutions CMSC 427
Sample Problems (Note, some of these problems may be a bit more involved than ones Iโd ask on a time-limited exam).
We can do this by translating to the origin, rotating, and translating back. We get:
We can verify that this is right by checking that it takes the point (1,1) (written (1,1,1) in homogenous coordinates) to the point (1,1), and that it takes the point (2,1) to (1,2).
To do this we need to find the inner product between a vector from (3,2) to (7,5) and a unit vector in the direction (1,2). The first vector is (4,3). The unit vector we need is (1,2)/sqrt(5). This inner product is 10/sqrt(5)=2sqrt(5)
We are changing the origin and the viewing direction. We can do this by combining two matrices. If we just wanted to change origins, all we would need to do is create a 3D translation matrix that takes (3,2,0) to the origin. This would be:
However, we also want to change the viewing direction. To do this, weโll create a matrix in which the first three elements of the third row represent our new z direction. This direction is represented by the unit vector (1,2,3)/sqrt(14). So, the matrix we want will look like:
Notice that to get the bottom two rows we never had to come up with the top two rows of the first matrix on the left.
Perspective projection scales points by the inverse of their distance. So, if we pick points that have the same z coordinate, they will all be scaled the same amount. So, for example, if we take a triangle with vertices at (0,0,2) (2,0,2), (0, 2, 2), this will appear in images with coordinates (0,0), (1,0), (0,1), and still be a right triangle.
With orthographic projection, the same triangle will appear as (0,0), (2,0), (0,2), also a right triangle.
We just need an example to show this. Letโs consider lines that lie in the y=-5 plane, with our standard perspective camera. Consider a line with the equation z = mx+b. This contains the points (0,-5,b) and (1,-5, m+b). These appear in the image as points (0, -5/b) and (1/(m+b), -5/(m+b)). This line has a slope of (-5/(m+b) + 5/b)/(1/(m+b)) = -5 + 5(m+b)/b = 5m/b. Clearly this slope depends not just on m, the slope of the original line, but also on b. Two lines with the same value for m and different values for b will be parallel in the world, but will have different slopes in the image.
First, letโs consider the simpler, naรฏve algorithm. We cannot just increment x from 15 to 25, and solve for two y values for each x, because in some parts of the circle y changes more rapidly than x, so we would get a circle with gaps. Instead, we can divide the circle into regions where either x or y is changing more rapidly. For example, at an angle between pi/4 and 0, y is changing more rapidly. This occurs in the region of the circle starting at (20+5/sqrt(2), 20+5/sqrt(2)) and ending at (25,20). Rounding off, this means we must consider y values of 24, 23, 22, 21, 20. For these, the corresponding x values are 23, 24, 25,25,25, so we fill in points (23,24), (24,23), (25,22), (25,21), (25,20).
Sampling this produces (1 1 ยผ 0 ยผ 1 1 ยผ 0 ยผ โฆ.). Now the average intensity in the image is still .5 (can you prove that this will always be true) and we have something that looks more like equal sized white and black stripes.
The key issue here is how big a neighborhood we use when deciding whether things are similar. If we use a neighborhood, that is big enough to capture a full stripe, then we will reproduce stripes of equal length. If we use a smaller neighborhood, weโll still get black and white stripes, but they may not be of equal length.
v will be the value of the largest component. So v = .7.
White light with the same value would be (.7, .7, .7). We can make light that is completely saturated, but has the same hue as our light by subtracting out the white, which would produce (.5, .1, 0). If we scale this light by 1.4 we get saturated light of the same hue, but with a value of .7, that is represented in RGB as (.7, .14, 0). Our light is therefore part way in between the fully unsaturated gray light (.7,.7,.7) and the saturated light at (.7, .14, 0). What fraction of the way are we from fully unsaturated to saturated? .4/.56, or .5/.7, both of which equal 5/7. Hue is represented by the angle between our light and red. For example, we can use (.7,.7,.7) as the origin, and find the angle between (.7,0,0) and (.7,.14,0). Things look a little simpler if we scale everything by 1/.7, in which case the origin is (1,1,1), red is at (1,0,0), and our hue is at (1, .2,0). This is about 6 degrees.
If a pixel has a hue of green, a saturation of .5, and a value of .4, describe it with RGB values.
Gray with a value of .4 would be (.4,.4,.4). Green with this value would be (0, .4, 0). Our color is halfway in between these two, so itโs (.2, .4, .2).
Representing these in rgb, they are (0 1 1), (1 0 1) (1 1 0). These are usually used in a subtractive system, where mixing them together will produce black. But in a monitor, small colored lights are added together, and so we will have equal parts of red, green and blue, which will appear white.