Crate hex2d [] [src]

Hexagonal map operations utility library

A lot of ideas taken from redbloggames hexagon page

Pointy-topped:

          /\
        /    \
       |      |
       |      |
        \    /
          \/

           -z
+y     YZ  |  XZ     +x
 ---       |       ---
    ---    |    ---
       --- | ---
  YX      -x-    XY
       --- | ---
    ---    |    ---
 ---   ZX  |  ZY   ---
-x         |          -y
           +z

Flat-topped:

           ____
          /    \
         /      \
         \      /
          \____/

       +y       -z
        \       /
         \ YZ  /
      YX  \   /  XZ
           \ /
  -x--------x--------+x
           / \
      ZX  /   \ XY
         /  ZY \
        /       \
       +z       -y

Reexports

pub use Direction::*;
pub use Angle::*;

Structs

Coordinate

Coordinate on 2d hexagonal grid

Position

Position on 2d hexagonal grid (Coordinate + Direction)

Enums

Angle

Angle, relative to a Direction

Direction

Direction on a hexagonal map

IntegerSpacing

Integer pixel tile size for integer pixel conversion functions

Spacing

Floating point tile size for pixel conversion functions

Spin

Spinning directions

Traits

Integer

Integer trait required by this library

ToCoordinate

Can be treated as a Coordinate

ToDirection

Can be treated as a Direction