Skip to content
Snippets Groups Projects
Commit f0ac2ebc authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

tryConnectToRoadmap uses only the 7 nearest neighbors

* The number of nearest neighbor is empirical, with no particular test
parent ef7d6005
No related branches found
No related tags found
No related merge requests found
...@@ -274,6 +274,8 @@ namespace hpp { ...@@ -274,6 +274,8 @@ namespace hpp {
graph::GraphPtr_t graph = problem_.constraintGraph (); graph::GraphPtr_t graph = problem_.constraintGraph ();
bool connectSucceed = false; bool connectSucceed = false;
std::size_t nbConnection = 0; std::size_t nbConnection = 0;
const std::size_t K = 7;
value_type distance;
for (core::Nodes_t::const_iterator itn1 = nodes.begin (); for (core::Nodes_t::const_iterator itn1 = nodes.begin ();
itn1 != nodes.end (); ++itn1) { itn1 != nodes.end (); ++itn1) {
ConfigurationPtr_t q1 ((*itn1)->configuration ()); ConfigurationPtr_t q1 ((*itn1)->configuration ());
...@@ -283,8 +285,10 @@ namespace hpp { ...@@ -283,8 +285,10 @@ namespace hpp {
itcc != roadmap ()->connectedComponents ().end (); ++itcc) { itcc != roadmap ()->connectedComponents ().end (); ++itcc) {
if (*itcc == (*itn1)->connectedComponent ()) if (*itcc == (*itn1)->connectedComponent ())
continue; continue;
for (core::Nodes_t::const_iterator itn2 = (*itcc)->nodes().begin (); core::Nodes_t knearest = roadmap()->nearestNeighbor ()
itn2 != (*itcc)->nodes ().end (); ++itn2) { ->KnearestSearch (q1, *itcc, K, distance);
for (core::Nodes_t::const_iterator itn2 = knearest.begin ();
itn2 != knearest.end (); ++itn2) {
bool _1to2 = (*itn1)->isOutNeighbor (*itn2); bool _1to2 = (*itn1)->isOutNeighbor (*itn2);
bool _2to1 = (*itn1)->isInNeighbor (*itn2); bool _2to1 = (*itn1)->isInNeighbor (*itn2);
if (_1to2 && _2to1) { if (_1to2 && _2to1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment