From e0456b4998d63605b747f526a74fd4d66c5f8ff3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Mon, 10 Oct 2016 15:54:52 -0500 Subject: [PATCH] ... --- lib/fpa/Base/MinimumSpanningTree.hxx | 90 ++++++++++++++-------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/lib/fpa/Base/MinimumSpanningTree.hxx b/lib/fpa/Base/MinimumSpanningTree.hxx index c85c283..e8ed6a2 100644 --- a/lib/fpa/Base/MinimumSpanningTree.hxx +++ b/lib/fpa/Base/MinimumSpanningTree.hxx @@ -142,9 +142,9 @@ GetPath( unsigned long N = this->m_Seeds.size( ); for( unsigned long i = 0; i < N; ++i ) { - if( this->m_Seeds[ i ] == pa->GetVertex( 0 ) ) + if( this->m_Seeds[ i ] == pa->GetVertex( pa->GetSize( ) - 1 ) ) ia = i; - if( this->m_Seeds[ i ] == pb->GetVertex( 0 ) ) + if( this->m_Seeds[ i ] == pb->GetVertex( pb->GetSize( ) - 1 ) ) ib = i; } // rof @@ -153,49 +153,49 @@ GetPath( if( ia != ib ) { // Compute front path - /* TODO - std::vector< long > fpath; - fpath.push_back( ia ); - while( ia != ib ) - { - ia = this->m_FrontPaths[ ia ][ ib ]; - fpath.push_back( ia ); - - } // elihw - - // Continue only if both fronts are connected - unsigned int N = fpath.size( ); - if( N > 0 ) - { - // First path: from start vertex to first collision - this->GetPath( - path, a, - this->m_Collisions[ fpath[ 0 ] ][ fpath[ 1 ] ].first - ); - - // Intermediary paths - for( unsigned int i = 1; i < N - 1; ++i ) - { - TPathTVertices ipath = - this->GetPath( - this->m_Collisions[ fpath[ i ] ][ fpath[ i - 1 ] ].first, - this->m_Collisions[ fpath[ i ] ][ fpath[ i + 1 ] ].first - ); - path.insert( path.end( ), ipath.begin( ), ipath.end( ) ); - - } // rof - - // Final path: from last collision to end point - TVertices lpath = - this->GetPath( - this->m_Collisions[ fpath[ N - 1 ] ][ fpath[ N - 2 ] ].first, b - ); - path.insert( path.end( ), lpath.begin( ), lpath.end( ) ); - - } // fi - - } // fi - */ + std::vector< long > fpath; + fpath.push_back( ia ); + while( ia != ib ) + { + ia = this->m_FrontPaths[ ia ][ ib ]; + fpath.push_back( ia ); + + } // elihw + + // Continue only if both fronts are connected + unsigned int N = fpath.size( ); + if( N > 0 ) + { + // First path: from start vertex to first collision + this->GetPath( + path, a, + this->m_Collisions[ fpath[ 0 ] ][ fpath[ 1 ] ].first + ); + + // Intermediary paths + for( unsigned int i = 1; i < N - 1; ++i ) + { + typename _TPath::Pointer ipath; + this->GetPath( + ipath, + this->m_Collisions[ fpath[ i ] ][ fpath[ i - 1 ] ].first, + this->m_Collisions[ fpath[ i ] ][ fpath[ i + 1 ] ].first + ); + for( long id = 0; id < ipath->GetSize( ); ++id ) + path->AddVertex( ipath->GetVertex( id ) ); + + } // rof + + // Final path: from last collision to end point + typename _TPath::Pointer lpath; + this->GetPath( + lpath, + this->m_Collisions[ fpath[ N - 1 ] ][ fpath[ N - 2 ] ].first, b + ); + for( long id = 0; id < lpath->GetSize( ); ++id ) + path->AddVertex( lpath->GetVertex( id ) ); + + } // fi } else { -- 2.47.1