-
Notifications
You must be signed in to change notification settings - Fork 673
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
map matching lazy shape and disallowed edge fix #1884
Conversation
// project a onto b where b is the origin vector representing this segment | ||
// and a is the origin vector to the point we are projecting, (a.b/b.b)*b | ||
const auto& u = shape[i]; | ||
const auto& v = shape[i + 1]; | ||
auto v = shape.pop(); |
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.
we decode one point at a time and completely avoid any allocations for shape decoding this gives decent speed up in loki and should do here as well (especially where we do many more checks with lots more input)
@@ -162,7 +162,8 @@ inline bool IsEdgeAllowed(const baldr::DirectedEdge* edge, | |||
const sif::cost_ptr_t& costing, | |||
const Label& pred_edgelabel, | |||
const baldr::GraphTile* tile) { | |||
return !pred_edgelabel.edgeid().Is_Valid() || edgeid == pred_edgelabel.edgeid() || | |||
return (!pred_edgelabel.edgeid().Is_Valid() && costing->GetEdgeFilter()(edge) != 0.f) || |
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.
this is the important bug fix, previously this said, whatever edge the routing sees, its allowed so long as its at the beginning of the route. this allowed the route to actually start and end on an inaccesable edge and give a route the wrong way on a one way. now if we dont have a predecessor then we'll grab the edge filter and make sure the edge is at least allowed regardless of predecessor.
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.
👍
there are two things going on here. the first thing is that during candidate search we use
lazy_shape
instead ofshape
to save allocations when doing edge snapping in meili now. this is a mirror of what we do in loki and has a nice performance benefit.the more important thing here is that we fixed a pretty big bug. when we did the refactor to use the regular
Allowed
method on the costing we had to worry about case of the first edge where we didnt have a predecessor. To work around that we apparently just said its allowed if it doesnt have a predecessor. That sucks because it leads to a situation where you can go the wrong way down a one way road if the match starts on that road. So now we use the edge filter on the first edge to remove edges that cant possibly be used by the routing algorithm.