0

I was wondering if anyone knows of a command that will (or a clean way to) retrieve an array of the pixel coordinates of a line in-between two points?

So for example: I have matrix 1, with points at (3,3) and (10,9). I want to get the coordinates of the starred pixels in matrix 2.

      matrix 1                 matrix 2
1 1 1 1 1 1 1 1 1 1 1    1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1    1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1 1    1 1 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1    1 1 1 * * 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1    1 1 1 1 1 * * 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1    1 1 1 1 1 1 1 * * 1 1
1 1 1 1 1 1 1 1 1 0 1    1 1 1 1 1 1 1 1 1 0 1
1 1 1 1 1 1 1 1 1 1 1    1 1 1 1 1 1 1 1 1 1 1
FireSky
  • 181
  • 4
  • 17
  • Look up [Bresenham's algorithm](http://en.wikipedia.org/wiki/Bresenham's_line_algorithm) and then visit the [Matlab File Exchange](http://www.mathworks.com/matlabcentral/fileexchange/?search_submit=fileexchange&query=Bresenham&term=Bresenham) for various implementations. – horchler Jul 26 '13 at 19:25
  • I was hoping for something cleaner then Bresenham's algorithm. I'm just baffled there is not a command for this. – FireSky Jul 26 '13 at 19:29

0 Answers0