Commit af54dc9
feat: add pure-Go grid traversal (k-ring/disk/ring) to x/h3go
Implement the grid traversal family in pure Go, verified against the
cgo reference:
- GridDisk (+ method), GridDisksUnsafe
- GridDiskDistances / Unsafe / Safe (+ methods)
- GridRing / GridRingUnsafe (+ methods)
- Cell.IsNeighbor
The core is neighborRotations, which steps to an adjacent cell while
threading base-cell rotation state and pentagon distortion. The fast
("Unsafe") spiral fails near pentagons and falls back to a breadth-first
"Safe" traversal. Adds the base-cell neighbor/rotation tables and the
Class II/III digit-adjustment tables, plus ErrPentagon and a setBaseCell
helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f5d7e2c commit af54dc9
5 files changed
Lines changed: 1663 additions & 0 deletions
0 commit comments