| Crates.io | hex-coordinates |
| lib.rs | hex-coordinates |
| version | 0.1.3 |
| created_at | 2022-08-13 00:43:52.516531+00 |
| updated_at | 2022-08-21 03:04:56.987359+00 |
| description | A library for handling hex coordinates. |
| homepage | |
| repository | https://github.com/JonathanWoollett-Light/hex-coordinates |
| max_upload_size | |
| id | 644322 |
| size | 55,228 |
A library for handling hex coordinates.
Massive credit to Hexagonal Grids from Red Blob Games.
| Offset | Doubled | Axial th> | Cube | |
|---|---|---|---|---|
| Pointy Rotation | evenr, oddr | doublewidth | axial | cube |
| Flat Rotation | evenq, oddq | doubleheight | ||
| Other Rotations | no | yes | ||
| Vector operations (add, subtract, scale) | no | yes | yes | yes | tr>
| Array storage | rectangular | no* | rhombus* | no* |
| Hash storage | any shape | any shape | ||
| Hexagonal symmetry | no | no | no | yes |
| Easy algorithms | few | some | most | most |
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).