Browse papers
A

Section A: Long Answer Questions

Attempt all / any as specified.

4 questions
1long14 marks

(a) Derive the decision parameters for Bresenham's line drawing algorithm for a line with slope 0<m<10 < m < 1, clearly stating the initial decision parameter and the incremental updates. (8)

(b) Using the Bresenham line algorithm, digitize the line from (20,10)(20, 10) to (30,18)(30, 18) and tabulate the pixel positions plotted. (6)

(a) Decision parameters for Bresenham's line algorithm (0<m<10 < m < 1)

For a line with slope 0<m<10 < m < 1, xx is the driving axis: xx is incremented by 1 at each step and we decide whether yy stays the same or increases by 1.

Let the line be y=mx+cy = mx + c where m=ΔyΔx=y2y1x2x1m = \dfrac{\Delta y}{\Delta x} = \dfrac{y_2 - y_1}{x_2 - x_1}.

Suppose pixel (xk,yk)(x_k, y_k) has just been plotted. The next pixel is either E(xk+1,yk)E(x_k+1, y_k) or NE(xk+1,yk+1)NE(x_k+1, y_k+1). At x=xk+1x = x_k + 1 the true line ordinate is

y=m(xk+1)+cy = m(x_k + 1) + c

Define the distances of the two candidate pixels from the true line:

dlower=yyk,dupper=(yk+1)yd_{lower} = y - y_k, \qquad d_{upper} = (y_k + 1) - y

The decision parameter is taken proportional to dlowerdupperd_{lower} - d_{upper} (multiplied by Δx\Delta x to keep it integer):

pk=Δx(dlowerdupper)=2Δyxk2Δxyk+cp_k = \Delta x\,(d_{lower} - d_{upper}) = 2\,\Delta y\cdot x_k - 2\,\Delta x\cdot y_k + c'

Decision rule:

  • If pk<0p_k < 0 → true line is closer to the lower pixel → plot EE, yk+1=yky_{k+1} = y_k.
  • If pk0p_k \geq 0 → plot NENE, yk+1=yk+1y_{k+1} = y_k + 1.

Incremental updates (subtract successive parameters):

pk+1pk=2Δy2Δx(yk+1yk)p_{k+1} - p_k = 2\,\Delta y - 2\,\Delta x\,(y_{k+1} - y_k) pk+1=pk+2Δyif pk<0\boxed{p_{k+1} = p_k + 2\,\Delta y \quad \text{if } p_k < 0} pk+1=pk+2Δy2Δxif pk0\boxed{p_{k+1} = p_k + 2\,\Delta y - 2\,\Delta x \quad \text{if } p_k \geq 0}

Initial decision parameter (at the start pixel (x1,y1)(x_1,y_1), with cc eliminated):

p0=2ΔyΔx\boxed{p_0 = 2\,\Delta y - \Delta x}

The algorithm uses only integer additions, which is its main advantage.

(b) Digitizing the line from (20,10)(20,10) to (30,18)(30,18)

Here Δx=3020=10\Delta x = 30-20 = 10, Δy=1810=8\Delta y = 18-10 = 8, slope m=0.8m = 0.8 (so 0<m<10<m<1, xx is the driving axis).

  • 2Δy=162\,\Delta y = 16
  • 2Δy2Δx=1620=42\,\Delta y - 2\,\Delta x = 16 - 20 = -4
  • Initial: p0=2ΔyΔx=1610=6p_0 = 2\,\Delta y - \Delta x = 16 - 10 = 6

Starting pixel (20,10)(20,10):

kkpkp_kplot (xk+1,yk+1)(x_{k+1}, y_{k+1})
06(21, 11)
12(22, 12)
2-2(23, 12)
314(24, 13)
410(25, 14)
56(26, 15)
62(27, 16)
7-2(28, 16)
814(29, 17)
910(30, 18)

Plotted pixels: (20,10),(21,11),(22,12),(23,12),(24,13),(25,14),(26,15),(27,16),(28,16),(29,17),(30,18)(20,10),(21,11),(22,12),(23,12),(24,13),(25,14),(26,15),(27,16),(28,16),(29,17),(30,18), ending exactly at the endpoint (30,18)(30,18).

line-algorithmscircle-algorithmsgraphics-primitives
2long12 marks

(a) Explain why homogeneous coordinates are used to represent two-dimensional transformations, and write the matrix representations for translation, rotation and scaling. (6)

(b) A triangle is defined by the vertices A(2,2)A(2,2), B(6,2)B(6,2) and C(4,6)C(4,6). Obtain the composite transformation matrix to rotate the triangle by 9090^\circ counter-clockwise about the vertex AA, and compute the coordinates of the transformed triangle. (6)

(a) Why homogeneous coordinates?

In 2D, scaling and rotation about the origin are linear operations expressible as a 2×22\times2 matrix multiplication, but translation is an addition (x=x+tx)(x'=x+t_x), not a matrix product. This makes it impossible to combine all transformations uniformly.

Homogeneous coordinates represent a 2D point (x,y)(x,y) as a triple (x,y,1)(x, y, 1) (more generally (xh,yh,h)(x_h, y_h, h) with x=xh/hx = x_h/h). This lets translation also be written as a 3×33\times3 matrix multiplication, so any sequence of translations, rotations and scalings can be composed into a single 3×33\times3 matrix by multiplication — efficient and uniform.

Matrix representations (homogeneous form):

Translation by (tx,ty)(t_x, t_y):

T=[10tx01ty001]T = \begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix}

Rotation by angle θ\theta (CCW) about origin:

R(θ)=[cosθsinθ0sinθcosθ0001]R(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix}

Scaling by (sx,sy)(s_x, s_y) about origin:

S=[sx000sy0001]S = \begin{bmatrix} s_x & 0 & 0 \\ 0 & s_y & 0 \\ 0 & 0 & 1 \end{bmatrix}

(b) Rotate triangle by 9090^\circ CCW about vertex A(2,2)A(2,2)

Rotation about an arbitrary point AA = translate AA to origin → rotate → translate back:

M=T(2,2)R(90)T(2,2)M = T(2,2)\cdot R(90^\circ)\cdot T(-2,-2)

For θ=90\theta = 90^\circ: cos90=0, sin90=1\cos90^\circ = 0,\ \sin90^\circ = 1, so

R(90)=[010100001]R(90^\circ) = \begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}

Composite matrix:

M=[102012001][010100001][102012001]=[014100001]M = \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 2 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} 1 & 0 & -2 \\ 0 & 1 & -2 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 0 & -1 & 4 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}

The general formula is x=(y2)+2=4y,  y=(x2)+2=xx' = -(y-2)+2 = 4-y,\ \ y' = (x-2)+2 = x.

Transformed vertices:

  • A(2,2)(42,2)=(2,2)A(2,2)\to(4-2,\,2) = (2,2) (fixed, as expected)
  • B(6,2)(42,6)=(2,6)B(6,2)\to(4-2,\,6) = (2,6)
  • C(4,6)(46,4)=(2,4)C(4,6)\to(4-6,\,4) = (-2,4)

Result: A(2,2), B(2,6), C(2,4)A'(2,2),\ B'(2,6),\ C'(-2,4).

2d-transformationscomposite-transformations
3long14 marks

(a) Distinguish between parallel projection and perspective projection, and classify parallel projections with the help of suitable diagrams. (6)

(b) Derive the transformation matrix for an oblique parallel projection onto the xyxy-plane, and show how the cavalier and cabinet projections are obtained as special cases of it. (8)

(a) Parallel vs. Perspective projection

FeatureParallel projectionPerspective projection
ProjectorsParallel to each otherConverge to a centre of projection (eye)
Centre of projectionAt infinityAt a finite distance
Size of objectPreserved (no foreshortening with distance)Distant objects appear smaller (foreshortening)
RealismLess realistic; good for engineering/CADMore realistic; matches human vision
Parallel linesRemain parallelConverge to vanishing points

Classification of parallel projections:

Parallel projection
├── Orthographic (projectors perpendicular to view plane)
│     ├── Multiview (front, top, side)
│     └── Axonometric (isometric, dimetric, trimetric)
└── Oblique (projectors at an angle to view plane)
      ├── Cavalier
      └── Cabinet

Diagram (described): In orthographic the projectors strike the xyxy view plane at 9090^\circ; in oblique the projectors meet the plane at an angle α\alpha, so zz-edges are drawn at an angle ϕ\phi with some scaling.

(b) Oblique parallel projection matrix onto xyxy-plane

A point (x,y,z)(x, y, z) is projected along a direction that makes an angle α\alpha with the view plane. A zz-line of length LL projects onto the plane with length LcotαL\cot\alpha at an angle ϕ\phi to the xx-axis. Let L1=cotαL_1 = \cot\alpha (the projected length of a unit zz-segment). Then the projected coordinates are

xp=x+zL1cosϕ,yp=y+zL1sinϕx_p = x + z\,L_1\cos\phi, \qquad y_p = y + z\,L_1\sin\phi

Oblique projection matrix (onto z=0z=0 plane):

Mobl=[10L1cosϕ001L1sinϕ000000001]M_{obl} = \begin{bmatrix} 1 & 0 & L_1\cos\phi & 0 \\ 0 & 1 & L_1\sin\phi & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

Special cases:

  • Cavalier projection: α=45L1=cot45=1\alpha = 45^\circ \Rightarrow L_1 = \cot 45^\circ = 1. Depth (zz) lines are drawn at full scale (no foreshortening). Typically ϕ=30\phi = 30^\circ or 4545^\circ.
  • Cabinet projection: tanα=2L1=cotα=12\tan\alpha = 2 \Rightarrow L_1 = \cot\alpha = \tfrac{1}{2}. Depth lines are drawn at half scale, giving a more realistic look. Typically ϕ=30\phi = 30^\circ or 4545^\circ.

Thus both are obtained from MoblM_{obl} by choosing L1=1L_1 = 1 (cavalier) or L1=12L_1 = \tfrac12 (cabinet).

3d-transformationsprojection
4long12 marks

(a) State the Cohen-Sutherland line clipping algorithm and explain the significance of the 4-bit region (out) codes. (6)

(b) Given a clipping window with corners (xmin,ymin)=(10,10)(x_{min}, y_{min}) = (10,10) and (xmax,ymax)=(40,40)(x_{max}, y_{max}) = (40,40), clip the line segment from P1(5,5)P_1(5,5) to P2(45,35)P_2(45,35) using the Cohen-Sutherland algorithm. Show the region codes and the computed intersection points. (6)

(a) Cohen-Sutherland line clipping algorithm

The algorithm clips a line against a rectangular window by assigning each endpoint a 4-bit region (out) code. The plane is divided into 9 regions by extending the window edges.

Bit assignment (bit = 1 if the point is outside that edge):

  • Bit 1 (MSB): Topy>ymaxy > y_{max}
  • Bit 2: Bottomy<yminy < y_{min}
  • Bit 3: Rightx>xmaxx > x_{max}
  • Bit 4 (LSB): Leftx<xminx < x_{min}

Window (inside) region has code 0000.

Steps:

  1. Compute outcodes c1,c2c_1, c_2 for the two endpoints.
  2. If c1 OR c2=0000c_1\ \text{OR}\ c_2 = 0000 → line is completely inside → accept (trivial accept).
  3. If c1 AND c20000c_1\ \text{AND}\ c_2 \neq 0000 → both endpoints lie outside the same edge → line is completely outside → reject (trivial reject).
  4. Otherwise the line is partially inside: pick an endpoint with a non-zero code, find its intersection with the corresponding window edge, replace that endpoint with the intersection point, recompute its code, and repeat from step 2.

Significance of the 4-bit codes: the OR test gives a fast trivial-accept, the AND test gives a fast trivial-reject, and each set bit directly indicates which window edge the line must be clipped against — avoiding expensive intersection computations for most lines.

(b) Clip P1(5,5)P2(45,35)P_1(5,5)\to P_2(45,35), window (10,10)(10,10)(40,40)(40,40)

Line slope: m=355455=3040=0.75m = \dfrac{35-5}{45-5} = \dfrac{30}{40} = 0.75.

Outcodes:

  • P1(5,5)P_1(5,5): x<10x<10 (left=1), y<10y<10 (bottom=1) → 0101
  • P2(45,35)P_2(45,35): x>40x>40 (right=1) → 0010

AND =0101 & 0010=0000= 0101\ \&\ 0010 = 0000 → not trivially rejected; clipping needed.

Clip P1P_1 (code 0101):

  • Against left x=10x=10: y=5+0.75(105)=5+3.75=8.75y = 5 + 0.75(10-5) = 5 + 3.75 = 8.75. Point (10,8.75)(10, 8.75) — but y=8.75<10y=8.75 < 10, still below window. New code 0100.
  • Against bottom y=10y=10: x=5+(105)/0.75=5+6.667=11.67x = 5 + (10-5)/0.75 = 5 + 6.667 = 11.67. Point (11.67,10)(11.67, 10), code 0000 (inside). So clipped start (11.67,10)\approx (11.67, 10).

Clip P2P_2 (code 0010):

  • Against right x=40x=40: y=5+0.75(405)=5+26.25=31.25y = 5 + 0.75(40-5) = 5 + 26.25 = 31.25. Point (40,31.25)(40, 31.25), code 0000 (inside). Clipped end =(40,31.25)= (40, 31.25).

Result: the visible clipped segment runs from (11.67,10)(11.67,\,10) to (40,31.25)(40,\,31.25).

clipping
B

Section B: Short Answer Questions

Attempt all / any as specified.

8 questions
5short6 marks

Compare raster scan and random (vector) scan display systems with respect to working principle, image quality, memory requirement and suitability. Define resolution, aspect ratio and frame buffer.

Raster scan vs. Random (vector) scan

AspectRaster scanRandom (vector) scan
Working principleElectron beam sweeps the whole screen row by row (left-right, top-bottom), refreshing all pixels from a frame bufferBeam is deflected directly to draw only the line segments of the picture (point-to-point), like a pen plotter
Image qualityCan show realistic, shaded, filled images; lines may show staircase (aliasing)Very smooth, high-resolution lines; cannot easily do shading/filled areas
Memory requirementLarge frame buffer storing intensity of every pixelSmall; stores a display (line) list, not per-pixel data
SuitabilityPhotographs, games, shaded images, GUIsLine drawings, CAD, engineering blueprints

Definitions:

  • Resolution: the maximum number of distinguishable points (pixels) per unit area, usually given as (horizontal × vertical) pixel count, e.g. 1920×10801920\times1080. Higher resolution → finer detail.
  • Aspect ratio: the ratio of the width to the height of the display (or of a pixel), e.g. 4:34{:}3 or 16:916{:}9. It is the ratio of horizontal to vertical points needed to produce equal-length lines.
  • Frame buffer (refresh buffer): a dedicated block of memory that holds the intensity/color value of every pixel of the image; the display controller reads it to refresh the screen. Its size = (resolution) × (bits per pixel).
graphics-primitivesdisplay-devices
6short6 marks

Explain the midpoint circle drawing algorithm and the use of the eight-way symmetry of a circle. Using it, determine the pixel positions for the first octant of a circle of radius r=8r = 8 centred at the origin.

Midpoint Circle Drawing Algorithm

For a circle x2+y2=r2x^2 + y^2 = r^2 centred at the origin, the decision function is f(x,y)=x2+y2r2f(x,y) = x^2 + y^2 - r^2 (f<0f<0 inside, f>0f>0 outside). The algorithm plots the second octant (xx from 00, yy from rr, slope between 0 and -1) and uses symmetry for the rest.

At pixel (xk,yk)(x_k, y_k) the next pixel is E(xk+1,yk)E(x_k+1, y_k) or SE(xk+1,yk1)SE(x_k+1, y_k-1). The decision parameter is ff at the midpoint (xk+1,yk12)(x_k+1, y_k-\tfrac12):

pk=(xk+1)2+(yk12)2r2p_k = (x_k+1)^2 + \left(y_k-\tfrac12\right)^2 - r^2
  • If pk<0p_k < 0 → midpoint inside → choose EE: pk+1=pk+2xk+1+1p_{k+1} = p_k + 2x_{k+1} + 1
  • If pk0p_k \geq 0 → choose SESE: pk+1=pk+2xk+1+12yk+1p_{k+1} = p_k + 2x_{k+1} + 1 - 2y_{k+1}

Initial value: p0=54r1rp_0 = \tfrac{5}{4} - r \approx 1 - r.

Eight-way symmetry: a circle is symmetric about both axes and the two diagonals, so computing one octant (x,y)(x,y) gives 8 pixels: (±x,±y)(\pm x,\pm y) and (±y,±x)(\pm y,\pm x). This means only 1/81/8 of the circle need be computed.

Pixels for first octant, r=8r = 8

p0=18=7p_0 = 1 - 8 = -7. Start (0,8)(0, 8).

pkp_k(xk+1,yk+1)(x_{k+1}, y_{k+1})
-7(1, 8)
-4(2, 8)
1(3, 7)
-6(4, 7)
3(5, 6)
-2(6, 6)

Stop when xyx \geq y (here at (6,6)(6,6), where x=yx=y).

Octant pixels: (0,8),(1,8),(2,8),(3,7),(4,7),(5,6),(6,6)(0,8),(1,8),(2,8),(3,7),(4,7),(5,6),(6,6).

circle-algorithms
7short6 marks

Define a Bezier curve. Write the parametric equation of a cubic Bezier curve in terms of its Bernstein blending functions and four control points, and list the important properties of Bezier curves.

Bezier Curve

A Bezier curve is a parametric curve defined by a set of (n+1)(n+1) control points P0,P1,,PnP_0, P_1, \dots, P_n. The curve is a weighted blend of these points using Bernstein polynomials as blending functions; it passes through the first and last control points and is pulled toward the intermediate ones.

Bernstein blending function:

Bi,n(t)=(ni)ti(1t)ni,0t1B_{i,n}(t) = \binom{n}{i}\, t^{i}\,(1-t)^{n-i}, \qquad 0 \le t \le 1

General Bezier curve: P(t)=i=0nPiBi,n(t)P(t) = \displaystyle\sum_{i=0}^{n} P_i\, B_{i,n}(t).

Cubic Bezier curve (n=3n=3, four control points P0,P1,P2,P3P_0,P_1,P_2,P_3):

P(t)=(1t)3P0+3t(1t)2P1+3t2(1t)P2+t3P3,0t1P(t) = (1-t)^3 P_0 + 3t(1-t)^2 P_1 + 3t^2(1-t) P_2 + t^3 P_3,\quad 0\le t\le 1

Important properties:

  1. Endpoint interpolation: P(0)=P0P(0)=P_0 and P(1)=PnP(1)=P_n; the curve passes through the first and last control points only.
  2. Convex hull property: the curve lies entirely within the convex hull of its control points (since Bi,n(t)=1\sum B_{i,n}(t)=1 and each Bi,n0B_{i,n}\ge0).
  3. Tangency: the curve is tangent to P1P0P_1-P_0 at the start and to PnPn1P_n-P_{n-1} at the end.
  4. Affine invariance: transforming the control points transforms the curve.
  5. Global control: moving any control point changes the whole curve shape.
  6. Degree = (number of control points − 1).
curves-and-surfaces
8short6 marks

Differentiate between object-space and image-space methods of hidden surface removal. Explain the Z-buffer (depth-buffer) algorithm and state one advantage and one disadvantage of it.

Object-space vs. Image-space hidden surface removal

Object-space methodsImage-space methods
Work in the world/object coordinate system, comparing objects (polygons) with each otherWork at the pixel/screen level, deciding visibility for each pixel
Accuracy independent of display resolution (geometric precision)Accuracy limited to display resolution
Cost grows roughly as O(n2)O(n^2) with number of objects nnCost depends on resolution and number of objects
Example: back-face detection, BSP-tree, depth sorting (painter's)Example: Z-buffer, scan-line, area-subdivision, ray casting

Z-buffer (depth-buffer) algorithm

Uses two buffers: a frame buffer (color of each pixel) and a Z-buffer (depth of the closest surface so far at each pixel).

Initialize: depth(x,y) = z_max (far),  color(x,y) = background
For each polygon:
  For each pixel (x,y) it covers:
    compute depth z at (x,y)
    if z < depth(x,y):        // nearer to viewer
        depth(x,y) = z
        color(x,y) = surface color at (x,y)

After all polygons are processed, the frame buffer holds the visible surfaces.

Advantage: simple to implement, no presorting of polygons needed, and it handles any number of objects of arbitrary shape (intersecting/penetrating surfaces) easily — it is hardware-friendly.

Disadvantage: requires a large amount of extra memory for the depth buffer, and it processes (and overwrites) hidden pixels too, doing redundant work; precision/aliasing issues with limited depth resolution.

hidden-surface-removal
9short6 marks

Compare Gouraud shading and Phong shading in terms of the quantity interpolated, computational cost and quality of the rendered surface (in particular the appearance of specular highlights).

Gouraud vs. Phong shading

AspectGouraud shadingPhong shading
Quantity interpolatedVertex colors (intensities) are computed using the lighting model at each vertex, then the intensity is linearly interpolated across the polygonSurface normals are interpolated across the polygon, and the lighting model is evaluated per pixel
Computational costLower — lighting evaluated only at vertices; cheap intensity interpolationHigher — normal interpolation plus a full lighting calculation at every pixel
QualitySmooths color discontinuities but misses specular highlights that fall inside a polygon; highlights look distorted or are lost; can show Mach-band effectsProduces accurate, well-shaped specular highlights anywhere on the surface; much smoother, more realistic surfaces
Specular highlightsPoorly rendered (only captured if they happen to land at a vertex)Correctly rendered, even in the polygon interior

Summary: Gouraud interpolates color (fast, lower quality), Phong interpolates normals and lights per pixel (slower, higher quality, especially for shiny/specular surfaces).

shading-and-rendering
10short6 marks

Explain the Sutherland-Hodgeman polygon clipping algorithm with a neat diagram. What is the major limitation of this algorithm when clipping concave polygons?

Sutherland-Hodgeman Polygon Clipping

This algorithm clips a polygon against a convex clip window by clipping it successively against each window edge, one at a time (left, right, bottom, top). The output vertex list from clipping against one edge becomes the input for the next edge.

Procedure (for one clip edge): traverse the polygon edges (each defined by current vertex SS → next vertex PP) and apply four cases relative to the clip boundary:

Case (SPS\to P)Output
Both insideoutput PP
SS inside, PP outsideoutput intersection point II
Both outsideoutput nothing
SS outside, PP insideoutput intersection II, then PP

Diagram (described): the original polygon is overlaid on the rectangular window; after clipping against the left edge, vertices outside the left edge are replaced by intersection points on that edge; repeating for right, bottom and top edges yields the final clipped polygon lying inside the window.

Major limitation: for concave polygons the algorithm can produce extraneous connecting lines — the clipped result may include spurious edges that join separate visible portions of the polygon (because the output is kept as a single vertex list). The polygon should be split into convex pieces, or a more general algorithm (e.g. Weiler-Atherton) must be used.

clipping2d-transformations
11short6 marks

Write the homogeneous transformation matrices for 3D rotation about the xx, yy and zz axes. Obtain the matrix that reflects a 3D object about the plane z=0z = 0.

3D rotation matrices (homogeneous, CCW, right-handed)

About the xx-axis (by angle θ\theta):

Rx(θ)=[10000cosθsinθ00sinθcosθ00001]R_x(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos\theta & -\sin\theta & 0 \\ 0 & \sin\theta & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

About the yy-axis:

Ry(θ)=[cosθ0sinθ00100sinθ0cosθ00001]R_y(\theta) = \begin{bmatrix} \cos\theta & 0 & \sin\theta & 0 \\ 0 & 1 & 0 & 0 \\ -\sin\theta & 0 & \cos\theta & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

About the zz-axis:

Rz(θ)=[cosθsinθ00sinθcosθ0000100001]R_z(\theta) = \begin{bmatrix} \cos\theta & -\sin\theta & 0 & 0 \\ \sin\theta & \cos\theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

Reflection about the plane z=0z = 0 (the xyxy-plane)

Reflection about z=0z=0 negates the zz-coordinate while leaving xx and yy unchanged (x=x, y=y, z=zx'=x,\ y'=y,\ z'=-z):

Mz=0=[1000010000100001]M_{z=0} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}
3d-transformations
12short6 marks

Write short notes on any two of the following:

(a) Anti-aliasing techniques (b) Boundary-fill vs. flood-fill algorithms (c) Color models (RGB and CMY)

(Answer any two.)

(a) Anti-aliasing techniques

Aliasing is the staircase (jagged) appearance of lines/edges and loss of fine detail caused by sampling a continuous image onto a discrete pixel grid. Anti-aliasing reduces it:

  • Super-sampling (post-filtering): render at higher resolution and average down (e.g. compute several sub-pixel samples per pixel and take their mean).
  • Area sampling (pre-filtering): set each pixel's intensity proportional to the fraction of its area covered by the primitive.
  • Pixel-weighting / filtering: weight sub-pixel samples by a filter (e.g. cone or Gaussian) so nearer-to-centre samples count more. The effect is smoother edges by using intermediate intensity (gray) levels along boundaries.

(b) Boundary-fill vs. Flood-fill

Both fill a connected region starting from a seed pixel, recursively spreading to 4-connected or 8-connected neighbours.

Boundary-fillFlood-fill
Fills until a specified boundary color is reachedFills all pixels having the same interior (old) color, replacing it with a new color
Used when the region is bounded by a single known border colorUsed when the region has no single boundary color but a uniform interior color
Stops at boundary colorStops when a pixel is not the old color
boundaryFill(x,y, fillColor, borderColor):
  c = getPixel(x,y)
  if c != borderColor and c != fillColor:
     setPixel(x,y,fillColor)
     // recurse on 4/8 neighbours

(c) Color models (RGB and CMY)

  • RGB (additive): uses primaries Red, Green, Blue; colors are formed by adding light. (0,0,0)(0,0,0) = black, (1,1,1)(1,1,1) = white. Used by emissive devices — monitors, cameras, scanners.
  • CMY (subtractive): uses Cyan, Magenta, Yellow (complements of RGB); colors formed by subtracting (absorbing) light from white. (0,0,0)(0,0,0) = white (paper), (1,1,1)(1,1,1) = black. Used by printers/hard-copy.
  • Relationship: [CMY]=[111][RGB]\begin{bmatrix}C\\M\\Y\end{bmatrix} = \begin{bmatrix}1\\1\\1\end{bmatrix} - \begin{bmatrix}R\\G\\B\end{bmatrix}. (In practice CMYK adds a black ink K for richer blacks.)
shading-and-renderinggraphics-primitives

Frequently asked questions

Where can I find the BE Computer Engineering (Pokhara University) Computer Graphics (PU, CMP 234) question paper 2079?
The full BE Computer Engineering (Pokhara University) Computer Graphics (PU, CMP 234) 2079 (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 (PU, CMP 234) 2079 paper come with solutions?
Yes. Every question on this Computer Graphics (PU, CMP 234) 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 (Pokhara University) Computer Graphics (PU, CMP 234) 2079 paper?
The BE Computer Engineering (Pokhara University) Computer Graphics (PU, CMP 234) 2079 paper carries 100 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Computer Graphics (PU, CMP 234) past paper free?
Yes — reading and attempting this Computer Graphics (PU, CMP 234) past paper on Kekkei is completely free.