C++ language is used in this packet DDA line algorithm is used in this code. Turbro C++ is the compiler used
#include #include #include #include void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); setcolor(BLUE); for(int i=0;i<11;i++) { rectangle(250+i,250+i,270-i,350-i); rectangle(280+i,240-i,380-i,220+i); rectangle(140+i,220+i,240-i,240-i); rectangle(250+i,210-i,270-i,110+i); } for(i=0;i<16;i++) { line(245+i,250-i,275-i,250-i); line(280-i,245-i,280-i,215+i); line(240+i,215+i,240+i,245-i); line(245+i,210+i,275-i,210+i); } getch(); }
DDA stands for Digital Differential Analyzer. It is an incremental method of scan conversion of the line. In this method calculation is performed at each step but by using results of previous steps.
Submitted by Siddhant prabhakar (siddhant142)
Download packets of source code on Coders Packet
Comments