Browse papers
A

Section A: Long Answer Questions

Attempt all / any as specified.

4 questions
1long12 marks

(a) Derive the decision parameter for Bresenham's line drawing algorithm for a line with slope 0 < m < 1, and state how the algorithm is generalized to handle lines of arbitrary slope. [7]

(b) Using the midpoint circle drawing algorithm, compute and tabulate the pixel positions in the first octant for a circle of radius r = 8 centred at the origin. [5]

(a) Bresenham's line algorithm, decision parameter (slope 0 < m < 1) [7]

We want to scan-convert a line from (x0,y0)(x_0,y_0) to (x1,y1)(x_1,y_1) with 0<m<10<m<1. Since m<1m<1, xx is the fast (driving) axis: we step xx by 1 each iteration and decide whether yy stays the same or increases by 1.

The line equation is y=mx+cy = mx + c, where m=ΔyΔxm = \dfrac{\Delta y}{\Delta x}, Δx=x1x0\Delta x = x_1-x_0, Δy=y1y0\Delta y = y_1-y_0.

At step kk the current pixel is (xk,yk)(x_k, y_k). The next xx is xk+1x_{k}+1; the candidates are the lower pixel (xk+1,yk)(x_k+1, y_k) and the upper pixel (xk+1,yk+1)(x_k+1, y_k+1). The true line at xk+1x_k+1 has y=m(xk+1)+cy = m(x_k+1)+c.

Let d1d_1 and d2d_2 be the vertical distances from the true line down to yky_k and up to yk+1y_k+1:

d1=yyk=m(xk+1)+cykd_1 = y - y_k = m(x_k+1)+c - y_k d2=(yk+1)y=yk+1m(xk+1)cd_2 = (y_k+1) - y = y_k+1 - m(x_k+1) - c

We choose the lower pixel if d1<d2d_1 < d_2, i.e. if d1d2<0d_1 - d_2 < 0:

d1d2=2m(xk+1)2yk+2c1d_1 - d_2 = 2m(x_k+1) - 2y_k + 2c - 1

Substitute m=Δy/Δxm=\Delta y/\Delta x and multiply by Δx\Delta x (positive, so the sign is preserved) to keep everything in integer arithmetic. Define the decision parameter:

pk=Δx(d1d2)=2Δyxk2Δxyk+(2Δy+Δx(2c1))p_k = \Delta x\,(d_1-d_2) = 2\Delta y\,x_k - 2\Delta x\,y_k + (2\Delta y + \Delta x(2c-1))

The constant terms collect into 2ΔyΔx2\Delta y - \Delta x, giving the initial value:

p0=2ΔyΔxp_0 = 2\Delta y - \Delta x

Decision rule:

  • If pk<0p_k < 0: choose lower pixel (xk+1,yk)(x_k+1,\,y_k), and pk+1=pk+2Δyp_{k+1} = p_k + 2\Delta y.
  • If pk0p_k \ge 0: choose upper pixel (xk+1,yk+1)(x_k+1,\,y_k+1), and pk+1=pk+2Δy2Δxp_{k+1} = p_k + 2\Delta y - 2\Delta x.

These recurrences use only integer additions of the precomputed constants 2Δy2\Delta y and 2Δy2Δx2\Delta y-2\Delta x — no multiplication or floating point per step.

Generalisation to arbitrary slope

The derivation above assumes 0<m<10<m<1 and x1>x0x_1>x_0. For a general line:

  1. m>1|m|>1 (steep lines): swap roles of xx and yy — step yy by 1 and decide on xx. The decision parameter becomes p0=2ΔxΔyp_0 = 2\Delta x - \Delta y with Δx,Δy\Delta x,\Delta y roles interchanged.
  2. Negative slope: if Δy<0\Delta y<0 (or Δx<0\Delta x<0) the chosen pixel is decremented instead of incremented along that axis.
  3. Direction: if the endpoints are given in the wrong order, swap them so we always march in the positive driving direction.

Thus, by choosing the driving axis as the one with the larger absolute change and adjusting the increment signs, the same integer decision logic handles all eight octants.

line-drawingcircle-drawingscan-conversion
2long12 marks

(a) Explain why homogeneous coordinates are used in computer graphics. Obtain the composite transformation matrix required to reflect an object about the line y = x + 2, clearly stating each elementary transformation in order. [8]

(b) A triangle has vertices A(2, 2), B(6, 2) and C(4, 6). Find the coordinates of the triangle after it is rotated 90° anticlockwise about the point (4, 2). [4]

(a) Homogeneous coordinates and reflection about y = x + 2 [8]

Why homogeneous coordinates? In 2D, a point (x,y)(x,y) is written as (x,y,1)(x,y,1), i.e. an extra coordinate is appended. The reasons are:

  • Translation becomes a matrix multiplication. Translation is additive in Cartesian form and cannot be expressed as a 2×22\times2 matrix; in homogeneous form it is a 3×33\times3 matrix, so it can be combined uniformly with rotation, scaling, etc.
  • Composite transformations can be pre-multiplied into a single matrix, so a sequence of operations is applied with one matrix-vector product per point.
  • They also allow representation of points at infinity (w = 0) and unify affine and projective (perspective) transformations.

Reflection about the line y=x+2y = x + 2: The line has slope 1 and y-intercept 2. We reduce it to reflection about the line y=xy=x (which passes through the origin) by the sequence:

  1. Translate so the line passes through the origin. The line crosses the y-axis at (0,2)(0,2); translate by (0,2)(0,-2):
T1=[100012001]T_1=\begin{bmatrix}1&0&0\\0&1&-2\\0&0&1\end{bmatrix}

Now the line becomes y=xy=x.

  1. Reflect about y=xy=x (swap x and y):
Ry=x=[010100001]R_{y=x}=\begin{bmatrix}0&1&0\\1&0&0\\0&0&1\end{bmatrix}
  1. Translate back by (0,+2)(0,+2):
T2=[100012001]T_2=\begin{bmatrix}1&0&0\\0&1&2\\0&0&1\end{bmatrix}

The composite matrix (applied right-to-left to a column point) is:

M=T2Ry=xT1M = T_2\cdot R_{y=x}\cdot T_1

Computing Ry=xT1=[012100001]R_{y=x}\cdot T_1 = \begin{bmatrix}0&1&-2\\1&0&0\\0&0&1\end{bmatrix}, then pre-multiplying by T2T_2:

M=[012102001]\boxed{M=\begin{bmatrix}0&1&-2\\1&0&2\\0&0&1\end{bmatrix}}

Check: a point on the line, say (0,2)(0,2), maps to (00+122,  0+0+2)=(0,2)(0\cdot0+1\cdot2-2,\;0+0+2)=(0,2) — fixed, as expected.

(b) Rotate triangle 90° anticlockwise about (4, 2) [4]

Procedure: translate pivot to origin, rotate 9090^\circ CCW (x,y)(y,x)(x,y)\to(-y,x), translate back.

With pivot (4,2)(4,2), a point (x,y)(x,y) maps to (4(y2),  2+(x4))\big(4-(y-2),\;2+(x-4)\big).

VertexRelative to pivotAfter 90° CCWFinal
A(2,2)(−2, 0)(0, −2)A'(4, 0)
B(6,2)(2, 0)(0, 2)B'(4, 4)
C(4,6)(0, 4)(−4, 0)C'(0, 2)

Result: A(4,0),  B(4,4),  C(0,2)A'(4,0),\;B'(4,4),\;C'(0,2).

2d-transformationshomogeneous-coordinates
3long12 marks

(a) Distinguish between parallel and perspective projection. Derive the perspective projection transformation matrix for a centre of projection located at a distance d from the projection plane along the z-axis, and explain the effect of vanishing points. [8]

(b) Write down the transformation matrix to rotate a 3D object about an axis parallel to the z-axis passing through the point (x0, y0, 0) by an angle θ. [4]

(a) Parallel vs perspective projection; perspective matrix; vanishing points [8]

Distinction:

FeatureParallel projectionPerspective projection
ProjectorsParallel to one anotherConverge to a single centre of projection (COP)
Object sizePreserved regardless of distanceDecreases with distance (foreshortening)
Parallel linesRemain parallelConverge to vanishing points
RealismLess realistic; used in CAD/engineeringMore realistic; matches human vision
MeasurementsTrue dimensions retainedNot preserved

Derivation of the perspective matrix: Let the projection plane be z=0z=0 and the centre of projection lie on the z-axis at (0,0,d)(0,0,-d) (so the plane is at distance dd from the COP). Consider a point P(x,y,z)P(x,y,z). The projector from the COP through PP meets the plane z=0z=0 at P(xp,yp,0)P'(x_p,y_p,0).

Using similar triangles along the projector:

xpx=dz+dxp=x1+z/d\frac{x_p}{x}=\frac{d}{z+d}\quad\Rightarrow\quad x_p=\frac{x}{1+z/d} yp=y1+z/dy_p=\frac{y}{1+z/d}

In homogeneous coordinates this division by (1+z/d)(1+z/d) is produced by placing 1/d1/d in the matrix and dividing by the homogeneous coordinate ww:

[xpypzpw]=[100001000000001d1][xyz1]=[xy0zd+1]\begin{bmatrix}x_p'\\y_p'\\z_p'\\w\end{bmatrix}=\begin{bmatrix}1&0&0&0\\0&1&0&0\\0&0&0&0\\0&0&\tfrac{1}{d}&1\end{bmatrix}\begin{bmatrix}x\\y\\z\\1\end{bmatrix}=\begin{bmatrix}x\\y\\0\\\tfrac{z}{d}+1\end{bmatrix}

Dividing by w=zd+1w=\frac{z}{d}+1 gives xp=x1+z/d,  yp=y1+z/dx_p=\dfrac{x}{1+z/d},\;y_p=\dfrac{y}{1+z/d}, confirming the result.

Vanishing points: Lines that are parallel in the scene but not parallel to the projection plane appear to converge to a common point called a vanishing point. The number of principal vanishing points (one, two, or three) equals the number of the three principal axes that pierce the projection plane, giving one-, two-, and three-point perspective. This convergence is what produces the sense of depth.

(b) Rotation about an axis parallel to z through (x0, y0, 0) by θ [4]

Translate the axis to the z-axis, rotate about z, translate back:

R=T(x0,y0,0)Rz(θ)T(x0,y0,0)R = T(x_0,y_0,0)\cdot R_z(\theta)\cdot T(-x_0,-y_0,0) R=[cosθsinθ0x0(1cosθ)+y0sinθsinθcosθ0y0(1cosθ)x0sinθ00100001]R=\begin{bmatrix}\cos\theta & -\sin\theta & 0 & x_0(1-\cos\theta)+y_0\sin\theta\\ \sin\theta & \cos\theta & 0 & y_0(1-\cos\theta)-x_0\sin\theta\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\end{bmatrix}

The zz-coordinate is unchanged because the axis is parallel to the z-axis.

3d-transformationsprojections
4long12 marks

(a) Describe the Cohen-Sutherland line clipping algorithm. Explain the significance of region (outcodes) and the conditions for trivial acceptance and trivial rejection. [7]

(b) Using the Cohen-Sutherland algorithm, clip the line segment from P1(−10, 30) to P2(40, 5) against a rectangular clipping window with corners (xmin, ymin) = (0, 0) and (xmax, ymax) = (30, 30). Show the intersection calculations. [5]

(a) Cohen–Sutherland line clipping algorithm [7]

The algorithm clips a line against an axis-aligned rectangular window with bounds xmin,xmax,ymin,ymaxx_{min},x_{max},y_{min},y_{max}. The plane is divided into nine regions, and each endpoint is assigned a 4-bit region code (outcode):

Bit 1 (8) : y > ymax   (Top)
Bit 2 (4) : y < ymin   (Bottom)
Bit 3 (2) : x > xmax   (Right)
Bit 4 (1) : x < xmin   (Left)

A bit is 1 when the point lies on that side of the window; the central (inside) region has code 0000.

1001 | 1000 | 1010
-----+------+-----
0001 | 0000 | 0010
-----+------+-----
0101 | 0100 | 0110

Significance of outcodes: they let us test acceptance/rejection with cheap bit operations:

  • Trivial acceptance: both endpoints have code 0000 (logical OR = 0). The whole line lies inside; draw it.
  • Trivial rejection: the bitwise AND of the two codes is non-zero. Both endpoints lie outside the same boundary, so the line cannot cross the window; discard it.
  • Otherwise (OR ≠ 0 and AND = 0): the line may cross the window. Pick the endpoint that is outside (non-zero code), compute its intersection with one violated boundary, replace that endpoint with the intersection, recompute its outcode, and repeat until trivial accept or reject.

Intersections use the line's slope m=y2y1x2x1m=\dfrac{y_2-y_1}{x_2-x_1}:

  • With a vertical edge x=xex=x_e: y=y1+m(xex1)y = y_1 + m(x_e - x_1).
  • With a horizontal edge y=yey=y_e: x=x1+yey1mx = x_1 + \dfrac{y_e - y_1}{m}.

(b) Clip P1(−10, 30) → P2(40, 5), window (0,0)–(30,30) [5]

Slope m=53040(10)=2550=0.5m = \dfrac{5-30}{40-(-10)} = \dfrac{-25}{50} = -0.5.

Outcodes:

  • P1(−10, 30): x<0x<0 → Left bit; y=30y=30 is on edge (not > 30), yy ok ⇒ code 0001.
  • P2(40, 5): x=40>30x=40>30 → Right bit; yy ok ⇒ code 0010.

OR = 0011 ≠ 0 (not trivially accepted); AND = 0000 (not trivially rejected) ⇒ clip.

Clip P1 against Left edge x=0x=0:

y=30+(0.5)(0(10))=305=25P1=(0,25)y = 30 + (-0.5)(0-(-10)) = 30 - 5 = 25 \Rightarrow P_1' = (0, 25)

New outcode of (0,25)(0,25) = 0000 (inside).

Clip P2 against Right edge x=30x=30:

y=30+(0.5)(30(10))=3020=10P2=(30,10)y = 30 + (-0.5)(30-(-10)) = 30 - 20 = 10 \Rightarrow P_2' = (30, 10)

New outcode of (30,10)(30,10) = 0000 (inside).

Both endpoints now inside ⇒ trivial acceptance.

Clipped segment: from (0, 25) to (30, 10).

clippingcohen-sutherland
B

Section B: Short Answer Questions

Attempt all / any as specified.

8 questions
5short8 marks

Explain the Z-buffer (depth-buffer) algorithm for hidden surface removal. Compare it with the back-face detection method, stating one advantage and one disadvantage of each.

Z-buffer (depth-buffer) algorithm

The Z-buffer is an image-space hidden-surface removal method. Two buffers of the same resolution as the frame buffer are maintained:

  • a depth buffer storing, for each pixel, the depth (z) of the closest surface seen so far, and
  • the frame buffer storing the corresponding colour.

Algorithm:

Initialise depth_buffer[x][y] = z_max (farthest)  for all pixels
Initialise frame_buffer[x][y] = background colour
for each polygon:
    for each pixel (x, y) covered by the polygon:
        compute z = depth of the polygon at (x, y)
        if z < depth_buffer[x][y]:        // nearer than stored
            depth_buffer[x][y] = z
            frame_buffer[x][y] = surface colour at (x, y)

Depth across a polygon is found incrementally: zx+1=zxacz_{x+1}=z_x-\dfrac{a}{c} along a scan line, so no per-pixel plane evaluation is needed.

Advantage: simple, handles any number of polygons in arbitrary order, easily hardware-accelerated. Disadvantage: requires a large extra depth buffer and writes every covered pixel (high memory/over-draw); limited z-precision can cause z-fighting.

Comparison with back-face detection

Back-face detection removes polygons whose outward normal N\mathbf{N} points away from the viewer, i.e. where NV>0\mathbf{N}\cdot\mathbf{V} > 0 (equivalently zz-component of N0\mathbf{N} \le 0 in view space). It is an object-space test.

MethodAdvantageDisadvantage
Z-bufferCorrect for any scene, including interpenetrating surfaces; order-independentNeeds large depth buffer; precision/z-fighting issues
Back-face detectionVery fast; cheap pre-pass that culls ~half the faces of a closed solidOnly works for single convex closed solids; cannot resolve overlap between separate objects, so it is normally a pre-filter, not a complete solution
hidden-surface-removalz-buffer
6short8 marks

State the Phong illumination model and write its equation including ambient, diffuse and specular components. Differentiate between Gouraud shading and Phong shading.

Phong illumination model

The Phong model computes the reflected intensity at a surface point as the sum of three terms — ambient, diffuse, and specular:

I=kaIaambient  +  kdIl(NL)diffuse  +  ksIl(RV)nspecularI = \underbrace{k_a I_a}_{\text{ambient}} \;+\; \underbrace{k_d I_l (\mathbf{N}\cdot\mathbf{L})}_{\text{diffuse}} \;+\; \underbrace{k_s I_l (\mathbf{R}\cdot\mathbf{V})^{n}}_{\text{specular}}

where:

  • IaI_a = ambient light intensity, IlI_l = point-source intensity;

  • ka,kd,ksk_a, k_d, k_s = ambient, diffuse and specular reflection coefficients;

  • N\mathbf{N} = unit surface normal, L\mathbf{L} = unit direction to the light, R\mathbf{R} = direction of perfect reflection of L\mathbf{L} about N\mathbf{N}, V\mathbf{V} = direction to the viewer;

  • nn = specular (shininess) exponent — larger nn gives a smaller, sharper highlight.

  • Ambient models uniform background light (no direction).

  • Diffuse (Lambert's cosine law) depends on the angle between N\mathbf{N} and L\mathbf{L}; viewpoint-independent.

  • Specular produces the shiny highlight; depends on the angle between R\mathbf{R} and V\mathbf{V}.

With multiple light sources the diffuse and specular terms are summed over all sources, and the term is clamped to non-negative values.

Gouraud vs Phong shading

AspectGouraud shadingPhong shading
What is interpolatedIntensities (colours) computed at vertices are interpolated across the polygonNormal vectors are interpolated across the polygon; lighting is computed per pixel
Where lighting is evaluatedAt each vertex onlyAt every interior pixel
HighlightsSpecular highlights can be missed or smeared if they fall inside a polygonRenders highlights accurately, even inside a polygon
CostCheaper / fasterMore expensive (per-pixel normalisation and lighting)
QualityMach-band artefacts possibleSmoother, more realistic
illuminationshading
7short8 marks

What are Bezier curves? List the important properties of a Bezier curve. A cubic Bezier curve is defined by control points P0(1, 1), P1(2, 4), P2(5, 4) and P3(6, 1); compute the point on the curve at parameter u = 0.5.

Bezier curves

A Bezier curve is a parametric curve defined by a set of n+1n+1 control points P0,P1,,PnP_0,P_1,\dots,P_n. The curve is a weighted blend of the control points using Bernstein basis polynomials:

P(u)=i=0nPiBi,n(u),Bi,n(u)=(ni)ui(1u)ni,0u1P(u)=\sum_{i=0}^{n} P_i\,B_{i,n}(u),\qquad B_{i,n}(u)=\binom{n}{i}u^{i}(1-u)^{n-i},\quad 0\le u\le 1

Important properties

  1. The curve passes through the first and last control points (P(0)=P0,  P(1)=PnP(0)=P_0,\;P(1)=P_n) but generally not the intermediate ones.
  2. It lies entirely within the convex hull of its control points.
  3. It is tangent to P0P1P_0P_1 at the start and to Pn1PnP_{n-1}P_n at the end.
  4. The basis functions are non-negative and sum to 1 (partition of unity) ⇒ affine invariance.
  5. The curve has the same degree structure but offers only global control — moving any control point changes the whole curve.
  6. It is invariant under affine transformations (transform the control points, not the curve).

Point at u = 0.5 (cubic, n = 3)

Cubic Bezier: P(u)=(1u)3P0+3(1u)2uP1+3(1u)u2P2+u3P3P(u)=(1-u)^3P_0+3(1-u)^2u\,P_1+3(1-u)u^2P_2+u^3P_3.

At u=0.5u=0.5 the blending weights are 0.125,0.375,0.375,0.1250.125,\,0.375,\,0.375,\,0.125.

x: 0.125(1)+0.375(2)+0.375(5)+0.125(6)=0.125+0.75+1.875+0.75=3.50.125(1)+0.375(2)+0.375(5)+0.125(6)=0.125+0.75+1.875+0.75=3.5

y: 0.125(1)+0.375(4)+0.375(4)+0.125(1)=0.125+1.5+1.5+0.125=3.250.125(1)+0.375(4)+0.375(4)+0.125(1)=0.125+1.5+1.5+0.125=3.25

P(0.5)=(3.5,  3.25)\boxed{P(0.5)=(3.5,\;3.25)}
curves-surfacesbezier
8short8 marks

Explain the scan-line polygon fill algorithm. Describe the role of the edge table and the active edge list, and how the algorithm handles vertices that are local minima or maxima.

Scan-line polygon fill algorithm

The algorithm fills a polygon by processing the image one horizontal scan line at a time. For a given scan line yy, it finds all points where the scan line crosses polygon edges, sorts these x-intersections, and fills the spans between pairs of intersections (odd–even / parity rule).

Steps:

1. Build the Edge Table (ET).
2. For y from y_min to y_max:
   a. Move edges whose y_min == y from ET into the Active Edge List (AEL).
   b. Remove edges from AEL whose y_max == y.
   c. Sort AEL by current x.
   d. Fill pixels between successive pairs of x: (x1,x2),(x3,x4),...
   e. For each edge in AEL, update x += 1/m  (incremental: x_{next}=x+inverse slope).

Edge Table (ET): a list bucketed by the smaller y (y_min) of each edge. Each entry stores: ymaxy_{max} of the edge, the xx at yminy_{min}, and the inverse slope 1/m=Δx/Δy1/m=\Delta x/\Delta y. Horizontal edges are excluded. The ET tells the algorithm when each edge becomes relevant.

Active Edge List (AEL): the set of edges that the current scan line actually intersects. As yy increases, edges are added from the ET (when y=yminy=y_{min}) and deleted (when y=ymaxy=y_{max}). The AEL is kept sorted by xx so that consecutive entries form fill spans.

Handling vertices (local minima / maxima)

A vertex shared by two edges can wrongly count as one or two intersections, breaking the parity rule. Convention:

  • At a vertex where the two edges go in the same y-direction (a local minimum or maximum, the edges form a 'spike'), count the vertex as two intersections.
  • At a vertex where the edges go in opposite y-directions (the polygon simply passes through), count it as one intersection.

In practice this is implemented by shortening one of the two edges by one scan line (decrement its ymaxy_{max} or adjust the endpoint) at a monotone vertex so that exactly one intersection is recorded; at a true extremum both edges are kept, yielding two. This guarantees correct odd–even spans.

scan-conversionpolygon-filling
9short6 marks

Describe the Sutherland-Hodgeman polygon clipping algorithm. Explain, with the help of a diagram, the four possible cases that arise when an edge is clipped against a single window boundary.

Sutherland–Hodgeman polygon clipping

This algorithm clips an arbitrary polygon against a convex clipping window by clipping the entire polygon successively against each window boundary, one at a time (e.g. left, then right, then bottom, then top). The output polygon (list of vertices) produced after clipping against one boundary becomes the input for the next boundary. This is the divide-and-conquer on edges approach.

For a single boundary, the polygon's vertices are processed as a sequence of edges (SE)(S \to E), where SS is the previous vertex and EE the current one. Each vertex is classified as inside or outside the boundary, giving four cases:

Four cases for an edge against one boundary

Let the boundary divide the plane into an inside half (window side) and outside half. For edge from start point SS to end point EE:

CaseSSEEOutput to result list
1InsideInsideoutput EE
2InsideOutsideoutput intersection point II (edge leaving)
3OutsideOutsideoutput nothing
4OutsideInsideoutput intersection II then EE (edge entering)

Diagram (described): imagine a vertical clip line, inside to its left.

  • Case 1: both SS and EE on the left → keep EE.
  • Case 2: SS on left, EE on right → the edge crosses the line; output only the crossing point II.
  • Case 3: both on the right → the edge is fully outside; output nothing.
  • Case 4: SS on right, EE on left → the edge re-enters; output the crossing point II first, then EE.

The intersection II is found by line–boundary intersection (parametric or slope form). After all four boundaries are processed, the accumulated vertex list is the clipped polygon. Limitation: for concave polygons it may produce spurious connecting edges, which require post-processing or the Weiler–Atherton algorithm.

clippingsutherland-hodgeman
10short6 marks

Differentiate between raster scan and random (vector) scan display systems. What is meant by aspect ratio and frame buffer of a raster display?

Raster scan vs Random (Vector) scan

FeatureRaster scanRandom (vector) scan
Drawing methodBeam sweeps the whole screen line by line (top to bottom), refreshing every pixelBeam is deflected directly between the endpoints of each line/figure (draws only the picture)
Picture stored asFrame buffer of pixel intensity valuesDisplay file (list of line-drawing commands)
Image qualityCan render filled areas, shading, realistic images; suffers from staircase/aliasing on slanted linesVery smooth, sharp lines; no aliasing
Suited forPhotographic/shaded images, modern displaysLine drawings, CAD wireframes
Resolution depends onNumber of pixels (frame-buffer size)Precision of the deflection electronics
Cost / complexityCheaper, dominant technologyMore expensive; poor for solid fills

Aspect ratio

The aspect ratio is the ratio of the screen's (or image's) horizontal extent to its vertical extent, aspect=widthheight\text{aspect} = \dfrac{\text{width}}{\text{height}} (e.g. 4:3, 16:9). Equivalently it can be stated as the ratio of vertical to horizontal points needed to draw equal-length lines; if pixels are not square, the aspect ratio must be accounted for so that circles do not appear as ellipses.

Frame buffer

The frame buffer (refresh buffer) is a dedicated block of memory that holds the intensity (and colour) value of every pixel of a raster display. The display controller scans the frame buffer in synchronism with the beam to refresh the screen. Its size is width×height×bits-per-pixel\text{width}\times\text{height}\times \text{bits-per-pixel}; the bits per pixel (bit depth) determine the number of representable colours/intensities (e.g. 8 bits → 256 levels).

output-primitivesdisplay-devices
11short6 marks

What is a B-spline curve? Explain how B-spline curves provide local control over the curve shape and state two advantages of B-spline curves over Bezier curves.

B-spline curve

A B-spline (Basis-spline) is a piecewise polynomial parametric curve defined by control points P0,,PnP_0,\dots,P_n and a set of basis functions Ni,k(u)N_{i,k}(u) of order kk (degree k1k-1):

P(u)=i=0nPiNi,k(u)P(u)=\sum_{i=0}^{n} P_i\,N_{i,k}(u)

The basis functions are built from a knot vector {u0,u1,}\{u_0,u_1,\dots\} via the Cox–de Boor recurrence. Crucially, the curve's degree (k1)(k-1) is independent of the number of control points, unlike a Bezier curve whose degree is fixed by the point count.

Local control

Each basis function Ni,k(u)N_{i,k}(u) is non-zero only over a limited span of kk knot intervals. Therefore each control point PiP_i influences only a small portion of the curve. Moving one control point alters only the segment(s) within that point's support, leaving the rest of the curve unchanged — this is local control. (A Bezier curve has global control: moving any point reshapes the whole curve.)

Two advantages of B-splines over Bezier curves

  1. Local control: editing one control point affects only a local region, not the entire curve.
  2. Degree independent of control-point count: you can add control points to refine the shape without raising the polynomial degree, keeping computation stable; B-splines also join segments with built-in continuity (Ck2C^{k-2}). (NURBS, a rational B-spline, can additionally represent exact conics such as circles.)
curves-surfacesb-spline
12short6 marks

Explain the depth-sorting (Painter's) algorithm for visible surface determination. Under what circumstances does the simple depth ordering fail, and how can such cases be resolved?

Depth-sorting (Painter's) algorithm

The Painter's algorithm is an object-space visible-surface method that draws polygons in order of decreasing depth — farthest first, nearest last — so that nearer surfaces paint over farther ones, just as a painter lays down background before foreground.

Steps:

1. Sort all polygons by their largest depth (z) value — farthest from viewer first.
2. Resolve any ambiguities/overlaps among polygons with overlapping z-extents.
3. Scan-convert (draw) the polygons in this back-to-front order into the frame buffer.

When simple depth ordering fails

Simply sorting by depth is not always sufficient. For two polygons P (front in the list) and Q, after the initial sort a series of overlap tests must hold; trouble arises when:

  • Their z-extents overlap and we cannot tell which is in front;
  • Polygons cyclically overlap (P is in front of Q, Q in front of R, R in front of P) — no valid ordering exists;
  • Polygons interpenetrate (pierce each other).

Resolution

For each pair whose depth ranges overlap, perform up to five tests in order; if any succeeds the order is fine:

  1. Their x-extents (bounding boxes) do not overlap.
  2. Their y-extents do not overlap.
  3. P is entirely on the far side of Q's plane.
  4. Q is entirely on the near side of P's plane.
  5. Their projections onto the view plane do not overlap.

If all tests fail, swap the two polygons and retry. For genuine cyclic overlap or interpenetration, split one polygon along the plane of the other so that the resulting pieces can be unambiguously ordered, then continue. (When robust handling of such cases is required, a Z-buffer is often preferred.)

hidden-surface-removalpainters-algorithm

Frequently asked questions

Where can I find the BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) question paper 2078?
The full BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) 2078 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Computer Graphics (IOE, CT 605 / ENCT 201) 2078 paper come with solutions?
Yes. Every question on this Computer Graphics (IOE, CT 605 / ENCT 201) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) 2078 paper?
The BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) 2078 paper carries 80 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Computer Graphics (IOE, CT 605 / ENCT 201) past paper free?
Yes — reading and attempting this Computer Graphics (IOE, CT 605 / ENCT 201) past paper on Kekkei is completely free.