Date of creation: 5.1.2014 - 6.1.2014
Platform: HTML5+JavaScript (IE9+, Firefox, Chrome, Safari)
Licence: Public Domain
Sources: Yes
Description: An example of a DDA-like algorithm to step through all grid cells that touch a ray and get the cell entry points. This algorithm is useful for many things, such as drawing 2D(/3D) lines or raycasting a 2D(/3D) volume. For example the classic Wolfenstein used a similar algorithm to raycast each vertical line. Also for 3D application voxel volumes/octres could be traversed by using this algorithm.

The example is 2D but to extend it to 3D, you’d need to add the Z-component and basically step the minimum of X, Y and Z on each step (instead of only X or Y as in the 2D case).

The code works under the processing.js framework.
Download: Link