]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/Skeleton.hxx
Skeleton representation added.
[cpPlugins.git] / lib / cpExtensions / DataStructures / Skeleton.hxx
1 #ifndef __cpExtensions__DataStructures__Skeleton__hxx__
2 #define __cpExtensions__DataStructures__Skeleton__hxx__
3
4 // -------------------------------------------------------------------------
5 template< unsigned int _VDim >
6 void cpExtensions::DataStructures::Skeleton< _VDim >::
7 AddBranch( TPath* path )
8 {
9   // Check inputs
10   if( path == NULL )
11     return;
12   unsigned long size = path->GetSize( );
13   if( size == 0 )
14     return;
15   TIndex a = path->GetVertex( 0 );
16   TIndex b = path->GetVertex( size - 1 );
17   if( this->HasEdge( a, b ) )
18     return;
19
20   // Add path
21   this->AddEdge( a, b, path );
22   this->AddEdge( b, a, path );
23   // TODO: this->Modified( );
24 }
25
26 // -------------------------------------------------------------------------
27 template< unsigned int _VDim >
28 const typename cpExtensions::DataStructures::Skeleton< _VDim >::
29 TPath* cpExtensions::DataStructures::Skeleton< _VDim >::
30 GetBranch( const TIndex& a, const TIndex& b ) const
31 {
32   static const TPath* null_path = NULL;
33   if( this->HasEdge( a, b ) )
34     return( this->GetEdges( a, b ).front( ) );
35   else
36     return( null_path );
37 }
38
39 // -------------------------------------------------------------------------
40 template< unsigned int _VDim >
41 cpExtensions::DataStructures::Skeleton< _VDim >::
42 Skeleton( )
43   : Superclass( )
44 {
45 }
46
47 // -------------------------------------------------------------------------
48 template< unsigned int _VDim >
49 cpExtensions::DataStructures::Skeleton< _VDim >::
50 ~Skeleton( )
51 {
52 }
53
54 #endif // __cpExtensions__DataStructures__Skeleton__hxx__
55
56 // eof - $RCSfile$