Semester
Subject
Year
Tribhuwan University
2079
Bachelor Level / Third Year / Fifth Semester / Science
(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.
Long Answers Questions
| Feature | DDA Algorithm | Bresenham's Algorithm |
|---|---|---|
| Computation | Uses floating-point arithmetic | Uses only integer arithmetic |
| Speed | Slower due to floating-point operations | Faster due to integer operations only |
| Rounding | Requires rounding off at each step | No rounding needed |
| Accuracy | Less accurate due to rounding errors | More accurate |
| Operations | Uses multiplication and division | Uses only addition and subtraction |
| Decision Parameter | No decision parameter used | Uses a decision parameter ($p_k$) |
| Efficiency | Less efficient | More efficient |
| Cost | More expensive in computation | Less expensive |
| Complexity | Simpler to implement | Slightly more complex logic |
| Hardware | Difficult to implement in hardware | Easy to implement in hardware |
Given: and
Step A: Calculate parameters
Since , the slope is steep (|m| > 1). We drive the algorithm along the y-axis (y is incremented each step).
Here, y decreases (from 6 to 1), so y steps by -1 each iteration. We need to decide whether x increments or stays same at each step.
Step B: Reformulate for steep line (driving along y-axis)
Initial decision parameter:
Decision rule (driving along y-axis):
Where (since y is decreasing)
Constants:
Step C: Iteration Table
| Step | Condition | Point | Next | |
|---|---|---|---|---|
| 0 | -1 | (10, 6) | ||
| 1 | 3 | (11, 5) | ||
| 2 | -3 | (11, 4) | ||
| 3 | 1 | (12, 3) | ||
| 4 | -5 | (12, 2) | ||
| 5 | — | — | (12, 1) | — |
Step D: Final Plotted Points
The pixels plotted are:
Bresenham's algorithm is superior to DDA as it avoids floating-point arithmetic entirely, making it faster and more suitable for hardware implementation. The algorithm efficiently determines the closest pixel positions using only integer addition and a simple decision parameter.
Short Answers Questions