Look at the following diagram depicting a parametric line $O +\vec vt$:
The goal is simple. Visit every square (squares numbered 0,1,2,3...) exactly and no more than once in the order they are numbered. And each time you move through the line you want to move the origin to the intersection of the dot with the line (*marked with the dots in my diagram).
However, the above is a simplification. The full problem also involves:
The grid is 3D (so we check intersections with planes, not lines). The side of a cube in this grid can be any real number, not necessarily 1.
The cubes are not "centered" at the origin. So the origin of the grid could be different than the origin of the reference frame, and it not be aligned with the distances of the grid at all (i.e the side length may be 0.4 and the origin could be placed at ($\pi$, $\pi$, $\pi$))
The general idea is simple enough. Check intersections with the 3 planes that you can potentially hit, based on the 3 orthogonal components of the direction vector
Check the intersection of the parametric line with each of the 3 planes and project your current point to the intersection to move it.
This sounds easy, except that generating the planes is turning to be a challenge. Given an arbitrary point $P$ determining the 6 planes on the current grid that contain it is being harder than expected and I wanted to know if people had ideas on how to either do this in a different way, or calculate the planes.