Function calculateOffsetIndex

  • Calculates an offset index from octant key coordinates.

    The index identifies the octant's positional offset relative to its parent:

     0: [0, 0, 0]
     1: [0, 0, 1]
     2: [0, 1, 0]
     3: [0, 1, 1]
     4: [1, 0, 0]
     5: [1, 0, 1]
     6: [1, 1, 0]
     7: [1, 1, 1]
    

    Note: This binary layout is defined in the external module sparse-octree.

    For more information on fast bitwise modulo with power of two divisors see: https://graphics.stanford.edu/~seander/bithacks.html#ModulusDivisionEasy

    Parameters

    • x: number

      The X-coordinate of the octant key.

    • y: number

      The Y-coordinate of the octant key.

    • z: number

      The Z-coordinate of the octant key.

    Returns number

    The index of the relative positional offset. Range: [0, 7].