Computer Graphics: Touch - Pass Exam Cram Guide Series
Computer Graphics: Touch - Pass Exam Cram Guide Series
COMPUTER GRAPHICS
Prepared By
Table of Contents
TABLE OF CONTENTS...........................................................................................................................................................................2 CHAPTER 3................................................................................................................................................................................................1 BASIC RASTER GRAPHICS ALGORITHMS FOR DRAWING 2D PRIMITIVES......................................................................1 CHAPTER 5................................................................................................................................................................................................4 GEOMETRICAL TRANSFORMATIONS.............................................................................................................................................4 CHAPTER 6................................................................................................................................................................................................5 VIEWING IN 3D.........................................................................................................................................................................................5 CHAPTER 11..............................................................................................................................................................................................7 REPRESENTING CURVES AND SURFACES.....................................................................................................................................7 CHAPTER 13..............................................................................................................................................................................................8 ACHROMATIC AND COLORED LIGHT............................................................................................................................................8 CHAPTER 15............................................................................................................................................................................................10 VISIBLE SURFACE DETERMINATION............................................................................................................................................10 CHAPTER 16............................................................................................................................................................................................11 ILLUMINATION AND SHADING........................................................................................................................................................11 CHAPTER.................................................................................................................................................................................................11 SHORT NOTES ON VARIOUS TOPICS.............................................................................................................................................11
FOR
DRAWING 2D PRIMITIVES
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
int x = x0; int y = y0; writePixel(x, y, value); while (y < y1) { if (d <= 0) { d += incrNE; x++; y++; } else { d += incrN; y++; } writePixel(x, y, value); }
// choose N
3.5
How can you make the mid-point line drawing algorithm slope independent? Explain in detail. [2006. Marks: 4] OR, Explain using algorithm. [2004. Marks: 6] To make the mid-point line drawing line algorithm slope independent, we find out the conditions for a line being placed in a region of the coordinate, and accordingly either transpose the values of x and y or negate the value of one or both while passing them to the DrawLine() function.
(x1, y1)
(x1, y1)
x0 x1 y0 < y1
(x0, y0) (x0, y0) (x0, y0) (x0, y0) 2 1 3 4 0 (x0, y0)
x0 < x1 y0 > y1
(x1, y1)
if (abs(dx) abs(dy)) { //group0: 0 |m| 1 if (x0 < x1 && y0 y1) { //op0 DrawLine(x0, y0, x1, y1, value); } else if (x0 > x1 && y0 y1) { //op3: change sign of x DrawLine(-x0, y0, -x1, y1, value); } else if (x0 > x1 && y0 >y1) { //op4: change sign of both x and y DrawLine(-x0, -y0, -x1, -y1, value); } else if (x0 < x1 && y0 > y1) { //op7: change sign of y DrawLine(x0, -y0, x1, -y1, value); } } else { //group1: |m| > 1 swap x and y if (x0 x1 && y0 < y1) { //op1 DrawLine(y0, x0, y1, x1, value); } else if (x0 > x1 && y0 < y1) { //op2: change sign of x DrawLine(y0, -x0, y1, -x1, value); } else if (x0 > x1 && y0 >y1) { //op5: change sign of both x and y DrawLine(-y0, -x0, -y1, -x1, value); } else if (x0 x1 && y0 > y1) { //op6: change sign of y DrawLine(-y0, x0, -y1, x1, value); } } 3.6 3.7 3.8
Illustrate the Bresenham algorithm to rasterize a line from (0, 0) to (-8, -4). [2002. Marks: 5] What steps are required to scan convert an arc of a circle using the polynomial method? [2001. Marks: 4] Why two sets of decision variables and its derivatives are required in mid-point ellipse drawing? Explain the transition/termination criteria from region-1 to region-2 in mid-point ellipse
2
drawing algorithm. [2007, 2003. Marks: 4] 3.9 Derive the (initial) decision variable and its derivatives in mid-point ellipse drawing algorithm. [2006. Marks: 6] OR, Derive decision parameters for the midpoint ellipse algorithm assuming the starting position at (r, 0) and points are to be generated along the curve path in anticlockwise direction. [2002. Marks: 9] Filling 3.1 3.2 3.3 3.4 What do you understand by polygon filling? [2005. Marks: 1] Mention three step process to fill the line span in scan line (polygon filling) algorithm. [2008. Marks: 4] How are the horizontal edges handled in scan line (polygon filling) algorithm? Explain with proper example. [2008. Marks: 3] What is Active Edge Table? Write down the processing steps of global edge table in scan line algorithm. [2008. Marks: 3]
Clipping 3.1 3.2 3.3 3.4 What is meant by clipping? [2007, 2004. Marks: 1] Explain Cohen-Sutherlands algorithm for line clipping. [2004. Marks: 3] Explain Sutherland-Hodgeman polygon clipping algorithm. [2007. Marks: 3] Consider a rectangular window whose lower left hand corner is at L(-3, 1) and upper right hand corner is R(2, 6). Find the region codes for the end points of the following two lines using Cohen-Sutherland line clipping algorithm: i. Line A(-4, 2), B(-1, 7) ii. Line C(-2, 3), D(1,2) Also determine the clipping category of the above lines. [2005. Marks: 3]
Exercises 5.1 Let P be the coordinate of a three-dimensional point on a sphere whose center is at origin. i. What will be the composite rotation matrix for determining the new coordinate of P after x = 30 and z = 30 rotations? ii. What will be the composite rotation matrix to move the point at its original location? [2008. Marks: 5] 5.2 Let P(12.0, 10.0, 25.0) be the coordinate of a three-dimensional point on a sphere whose center is at origin. Determine the new coordinate of P after x = 45 and y = 45 and z = 30. (Use the composite matrix) [2007. Marks: 3] Let P(12.0, 0.0, 25.0) be the coordinate of a three-dimensional point on a sphere whose center is at (10.0, 50.0, 30.0). Determine the new coordinate of P after x = 45 and y = 45 and z = 30. (Use the composite matrix) [2006. Marks: 3] Let P(10.0, 0.0, 30.0) be the coordinate of a three-dimensional point on a sphere whose center is at (10.0, 50.0, 30.0). Determine the new coordinate of P after x = 30 and y = 60 and z = 30. (Use the composite matrix) [2006. Marks: 3] Let P(12.0, 24.0, 100.0) be the coordinate of a three-dimensional point on a sphere whose center is at (10.0, 50.0, 30.0). Determine the new coordinate of P after Rx(300) and Ry(600). (Use composition of three dimensional transformation rule) [2004. Marks: 4] Let P(12.0, 24.0, 20.0) be the coordinate of a three-dimensional point on a sphere whose center
4
5.3
5.4
5.5
5.6
is at (10.0, 50.0, 30.0). Determine the new coordinate of P after Ry(30) and Rz(60). (Use composition of three dimensional transformations rule) [2003, 2002. Marks: 2/5]
CHAPTER 6 VIEWING IN 3D
Theories 6.1 Distinguish between perspective and parallel projection. Mention some anomalies while performing perspective projection. [2007. Marks: 3] Perspective Projection 1. The distance between the center of projection and the projection plane is finite. 2. To determine the perspective projection, its center of projection is explicitly specified. 3. The size of perspective projection of an object varies inversely with the distance of that object from the center of projection. 4. Angles are preserved only on those face of the object parallel to the projection plane and do not in general project as parallel line. 5. The center of projection is a point that has a homogeneous coordinate. 6.2 6.3 6.4 6.5 Parallel Projection 1. The distance between the center of projection and the projection plane is infinite. 2. To define the parallel projection, its direction of projection is specified. 3. The perspective foreshortening (which is human visual system) is lacking. This projection can be used for exact measurement of object. 4. The parallel lines remain parallel.
In what way is orthographic projection a special case of perspective projection? Mathematically prove this special case. [2008. Marks: 3] Derive a perspective projection matrix when the projection plane is at x = d and the center of projection is at x = -d. [2008. Marks: 4] Derive the general perspective projection onto the view plane z = a where the center of projection is the origin (0, 0, 0). [2007. Marks: 3] Derive perspective projection matrix where the projection plane is perpendicular to the z-axis, but the center of projection is not on the z-axis. [2004. Marks: 6] Show that this can be treated as the standard projection matrix. [2003. Marks: 7] Derive perspective projection matrices assuming (i) Origin at the center of projection (ii) Origin on the projection plane (Assuming both center of projection and the iso-center of projection plane is on the z-axis) [2002. Marks: 10]
6.6
6.7
A unit cube is projected onto the XY-plane. Draw the projected image using standard perspective projection with (i) d = 1 and (ii) d = 10, where d is the distance of COP from the projection plane. Assume that the projection plane is at the origin. [2008. Marks: 3] Show that the normalized perspective to parallel transform preserves the relationship of the original perspective transformation while transforming the normalized perspective view volume onto the unit cube. [2002. Marks: 4]
6.8
Exercises 6.1 Let P(40.0, 65.0, 0.0) be the coordinate of a three dimensional point projected on the projection plane. The center of projection of P is (70.0, 10.0, -205.0). The origin of the projection plane is (0.0, 0.0, -150.0). Determine the coordinate of P on the projection plane. [2007, 2005. Marks: 4] Let P(40.0, 30.0, 200.0) be the coordinate of a three dimensional point projected on the projection plane. The center of projection of P is (70.0, 10.0, 5.0). The origin of the projection plane is (0.0, 0.0, 150.0). Determine the coordinate of P on the projection plane. [2004. Marks: 4] Let P(27.0, 30.0, 190.0) be the coordinate of a three dimensional point projected on the projection plane. The center of projection of P is (7.0, 60.0, 5.0). The origin of the projection plane is at a distance 150.0. If the projection plane is perpendicular to the z-axis, then determine the coordinate of P on the projection plane. [2004. Marks: 4] Let P(27.0, 30.0, 190.0) be the coordinate of a three dimensional point on a sphere whose isocenter is at (7.0, 15.0, 200.0). The center of projection is at the origin and the projection place is at a distance 155.0 in z direction from the center of projection. i. Determine the coordinate of P on the projection plane. ii. What will be the coordinate of P on the projection plane after Rz(30)? [2002. Marks: 5 + 5]
6.2
6.3
6.4
What is meant by half-toning? [2004. Marks: 2] Explain half-toning algorithm to convert a grey level image into binary image. [2005. Marks:
Convert the following RGB colors into equivalent HLS color model:
i. (1.0, 0.7, 0.5) ii. (0.0, 0.9, 0.1) iii. (0.1, 0.2, 0.7) iv. (0.5, 0.4, 0.8) N.B.: Range: Hue = 0 to 360 , Others = 0.0 to 1.0 [In-course 2008-2009. Marks: 16] 13.13 Convert the following CMY colors into equivalent HSV/HSB color model: v. (1.0, 0.7, 0.5) vi. (0.0, 0.9, 0.1) vii. (0.1, 0.2, 0.7) viii. (0.5, 0.4, 0.8) N.B.: Range: Hue = 0 to 360 , Others = 0.0 to 1.0 [In-course 2008-2009. Marks: 18]
VISIBLE
Z-Buffer 15.1 15.2
How is the depth of a polygon determined by the painters algorithm? [2006. Marks: 2] {15.5, p697} What is hidden surface problem? Explain different steps involved in Z-buffer algorithm. [2005. Marks: 4] ALSO, Explain Z-buffer algorithm. How does it determine which surfaces are hidden and which are not? What happens when two polygons have the same z value? [2006, 2003, 2002. Marks: 3] {15.4, p692}
15.3
In a situation A, a scene has 100 polygons and the frame buffer size is 19201200 pixels. In situation B, a scene has 100,000 polygons and the frame buffer is 320240 pixels. Briefly discuss which hidden surface removal method (Back-face Culling or Z-buffer) would be efficient for each scene? [2008. Marks: 3]
Ray-Tracing 15.1 15.2 15.3 15.4 What is meant by ray tracing? [2002. Marks: 3] Mention some advantages of ray tracing method. [2006. Marks: 2] {p725} Explain basic ray tracing method with the help of a flowchart. [2003. Marks: 6] Describe how hidden surface removal and projection are integrated into ray-tracing process. [2005. Marks: 3]
Exercises 15.1 There are three points A(1, 2, 0), B(3, 5, 15) and C(3, 5, 7). Determine which points obscure each other when viewed from point P(0, 0, -15). [2008. Marks: 2] Similar to exercise 15.3 15.2 Given points P1(2, 3, 1), P2(3, 7, 15) and P3(3, 7, 9) and viewpoint C(2, 1, -5), determine which points obscure the others when viewed from C. [2006. Marks: 3] Similar to exercise 15.3 15.3 Given points P1(1, 2, 0), P2(3, 6, 20) and P3(2, 4, 6) and viewpoint C(0, 0, -10), determine which points obscure the others when viewed from C. [2005. Marks: 3] Applying the parametric equation of line on points C and P1, we get x=t y = 2t z = -10 + 10t To determine whether P2 lies on this line, we see that x = 3 when t = 3, and then at t = 3, x = 3, y = 6 and z = 20. So, P2 lies on the projection line through C and P1. Next, we determine which point is in front with respect to C. Now, C occurs on the line at t = 0, P1 occurs at t = 1, and P2 occurs at t = 3. Thus, comparing t values, P1 is in front of P2 with respect to C; that is, P1 obscures P2. We now determine whether P3 is on the line. Now, x = 2 when t = 2 and then y = 4, and z = 10. Thus, P3 is not on this projection line and so it neither obscures nor is obscured by P1 and P2. 15.4 Given points P1(1, 2, 0), P2(3, 5, 15) and P3(3, 5, 7) and viewpoint C(0, 0, -15), determine which points obscure the others when viewed from C. [2002. Marks: 8]
10
SHORT
Write short notes on the following: [Marks: 2 to 2.5 each] 1. Recursive ray-tracing [2007] 2. Line-clipping algorithms [2007, 2006] 3. Bicubic surface representation techniques [2007] 4. Antialiasing algorithms [2007] 5. Specular reflection [2006] 6. Polygonal surface representation techniques [2006] 7. Polygon filling algorithm [2006] 8. Light source attenuation [2005, 2002] 9. Atmospheric attenuation [2002] 10. Antialiasing [2005] 11. Bicubic surfaces [2005] 12. Video controller [2005] 13. BMP file format [2004] 14. B-spline [2004] 15. Rendering pipeline [2004] 16. CMY Color Model [2004]
11
17. Geometric vector [2002] 18. Basis matrix [2002] 19. Blending function in parametric curves [2002]
12