Module hexagonal_pathfinding_astar::astar_cubic[][src]

Expand description

A-Star pathfinding algorithm for a Cubic grid alignment.

You can represent a hexagon grid through three primary axes. We denote the axes x, y and z. The Cubic coordinate system is very useful as some calculations cannot be performed through other coordinate systems (they don’t contain enough data).

A Cubic grid is structured such:

             _______
            /   0   \
    _______/         \_______
   /  -1   \ 1    -1 /   1   \
  /         \_______/         \
  \ 1     0 /   x   \ 0    -1 /
   \_______/         \_______/
   /  -1   \ y     z /   1   \
  /         \_______/         \
  \ 0     1 /   0   \ -1    0 /
   \_______/         \_______/
           \ -1    1 /
            \_______/

Functions

From a starting node calculate the most efficient path to the end node