1 #ifndef __CPM__ALGORITHMS__QUADEDGE__MESHZIPFUNCTION__HXX__
2 #define __CPM__ALGORITHMS__QUADEDGE__MESHZIPFUNCTION__HXX__
4 // -------------------------------------------------------------------------
6 typename cpm::Algorithms::QuadEdge::MeshZipFunction< M >::
7 TOutput cpm::Algorithms::QuadEdge::MeshZipFunction< M >::
8 Evaluate( const TInput& e )
12 itkDebugMacro( "No mesh present" );
13 return( TEdge::NoGeometry );
19 itkDebugMacro( "Incoming edge must be adjacent to NOFACE" );
20 return( TEdge::NoGeometry );
24 // Initial state Final state //
30 // VTrashed Vkept V //
38 // ------- Org -------- --------- Org --------- //
43 // This is the original situation:
49 // ------ VRite VLeft -------- //
57 // V ------------ Org ------------ VOpposite //
61 // Store for latter usage (since e and e->GetRight( ) will be deleted):
62 TEdge* a = e->GetLnext( );
63 TEdge* b = e->GetOnext( )->GetSym( );
64 TOutput VLeft = e->GetDestination( );
65 TOutput VRight = b->GetOrigin( );
66 bool wasFacePresent = e->IsRightSet( );
67 TOutput resultingPointId = TEdge::NoGeometry;
69 // We should be cautious and consider the case when the very
70 // initial situation was the following:
83 // --------- Org --------- //
89 if( e->IsWire( ) && b->IsWire( ) )
92 this->m_Mesh->LightWeightDeleteEdge(e);
93 this->m_Mesh->LightWeightDeleteEdge(b);
95 return( resultingPointId );
101 // Delete the Edge e and it's right face:
104 this->m_Mesh->DeleteFace( e->GetRight( ) );
105 this->m_Mesh->LightWeightDeleteEdge(e);
108 // We should be cautious and consider the case when the very
109 // initial situation was the following:
114 // VRight = VLeft ------- VOpposite //
122 // --------- Org --------- //
127 // in which case the current situation is the following:
133 // VRight = VLeft ------- VOpposite //
141 // --------- Org --------- //
146 // and hence the connectivity part of "Zip" job is already done.
147 // Check for that case:
149 if( VLeft != VRight )
151 // We are now left with the following situation
157 // ----- VRight VLeft -------- //
165 // V ------------ Org ------------ VOpposite //
169 // where we just miss a simple Mesh::Splice( ) to obtain::
174 // ---- VRight = VLeft ------ VOpposite //
182 // V ------------ Org ------------ //
186 // TODO: resultingPointId = this->m_Mesh->Splice(a, b);
190 // We restore the deleted face (when it was present):
193 this->m_Mesh->AddFace(b);
195 this->m_Mesh->Modified( );
196 return( resultingPointId );
199 // -------------------------------------------------------------------------
201 cpm::Algorithms::QuadEdge::MeshZipFunction< M >::
207 // -------------------------------------------------------------------------
209 cpm::Algorithms::QuadEdge::MeshZipFunction< M >::
214 #endif // __CPM__ALGORITHMS__QUADEDGE__MESHZIPFUNCTION__HXX__