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.
- Host: GitHub
- URL: https://github.com/jonathanwoollett-light/hex-coordinates
- Owner: JonathanWoollett-Light
- Created: 2022-08-13T00:43:40.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-11T16:25:45.000Z (over 2 years ago)
- Last Synced: 2025-03-04T21:37:21.100Z (3 months ago)
- Language: Rust
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hex-coordinates
[](https://crates.io/crates/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
algorithmsfewsomemostmostThe 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).