Line drawing

On a grid map, line drawing is useful for for visibility, the path of an arrow/bullet, and enemy AI. There are several fast algorithms for this but I prefer using a very simple algorithm. Here's the algorithm in action:

Let's look at linear interpolation, or lerp, for numbers:

lerp(  0,   1, ) = 
lerp(  0, 100, ) = 
lerp(  3,   5, ) = 
lerp(  5,   3, ) = 

Let's look at linear interpolation for points. We can separately linearly interpolate the x and y values, and it behaves as we might expect: