Hi, I'm looking for some ideas for an algorithm that, very broadly, enumerates the 3D cells through which a ray passes (the cells must be in order).
I have the starting position and direction of the ray in 3D co-ordinates. The direction will be given as the X-, Y-, and Z-rotation of the ray, so (for example) I may need to use the tan() function from <cmath> to convert the rotation into a gradient. I don't know.
For clarity, by 'cell' I mean a 3D version of a spreadsheet cell. These cells are cubes, though, unlike the elongated oblongs in a spreadsheet.
The idea behind this is to display a voxel model on the screen - it's just ray casting with voxels instead of triangles. Since the above algorithm would need to run once for every pixel on the screen, I would prefer a speedy algorithm to an elegant one. All thoughts appreciated.
Thanks for your time!
PS. In case you were wondering, this is NOT a piece of coursework, or homework, or any other work; nor is it for a competition. It's just a personal project of mine.