Skip to content

Improve area check precision - #2684

Merged
easbar merged 3 commits into
graphhopper:masterfrom
otbutz:small_area_check
Oct 31, 2022
Merged

easbar merged 3 commits into
graphhopper:masterfrom
otbutz:small_area_check

Conversation

@otbutz

@otbutz otbutz commented Oct 24, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #2683

We should only early-out if the rectangle fully contains the bounding box of the edge. This still avoids costly way geometry checks in most cases but improves accuracy for checks near the borders of the polygons bounding box.

@otbutz

otbutz commented Oct 24, 2022

Copy link
Copy Markdown
Contributor Author

This should also improve cases like this one:

edge-around-bbox

Note that we still have limited precision until we use the BBox of the full edge as described in #2625

@otbutz

otbutz commented Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

@karussell @easbar

@easbar

easbar commented Oct 25, 2022

Copy link
Copy Markdown
Member

This looks good to me, but let's see what karussell has to say. And maybe you can add a test for this in method that illustrates the critical cases you found? That should be fairly simple to do. You can create a test edge like this:

        BaseGraph g = new BaseGraph.Builder(1).create();
        EdgeIteratorState edge = g.edge(0, 1).setWayGeometry(Helper.createPointList(lat1, lon1, lat2, lon2, lat3, lon3));

@otbutz

otbutz commented Oct 26, 2022

Copy link
Copy Markdown
Contributor Author

@easbar added a unittest to cover the different cases

@karussell karussell left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find and thank you for the fix!

@karussell karussell added this to the 7.0 milestone Oct 31, 2022
@easbar
easbar merged commit 5ace05c into graphhopper:master Oct 31, 2022
@otbutz otbutz mentioned this pull request Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom areas are imprecise

3 participants