Graphics 3
Graphics 3
Graphics 3
Practical:-03
#include <stdio.h>
#include <graphics.h>
#include <math.h>
visualization
}
} int main() { int gd = DETECT, gm;
getch();
closegraph();
return 0; }
Output:-
#include <stdio.h>
#include <graphics.h>
#include <math.h>
#include <stdlib.h>
< x2) ? 1 : -1; int sy = (y1 < y2) ? 1 : -1; int err = dx - dy;
int e2 = 2 * err;
err -= dy; x1
+= sx; } if
{ err += dx;
y1 += sy;
}
delay(5); // Optional delay for visualization
}
} int main() { int gd =
DETECT, gm;
&y2);
return 0; }
Output:-
Aqsa,22DCS008
Practical:-03
Comparison of Results:
• DDA:
• Bresenham’s: