]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/DataStructures/Skeleton.hxx
Skeleton representation added.
[cpPlugins.git] / lib / cpExtensions / DataStructures / Skeleton.hxx
diff --git a/lib/cpExtensions/DataStructures/Skeleton.hxx b/lib/cpExtensions/DataStructures/Skeleton.hxx
new file mode 100644 (file)
index 0000000..ff00cb6
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef __cpExtensions__DataStructures__Skeleton__hxx__
+#define __cpExtensions__DataStructures__Skeleton__hxx__
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+void cpExtensions::DataStructures::Skeleton< _VDim >::
+AddBranch( TPath* path )
+{
+  // Check inputs
+  if( path == NULL )
+    return;
+  unsigned long size = path->GetSize( );
+  if( size == 0 )
+    return;
+  TIndex a = path->GetVertex( 0 );
+  TIndex b = path->GetVertex( size - 1 );
+  if( this->HasEdge( a, b ) )
+    return;
+
+  // Add path
+  this->AddEdge( a, b, path );
+  this->AddEdge( b, a, path );
+  // TODO: this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+const typename cpExtensions::DataStructures::Skeleton< _VDim >::
+TPath* cpExtensions::DataStructures::Skeleton< _VDim >::
+GetBranch( const TIndex& a, const TIndex& b ) const
+{
+  static const TPath* null_path = NULL;
+  if( this->HasEdge( a, b ) )
+    return( this->GetEdges( a, b ).front( ) );
+  else
+    return( null_path );
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+cpExtensions::DataStructures::Skeleton< _VDim >::
+Skeleton( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< unsigned int _VDim >
+cpExtensions::DataStructures::Skeleton< _VDim >::
+~Skeleton( )
+{
+}
+
+#endif // __cpExtensions__DataStructures__Skeleton__hxx__
+
+// eof - $RCSfile$