If we use the kRing(H3Index origin, int k, H3Index* out)
function to get surrounding hexagons, and we're going to refine the results on the client (i.e. haversine), we never have to worry about pentagons, do we? Because, AFAIK, pentagons have H3 indexes also and are, for all intents and purposes, treated just like hexagons, correct?
It is the hexRange(H3Index origin, int k, H3Index* out)
function that cares about pentagons, correct?
For some intents and purposes, yes, pentagons are simply hexagons with one axial dimension removed. They have a normal H3 index representation, will work correctly with most functions that take H3 cells as input, and should be fine in the case you describe. The main considerations are:
h3ToGeoBoundary
, or 10 vertices for odd resolutions (to account for distortion at the icosahedron edges)kRing
, you can no longer make any assumptions about the shape of the returned set - e.g. you may have fewer cells in a different arrangement than you would if you only encounter hexagons.hexRange
, hexRing
, and a few others) will fail with an error code if they encounter a pentagon. hexRange
in particular is a fast kRing
algorithm, which kRing
uses under the hood, falling back to a slow-but-correct algo if a pentagon is encountered. You should only use hexRange
if performance is very important and you're willing to handle failures. Functions that do not handle pentagons are generally clearly specified in the docs.