[][src]Function libh3::k_ring_distances

pub fn k_ring_distances(origin: H3Index, radius: i32) -> Vec<(H3Index, i32)>

Get all hexagons in a k-ring around a given center, in an array of arrays ordered by distance from the origin. The order of the hexagons within each ring is undefined.

Arguments

  • origin - The center of the ring.
  • radius - The radis of the ring in hexagons, which is the same resolution as the origin.
let expected_kring_distances = vec![
  (0x8a2a1072b59ffff, 0),
  (0x8a2a1072b597fff, 1),
  (0x8a2a1070c96ffff, 1),
  (0x8a2a1072b4b7fff, 1),
  (0x8a2a1072b4a7fff, 1),
  (0x8a2a1072b58ffff, 1),
  (0x8a2a1072b587fff, 1),
];
let r = libh3::k_ring_distances(0x8a2a1072b59ffff, 1);
assert_eq!(r, expected_kring_distances);