You are in luck: there is a way to get decent coordinating encodings with high spatial connectivity using something called a Z-order curve .
The trick is to alternate the bits of different coordinate components. Therefore, if you have 3 8-bit coordinates, for example:
[XXXXXXXX, YYYYYYYY, ZZZZZZZZ]
Then the encoded value of the z-curve will be the only 24-bit value:
XYZXYZXYZXYZXYZXYZXYZXYZ
You can extend to more bits or coordinates as needed.
This encoding works because coordinates that are close in space will have differences, mainly in lower order bits. Thus, alternating the coordinates, you get the differences focused in the least significant bits of the encoded value.
An additional interesting property is that the least significant bits describe the coordinates in cubes of space. Thus, the lowest 3-bit address position with 2x2x2 cubes, the smallest 6-bit address position within 4 * 4 * 4 cubes, the lowest 9-bit position within 8 * 8 * 8 cubes, etc. Thus, it is actually a fairly ideal system for accessing co-constraints within the octa.
mikera
source share