Original Post
Ok I have been pondering on this for 2 days now and cannot find a satisfying solution while I'm sure there must be one (for which im probably going to slap myself in the face for not seeing it).
The blue line is a limited line from coordinates A to B. These are floating point coordinates, hence the resolution is virtually infinite. The grid are integer cells (rows and columns), they are square and of fixed size. I want to know what cells are touched by the line. (as I indicated here by coloring the cells red) I can come up with several inefficient algorithms like, for example, running through all cells and see if they touch the line, but that is not acceptable. Does anyone know of a way to do this properly? Any tutorial describing it maybe? Any help would be much appreciated!
The blue line is a limited line from coordinates A to B. These are floating point coordinates, hence the resolution is virtually infinite. The grid are integer cells (rows and columns), they are square and of fixed size. I want to know what cells are touched by the line. (as I indicated here by coloring the cells red) I can come up with several inefficient algorithms like, for example, running through all cells and see if they touch the line, but that is not acceptable. Does anyone know of a way to do this properly? Any tutorial describing it maybe? Any help would be much appreciated!