hex-coordinates

Crates.iohex-coordinates
lib.rshex-coordinates
version0.1.3
sourcesrc
created_at2022-08-13 00:43:52.516531
updated_at2022-08-21 03:04:56.987359
descriptionA library for handling hex coordinates.
homepage
repositoryhttps://github.com/JonathanWoollett-Light/hex-coordinates
max_upload_size
id644322
size55,228
Jonathan Woollett-Light (JonathanWoollett-Light)

documentation

https://docs.rs/hex-coordinates/

README

hex-coordinates

crates.io docs.rs

A library for handling hex coordinates.

Massive credit to Hexagonal Grids from Red Blob Games.

OffsetDoubledAxialCube
Pointy Rotationevenr, oddrdoublewidthaxialcube
Flat Rotationevenq, oddqdoubleheight
Other Rotationsnoyes
Vector operations (add, subtract, scale)noyesyesyes
Array storagerectangularno*rhombus*no*
Hash storageany shapeany shape
Hexagonal symmetrynononoyes
Easy algorithmsfewsomemostmost

The article notes:

My recommendation: if you are only going to use non-rotated rectangular maps, consider the doubled or offset system that matches your map orientation. For maps with Rotation, or non-rectangularly shaped maps, use axial/cube. Either choose to store the s coordinate (cube), or calculate it when needed as -q-r (axial).

Commit count: 19

cargo fmt