0

I have a voxel raytracer that outputs an XYZ coordinate normalized to the 0-2 area. Whichever coordinate is 0 or 2 is the face that was hit, and the other two are the texture coordinate. The problem arises when I want to rotate the cube faces.

These are only ever 90 degree turns about the 3 orthogonal axis, so this is more of a texture/coordinate shuffling than a traditional rotation, and there are only 24 possible rotations to choose from so I could just create some lookup table and just label every rotation with some arbitrary quantifier and grab the coordinates to use + the face to draw for a given face, but this is arduous to create, and slow.

Does there exist a simpler method/more readable than an arbitrary lookup table, or at least a good qualifier?

Logos King
  • 121
  • 1
  • 6
  • sound similar to what I did in bullet #3 in [Quaternion rotation does not work as excepted](https://stackoverflow.com/a/39024016/2521214) so you simply rotate using standard rotation formulas/matrices and then identify which axis is which with few dot products – Spektre Sep 16 '22 at 11:09
  • its not persay a rotation of the cube. the cube never moves. it's only the textures on the cube that move, while the touching edges are preserved – Logos King Sep 17 '22 at 13:02

0 Answers0