Get the latest tech news

The DDA Algorithm, explained interactively


I've written a number of voxel raytracers, and all of them (all the good ones, at least) use the Digital Differential Analyzer Algorithm for raycasting. I've only ever "implemented" this algorithm once, by copying a reference somewhere.

I've written a number of voxel raytracers, and all of them (all the good ones, at least) use the Digital Differential Analyzer Algorithm for raycasting. If you've spent some time recently with geometry or a graphing calculator, you might already have figured out that this is actually a line intersection problem. If we imagine the yellow line above as the diagonal of a right triangle, we can calculate its length using its legs, drawn below as pink and blue.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of DDA Algorithm

DDA Algorithm