I have a line-of-sight problem I need to solve by visiting all possible cells in a 3D voxel space between two (non-grid-aligned) points.
I have considered using a 3D
Here is a public link to a recent port of my voxel ray from C++ into javascript:
https://github.com/jeremykentbgross/EmpathicCivGameEngine/blob/master/engine/public/scripts/Ray2D.js
Note: the port is currently in 2D on a quadtree (instead of 3D on an octtree), but only because one dimension is commented out for my 2D javascript engine. It works fine in my 3D C++ engine (where I ported it from) so if you uncomment the Z axis lines it will work. The file also has a lot of inline comments on how the math works.
You should also reference the RayTracer2D.js (in the same directory) which uses the ray to find all intersected objects and their intersection points in the order they are hit.
For reference the quad tree structure it is tracing through is also in the same folder: QuadTree.js
Note that you could also ray trace lower LOD's simply by limiting how deep you traverse into the tree during the trace.
Hope that helps.