Crate hex2d

Source
Expand description

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

Re-exports§

Structs§

  • Coordinate on 2d hexagonal grid
  • An iterator over an a line of Coordinates
  • An iterator over an a line of Coordinates, using a lossy algorithm
  • An iterator over an a line of Coordinates, with edge detection
  • Position on 2d hexagonal grid (Coordinate + Direction)
  • Iterator over an range
  • Iterator over a ring

Enums§

  • Angle, relative to a Direction
  • Direction on a hexagonal map
  • Integer pixel tile size for integer pixel conversion functions
  • Floating point tile size for pixel conversion functions
  • Spinning directions

Traits§

  • Integer trait required by this library