|
Angle |
cos |
sin |
|
0 |
1 |
0 |
|
30 |
√3/2 |
1/2 |
|
45 |
√2/2 |
√2/2 |
|
60 |
1/2 |
√3/2 |
|
90 |
0 |
1 |
1) (2 points) We have a tiny 8x4 raster screen. What size frame buffer in bytes is required to store pixel the colors for an RGB system? 8*4*24/8=96 bytes
2) (2 points) Draw the resulting diagram when I make the following GL calls
glBegin(GL_LINES); V1
glVertex3fv(vertex1); *
glVertex3fv(vertex2); V2* *V3
glVertex3fv(vertex3); V4* * V5
glVertex3fv(vertex4);
glVertex3fv(vertex5);
glEnd();
4) Given the following polyline, shade only the interior regions. Show all work.
a) (3 points)Use the odd-even rule.
Crosses even edges exterior
Cross odd edges interior
b) (3 points)Use the non-zero winding rule R to L add one
L to R subtract one
If nonzero, interior 

Line algorithms and anti-aliasing
6) (5 points)Consider the line from (7 , 2) to (12 , 4). Use Bresenham’s algorithm to determine the pixels. Plot on the Raster Screen. Show all work.
7
2
K Pk Xk+1 Yk+1
0 -1
8 2
1 3 9 3
2 -3 10 3
1 1 11 4
4 -5 12 4
ΔX=5 2ΔX=10
ΔY=2 2ΔY=4
M < 1 P0 = 2ΔY – ΔX = 4-5=-1
If Pk < 0, plot Xk
+1, Yk: Pk+1 = Pk+2ΔY Pk+1 = Pk+4
Else plot Xk +1, Yk+1: Pk+1 = Pk+2ΔY-2ΔX
Pk+1 = Pk+4-10= Pk-2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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