-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix avoid polygons again #3194
Fix avoid polygons again #3194
Conversation
src/loki/polygon_search.cc
Outdated
line_bg_t edge_line{edge_info.shape().begin(), edge_info.shape().end()}; | ||
bool intersects = false; | ||
for (const auto& ring_loc : bin.second) { | ||
intersects = bg::intersects(rings_bg[ring_loc], edge_info.shape()); | ||
intersects = bg::intersects(rings_bg[ring_loc], edge_line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's the actual change
@purew maybe this also fixes the clang issues over at #2750 (comment) ? |
Initially getting one error
Fixing that, I still get the error in the unittest:
|
…trategy to calculate perimeter of rings
@kevinkreiser thanks for the review, I added haversine perimeter calculation and removed our own ring closing logic when parsing the request. @purew the unused-variable warning is gone, forgot to add that function as a strategy.. No idea what to make of that failing test, maybe I'll try clang one of these days |
this looks good to me. are we saying that compiling with clang fails the tests though? |
seems so @kevinkreiser . though that's not new with this PR, @purew reported it a couple of weeks back in that initial PR. Must've somehow been introduced with clang 12.0, no idea what's so compiler-specific about that test.. I'll open another issue about it. |
Yea, I'm seeing this I haven't dug into why this is though. |
Fixes #3182
The issue was a little subtle: we register
std::vector<PointLL>
as abg::polygon
so the edge'sshape
was interpreted as a polygon geometry and then used to intersect with the avoid_polygons, which I guess is sorta undefined behavior (at least for me).I also added a
to_geojson()
for debugging as you suggested @kevinkreiser, as a trace log, very helpful..Could be done a bit different, by registering another structure with bg, e.g.that only works if we register std::vector as linestring, of course bg::intersects needs two geometry types. For polygons we wouldn't need to register our own geometry type, we could use bg::model::polygon, but the Tiles::Intersect method somehow won't take that type as an argument.std::deque<PointLL>
, to avoid casting every edge to a linestring. With a few experiments I didn't see any significant performance deviation from master though, but let me know if you'd prefer that.