#include<graphics.h>
#include<iostream.h>
#include<dos.h>
#include<math.h>
#include<conio.h>
void main()
{
int gd=DETECT,gm;
int x1,x2,y1,y2;
int i,flag,d;
clrscr();
cout<<"Enter value of (x1,y1)= ";
cin>>x1>>y1;
cout<<"Enter value of (x2,y2)= ";
cin>>x2>>y2;
initgraph(&gd,&gm,"c:\\tc\\bgi");
int dx,dy;
dx=abs(x2-x1);
dy=abs(y2-y1);
int x,y,t,s1,s2;
x=x1;
y=y1;
if((x2-x1)>0)
s1=1;
else
s1=-1;
if((y2-y1)>0)
s2=1;
else
s2=-1;

if(dy>dx)
{
t=dx;
dx=dy;
dy=t;
flag=1;
}
else
flag=0;
d=2*dy-dx;
outtextxy(x1,y1,"(x1,y1)");
outtextxy(x2,y2,"(x2,y2)");
i=1;
a:
putpixel(x,y,3);
delay(40);
while(d>=0)
{
if (flag==1)
x=x+s1;
else
y=y+s2;
d=d-2*dx;
}
if (flag==1)
y=y+s2;
else
x=x+s1;
d=d+2*dy;
i++;
if(i<=dx)
goto a;
getch();

closegraph();
}

Home      |      About Us      |     Portfolio      |      Services      |      Courses      |     Career      |      Cost      |      Contact Us
Services
  SEO   
  Link Building
  Data Entry
  Web Design and development
  Web Application development
 

Graphic and multimedia

  E-Commerce Solutions
  Software development
  Web Marketing & Promoting
  Internet Marketing
  IT Outsourcing
  Multimedia/CD Presentation
  Synopsis Ideas
  Project Ideas
  Placement Papers
  Live Project Training
  Programming & Projects
  Faq
  Training @balujalabs
 
 
Method
 

Write a program to draw a line using Bresonhams line drawing algorithm?

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Write a program to draw a line using DDA line algorithm?
2 Write a program to draw a line using Bresonhams line drawing algorithm?
3 Write a program to draw a circle using Bresenham circle drawing algorithm?
4 Write a program to draw a circle using Midpoint circle drawing algorithm.
5 Write a program to draw a ellipse using Midpoint circle drawing algorithm.
6 Write a program to Implement Translation?
7 Write a program to Implement Rotation?
8 Write a program to Implement Shearing?
9 Write a program to Implement CotenSuther Land clipping algorithm? .
10 Write a program to implement polygon clipping?