0% found this document useful (0 votes)
115 views14 pages

Computer Graphics: Touch - Pass Exam Cram Guide Series

This document provides a summary of chapters from a guide on computer graphics. It includes chapters on basic raster graphics algorithms for drawing 2D primitives, geometrical transformations, viewing in 3D, representing curves and surfaces, achromatic and colored light, visible surface determination, illumination and shading, and short notes on various topics. The table of contents lists the chapter titles and section numbers for topics covered within each chapter.

Uploaded by

gazal_chopra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views14 pages

Computer Graphics: Touch - Pass Exam Cram Guide Series

This document provides a summary of chapters from a guide on computer graphics. It includes chapters on basic raster graphics algorithms for drawing 2D primitives, geometrical transformations, viewing in 3D, representing curves and surfaces, achromatic and colored light, visible surface determination, illumination and shading, and short notes on various topics. The table of contents lists the chapter titles and section numbers for topics covered within each chapter.

Uploaded by

gazal_chopra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 14

Special Edition for CSEDU Students Students

TOUCH-N-PASS EXAM CRAM GUIDE SERIES

COMPUTER GRAPHICS

Prepared By

Sharafat Ibn Mollah Mosharraf


12
th

CSE, DU Batch (2005-2006)

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

CHAPTER 3 BASIC RASTER GRAPHICS ALGORITHMS


Scan Conversion 3.1 3.2 3.3 What do you mean by scan conversion? [2002. Marks: 2] How can you determine whether a point P(x, y) lies to the left or to the right of a line segment joining the points Q(x1, y1) and R(x2, y2)? [2007, 2004, 2002. Marks: 2] Make a comparative analysis of the following algorithms: [2005. Marks: 3] i. 3.4 Basic incremental algorithm ii. Mid-point line drawing algorithm Derive the (initial) decision variable and its derivatives in mid-point/Bresenhams line drawing algorithm while the slope of the line is 1.0 AND . [2005, 2003. Marks: 6] For slope 1.0 |m| , the decision to be made is between N and NE. The midpoint to be tested is at (xp + , yp + 1). Decision variable, d = F(xp + , yp + 1) = a(xp + ) + b(yp + 1) + c (1) Initial value of d, d0 = F(x0 + , y0 + 1) = a(x0 + ) + b(y0 + 1) + c = ax0 + by0 + c + a / 2 + b = F(x0, y0) + a / 2 + b =0+a/2+b [ (x0, y0) is a point on the line] =a/2+b = dy / 2 dx If N chosen, then dnew = F(xp + , yp + 2) = a(xp + ) + b(yp + 2) + c = a(xp + ) + b(yp + 1) + c + b =d+b [From (1)] incN = b = dx If NE chosen, then dnew = F(xp + ), yp + 2) = a(xp + ) + b(yp + 2) + c = a(xp + ) + b(yp + 1) + c + a + b =d+a+b [From (1)] incNE = a + b = dy dx [The algorithm is not needed to answer this question (the question simply didnt ask for it). However, it is provided below for convenience.] To eliminate the fraction in d0, we redefine our original F by multiplying it by 2; F(x, y) = 2(ax + by + c). This multiplies each constant (a, b and c) and the decision variable (d) by 2, but does not affect the sign of the decision variable.
Listing: The midpoint line scan-conversion algorithm for slope 1.0 and . 1 2 3 4 5 6 7 /* Assumes 1 <= |m| <= */ void midpointLine(int x0, int y0, int x1, int y1, int value) { int dx = x1 - x0; int dy = y1 - y0; int d = dy - 2 * dx; // initial value of d int incrN = -2 * dx; // increment used for move to N int incrNE = 2 * (dy - dx); // increment used for move to NE
1

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); }

// the start pixel // choose NE

// choose N

// the selected pixel closest to the line

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.

x0 > x1 y0 < y1 x0 > x1 y0 y1 (x1, y1)

(x1, y1)

(x1, y1)

x0 x1 y0 < y1

x0 < x1 y0 y1 (x1, y1)

(x0, y0) (x0, y0) (x0, y0) (x0, y0) 2 1 3 4 0 (x0, y0)

(x1, y1) x0 > x1 y0 > y1

7 (x0, y0) 5 6 (x0, y0) (x0, y0) (x1, y1) x0 x1 y0 > y1

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

x0 > x1 (x1, y1) y0 > y1

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]

CHAPTER 5 GEOMETRICAL TRANSFORMATIONS


Theories 5.1 5.2 5.3 5.4 What are the advantages of using homogeneous coordinate system? [2008. Marks: 1] What is the difference between geometric transformation and coordinate transformation? [2006. Marks: 1] How can you make a coordinate transformation matrix using geometric transformation matrix? Explain using proper example. [2008, 2006. Marks: 5] What do you understand by the composition of geometric/3D transformations? Show (using proper example) that composition of geometric transformations is a must when the center of rotation is not on the origin. [2003. Marks: 4] Explain how to achieve the transformations so that the line lengths remain unaffected and the motions look realistic. [2002. Marks: 10] Show that two successive reflections about either of the coordinate axes is equivalent to a single rotation about the coordinate origin. [2007. Marks: 4] Derive a 44 composite rotation matrix while a 3D point rotating across x-, y- and z-axis (assuming center of a rotation at origin). [2007, 2006, 2005. Marks: 3] Derive a 44 3D rotation matrix while rotating across z-axis where the center of a rotation at (a, b, c). [2004. Marks: 4] Derive a 44 3D rotation matrix while rotating across y-axis. [2003. Marks: 4] Derive a 44 3D rotation matrix while rotating across z-axis. [2002. Marks: 4] Find the transformation for mirror reflection with respect to the xy plane. [2002. Marks: 6] Compute the tilting matrix for the rotation about the x-axis followed by a rotation about the yaxis. Does the order of performing the rotation matter? [2002. Marks: 6 + 3] {Foley p208-209}

5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12

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.

5. The direction of projection is a vector.

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

CHAPTER 11 REPRESENTING CURVES AND SURFACES


11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 Write about the different ways of representing polygonal meshes. [2007, 2005. Marks: 3] Why polynomials of high degree are not useful in curve fitting? [2005. Marks: 1] {Because it is complex (???)} What is G1 and C1 continuity? [2002. Marks: 2] What is a Bezier curve? Mention some properties of Bezier Curve. Find the equations for the control points of a 3rd order Bezier curve. [2006, 2004. Marks: 4] Show that a 3rd Order Bezier curve can be expressed as Q(t) = (1 t)3P0 + 3(1 t)2tP1 + 3(1 t)t2P2 + t3P3 [2004. Marks: 3] Write a routine to display a 3rd order Bezier curve using a subdivision method. [2006, 2004, 2003. Marks: 3] {11.2.7 p531} Derive the basis matrix and blending functions of Bezier cubic curve. [2007, 2005. Marks: 3] Determine the Bezier blending functions for five control points. Plot each function and label the maximum and minimum values. [2006. Marks: 3] Explain about Hermite curve with proper mathematical derivations. [2002. Marks: 8] Write a program in C to display Hermite Curve. [2002. Marks: 2] How is Hermite geometry and Bezier geometry related? Prove the relation. [2008. Marks: 3] Find the basis matrices to establish a relationship between Bezier curve, B-spline curve and Hermite curve. [2003. Marks: 6] Define B-spline curves. Mention some properties of B-spline curves. [2007, 2002. Marks: 4] Consider a quadratic parametric cubic curve Q(t) = T.M.G, where T = [t2 t 1]. The geometry vector for this curve is defined as G = [P0, P1 P2]. i. Find the basic matrix M. ii. Find the blending functions for this curve. [2008. Marks: 2 + 1] 11.15 A Bezier curve Q has control points P0 = (0, 0, 0), P1 = (0, 1, 0), P2 = (1, 1, 0) and P3 = (2, 0, 0). i. Plot the control points and give a freehand sketch of the curve. ii. What point is Q(1/2)? iii. What are the values of the derivatives Q(0) and Q(1)? [2008. Marks: 4]

CHAPTER 13 ACHROMATIC AND COLORED LIGHT


13.1 13.2 3] 13.3 13.4 13.5 13.6 13.7 13.8 13.9 13.10 Explain the technique of converting a grey image into half-toned binary image using a 33 dither matrix using proper flow-chart. [2003. Marks: 4] Write down the algorithm (with appropriate comments) to convert RGB to HSV color model. [2007, 2006. Marks: 4] Write down the algorithm (with appropriate comments) to convert RGB to HLS color model. [2005. Marks: 4] Write down the algorithm to convert HLS to RGB color model and hence describe the red color distribution principle in HLS color model. [2004. Marks: 5] Write down the algorithm to convert HSV to RGB color model and hence describe the red color distribution principle in HSV color model. [2003. Marks: 4] Draw RGB and CMY color cube. [2007, 2006. Marks: 3] Convert the following CMY color to HSV color: C = 1.0, M = 0.5, Y = 0.0. [2008. Marks: 3] Imagine that you have a CMYK printer where cyan and magenta inks have been swapped. When one tries to print the following colors, what color will actually appear on the paper? [2008. Marks: 2] i. Red ii. Green iii. Blue iv. Cyan v. Magenta vi. Yellow vii. Black viii. 13.11 White The color format in BMP file is BGR, whereas the format in OpenGL is RGB. What will happen for the following colors if someone assumes BMP file as RGB format? [In-course 20082009. Marks: 8] i. Red ii. Green iii. Blue iv. Cyan v. Magenta vi. Yellow vii. Black viii. 13.12 White
8

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

CHAPTER 15 SURFACE DETERMINATION

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

Similar to exercise 15.3

CHAPTER 16 ILLUMINATION AND SHADING


16.1 16.2 16.3 16.4 16.5 What are the differences between local and global light model? [2008, 2006. Marks: 2] Explain in details about specular reflection in illumination model. [2002. Marks: 10] Explain diffuse reflection model. [2007, 2003. Marks: 3] Explain Gouraud shading. Show that this algorithm can easily be integrated with the scan-line visible surface algorithm. [2008. Marks: 5] How the Phong illumination model can be implemented in OpenGL? [2008. Marks: 3]

SHORT

CHAPTER NOTES ON VARIOUS TOPICS

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

You might also like