]> Creatis software - cpMesh.git/blob - lib/cpm/Algorithms/QuadEdge/MeshEulerOperatorJoinVertexFunction.h
First commit
[cpMesh.git] / lib / cpm / Algorithms / QuadEdge / MeshEulerOperatorJoinVertexFunction.h
1 #ifndef __CPM__ALGORITHMS__QUADEDGE__MESHEULEROPERATORJOINVERTEXFUNCTION__H__
2 #define __CPM__ALGORITHMS__QUADEDGE__MESHEULEROPERATORJOINVERTEXFUNCTION__H__
3
4 #include <stack>
5 #include <cpm/Algorithms/QuadEdge/MeshFunctionBase.h>
6
7 namespace cpm
8 {
9   namespace Algorithms
10   {
11     namespace QuadEdge
12     {
13       /**
14        */
15       template< class M >
16       class MeshEulerOperatorJoinVertexFunction
17         : public MeshFunctionBase< M, typename M::TPrimalEdge*, typename M::TPrimalEdge* >
18       {
19       public:
20         typedef typename M::TPrimalEdge               TEdge;
21         typedef MeshEulerOperatorJoinVertexFunction   Self;
22         typedef MeshFunctionBase< M, TEdge*, TEdge* > Superclass;
23         typedef itk::SmartPointer< Self >             Pointer;
24         typedef itk::SmartPointer< const Self >       ConstPointer;
25
26         typedef M TMesh;
27         typedef typename Superclass::TInput  TInput;
28         typedef typename Superclass::TOutput TOutput;
29         typedef typename M::PointIdentifier TPointId;
30
31         typedef std::stack< TEdge* > TStack;
32
33         enum TEdgeStatus
34         {
35           STANDARD_CONFIG = 0,
36           EDGE_NULL,
37           MESH_NULL,
38           EDGE_ISOLATED,
39           TOO_MANY_COMMON_VERTICES,
40           TETRAHEDRON_CONFIG,
41           QUADEDGE_ISOLATED,
42           FACE_ISOLATED,
43           SAMOSA_CONFIG,
44           EYE_CONFIG,
45           EDGE_JOINING_DIFFERENT_BORDERS
46         };
47
48       public:
49         itkNewMacro( Self );
50         itkTypeMacro( MeshEulerOperatorJoinVertexFunction, MeshFunctionBase );
51
52         itkGetConstMacro( OldPointID, TPointId );
53         itkGetConstMacro( EdgeStatus, TEdgeStatus );
54
55       public:
56         virtual TOutput Evaluate( const TInput& e );
57
58       protected:
59         MeshEulerOperatorJoinVertexFunction( );
60         virtual ~MeshEulerOperatorJoinVertexFunction( );
61
62         TPointId CommonVertexNeighboor( TEdge* e );
63         bool IsTetrahedron( TEdge* e );
64         bool IsFaceIsolated(
65           TEdge* e, bool iWasLeftFace, TStack& oToBeDeleted
66           );
67         bool IsSamosa( TEdge* e );
68         bool IsEye( TEdge* e );
69         bool IsEdgeLinkingTwoDifferentBorders( TEdge* e );
70         TEdgeStatus CheckStatus( TEdge* e, TStack& oToBeDeleted );
71         TEdge* Process( TEdge* e );
72         TEdge* ProcessQuadEdge( TEdge* e );
73         TEdge* ProcessFace( TEdge* e, TStack& EdgesToBeDeleted );
74
75       private:
76         // Purposely not implemented
77         MeshEulerOperatorJoinVertexFunction( const Self& );
78         void operator=( const Self& );
79
80       protected:
81         TPointId    m_OldPointID;
82         TEdgeStatus m_EdgeStatus;
83       };
84
85     } // ecapseman
86
87   } // ecapseman
88
89 } // ecapseman
90
91 #include <cpm/Algorithms/QuadEdge/MeshEulerOperatorJoinVertexFunction.hxx>
92
93 #endif // __CPM__ALGORITHMS__QUADEDGE__MESHEULEROPERATORJOINVERTEXFUNCTION__H__
94
95 // eof - $RCSfile$