You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
polygonToCells algorithm basically seems to have following steps:
find hexagons lying on polygons outer and inner rings
do breadth-first search starting from every found hexagon and check if next neighbour hexagon center contained by polygon
First step with ring hexagons tracing seems unnecessary for me because in breadth-first search any point from polygon can be used as start point and all others will be found eventually.
Thank you for your submission. In the future, it might make sense to discuss in our Slack channel or in a GitHub issue before putting together a PR.
The reason we include the step of tracing the outlines is that the cells returned by polyfill may not be contiguous. The current polyfill algorithm only takes cells whose centers fall within the polygon, so there are many cases in which a simple flood fill won't work - imagine for example a "barbell" shape with two areas filled with cells, separated by a arbitrarily long "bar" with no cells. Depending on the scale of the shapes and the resolution of the cells, there may be many cases like this in a given dataset. Outline tracing was the best option we could come up with that handles all of these cases. We'd welcome other more efficient approaches here.
It looks like we don't have good test cases for these issues, however - I would have hoped the tests would fail in this PR, but they don't, which suggests a gap in our unit tests.
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
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.
polygonToCells algorithm basically seems to have following steps:
First step with ring hexagons tracing seems unnecessary for me because in breadth-first search any point from polygon can be used as start point and all others will be found eventually.