Home Products Download Order Contacts

comp.graphics.algorithms

Subject: My Bresenham like line plotting algorithm



Hi,
I just made a bresenham like line plotting algorothm I would like to
share. It is different from bresenham but has the same
assumptions.(x2>x1,y2>y1,x2-x1>=y2-y1)

following is the algorithm in c:

void LineM(int x1,int y1,int x2,int y2)


{
int x,y,d,dx,dy;
y=y1;
dy=y2-y1;
dx=x2-x1;
for(x=x1,d=0;x<=x2;x++,d+=dy)


{
if ((d<<1)>=dx)
putpixel(x,y+1);
else
putpixel(x,y);

if (d>=dx)


{
y++;
d-=dx;
}//if d>=dx
}//for
}//lineM


Reply


View All Messages in comp.graphics.algorithms

path:


Replies:
Re: My Bresenham like line plotting algorithm

Copyright 2006 WatermarkFactory.com. All Rights Reserved.