]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/Algorithm.hxx
Refactoring: gaussian model estimator
[FrontAlgorithms.git] / lib / fpa / Base / Algorithm.hxx
index 21670ef7396522c40c2a918432182d7d96037b34..eb307580601ef9a85042165a46cd93b934afa94f 100644 (file)
@@ -148,7 +148,7 @@ _Loop( )
 
       // Iterate over neighbors
       typename _TVertices::iterator nIt = neighborhood.begin( );
-      for( ; nIt != neighborhood.end( ); ++nIt )
+      while( nIt != neighborhood.end( ) )
       {
         _TNode neighbor = this->_Node( *nIt );
         neighbor.Vertex = *nIt;
@@ -159,6 +159,7 @@ _Loop( )
           {
             this->_QueueClear( );
             nIt = neighborhood.end( );
+            continue;
 
           } // fi
         }
@@ -182,8 +183,9 @@ _Loop( )
             this->InvokeEvent( TFreezeEvent( *nIt, candidate.FrontId ) );
 
         } // fi
+        ++nIt;
 
-      } // rof
+      } // elihw
     }
     else
       this->_QueueClear( );
@@ -230,13 +232,14 @@ _UpdateCollisions( const TVertex& a, const TVertex& b )
   _TNode na = this->_Node( a );
   _TNode nb = this->_Node( b );
   long fa = na.FrontId;
-  long fb = na.FrontId;
+  long fb = nb.FrontId;
 
   if( fa != fb )
   {
     // Mark collision, if it is new
     bool exists = this->m_Collisions[ fa ][ fb ].second;
     exists     &= this->m_Collisions[ fb ][ fa ].second;
+        
     if( !exists )
     {
       this->m_Collisions[ fa ][ fb ].first = na.Vertex;