fast-voxel-traversal-algorithm icon indicating copy to clipboard operation
fast-voxel-traversal-algorithm copied to clipboard

the way tMax is calculated covers only one quadrant of directions

Open elena-pascal opened this issue 2 years ago • 1 comments

I'm trying to understand the suggestion on how to compute tMax which is describes as below

// grid.minBound.x is the lower left corner of the grid.
// current_X_index is the current X index where the ray begins. If it starts outside, this is 1.
// ray_origin.x is the x-coordinate of where the ray originates.
// ray.direction.x is the x-direction of the ray’s travel path.
tMax = (grid.minBound.x + current_X_index - ray_origin.x) / ray.direction.x);

I think this implies that the direction of travel is always up right. If the travel direction is to the right then I believe it should be:

tMax = (grid.minBound.x + current_X_index - 1 + ray_origin.x) / ray.direction.x);

elena-pascal avatar May 23 '22 11:05 elena-pascal

If anyone else is interested in extending this to all direction quadrants, here is the solution I settled on.

elena-pascal avatar May 24 '22 12:05 elena-pascal