Special Edition for CSEDU
CSEDU Students

Students

TOUCH-N-PASS EXAM CRAM GUIDE SERIESCOMPUTER GRAPHICS

Prepared By

Sharafat Ibn Mollah Mosharraf
CSE, DU
12 Batch (20052005-2006)
2006)
th

Table of Contents
CHAPTER 3: BASIC RASTER GRAPHICS ALGORITHMS FOR DRAWING 2D PRIMITIVES ...................................... 1
SCAN CONVERSION ......................................................................................................................................................................... 1
FILLING ........................................................................................................................................................................................... 3
CLIPPING ......................................................................................................................................................................................... 3
CHAPTER 5: GEOMETRICAL TRANSFORMATIONS ........................................................................................................... 4
THEORIES ........................................................................................................................................................................................ 4
EXCERCISES .................................................................................................................................................................................... 4
CHAPTER 6: VIEWING IN 3D ...................................................................................................................................................... 5
THEORIES ........................................................................................................................................................................................ 5
EXCERCISES .................................................................................................................................................................................... 6
CHAPTER 11: REPRESENTING CURVES AND SURFACES ................................................................................................. 7
CHAPTER 13: ACHROMATIC AND COLORED LIGHT......................................................................................................... 8
CHAPTER 15: VISIBLE SURFACE DETERMINATION ........................................................................................................ 10
Z-BUFFER ..................................................................................................................................................................................... 10
RAY-TRACING .............................................................................................................................................................................. 10
EXERCISES .................................................................................................................................................................................... 10
CHAPTER 16: ILLUMINATION AND SHADING.................................................................................................................... 11
CHAPTER: SHORT NOTES ON VARIOUS TOPICS .............................................................................................................. 11

CHAPTER 3
BASIC RASTER GRAPHICS ALGORITHMS FOR DRAWING 2D PRIMITIVES
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.
ii.

3.4

Basic incremental algorithm
Mid-point line drawing algorithm

Derive the (initial) decision variable and its derivatives in mid-point/Bresenham’s 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 + 3ൗ2), yp + 2)
= a(xp + 3ൗ2) + 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 didn’t 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 notaffect 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
8
9

/* 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
int x = x0;

1

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

3.5

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}

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 (x , y )1x0 > x1
y0 ≤ y1x0 ≤ x1(x1, y1) y0 < y1

1x0 < x1
y0 ≤ y1(x0, y0) (x0, y0)(x1, y1)(x1, y1)2 1(x0, y0)30(x0, y0)4(x1, y1)x0 > x1
y0 > y17(x0, y0)
5 6(x0, y0)(x0, y0)(x0, y0)x0 > x1 (x1, y1)
y0 > y1if (abs(dx) ≥ abs(dy)) {//group0: 0 ≤ |m| ≤ 1//op0
if (x0 < x1 && y0 ≤ y1) {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 yif (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);}}(x1, y1)x0 < x1
y0 > y1(x1, y1) x0 ≤ x1
y0 > y1

3.6

Illustrate the Bresenham algorithm to rasterize a line from (0, 0) to (-8, -4). [2002. Marks: 5]

3.7

What steps are required to scan convert an arc of a circle using the polynomial method?
[2001. Marks: 4]

3.8

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 drawing algorithm. [2007, 2003. Marks: 4]

2

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

What do you understand by polygon filling? [2005. Marks: 1]

3.2

Mention three step process to fill the line span in scan line (polygon filling) algorithm. [2008.
Marks: 4]

3.3

How are the horizontal edges handled in scan line (polygon filling) algorithm? Explain withproper example. [2008. Marks: 3]

3.4

What is Active Edge Table? Write down the processing steps of global edge table in scan line
algorithm. [2008. Marks: 3]

Clipping
3.1

What is meant by clipping? [2007, 2004. Marks: 1]

3.2

Explain Cohen-Sutherland’s algorithm for line clipping. [2004. Marks: 3]

3.3

Explain Sutherland-Hodgeman polygon clipping algorithm. [2007. Marks: 3]

3.4

Consider a rectangular window whose lower left hand corner is at L(-3, 1) and upper righthand 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.
ii.

Line A(-4, 2), B(-1, 7)
Line C(-2, 3), D(1,2)

Also determine the clipping category of the above lines. [2005. Marks: 3]3

CHAPTER 5GEOMETRICAL TRANSFORMATIONS
Theories
5.1

What are the advantages of using homogeneous coordinate system? [2008. Marks: 1]

5.2

What is the difference between geometric transformation and coordinate transformation?
[2006. Marks: 1]

5.3

How can you make a coordinate transformation matrix using geometric transformation
matrix? Explain using proper example. [2008, 2006. Marks: 5]

5.4

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 ofrotation is not on the origin. [2003. Marks: 4]

5.5

Explain how to achieve the transformations so that the line lengths remain unaffected andthe motions look realistic. [2002. Marks: 10]

5.6

Show that two successive reflections about either of the coordinate axes is equivalent to asingle rotation about the coordinate origin. [2007. Marks: 4]

5.7

Derive a 4×4 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]

5.8

Derive a 4×4 3D rotation matrix while rotating across z-axis where the center of a rotation at(a, b, c). [2004. Marks: 4]

5.9

Derive a 4×4 3D rotation matrix while rotating across y-axis. [2003. Marks: 4]

5.10

Derive a 4×4 3D rotation matrix while rotating across z-axis. [2002. Marks: 4]

5.11

Find the transformation for mirror reflection with respect to the xy plane. [2002. Marks: 6]

5.12

Compute the tilting matrix for the rotation about the x-axis followed by a rotation about they-axis. Does the order of performing the rotation matter? [2002. Marks: 6 + 3] {Foley p208-209}

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]

5.3

Let P(12.0, 0.0, 25.0) be the coordinate of a three-dimensional point on a sphere whose centeris 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]

5.4

Let P(10.0, 0.0, 30.0) be the coordinate of a three-dimensional point on a sphere whose centeris 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]

5.5

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). (Usecomposition of three dimensional transformation rule) [2004. Marks: 4]

5.6

Let P(12.0, 24.0, 20.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 Ry(30) and Rz(60). (Usecomposition of three dimensional transformations rule) [2003, 2002. Marks: 2/5]
4

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

Parallel Projection

1. The distance between the center of 1. The distance between the center of projection
projection and the projection plane is finite.
and the projection plane is infinite.
2. To determine the perspective projection, its 2. To define the parallel projection, its direction
center of projection is explicitly specified.
of projection is specified.
3. The size of perspective projection of an 3. The perspective foreshortening (which isobject varies inversely with the distance ofhuman visual system) is lacking. Thisthat object from the center of projection.
projection can be used for exact measurementof object.
4. Angles are preserved only on those face of 4. The parallel lines remain parallel.
the object parallel to the projection plane anddo not in general project as parallel line.
5. The center of projection is a point that has a 5. The direction of projection is a vector.
homogeneous coordinate.
6.2

In what way is orthographic projection a special case of perspective projection?
Mathematically prove this special case. [2008. Marks: 3]

6.3

Derive a perspective projection matrix when the projection plane is at x = d and the center ofprojection is at x = -d. [2008. Marks: 4]

6.4

Derive the general perspective projection onto the view plane z = a where the center ofprojection is the origin (0, 0, 0). [2007. Marks: 3]

6.5

Derive perspective projection matrix where the projection plane is perpendicular to the zaxis, 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]

6.6

Derive perspective projection matrices assuming
(i)
(ii)

Origin at the center of projection
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.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]

6.8

Show that the normalized perspective to parallel transform preserves the relationship of theoriginal perspective transformation while transforming the normalized perspective view volume
onto the unit cube. [2002. Marks: 4]5

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]

6.2

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]

6.3

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]

6.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.
ii.

Determine the coordinate of P on the projection plane.
What will be the coordinate of P on the projection plane after Rz(30)? [2002. Marks:
5 + 5]

6

CHAPTER 11
REPRESENTING CURVES AND SURFACES
11.1

Write about the different ways of representing polygonal meshes. [2007, 2005. Marks: 3]

11.2

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]

11.3
11.4

What is a Bezier curve? Mention some properties of Bezier Curve. Find the equations forthe control points of a 3rd order Bezier curve. [2006, 2004. Marks: 4]
Show that a 3rd Order Bezier curve can be expressed as

11.5

Q(t) = (1 – t)3P0 + 3(1 – t)2tP1 + 3(1 – t)t2P2 + t3P3 [2004. Marks: 3]
11.6

Write a routine to display a 3rd order Bezier curve using a subdivision method. [2006, 2004,
2003. Marks: 3] {11.2.7 p531}

11.7

Derive the basis matrix and blending functions of Bezier cubic curve. [2007, 2005. Marks: 3]

11.8

Determine the Bezier blending functions for five control points. Plot each function and label
the maximum and minimum values. [2006. Marks: 3]

11.9

Explain about Hermite curve with proper mathematical derivations. [2002. Marks: 8]

11.10

Write a program in C to display Hermite Curve. [2002. Marks: 2]

11.11

How is Hermite geometry and Bezier geometry related? Prove the relation. [2008. Marks: 3]

11.12

Find the basis matrices to establish a relationship between Bezier curve, B-spline curve andHermite curve. [2003. Marks: 6]

11.13

Define B-spline curves. Mention some properties of B-spline curves. [2007, 2002. Marks: 4]

11.14

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.
ii.

11.15

Find the basic matrix M.
Find the blending functions for this curve. [2008. Marks: 2 + 1]

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.
ii.
iii.

Plot the control points and give a freehand sketch of the curve.
What point is Q(1/2)?
What are the values of the derivatives Q′(0) and Q′(1)? [2008. Marks: 4]7

CHAPTER 13
ACHROMATIC AND COLORED LIGHT
13.1

What is meant by half-toning? [2004. Marks: 2]

13.2

Explain half-toning algorithm to convert a grey level image into binary image. [2005.
Marks: 3]

13.3

Explain the technique of converting a grey image into half-toned binary image using a 3×3
dither matrix using proper flow-chart. [2003. Marks: 4]

13.4

Write down the algorithm (with appropriate comments) to convert RGB to HSV color
model. [2007, 2006. Marks: 4]

13.5

Write down the algorithm (with appropriate comments) to convert RGB to HLS color
model. [2005. Marks: 4]

13.6

Write down the algorithm to convert HLS to RGB color model and hence describe the redcolor distribution principle in HLS color model. [2004. Marks: 5]

13.7

Write down the algorithm to convert HSV to RGB color model and hence describe the redcolor distribution principle in HSV color model. [2003. Marks: 4]

13.8

Draw RGB and CMY color cube. [2007, 2006. Marks: 3]

13.9

Convert the following CMY color to HSV color: C = 1.0, M = 0.5, Y = 0.0. [2008. Marks: 3]

13.10

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.
ii.
iii.
iv.
v.
vi.
vii.
viii.

13.11

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.
ii.
iii.
iv.
v.
vi.
vii.
viii.

13.12

Red
Green
Blue
Cyan
Magenta
Yellow
Black
White

Red
Green
Blue
Cyan
Magenta
YellowBlack
White

Convert the following RGB colors into equivalent HLS color model:
i.
ii.
iii.
iv.

(1.0, 0.7, 0.5)
(0.0, 0.9, 0.1)
(0.1, 0.2, 0.7)
(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]8

13.13

Convert the following CMY colors into equivalent HSV/HSB color model:
v.
vi.
vii.
viii.

(1.0, 0.7, 0.5)
(0.0, 0.9, 0.1)
(0.1, 0.2, 0.7)
(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]

9

CHAPTER 15
VISIBLE SURFACE DETERMINATION
Z-Buffer
15.1

How is the depth of a polygon determined by the painter’s algorithm? [2006. Marks: 2] {15.5,
p697}

15.2

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 andwhich 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 1920×1200 pixels. In
situation B, a scene has 100,000 polygons and the frame buffer is 320×240 pixels. Briefly discuss
which hidden surface removal method (Back-face Culling or Z-buffer) would be efficient foreach scene? [2008. Marks: 3]

Ray-Tracing
15.1

What is meant by ray tracing? [2002. Marks: 3]

15.2

Mention some advantages of ray tracing method. [2006. Marks: 2] {p725}

15.3

Explain basic ray tracing method with the help of a flowchart. [2003. Marks: 6]

15.4

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 obscureeach 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 = 2tz = -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]
Similar to exercise 15.3
10

CHAPTER 16
ILLUMINATION AND SHADING
16.1

What are the differences between local and global light model? [2008, 2006. Marks: 2]

16.2

Explain in details about specular reflection in illumination model. [2002. Marks: 10]

16.3

Explain diffuse reflection model. [2007, 2003. Marks: 3]

16.4
16.5

Explain Gouraud shading. Show that this algorithm can easily be integrated with the scanline visible surface algorithm. [2008. Marks: 5]
How the Phong illumination model can be implemented in OpenGL? [2008. Marks: 3]

CHAPTERSHORT 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]
17. Geometric vector [2002]
18. Basis matrix [2002]
19. Blending function in parametric curves [2002]

11