H3 allows you to find cells at specific distances from an origin cell.
GridDisk(origin, k): Returns all cells within grid distance k of the origin (the k-ring).GridRing(origin, k): Returns only the cells at exactly grid distance k (the 'hollow' ring).GridDiskDistances(origin, k): Returns cells grouped by their distance from the origin, where the outer slice index corresponds to the distance.
Note on Unsafe methods: Functions suffixed with Unsafe (e.g., GridDiskUnsafe) are faster but have undefined behavior if the operation crosses a pentagon or enters a pentagon distortion area.
// Get all cells in the 2-ring
disk, err := cell.GridDisk(2)
// Get cells at exactly distance 2
ring, err := cell.GridRing(2)
// Get cells grouped by distance
dists, err := cell.GridDiskDistances(2)
// dists[0] contains origin, dists[1] contains neighbors, etc.