BE Computer Engineering (Pokhara University) Computer Graphics (PU, CMP 234) Question Paper 2079 Nepal
This is the official BE Computer Engineering (Pokhara University) Computer Graphics (PU, CMP 234) question paper for 2079, as set in the regular annual examination. It carries 100 full marks and a time allowance of 180 minutes, across 12 questions. On Kekkei you can attempt this Computer Graphics (PU, CMP 234) 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 (Pokhara University) Computer Graphics (PU, CMP 234) 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 parameters for Bresenham's line drawing algorithm for a line with slope , clearly stating the initial decision parameter and the incremental updates. (8)
(b) Using the Bresenham line algorithm, digitize the line from to and tabulate the pixel positions plotted. (6)
(a) Decision parameters for Bresenham's line algorithm ()
For a line with slope , is the driving axis: is incremented by 1 at each step and we decide whether stays the same or increases by 1.
Let the line be where .
Suppose pixel has just been plotted. The next pixel is either or . At the true line ordinate is
Define the distances of the two candidate pixels from the true line:
The decision parameter is taken proportional to (multiplied by to keep it integer):
Decision rule:
- If → true line is closer to the lower pixel → plot , .
- If → plot , .
Incremental updates (subtract successive parameters):
Initial decision parameter (at the start pixel , with eliminated):
The algorithm uses only integer additions, which is its main advantage.
(b) Digitizing the line from to
Here , , slope (so , is the driving axis).
- Initial:
Starting pixel :
| plot | ||
|---|---|---|
| 0 | 6 | (21, 11) |
| 1 | 2 | (22, 12) |
| 2 | -2 | (23, 12) |
| 3 | 14 | (24, 13) |
| 4 | 10 | (25, 14) |
| 5 | 6 | (26, 15) |
| 6 | 2 | (27, 16) |
| 7 | -2 | (28, 16) |
| 8 | 14 | (29, 17) |
| 9 | 10 | (30, 18) |
Plotted pixels: , ending exactly at the endpoint .
(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 , and . Obtain the composite transformation matrix to rotate the triangle by counter-clockwise about the vertex , 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 matrix multiplication, but translation is an addition , not a matrix product. This makes it impossible to combine all transformations uniformly.
Homogeneous coordinates represent a 2D point as a triple (more generally with ). This lets translation also be written as a matrix multiplication, so any sequence of translations, rotations and scalings can be composed into a single matrix by multiplication — efficient and uniform.
Matrix representations (homogeneous form):
Translation by :
Rotation by angle (CCW) about origin:
Scaling by about origin:
(b) Rotate triangle by CCW about vertex
Rotation about an arbitrary point = translate to origin → rotate → translate back:
For : , so
Composite matrix:
The general formula is .
Transformed vertices:
- (fixed, as expected)
Result: .
(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 -plane, and show how the cavalier and cabinet projections are obtained as special cases of it. (8)
(a) Parallel vs. Perspective projection
| Feature | Parallel projection | Perspective projection |
|---|---|---|
| Projectors | Parallel to each other | Converge to a centre of projection (eye) |
| Centre of projection | At infinity | At a finite distance |
| Size of object | Preserved (no foreshortening with distance) | Distant objects appear smaller (foreshortening) |
| Realism | Less realistic; good for engineering/CAD | More realistic; matches human vision |
| Parallel lines | Remain parallel | Converge 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 view plane at ; in oblique the projectors meet the plane at an angle , so -edges are drawn at an angle with some scaling.
(b) Oblique parallel projection matrix onto -plane
A point is projected along a direction that makes an angle with the view plane. A -line of length projects onto the plane with length at an angle to the -axis. Let (the projected length of a unit -segment). Then the projected coordinates are
Oblique projection matrix (onto plane):
Special cases:
- Cavalier projection: . Depth () lines are drawn at full scale (no foreshortening). Typically or .
- Cabinet projection: . Depth lines are drawn at half scale, giving a more realistic look. Typically or .
Thus both are obtained from by choosing (cavalier) or (cabinet).
(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 and , clip the line segment from to 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): Top —
- Bit 2: Bottom —
- Bit 3: Right —
- Bit 4 (LSB): Left —
Window (inside) region has code 0000.
Steps:
- Compute outcodes for the two endpoints.
- If → line is completely inside → accept (trivial accept).
- If → both endpoints lie outside the same edge → line is completely outside → reject (trivial reject).
- 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 , window –
Line slope: .
Outcodes:
- : (left=1), (bottom=1) →
0101 - : (right=1) →
0010
AND → not trivially rejected; clipping needed.
Clip (code 0101):
- Against left : . Point — but , still below window. New code
0100. - Against bottom : . Point , code
0000(inside). So clipped start .
Clip (code 0010):
- Against right : . Point , code
0000(inside). Clipped end .
Result: the visible clipped segment runs from to .
Section B: Short Answer Questions
Attempt all / any as specified.
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
| Aspect | Raster scan | Random (vector) scan |
|---|---|---|
| Working principle | Electron beam sweeps the whole screen row by row (left-right, top-bottom), refreshing all pixels from a frame buffer | Beam is deflected directly to draw only the line segments of the picture (point-to-point), like a pen plotter |
| Image quality | Can show realistic, shaded, filled images; lines may show staircase (aliasing) | Very smooth, high-resolution lines; cannot easily do shading/filled areas |
| Memory requirement | Large frame buffer storing intensity of every pixel | Small; stores a display (line) list, not per-pixel data |
| Suitability | Photographs, games, shaded images, GUIs | Line 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. . Higher resolution → finer detail.
- Aspect ratio: the ratio of the width to the height of the display (or of a pixel), e.g. or . 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).
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 centred at the origin.
Midpoint Circle Drawing Algorithm
For a circle centred at the origin, the decision function is ( inside, outside). The algorithm plots the second octant ( from , from , slope between 0 and -1) and uses symmetry for the rest.
At pixel the next pixel is or . The decision parameter is at the midpoint :
- If → midpoint inside → choose :
- If → choose :
Initial value: .
Eight-way symmetry: a circle is symmetric about both axes and the two diagonals, so computing one octant gives 8 pixels: and . This means only of the circle need be computed.
Pixels for first octant,
. Start .
| -7 | (1, 8) |
| -4 | (2, 8) |
| 1 | (3, 7) |
| -6 | (4, 7) |
| 3 | (5, 6) |
| -2 | (6, 6) |
Stop when (here at , where ).
Octant pixels: .
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 control points . 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:
General Bezier curve: .
Cubic Bezier curve (, four control points ):
Important properties:
- Endpoint interpolation: and ; the curve passes through the first and last control points only.
- Convex hull property: the curve lies entirely within the convex hull of its control points (since and each ).
- Tangency: the curve is tangent to at the start and to at the end.
- Affine invariance: transforming the control points transforms the curve.
- Global control: moving any control point changes the whole curve shape.
- Degree = (number of control points − 1).
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 methods | Image-space methods |
|---|---|
| Work in the world/object coordinate system, comparing objects (polygons) with each other | Work 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 with number of objects | Cost 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.
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
| Aspect | Gouraud shading | Phong shading |
|---|---|---|
| Quantity interpolated | Vertex colors (intensities) are computed using the lighting model at each vertex, then the intensity is linearly interpolated across the polygon | Surface normals are interpolated across the polygon, and the lighting model is evaluated per pixel |
| Computational cost | Lower — lighting evaluated only at vertices; cheap intensity interpolation | Higher — normal interpolation plus a full lighting calculation at every pixel |
| Quality | Smooths color discontinuities but misses specular highlights that fall inside a polygon; highlights look distorted or are lost; can show Mach-band effects | Produces accurate, well-shaped specular highlights anywhere on the surface; much smoother, more realistic surfaces |
| Specular highlights | Poorly 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).
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 → next vertex ) and apply four cases relative to the clip boundary:
| Case () | Output |
|---|---|
| Both inside | output |
| inside, outside | output intersection point |
| Both outside | output nothing |
| outside, inside | output intersection , then |
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.
Write the homogeneous transformation matrices for 3D rotation about the , and axes. Obtain the matrix that reflects a 3D object about the plane .
3D rotation matrices (homogeneous, CCW, right-handed)
About the -axis (by angle ):
About the -axis:
About the -axis:
Reflection about the plane (the -plane)
Reflection about negates the -coordinate while leaving and unchanged ():
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-fill | Flood-fill |
|---|---|
| Fills until a specified boundary color is reached | Fills 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 color | Used when the region has no single boundary color but a uniform interior color |
| Stops at boundary color | Stops 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. = black, = 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. = white (paper), = black. Used by printers/hard-copy.
- Relationship: . (In practice CMYK adds a black ink K for richer blacks.)
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.