Rank: 2475 based on 46 downloads (last 30 days) and 1 file submitted
photo

Narupon Chattrapiban

E-mail
Company/University
University of Maryland

Personal Profile:

 

Watch this Author's files

 

Files Posted by Narupon Chattrapiban
Updated   File Tags Downloads
(last 30 days)
Comments Rating
08 Nov 2006 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban bresenham, line profile, image 46 8
  • 4.25
4.2 | 9 ratings
Comments and Ratings on Narupon Chattrapiban's Files View all
Updated File Comment by Comments Rating
06 Nov 2013 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban JK Hwang

Hi, I think that your code is very helpful. However, I found a minor bug in the code.
----------
if bitshift(error,1) >= delx, % same as -> if 2*error >= delx,
y_n = y_n + ystep;
error = error - delx;
end

----------
In case of a coordinate of first point is (2,3) and second point is (3,11), it does not work and print out error message. I think this error caused by 'bitshift' function. I changed the function to '2*error', then the problem is solved.

28 Feb 2013 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban Raz Shimoni

I have been using this function for some time now, and saw that other Bresenham's Line functions were more recently uploaded to MFE. I haven't compared performances yet, still this works great.

17 May 2010 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban Fernando Gonzalez

12 Apr 2010 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban Christian

Hi! Nice Code!

However, i think there is a little bug:

the code that i downloaded says:

----------
if steep,
myline(n) = mymat(x_n,y_n);
outmat(x_n,y_n) = 0;
X(n) = x_n;
Y(n) = y_n;
else
myline(n) = mymat(y_n,x_n);
outmat(y_n,x_n) = 0;
X(n) = y_n;
Y(n) = x_n;
end
-------

...this does not work for me, i think the code within the if and else statements should be swapped:

---------
if steep,
myline(n) = mymat(y_n,x_n);
outmat(y_n,x_n) = 0;
X(n) = y_n;
Y(n) = x_n;
else
myline(n) = mymat(x_n,y_n);
outmat(x_n,y_n) = 0;
X(n) = x_n;
Y(n) = y_n;
end
-------

Best,
Christian

12 Apr 2010 Bresenham's Line Generate a line profile of a 2d image Author: Narupon Chattrapiban Christian

Contact us