I have chosen a stack based traversal algorithm (Recursive Ray Traversal Algorithm), and I am having a little trouble understanding it.
Here is what I understand.
I need to find a point where the ray enters the voxel (then calculate the distance ray origin and that point) where it exits (then calculate the distance between ray origin and that point), distance between ray origin and plane (in some papers I saw the formula:
(splitPoint - rayOrigin[currentAxle]) / rayOrientation[currentAxle]
My ray orientation is (0, 0, -1)
and then in some cases I will be dividing with zero (because x = 0
and y = 0
). How can this be?
And in the init of the algorithm, the ray origin is in the main voxel, how do I get the distance where the ray enters the voxel?
Do I understand this correctly? Can someone explain?