├── BRESENH.C └── README.md /BRESENH.C: -------------------------------------------------------------------------------- 1 | // Author : youtube channel-dotnetmob 2 | // Date : 01-May-2015 3 | // Description : program for drawing line using bresenham's line algorithm 4 | 5 | #include 6 | #include 7 | 8 | void main() 9 | { 10 | int i,gd=DETECT,gm,x1,y1,x2,y2,dx,dy,pk; 11 | do 12 | { 13 | initgraph(&gd,&gm,"C:\\TurboC3\\bgi"); 14 | 15 | printf("Enter start coordinate : "); 16 | scanf("%d%d",&x1,&y1); 17 | printf("Enter end coordinate : "); 18 | scanf("%d%d",&x2,&y2); 19 | 20 | clrscr(); 21 | cleardevice(); 22 | 23 | dx=x2-x1; 24 | dy=y2-y1; 25 | pk=2*dy-dx; 26 | 27 | do 28 | { 29 | putpixel(x1,y1,GREEN); 30 | if(pk<0) 31 | pk+=2*dy; 32 | else 33 | { 34 | ++y1; 35 | pk+=2*(dy-dx); 36 | } 37 | ++x1; 38 | }while(x1<=x2); 39 | 40 | printf("press 'y' for try again..."); 41 | }while(getch()=='y'); 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Drawing-Line-using-Bresenham-s-Algorithm 2 | Drawing Line using Bresenham's Algorithm 3 | 4 | 5 | ## How it works ? 6 | 7 | :tv: Video tutorial on this same topic 8 | Url : https://youtu.be/_Ic2k-lWbec 9 | 10 | Demo for Bresenham's Circle Program in C 13 | 14 | 15 | | :bar_chart: | List of Tutorials | | :moneybag: | Support Us | 16 | |--------------------------:|:---------------------|---|---------------------:|:-------------------------------------| 17 | | Angular |http://bit.ly/2KQN9xF | |Paypal | https://goo.gl/bPcyXW | 18 | | Asp.Net Core |http://bit.ly/30fPDMg | |Amazon Affiliate | https://geni.us/JDzpE | 19 | | React |http://bit.ly/325temF | | 20 | | Python |http://bit.ly/2ws4utg | | :point_right: | Follow Us | 21 | | Node.js |https://goo.gl/viJcFs | |Website |http://www.codaffection.com | 22 | | Asp.Net MVC |https://goo.gl/gvjUJ7 | |YouTube |https://www.youtube.com/codaffection | 23 | | Flutter |https://bit.ly/3ggmmJz| |Facebook |https://www.facebook.com/codaffection | 24 | | Web API |https://goo.gl/itVayJ | |Twitter |https://twitter.com/CodAffection | 25 | | MEAN Stack |https://goo.gl/YJPPAH | | 26 | | C# Tutorial |https://goo.gl/s1zJxo | | 27 | | Asp.Net WebForm |https://goo.gl/GXC2aJ | | 28 | | C# WinForm |https://goo.gl/vHS9Hd | | 29 | | MS SQL |https://goo.gl/MLYS9e | | 30 | | Crystal Report |https://goo.gl/5Vou7t | | 31 | | CG Exercises in C Program |https://goo.gl/qEWJCs | | 32 | --------------------------------------------------------------------------------