Im trying to abstract a 3D point system using binary to speed things up.
Lets say I have an arbitrary 3D “volume”, say, 8x8x8 units. this volume is defined by a 512-bit binary number (1-dimensional line in essence).
How could I select a 0 or 1 within that number given a 3D position? Im wondering if there is a simple set of binary operations to do something like this, because Ive seen similar implementations, but no description of how they actually work.
Like, lets say this volume is defined left to right (0-7 on the x axis), then forward to back (0-7 on the y axis) and then bottom to top (0-7 on the z axis), making up an 8×8 cube.
Is there some way in binary / bitwise math to count along the x > y > z axis and separate out a binary value from the array given a 3D point?
Realistically, I could just convert this binary number to a 1D array and use basic modulos to select the proper position, but if I can speed this up with binary it would really help me out in the long run.