Skip to content
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 search_cutoff check in loki correlate_node #2023

Merged
merged 4 commits into from Nov 5, 2019
Merged

Conversation

danpaz
Copy link
Collaborator

@danpaz danpaz commented Nov 4, 2019

Issue

Previously, the correlate_node check in loki was incorrectly filtering out candidate edges that were outside the node_snap_tolerance but within the search_cutoff. We were measuring the wrong distance for cutoff, from the correlated node to the input location rather than from the edge to the input location. This would result in no edges being found even if the location was directly on an edge.

@kevinkreiser any thoughts on how I might implement a regression test for this case?

Tasklist

  • Add tests
  • Review - you must request approval to merge any PR to master
  • Add #fixes with the issue number that this PR addresses
  • Generally use squash merge to rebase and clean comments before merging
  • Update the changelog
  • Update relevant documentation

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@kevinkreiser
Copy link
Member

@danpaz yep you could do exactly this check in search.cc test. basically make a test where the input location is on the edge. in the test we have a perfectly vertical edge so you can just vary the latitude until its the right distance away from the node. its pretty easy to check for. set node snap to like 100m and set search_cutoff to like 1 meter.

@@ -259,9 +262,6 @@ struct bin_handler_t {
// cache the distance
if (distance == std::numeric_limits<float>::lowest())
distance = node_ll.Distance(location.latlng_);
// the search cutoff is a hard filter so skip any outside of that
if (distance > location.search_cutoff_)
return;
Copy link
Member

Choose a reason for hiding this comment

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

this was my screw up back when we added search_cutoff. should have thought about that a little harder at the time. apologies!

kevinkreiser
kevinkreiser previously approved these changes Nov 4, 2019
@danpaz
Copy link
Collaborator Author

danpaz commented Nov 5, 2019

Added a test in ba59cbd. I verified this test failed before the bugfix commit and passes now after the fix.

@danpaz danpaz merged commit 7215ac0 into master Nov 5, 2019
@danpaz danpaz deleted the bugfix_node_cutoff branch November 5, 2019 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants