An open API service indexing awesome lists of open source software.

https://github.com/jonathanwoollett-light/hex-coordinates

A library for handling hex coordinates.
https://github.com/jonathanwoollett-light/hex-coordinates

Last synced: 2 months ago
JSON representation

A library for handling hex coordinates.

Awesome Lists containing this project

README

        

# hex-coordinates

[![crates.io](https://img.shields.io/crates/v/hex-coordinates)](https://crates.io/crates/hex-coordinates)
[![docs.rs](https://img.shields.io/docsrs/hex-coordinates)](https://docs.rs/hex-coordinates/)

A library for handling hex coordinates.

Massive credit to [Hexagonal Grids from Red Blob Games](https://www.redblobgames.com/grids/hexagons/).

OffsetDoubledAxial
th>CubePointy Rotationevenr,
oddrdoublewidthaxialcubeFlat Rotationevenq,
oddqdoubleheightOther RotationsnoyesVector operations
(add, subtract, scale)noyesyesyes
tr>Array
storagerectangularno*rhombus*no*
Hash storageany shapeany
shapeHexagonal
symmetrynononoyesEasy
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).