Conversion of Cartesian coordinates from and to Generalized Balanced Ternary addresses

Hexagonal grids have several advantages over square grids, such as a greater angular resolution and unambiguous connectivity. The Generalized Balanced Ternary (GBT) system is a spatial addressing method for hexagonal grids in which the hexagons are arranged in hierarchical aggregates, and which accommodates vector operations in GBT space. Efficient algorithms for converting Cartesian coordinates from and to GBT addresses are based on the dual representation of the hexagonal tessellation. The GBT-to-Cartesian algorithm is an order of magnitude faster than the Cartesian-to-GBT algorithm, the latter requiring interpolation and GBT addition for each digit of the generated GBT address.