Expand description
While most hex-grid-based 2D games use multiple coordinates, hex-spiral uses a single-coordinate spiral,
where the central hex has the position 0
, and further hexes are placed within theoretical hexagonal rings
that surround it. The hexes are flat-topped and every ring is indexed starting with the hex on the top edge
of the previous ring and with further positions growing clockwise.
Structs§
- Directional
Neighbor Iter - An iterator returning subsequent neighboring positions in the given direction.
The top direction is
0
, and it increases up to5
clockwise.
Functions§
- are_
grouped - are_
neighbors - Returns
true
if the given 2 positions are neighbors. - is_
at_ ring_ tip - Returns
true
if the given position is at one of the tips of a ring. - is_
path_ consistent - Returns
true
if the given list of positions consists of subsequent neighbors. - neighboring_
positions - Returns the 6 neighbors of the given position, always in the same clockwise order.
- ring
- The index of the ring for the given position.
- ring_
edge_ index - Returns the index of the edge of the ring the given position belongs to.
- ring_
offset - The starting position of hexes within the ring with the given index.