Here's some code to convert spiral coordinates for a hexagon grid to cube coordinates (q,r,s) and vice versa.
- The main code is written in Rust. Use cargo run, or go check out hex-spiral as this crate now has the same functionality built in.
- spiral_to_cube_demo.ipynb shows some of the maths behind how this is done in a visual way, and how you might go about this in Python.