BRESENHAM’s LINE DRAWING ALGORITHM


BRESENHAM’s LINE DRAWING ALGORITHM

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void linebrel(int,int,int,int);
void main()
{
int gd=DETECT ,gm,xa,xb,ya,yb;
clrscr();
initgraph(&gd,&gm,"c:/tc/bgi");
printf("Enter the starting points of the line:");
scanf("%d%d",&xa,&ya);
printf("Enter the ending points of the line:");
scanf("%d%d",&xb,&yb);
linebrel(xa,ya,xb,yb);
getch();
}
void linebrel(int xa,int ya,int xb,int yb)
{
int dx=abs(xa-xb),dy=abs(ya-yb);
int p=2*dy-dx;
int twody=2*dy,twodydx=2*(dy-dx);
int x,y,xend;
if(xa>xb)
{
x=xb;
y=yb;
xend=xa;
}
else
{
x=xa;
y=ya;
xend=xb;
}
putpixel(x,y,6);
while(x<xend)
{
x++;
if(p<0)
p+=twody;
else
{
y++;
p+twodydx;
}
putpixel(x,y,6);
}
}




Previous
Next Post »

1 comments:

Click here for comments
Anonymous
admin
30 March 2022 at 04:55 ×

Bresenham’S Line Drawing Algorithm ~ Atoz >>>>> Download Now

>>>>> Download Full

Bresenham’S Line Drawing Algorithm ~ Atoz >>>>> Download LINK

>>>>> Download Now

Bresenham’S Line Drawing Algorithm ~ Atoz >>>>> Download Full

>>>>> Download LINK

Congrats bro Anonymous you got PERTAMAX...! hehehehe...
Reply
avatar