BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) Question Paper 2079 Nepal
This is the official BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) question paper for 2079, as set in the regular annual examination. It carries 80 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Computer Graphics (IOE, CT 605 / ENCT 201) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) exam or solving previous years' question papers, this 2079 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt all / any as specified.
(a) Derive the decision parameter for Bresenham's line drawing algorithm for a line with slope , clearly stating the initial decision parameter and the incremental update rules. [8]
(b) Using Bresenham's line drawing algorithm, trace and tabulate all the intermediate pixel positions for a line segment from point A(2, 3) to point B(9, 8). [4]
(a) Derivation of Bresenham's decision parameter () [8]
Consider a line with slope where , and . Since the slope is less than 1, is the fast (driving) axis: at every step we increment by 1 and decide whether stays the same or increases by 1.
Suppose pixel has just been plotted. At the next column the true line is at . The two candidate pixels are the lower and the upper .
Let and be the vertical distances from the true line to these candidates:
The difference decides the closer pixel:
Substituting and multiplying by so the test stays integer, define the decision parameter:
where is constant. Because , the sign of equals the sign of :
- If → lower pixel is closer → choose .
- If → upper pixel is closer → choose .
Incremental update. Writing and :
- If (lower, unchanged):
- If (upper, increases):
Initial parameter. Starting at on the line (), substitution gives the simple integer start:
Only integer additions are used, which is why Bresenham's algorithm is fast.
(b) Trace from to [4]
Constants:
| Step | Action | Pixel | |
|---|---|---|---|
| start | — | plot start | |
| 0 | 3 () | , | → |
| 1 | -1 () | , | → |
| 2 | 9 () | , | → |
| 3 | 5 () | , | → |
| 4 | 1 () | , | → |
| 5 | -3 () | , | → |
| 6 | 7 () | , | → end |
Pixels plotted: — terminating correctly at .
(a) A triangle is defined by the vertices , and . Perform a rotation of counter-clockwise about the point and find the coordinates of the transformed vertices using homogeneous coordinate matrices. Show the composite transformation matrix. [8]
(b) Explain why homogeneous coordinates are used to represent 2D transformations, and show how translation can be expressed in matrix form using them. [4]
(a) Rotation of CCW about [8]
Rotation about an arbitrary point is a composite transformation: translate the pivot to the origin, rotate, then translate back:
With , :
Composite matrix:
(giving ). Applying to each vertex :
| Vertex | Result | ||
|---|---|---|---|
Transformed triangle: .
(b) Why homogeneous coordinates [4]
A point is represented as , i.e. a 2D point becomes a 3-component vector.
-
Reason: Rotation, scaling and shearing are linear and can be written as matrix multiplications, but translation is additive () and cannot be expressed as a multiplication. By adding a third coordinate, translation becomes a matrix multiplication, so all transformations are uniform matrices and can be composed by simple matrix multiplication.
-
Translation in matrix form:
(a) Distinguish between parallel projection and perspective projection. Derive the transformation matrix for a perspective projection of a 3D point onto the plane with the centre of projection at distance along the negative z-axis. [8]
(b) Write the homogeneous transformation matrix for scaling about an arbitrary fixed point in 3D. [4]
(a) Parallel vs Perspective projection + perspective matrix [8]
| Aspect | Parallel projection | Perspective projection |
|---|---|---|
| Projectors | Parallel to each other | Converge at the centre of projection (COP) |
| Object size | Preserved (no foreshortening) | Distant objects appear smaller (foreshortening) |
| Realism | Less realistic; used in CAD/engineering drawings | More realistic; matches human eye / camera |
| Parallel lines | Remain parallel | Converge to vanishing points |
| COP | At infinity | At a finite distance |
Derivation (projection onto , COP at on the negative z-axis).
Let a 3D point be . The projector is the line joining the COP to . We find where this line meets the plane . Parametrically a point on the line is
Set : . Then
In homogeneous coordinates this division by is captured by:
Dividing through by recovers , , . The non-zero entry in the bottom row is what produces perspective foreshortening; if that entry vanishes and the matrix degenerates to a parallel (orthographic) projection.
(b) Scaling about an arbitrary fixed point in 3D [4]
(a) Explain the Cohen–Sutherland line clipping algorithm using region (outcode) codes. With the help of the algorithm, clip the line segment from to against a rectangular clipping window with corners and . [8]
(b) State the limitation of the Sutherland–Hodgeman polygon clipping algorithm when clipping a concave polygon. [4]
(a) Cohen–Sutherland line clipping [8]
The plane is divided into 9 regions by extending the window edges; each region has a 4-bit outcode (Top, Bottom, Right, Left):
- bit 0 (Left): set if
- bit 1 (Right): set if
- bit 2 (Bottom): set if
- bit 3 (Top): set if
Algorithm: compute outcodes for both endpoints.
- If both codes are → trivially accept (line wholly inside).
- If logical AND of the codes → trivially reject (both on same outside side).
- Otherwise pick an endpoint that is outside, find its intersection with the corresponding window edge, replace the endpoint with the intersection, recompute its outcode, and repeat until accept or reject.
Intersections use: for a vertical edge , ; for a horizontal edge , .
Given: , , window –. Slope .
- Outcode(): → Left = 0001.
- Outcode(): → Top = 1000.
- AND → not trivially rejected; not both zero → clip.
Clip against left edge :
New , outcode (inside).
Clip against top edge :
New , outcode .
Both endpoints now inside → accept.
Clipped segment: from to .
(b) Limitation of Sutherland–Hodgeman with a concave polygon [4]
The Sutherland–Hodgeman algorithm clips the polygon successively against each window edge, treating the output as a single connected vertex list. For a concave polygon this can produce extraneous connecting edges: when the clipped result should split into two or more separate pieces, the algorithm instead joins them with a spurious line that runs along the window boundary, giving an incorrect filled region. The remedy is to split the concave polygon into convex pieces first, or to use the Weiler–Atherton algorithm, which handles concave polygons correctly.
Section B: Short Answer Questions
Attempt all / any as specified.
Explain the midpoint circle drawing algorithm, deriving its decision parameter. Using the eight-way symmetry property, list the pixel positions generated in the first octant for a circle of radius centred at the origin.
Midpoint Circle Drawing Algorithm [6]
For a circle of radius centred at the origin the implicit function is
which is inside, on, and outside the circle. The algorithm works in the second octant (from to the line), where is the driving axis. After plotting we test the midpoint between the two candidate pixels and :
- If → midpoint inside → choose ( unchanged).
- If → midpoint outside → choose ( decreases).
Incremental updates:
- if :
- if :
Initial value at : .
Eight-way symmetry: each computed gives 8 pixels: and , so only one octant need be computed.
Trace for (first octant, )
| Decision | Next | ||
|---|---|---|---|
| → E | |||
| → E | |||
| → SE | |||
| → E | |||
| → SE | |||
| → SE | |||
| — | → stop | — |
First-octant pixels: (computation stops when ).
Define a Bézier curve. Write the blending (Bernstein basis) function for a cubic Bézier curve, and list any three important properties of Bézier curves.
Bézier Curve [6]
Definition. A Bézier curve of degree is a parametric curve defined by control points as a weighted blend of those points using Bernstein basis polynomials, for :
Cubic Bézier () blending functions:
so that
Three important properties:
- Endpoint interpolation – the curve passes exactly through the first and last control points: , .
- Convex-hull property – the curve lies entirely within the convex hull of its control points (since the Bernstein basis is non-negative and sums to 1).
- Tangency at endpoints – the curve is tangent to at the start and to at the end, which makes smooth joining of segments easy. (Also: affine invariance and no local control.)
Describe the Z-buffer (depth-buffer) algorithm for hidden surface removal. State its main advantages and disadvantages compared to a scan-line method.
Z-Buffer (Depth-Buffer) Algorithm [6]
The Z-buffer is an image-space hidden-surface removal method using two buffers of the same resolution as the frame buffer:
- Frame (colour) buffer – stores the colour of each pixel.
- Depth (Z) buffer – stores the (depth) of the nearest surface seen so far at each pixel.
Algorithm:
Initialise depth-buffer[x][y] = z_max (far) for all pixels
Initialise frame-buffer[x][y] = background colour
for each polygon:
for each pixel (x,y) it covers:
compute depth z of the polygon at (x,y) // by interpolation
if z < depth-buffer[x][y]: // nearer than stored
depth-buffer[x][y] = z
frame-buffer[x][y] = surface colour at (x,y)
The depth across a polygon is found incrementally: moving one pixel in (where is the plane), so no per-pixel division is needed.
Advantages (vs scan-line):
- Very simple to implement; handles any number of polygons in arbitrary order (no presorting).
- Easily implemented in hardware → standard in GPUs.
- Time is roughly linear in the number of polygons.
Disadvantages (vs scan-line):
- Requires large extra memory for the depth buffer.
- Finite depth precision causes z-fighting (aliasing of close/coplanar surfaces).
- Wastes work rendering pixels later overwritten; does not handle transparency or anti-aliasing directly, whereas the scan-line method processes one scan line at a time using much less memory.
Explain the Phong illumination model, clearly describing the ambient, diffuse and specular components and the role of each term in the lighting equation.
Phong Illumination Model [6]
The Phong model computes the reflected intensity at a surface point as the sum of three components — ambient + diffuse + specular:
where = surface normal, = direction to light, = mirror-reflection direction of about , = direction to viewer (all unit vectors), and are ambient and source intensities.
1. Ambient term (). Models the uniform background light scattered many times in the scene. It is constant and independent of light/viewer direction, ensuring that surfaces facing away from the light are not completely black. is the ambient reflection coefficient.
2. Diffuse term (). Models Lambertian (matte) reflection scattered equally in all directions. Its brightness depends only on the angle between and (i.e. ), being maximum when the light hits head-on and zero when grazing. It is view-independent; is the diffuse coefficient (surface colour). If the term is clamped to 0.
3. Specular term (). Models the shiny highlight of glossy surfaces. It is strongest when the viewer looks along the reflection direction () and falls off with the shininess exponent — large gives a small, sharp highlight; small a broad, dull one. It is view-dependent; is the specular coefficient.
For multiple lights the diffuse and specular contributions are summed over all sources.
Differentiate between Gouraud shading and Phong shading. State which technique correctly renders specular highlights and explain why.
Gouraud vs Phong Shading [6]
| Aspect | Gouraud shading | Phong shading |
|---|---|---|
| What is interpolated | Vertex colours (intensities) across the polygon | Vertex normals, then lighting computed per pixel |
| Where lighting is evaluated | Only at the vertices | At every interior pixel |
| Cost | Cheaper / faster | More expensive (per-pixel normalisation + lighting) |
| Smoothness | Removes Mach-band intensity discontinuities reasonably | Smoother, more accurate shading |
| Specular highlights | Often rendered incorrectly | Rendered correctly |
Procedure (Gouraud): compute a normal at each vertex (average of adjacent face normals), apply the illumination model to get a colour at each vertex, then bilinearly interpolate those colours along edges and scan lines.
Procedure (Phong): interpolate the normal vectors across the polygon (re-normalising each), and apply the full illumination model at each pixel.
Which renders specular highlights correctly → Phong shading.
Why: A specular highlight is a small, sharply varying bright spot. In Gouraud shading the highlight is sampled only at the vertices; if the highlight falls in the interior of a polygon (between vertices), the vertex intensities are low and linear colour interpolation simply averages them, so the highlight is missed or smeared. Phong shading interpolates the normals and recomputes the term per pixel, so the peak of the highlight is captured wherever it occurs on the surface.
Explain boundary-fill and flood-fill area-filling algorithms. Distinguish between 4-connected and 8-connected approaches with the help of suitable diagrams.
Boundary-Fill and Flood-Fill [6]
Both are seed-fill algorithms: starting from an interior seed pixel they recursively spread the fill colour to neighbouring pixels.
Boundary-fill. Used when the region is defined by a specific boundary colour. Starting at a seed inside the region, set it to the fill colour and recurse to neighbours, stopping when a pixel is the boundary colour or already filled.
boundaryFill(x, y, fillColour, boundaryColour):
c = getPixel(x, y)
if c != boundaryColour and c != fillColour:
setPixel(x, y, fillColour)
// 4-connected neighbours
boundaryFill(x+1, y, ...); boundaryFill(x-1, y, ...)
boundaryFill(x, y+1, ...); boundaryFill(x, y-1, ...)
Flood-fill. Used when a region is defined by a single interior colour (no defined boundary). It replaces all connected pixels having the old interior colour with the new colour, stopping when a pixel no longer matches the old colour.
floodFill(x, y, oldColour, newColour):
if getPixel(x, y) == oldColour:
setPixel(x, y, newColour)
floodFill on the 4 (or 8) neighbours
4-connected vs 8-connected:
- 4-connected: recurse to the 4 edge neighbours only — right, left, up, down. Simpler, but it cannot pass through regions connected only diagonally, so thin diagonal gaps in a boundary leave parts unfilled.
- 8-connected: recurse to all 8 neighbours — the 4 edge plus 4 diagonal (corner) pixels. It fills more completely and handles diagonally connected regions, but a single-pixel diagonal boundary may leak the fill outside the intended area.
Diagrams (described):
4-connected: 8-connected:
N NW N NE
W P E W P E
S SW S SE
The centre pixel reaches only N/S/E/W in the 4-connected case, and additionally the four diagonal corners in the 8-connected case.
(a) Describe the Sutherland–Hodgeman polygon clipping algorithm and the four possible vertex-edge cases it handles. [4]
(b) Briefly explain the strategies used for text clipping. [2]
(a) Sutherland–Hodgeman polygon clipping [4]
The polygon is clipped against the four window edges one at a time (left, right, bottom, top); the output vertex list from one edge becomes the input to the next. For each edge, each polygon edge is examined and 0, 1 or 2 vertices are output according to four cases (in = inside the clip edge, out = outside):
| Case | Output | ||
|---|---|---|---|
| 1 | in | in | output |
| 2 | in | out | output intersection point only |
| 3 | out | in | output intersection point, then |
| 4 | out | out | output nothing |
After all four edges are processed, the remaining vertex list is the clipped polygon. (It works correctly for convex polygons; concave ones may need splitting.)
(b) Text clipping strategies [2]
- All-or-none string clipping: the whole string is kept only if its entire bounding box lies inside the window; otherwise the whole string is discarded.
- All-or-none character clipping: each character is kept or rejected as a unit based on whether its bounding box is fully inside.
- Character (component) clipping: individual characters are clipped at the boundary — outline (stroke) text is clipped like line/curve primitives, and bitmap text is clipped pixel by pixel, so partially visible characters appear cut off at the window edge.
What is meant by local control of a curve? Compare B-spline curves with Bézier curves with respect to local control and continuity.
Local Control of a Curve [6]
Local control means that moving (or editing) a single control point changes only a limited, nearby portion of the curve, leaving the rest of the curve unchanged. The opposite is global control, where every control point influences the entire curve.
B-spline vs Bézier
| Property | Bézier curve | B-spline curve |
|---|---|---|
| Local control | No – each blending function is non-zero over all , so moving any control point alters the whole curve. | Yes – each B-spline basis function is non-zero only over a limited span (degree covers knot intervals), so moving a control point affects only that local region. |
| Degree vs #control points | Degree is fixed by the number of control points ( points → degree ); more points ⇒ higher degree. | Degree is independent of the number of control points, so many points can be used at low (e.g. cubic) degree. |
| Continuity | A single segment is ; joining segments requires manually matching positions/tangents to get . | A degree- B-spline (with simple knots) is automatically continuous across its segments (e.g. a cubic B-spline is ). |
| Convex hull | Lies within the convex hull of all control points. | Lies within the union of convex hulls of local groups of control points (tighter). |
Summary: Bézier curves are simple and interpolate their endpoints but lack local control and give only manual continuity; B-spline curves provide local control and built-in higher-order continuity, making them better for complex, editable curves and surfaces.
Frequently asked questions
- Where can I find the BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) question paper 2079?
- The full BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) 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 (IOE, CT 605 / ENCT 201) 2079 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) 2079 paper?
- The BE Computer Engineering (IOE, TU) Computer Graphics (IOE, CT 605 / ENCT 201) 2079 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.