Method: H3::Traversal#hex_range
- Defined in:
- lib/h3/traversal.rb
#hex_range(origin, k) ⇒ Array<Integer>
Derives H3 indexes within k distance of the origin H3 index.
Similar to #k_ring, except that an error is raised when one of the indexes returned is a pentagon or is in the pentagon distortion area.
k-ring 0 is defined as the origin index, k-ring 1 is defined as k-ring 0 and all neighboring indexes, and so on.
Output is inserted into the array in order of increasing distance from the origin.
82 83 84 85 86 87 88 |
# File 'lib/h3/traversal.rb', line 82 def hex_range(origin, k) max_hexagons = max_kring_size(k) out = H3Indexes.of_size(max_hexagons) pentagonal_distortion = Bindings::Private.hex_range(origin, k, out) raise(ArgumentError, "Specified hexagon range contains a pentagon") if pentagonal_distortion out.read end |