]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/Skeleton.hxx
...
[cpPlugins.git] / lib / cpExtensions / DataStructures / Skeleton.hxx
index ff00cb653387cf8d9f267c5a4f461962a337d18b..12f463f3796055dd017ac03255623102e5e5839c 100644 (file)
@@ -18,6 +18,8 @@ AddBranch( TPath* path )
     return;
 
   // Add path
+  this->SetVertex( a, a );
+  this->SetVertex( b, b );
   this->AddEdge( a, b, path );
   this->AddEdge( b, a, path );
   // TODO: this->Modified( );
@@ -36,6 +38,42 @@ GetBranch( const TIndex& a, const TIndex& b ) const
     return( null_path );
 }
 
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+std::vector< typename cpExtensions::DataStructures::Skeleton< _VDim >::TIndex >
+cpExtensions::DataStructures::Skeleton< _VDim >::
+GetEndPoints( ) const
+{
+  std::vector< TIndex > res;
+  auto mIt = this->BeginEdgesRows( );
+  for( ; mIt != this->EndEdgesRows( ); ++mIt )
+  {
+    unsigned long count = mIt->second.size( );
+    if( count == 1 )
+      res.push_back( mIt->first );
+
+  } // rof
+  return( res );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+std::vector< typename cpExtensions::DataStructures::Skeleton< _VDim >::TIndex >
+cpExtensions::DataStructures::Skeleton< _VDim >::
+GetBifurcations( ) const
+{
+  std::vector< TIndex > res;
+  auto mIt = this->BeginEdgesRows( );
+  for( ; mIt != this->EndEdgesRows( ); ++mIt )
+  {
+    unsigned long count = mIt->second.size( );
+    if( count > 1 )
+      res.push_back( mIt->first );
+
+  } // rof
+  return( res );
+}
+
 // -------------------------------------------------------------------------
 template< unsigned int _VDim >
 cpExtensions::DataStructures::Skeleton< _VDim >::