Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
h3_grid_path_cells_recursive
allows creating a path between arbitrary h3 indexes.h3_grid_path_cells
function fails if base cells oforigin
anddestination
are not neighbors or the same base cell (this is what happens in the case from #71, see cellToLocalIjk, and _getBaseCellDirection definitions). Additionally, it's not always possible to create a path across a base pentagon: the indexes must be on the same icosahedron face or faces sharing an edge (see this comment in the library).Recursive function checks for this conditions before calling
h3_grid_path_cells
and usesST_Centroid
to find a middle point on the path and call itself on each half. It is possible that this middle point index is outside of path that h3 would have generated, especially for lower resolutions, but this doesn't seem to be a problem ash3_grid_path_cells
output itself is not strictly defined.There's no convenient way to check if indexes are on edge sharing faces, so the function just checks if they have a common face.
Example: res. 4 indexes from Baghdad to Osaka: