Crate hex2d

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§

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

Structs§

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

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