A technique for consistently indexing neighbors in N-dimensional quad/octrees using ternary numbers. Each neighbor is assigned an index based on an N-digit ternary number where each digit encodes whether the neighbor is on the low side (0), high side (1), or spans the full axis (2). This scheme naturally excludes the current cell from the neighbor list, since the cell spanning all axes maps to a value just outside the valid index range.
Sort: