The given problem is to find a way to efficiently return all boxes hit by a ray.
So I came up with an idea but I want to know your opinion before I waste time in programming something not working.
Basically, the idea is to have a grid of boxes with height = width, all of these boxes are the same size and they don't have a gap between each other, I also have a function to calculate the box index which belongs to a point.(in which box the point is)
Now I calculate a box around the grid and calculate the hit points of a ray with the edges. So I know the intersection points and of course the direction of the rays, now I take the direction, normalize it and divide it by 2. ( I'm not really sure if I need /2 but I feel better with it) The resulting vector is now my "step size". (I call this vector v) So if I take now my first intersection point add v, calculate the box which belongs to the resulting point and does this again and again until I reach my second intersection point I shouldn't miss any box. (right?)
But I'm not sure about that so I ask for your opinion.