Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

the way tMax is calculated covers only one quadrant of directions #7

Open
elena-pascal opened this issue May 23, 2022 · 1 comment
Open

Comments

@elena-pascal
Copy link

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
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant