Add Gosper island boundary edge iterator#1138
Open
ajfriend wants to merge 4 commits intouber:masterfrom
Open
Conversation
Collaborator
Author
|
Talk explaining how this fits in: https://ajfriend.com/h3c2p-talk/ |
src/h3lib/lib/iterGosper.c
Outdated
|
|
||
| // H3 edge direction at each edge index, in counter-clockwise order around the | ||
| // hexagon. Stored in the directed edge's reserved bits. | ||
| static const int8_t edge_dir[] = {3, 1, 5, 4, 6, 2}; |
Collaborator
There was a problem hiding this comment.
You could also write this with type Direction and use I_AXIS_DIGIT, etc.
Collaborator
Author
There was a problem hiding this comment.
Yeah, that's better. Updated.
I left some comments on the numeric sequence, because I think that makes it easier to see the shared pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1114
Adds
IterEdgesGosper, an iterator that yields the directed edges forming the boundary (Gosper island outline) of a cell's child set at a given resolution.rexpanded to child resolutionR: hexagons produce6 * 3^(R-r)edges, pentagons produce5 * 3^(R-r)Usage
Next step: Speed up
cellsToMultiPolygonThis is a building block for a faster
cellsToMultiPolygon. When given a pre-compacted input cell set, the iterator allows thecellsToMultiPolygonalgorithm to walk the Gosper island boundary edges directly, skipping all internal edges. On a Colorado polygon at resolution 8, this yields a 35x speedup. The higher the resolution, the better the speedup. This speedup is separate from the 3-4x improvement already achieved with the newcellsToMultiPolygonalgorithm.