bresenham edit page

Bresenham line algorithm

Syntax

[x,y] = bresenham(x1,y1,x2,y2)

Input

(x1,y1) start position
(x2,y2) end position

Output

x, y the integer line coordinates from (x1,y1) to (x2,y2)

Example

[x,y] = bresenham(1,1, 10,-5);
plot(x,y,'or'); axis equal