cg dda algo
cg dda algo
Aim: Implement and compare the performance of Simple DDA, Symmetrical DDA, and
Bresenham’s algorithm for positive and negative line slope.
Algorithm:
Calculate Differences:
• dx = x2 - x1
• dy = y2 - y1
the increments:
• x = x1
• y = y1
Code:
#include<iostream.h>
#include<dos.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{ clrscr();
getch();
closegraph();
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Output:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Learning Outcomes:
1. Line Drawing Concepts: Understand the working of DDA and Bresenham's algorithms for
line drawing.
2. Performance Comparison: Analyze and compare the efficiency of Simple DDA,
Symmetrical DDA, and Bresenham’s algorithms.
3. Error Handling: Learn how error terms are managed in graphics algorithms to minimize
visual imperfections.
4. Optimization: Explore the efficiency of integer-based algorithms (like Bresenham's) vs.
floating-point methods (like DDA).
5. Coding and Debugging: Improve coding and debugging skills through algorithm
implementation and testing.