I recently implemented the Amanatides & Woo algorithm for voxel ray casts. I wrote a small visualization to help me understand how it works. The horizontal green line shows the nearest boundary for the lines of Y and the red line shows the nearest boundary for X. The green cube is where the white vector would eventually intersect the green line. Same for the red cube and red line. The intuition behind the algorithm is that you always move in the direction of the nearest cube, so if the green cube were closer than the red cube with the green line above, then we'd increase +Y. If the red cube were closer and the red line to the right, then we'd increase +X.