Credit:Eli TamangEli Tamang

Tribhuwan University

Institute of Science and Technology

2082

Bachelor Level / Third Year / Fifth Semester / Science

Bachelors in Information Technology (BIT304)

(Computer Graphics)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
Describe Bresenham's circle drawing algorithm. Trace the DDA algorithm to draw a line segment from (2,2)(2, 2) to (6,6)(6, 6).[10]

Bresenham's Circle Drawing Algorithm & DDA Line Algorithm Trace [10 marks]


Part A: Bresenham's Circle Drawing Algorithm

Bresenham's Circle Drawing Algorithm is an efficient scan-conversion method that uses only integer arithmetic to determine the closest pixel positions along a circle's circumference, exploiting the eight-way symmetry of a circle.

Key Idea:

The algorithm calculates pixels for only one-eighth of the circle (from 0° to 45°) and uses symmetry to plot the remaining seven octants simultaneously.

Eight-Way Symmetry:

For a point (x,y)(x, y) on the circle, the following 8 points are also on the circle:

(x,y), (x,y), (x,y), (x,y), (y,x), (y,x), (y,x), (y,x)(x,y),\ (-x,y),\ (x,-y),\ (-x,-y),\ (y,x),\ (-y,x),\ (y,-x),\ (-y,-x)

Algorithm Steps:

  • a. Input the radius rr and circle center (xc,yc)(x_c, y_c)
  • b. Set starting point: x=0x = 0, y=ry = r
  • c. Calculate initial decision parameter: p0=32rp_0 = 3 - 2r
  • d. At each xkx_k position, check the decision parameter pkp_k:
    • If pk<0p_k < 0: Next point is (xk+1, yk)(x_{k}+1,\ y_k) and pk+1=pk+4xk+6p_{k+1} = p_k + 4x_k + 6
    • If pk0p_k \geq 0: Next point is (xk+1, yk1)(x_{k}+1,\ y_k - 1) and pk+1=pk+4(xkyk)+10p_{k+1} = p_k + 4(x_k - y_k) + 10
  • e. Plot the symmetric points in all eight octants (translate by adding $x_c, y_c$)
  • f. Repeat steps d–e until xyx \geq y

Advantages:

  • Uses only integer addition and subtraction — no multiplication or trigonometry
  • Very fast and efficient for hardware implementation
  • Produces smooth, symmetric circles

Part B: DDA Algorithm Trace — Line from (2, 2) to (6, 6)

DDA (Digital Differential Analyzer) is a line drawing algorithm that uses incremental floating-point calculations to find successive pixel positions along a line.

Given:

  • Start point: (x1,y1)=(2,2)(x_1, y_1) = (2, 2)
  • End point: (x2,y2)=(6,6)(x_2, y_2) = (6, 6)

Step-by-step Calculation:

dx=x2x1=62=4dx = x_2 - x_1 = 6 - 2 = 4

dy=y2y1=62=4dy = y_2 - y_1 = 6 - 2 = 4

steps=max(dx,dy)=max(4,4)=4steps = \max(|dx|, |dy|) = \max(4, 4) = 4

xinc=dxsteps=44=1x_{inc} = \frac{dx}{steps} = \frac{4}{4} = 1

yinc=dysteps=44=1y_{inc} = \frac{dy}{steps} = \frac{4}{4} = 1

Iteration Table:

Step xx yy Pixel Plotted (round(x),round(y))(\text{round}(x), \text{round}(y))
0 2 2 (2, 2)
1 3 3 (3, 3)
2 4 4 (4, 4)
3 5 5 (5, 5)
4 6 6 (6, 6)

Explanation: Since the line has a slope of m=dydx=44=1m = \frac{dy}{dx} = \frac{4}{4} = 1 (45° line), both x and y increment by exactly 1 at each step, producing a perfect diagonal line.

image


Conclusion: Bresenham's circle algorithm is preferred over parametric methods due to its integer-only arithmetic and efficiency. The DDA algorithm is simple and works well for lines of any slope by choosing the larger of dx/dy as the number of steps, ensuring smooth pixel placement.

2.
What is scaling in 3D graphics? Derive the scaling matrix for scaling along the XX, YY, and ZZ axes. Apply the scaling transformation to a point (2,3,4)(2, 3, 4) with scaling factors Sx=2S_x = 2, Sy=3S_y = 3, Sz=4S_z = 4.[10]
3.
Describe the concept of Bezier curves in 3D modeling. Derive the equation for a Bezier curve and discuss how it is used in curve modeling and animation.[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
Discuss how rasterization and rendering help in generating a realistic image from a 3D model and what factors affect the quality of the rendered output. [5]
5.
Explain the concept of translation transformation in 2D graphics. Discuss the effect of translation on objects. [5]
6.
Given a polygon with vertices A(3,4)A(3, 4), B(7,4)B(7, 4), C(7,8)C(7, 8), D(3,8)D(3, 8), clip it against a rectangular window with coordinates (4,5)(4, 5), (6,7)(6, 7) using Sutherland-Hodgman polygon clipping algorithm. [5]
7.
What are object space techniques in visible surface detection? Explain how these techniques are used in 3D graphics. [5]
8.
Describe the Scan-Line method for visible surface detection. Write its advantages and limitations. [5]
9.
Explain the concept of ambient reflection in the context of illumination models. How does it affect the overall lighting in a 3D scene? [5]
10.
Describe the Gouraud Shading model. How does Gouraud shading improve the rendering of 3D objects compared to constant shading? [5]
11.
What is virtual reality? Describe the components of VR system. [5]
12.
Write short notes on: a) Area subdivision method Write short notes on: b) OpenGL viewing [2.5+2.5]