Crate beehive

Source
Expand description

Utilities and collections for 3D hexagonal maps.

§Coordinate space

Coordinates are in cube or axial space where Z is the cube axis, with an additional vertical axis W.

§Flat-top

       yz +Y
       __
   yx /  \ xz +X
-X zx \__/ xy
    -Y zy

§Pointy-top

    yx  /\  yz  +Y
-X  zx |  | xz  +X
-Y  zy  \/  xy

§Crate Features

  • serde-1: Enabled by default. Serialization support via serde.
  • collections: Enabled by default. Collections that work with hex coordinates.
  • rand-07: Disabled by default.rand 0.7 distribution implementations for Direction and QuadPrism.

Modules§

collections
Hex grid related collections. Only available with the collections feature.
coords
Cube and axial hex coordinates.
directions
Hex directions
line
Discrete line iterator in hex space.
quad_prism
A parallelogram prism aligned to X and Y axes.

Structs§

DirectionMap
A stack-allocated map backed by an array that can be indexed by Direction.
HexMap
A generic QuadPrism-shaped dense container indexed by hex coordinates.
KdTree
Generic KD-tree in hex space, implemented on a flat vector.
Point
Cube hex coordinates representing points. Only valid points on the plane can be normally created.
PointAxial
Axial hex coordinates representing points. Always valid.
QuadPrism
A parallelogram prism aligned to X and Y axes.
Vector
Cube hex coordinates representing vectors. Only valid points on the plane can be normally created.
VectorAxial
Axial hex coordinates representing vectors. Always valid.

Enums§

Direction
All hex directions in sequential order.