You'll have to translate to whatever the proper syntax for the coding you use. Its a start and possibly buggy.

This shouldn't care what order the points are given in or which direction the slope is.

glenn

start point = (x1,y1)
end point = (x2,y2)

xdir=(x1-x2)/abs(x1-x2)
ydir=(y1-y2)/abs(y1-y2)

rise=abs(y1-y2)
run=abs(x1-x2)
slope=rise/run
count=0

if run>=rise
do until count=x2
check pixel at (x1,y1)
count=count+xdir
x1=x1+xdir
y1=int(y1+slope*count) < buggy
end
else
do until count=y2
check pixel at (x1,y1)
count=count+xdir
y1=y1+ydir
x1=int(x1+(1/slope)*count) <buggy
end
endif

edit: yep it's buggy but its bed time. There is always tommorrow


Edited by gbeer (16/06/2003 23:19)
_________________________
Glenn