HalfEdgeModel< T > Class Template Reference

#include <TAPsHalfEdgeModel.hpp>

Inheritance diagram for HalfEdgeModel< T >:

Inheritance graph
[legend]
Collaboration diagram for HalfEdgeModel< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void ApplyAndResetTransform ()
 Apply the current transformation to the model permanently. Then reset the transformation to identity.
virtual void BuildBVHTree (TAPs::Enum::CD treeType)
virtual void CalAndSetNormals ()
HEFaceList< T > *const GetFaceList () const
HEFaceList< T > *const GetHoleFaceList () const
virtual T GetMaxHalfLength () const
HEVertexList< T > *const GetVertexList () const
 HalfEdgeModel ()
virtual void Initialize ()
void InsertVertexSplitEdge ()
void IVSE (HEHalfEdge< T > *he, Vector3< T > const *const pos=NULL)
void JFKE (HEHalfEdge< T > *he)
void JoinFaceKillEdge ()
void JoinVertexKillEdge ()
void JVKE (HEHalfEdge< T > *he, Vector3< T > const *const pos=NULL)
void SFME (HEHalfEdge< T > *he1, HEHalfEdge< T > *he2)
void SplitFaceMakeEdge ()
void SplitVertexMakeEdge ()
void SVME (HEHalfEdge< T > *he1, HEHalfEdge< T > *he2, Vector3< T > const *const pos1=NULL, Vector3< T > const *const pos2=NULL)
virtual ~HalfEdgeModel ()

Protected Member Functions

virtual void CalAndSetFaceNormalsNotNormalized ()
virtual void CalAndSetVertexNormals ()
virtual void CalBoundingAABB ()
virtual void CalBoundingEllipsoid ()
virtual void CalBoundingSphere ()
virtual void NormalizeFaceNormals ()

Protected Attributes

HEFaceList< T > * m_listFace
HEFaceList< T > * m_listHoleFace
HEVertexList< T > * m_listVertex

Friends

std::ostream & operator<< (std::ostream &output, HalfEdgeModel< T > const &o)


Detailed Description

template<typename T>
class HalfEdgeModel< T >

Definition at line 74 of file TAPsHalfEdgeModel.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs__OpenGL HalfEdgeModel< T >::HalfEdgeModel (  )  [inline]

Definition at line 22 of file TAPsHalfEdgeModel.cpp.

00023     : OpenGLMeshModel<T>()
00024 {
00025     m_listVertex   = new HEVertexList<T>();
00026     m_listFace     = new HEFaceList<T>();
00027     m_listHoleFace = new HEFaceList<T>();
00028     if (   m_listVertex   == NULL 
00029         || m_listFace     == NULL
00030         || m_listHoleFace == NULL ) {
00031 
00032         #ifdef TAPs_DEBUG_MODE
00033         std::cerr << "HalfEdgeModel ERROR: Can create an halfedge object." << std::endl;
00034         #endif//TAPs_DEBUG_MODE
00035 
00036         exit(1);
00037     }
00038 
00039     #ifdef TAPs_DEBUG_MODE
00040     std::cout << "HalfEdgeModel<" << typeid(T).name() << "> Constructor\n";
00041     #endif//TAPs_DEBUG_MODE
00042 }

template<typename T>
HalfEdgeModel< T >::~HalfEdgeModel (  )  [inline, virtual]

Definition at line 46 of file TAPsHalfEdgeModel.cpp.

00047 {
00048     delete m_listVertex;
00049     delete m_listFace;
00050     delete m_listHoleFace;
00051     //----------------------------------------------------------------
00052     // For simulation
00053     //delete m_prODESolver;
00054     #ifdef TAPs_DEBUG_MODE
00055     std::cout << "HalfEdgeModel<" << typeid(T).name() << "> Destructor\n";
00056     #endif//TAPs_DEBUG_MODE
00057 }


Member Function Documentation

template<typename T>
void HalfEdgeModel< T >::ApplyAndResetTransform (  )  [inline, virtual]

Apply the current transformation to the model permanently. Then reset the transformation to identity.

So that the transformation can be turned off to save the computation time that have to use when the model has the transformation on.

The side effect is that the model's original shape is permanently changed by the transformation (before the transformation is reset).

Reimplemented from Model< T >.

Reimplemented in HETriMeshOneModelMultiParts< T >.

Definition at line 207 of file TAPsHalfEdgeModel.cpp.

00208 {
00209     HEVertex<T> * heVertex = GetVertexList()->Head();
00210     //--------------------------------------------------------------------
00211     while ( heVertex ) {
00212         heVertex->SetPosition( 
00213             (     GetTransform().ReturnMatrixTransform() 
00214                 * Vector4<T>( heVertex->GetPosition() )
00215             ).GetVector3()
00216         );
00217         heVertex = heVertex->Next();
00218     }
00219     //--------------------------------------------------------------------
00220     // Set Transformation to Identity Matrix
00221     GetTransform().MakeIdentity();
00222     //--------------------------------------------------------------------
00223     // Recalculate Bounding Volume(s)
00224     CalBoundingAABB();
00225     CalBoundingEllipsoid();
00226     CalBoundingSphere();
00227 
00228     // Update the bounding volume tree
00229     if ( GetBVHTree() ) {
00230         GetBVHTree()->Update();
00231     }
00232 }

template<typename T>
void HalfEdgeModel< T >::BuildBVHTree ( TAPs::Enum::CD  treeType  )  [inline, virtual]

Reimplemented in HalfEdgeTrigonalModel< T >.

Definition at line 301 of file TAPsHalfEdgeModel.cpp.

00302 {
00303     //BVHTree<T>::
00304     // Call a static fn from BVHTree class
00305     // m_pBVHTree is inherited from ColDetSupport class
00306 
00307     //m_pBVHTree = BVHTree<T>::BuildBVHTree( GetTransform(), m_listFace, treeType, m_pBVHTree );
00308 
00309     m_pBVHTree = TAPs::CD::BuildBVHTree<T>( GetTransform(), m_listFace, treeType );
00310 
00311     //std::cout << "m_pVBHTree: " << m_pBVHTree << std::cout;
00312 }

template<typename T>
void HalfEdgeModel< T >::CalAndSetFaceNormalsNotNormalized (  )  [inline, protected, virtual]

Reimplemented in HalfEdgeTrigonalModel< T >.

Definition at line 138 of file TAPsHalfEdgeModel.cpp.

00139 {
00140     // Calculate and set the normal of each face
00141     HEFace<T> * face = m_listFace->Head();
00142     while ( face != NULL ) {
00143         Vector3<T> const & v0 = face->IncidentHalfEdge()->Prev()->Vertex()->GetPosition();
00144         Vector3<T> const & v1 = face->IncidentHalfEdge()->Vertex()->GetPosition();
00145         Vector3<T> const & v2 = face->IncidentHalfEdge()->Next()->Vertex()->GetPosition();
00146         face->SetNormal( (v1 - v0) ^ (v2 - v1) );
00147         face = face->Next();
00148     }
00149 }

template<typename T>
void HalfEdgeModel< T >::CalAndSetNormals (  )  [inline, virtual]

Reimplemented in HalfEdgeTrigonalModel< T >.

Definition at line 128 of file TAPsHalfEdgeModel.cpp.

00129 {
00130     CalAndSetFaceNormalsNotNormalized();
00131 //  DetermineFaceRings();
00132     CalAndSetVertexNormals();
00133     NormalizeFaceNormals();
00134 }

template<typename T>
void HalfEdgeModel< T >::CalAndSetVertexNormals (  )  [inline, protected, virtual]

Reimplemented in HalfEdgeTrigonalModel< T >.

Definition at line 165 of file TAPsHalfEdgeModel.cpp.

00166 {
00167     HEVertex<T> *vertex = m_listVertex->Head();
00168     HEHalfEdge<T> *halfEdge;
00169 
00170     #ifdef TAPs_DEBUG_MODE
00171     std::cout << "FIND VERTEX NORMAL" << std::endl;
00172     #endif//TAPs_DEBUG_MODE
00173 
00174     while ( vertex ) {
00175         Vector3<T> vNormal;
00176         halfEdge = vertex->IncidentHalfEdge();
00177 
00178         #ifdef TAPs_DEBUG_MODE
00179         std::cout << *halfEdge << std::endl;
00180         #endif//TAPs_DEBUG_MODE
00181 
00182         vNormal = Vector3<T>(0,0,0);
00183         int count1 = 0;
00184         int count2 = 0;
00185         do {
00186             vNormal += halfEdge->Face()->GetNormal();
00187             halfEdge = halfEdge->Pair()->Next();
00188             // Cannot use previous, because of half-edge data structure
00189             //halfEdge = halfEdge->Pair()->Prev();
00190             //if ( halfEdge == NULL ) {
00191             //  std::cout << "--------------------=================>>>>>>> NULL\n";
00192                 //assert( false );
00193             //  break;
00194             //}
00195         } while ( halfEdge != vertex->IncidentHalfEdge() );
00196 
00197         vertex->SetNormal( vNormal.Normalized() );
00198         vertex = vertex->Next();
00199     }
00200 }

template<typename T>
void HalfEdgeModel< T >::CalBoundingAABB (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 241 of file TAPsHalfEdgeModel.cpp.

00242 {
00243     HEVertex<T> *vertex = m_listVertex->Head();
00244     m_paBoundingAABB[0] = m_paBoundingAABB[1] = vertex->GetPosition();
00245     while ( vertex ) {
00246         // Find lowest x, y, and z
00247         if ( m_paBoundingAABB[0][0] > (*vertex)[0] )
00248              m_paBoundingAABB[0][0] = (*vertex)[0];
00249         if ( m_paBoundingAABB[0][1] > (*vertex)[1] )
00250              m_paBoundingAABB[0][1] = (*vertex)[1];
00251         if ( m_paBoundingAABB[0][2] > (*vertex)[2] )
00252              m_paBoundingAABB[0][2] = (*vertex)[2];
00253         // Find highest x, y, and z
00254         if ( m_paBoundingAABB[1][0] < (*vertex)[0] )
00255              m_paBoundingAABB[1][0] = (*vertex)[0];
00256         if ( m_paBoundingAABB[1][1] < (*vertex)[1] )
00257              m_paBoundingAABB[1][1] = (*vertex)[1];
00258         if ( m_paBoundingAABB[1][2] < (*vertex)[2] )
00259              m_paBoundingAABB[1][2] = (*vertex)[2];
00260         // Next vertex
00261         vertex = vertex->Next();
00262     }
00263     // Find the bounding volume center
00264     m_pBoundingCenter[0] = ( m_paBoundingAABB[0][0] + m_paBoundingAABB[1][0] ) / 2.0;
00265     m_pBoundingCenter[1] = ( m_paBoundingAABB[0][1] + m_paBoundingAABB[1][1] ) / 2.0;
00266     m_pBoundingCenter[2] = ( m_paBoundingAABB[0][2] + m_paBoundingAABB[1][2] ) / 2.0;
00267 }

template<typename T>
void HalfEdgeModel< T >::CalBoundingEllipsoid (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 270 of file TAPsHalfEdgeModel.cpp.

00271 {
00272     T x = m_paBoundingAABB[1][0] - m_pBoundingCenter[0];
00273     x *= x;
00274     T y = m_paBoundingAABB[1][1] - m_pBoundingCenter[1];
00275     y *= y;
00276     T z = m_paBoundingAABB[1][2] - m_pBoundingCenter[2];
00277     z *= z;
00278     m_pBoundingEllipsoid[1] = sqrt( y + z );
00279     m_pBoundingEllipsoid[2] = sqrt( z + x );
00280     m_pBoundingEllipsoid[0] = sqrt( x + y );
00281 }

template<typename T>
void HalfEdgeModel< T >::CalBoundingSphere (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 284 of file TAPsHalfEdgeModel.cpp.

00285 {
00286     T squaredLength;
00287     m_pBoundingSphere = 0;
00288     HEVertex<T> *vertex = m_listVertex->Head();
00289     while ( vertex ) {
00290         squaredLength = (vertex->GetPosition() - m_pBoundingCenter).SquaredLength();
00291         if ( squaredLength > m_pBoundingSphere )
00292             m_pBoundingSphere = squaredLength;
00293         // Next vertex
00294         vertex = vertex->Next();
00295     }
00296     m_pBoundingSphere = sqrt( m_pBoundingSphere );
00297 }

template<typename T>
HEFaceList<T>* const HalfEdgeModel< T >::GetFaceList (  )  const [inline]

Definition at line 190 of file TAPsHalfEdgeModel.hpp.

00190 { return m_listFace; }

template<typename T>
HEFaceList<T>* const HalfEdgeModel< T >::GetHoleFaceList (  )  const [inline]

Definition at line 191 of file TAPsHalfEdgeModel.hpp.

00191 { return m_listHoleFace; }

template<typename T>
T HalfEdgeModel< T >::GetMaxHalfLength (  )  const [inline, virtual]

Implements Model< T >.

Definition at line 110 of file TAPsHalfEdgeModel.cpp.

00111 {
00112     T maxHalfSize = 0.0;
00113     HEVertex<T> *ptr = m_listVertex->Head();
00114     while ( ptr != NULL ) {
00115         if ( fabs( (*ptr)[0] ) > maxHalfSize )
00116             maxHalfSize = fabs( (*ptr)[0] );
00117         if ( fabs( (*ptr)[1] ) > maxHalfSize )
00118             maxHalfSize = fabs( (*ptr)[1] );
00119         if ( fabs( (*ptr)[2] ) > maxHalfSize )
00120             maxHalfSize = fabs( (*ptr)[2] );
00121         ptr = ptr->Next();
00122     }
00123     return maxHalfSize;
00124 }

template<typename T>
HEVertexList<T>* const HalfEdgeModel< T >::GetVertexList (  )  const [inline]

Definition at line 189 of file TAPsHalfEdgeModel.hpp.

00189 { return m_listVertex; }

template<typename T>
void HalfEdgeModel< T >::Initialize (  )  [inline, virtual]

Implements Model< T >.

Reimplemented in HalfEdgeTrigonalModel< T >, HETriMeshOneModelMultiParts< T >, and SpringHalfEdgeModel< T >.

Definition at line 62 of file TAPsHalfEdgeModel.cpp.

00063 {
00064     // Model Initialization
00065     CalAndSetNormals();
00066     ApplyMaterial();
00067     CalBoundingAABB();
00068     CalBoundingEllipsoid();
00069     CalBoundingSphere();
00070 
00071     // For Fast Access
00072     //SetListOfVertexPositionsAndNormals();
00073 
00074     /*
00075     std::cout << *this << std::endl;
00076     //*/
00077 }

template<typename T>
void HalfEdgeModel< T >::InsertVertexSplitEdge (  )  [inline]

Definition at line 223 of file TAPsHalfEdgeModel.hpp.

00223 {};

template<typename T>
void HalfEdgeModel< T >::IVSE ( HEHalfEdge< T > *  he,
Vector3< T > const *const   pos = NULL 
) [inline]

Definition at line 352 of file TAPsHalfEdgeModel.cpp.

00353 {
00354     //---------------------------------------------------------------
00355     // Crete New Vertex
00356     HEVertex<T> * newVertex;
00357     if ( pos != NULL ) {
00358         newVertex = new HEVertex<T>( *pos, he->Vertex()->GetNormal() );
00359     }
00360     else {
00361         newVertex = new HEVertex<T>( he->Vertex()->GetPosition(), 
00362                                      he->Vertex()->GetNormal() );
00363     }
00364     //---------------------------------------------------------------
00365     // Update Vertex List and Number of Vertices
00366     //GetVertexList()->Append( newVertex ); // or Append or Prepend
00367     GetVertexList()->InsertAfter( newVertex );  // or Append or Prepend
00368     SetNoVertices( GetVertexList()->Size() );
00369     //SetNoVertices( GetNoVertices() + 1 );
00370     //---------------------------------------------------------------
00371     // Crete New HalfEdges
00372     HEHalfEdge<T> * newHalfEdge = new HEHalfEdge<T>( 
00373                         newVertex,      // original vertex
00374                         he->Face(),     // incident face
00375                         he,             // previous halfedge
00376                         he->Next(),     // next halfedge
00377                         he->Pair() );   // pair halfedge
00378     HEHalfEdge<T> * newPairHalfEdge = new HEHalfEdge<T>( 
00379                     newVertex,          // original vertex
00380                     he->Pair()->Face(), // incident face
00381                     he->Pair(),         // previous halfedge
00382                     he->Pair()->Next(), // next halfedge
00383                     he );               // pair halfedge
00384     //---------------------------------------------------------------
00385     // Rearrange Pointers
00386     newHalfEdge->Pair()->Pair( newHalfEdge );
00387     newHalfEdge->Prev()->Next( newHalfEdge );
00388     newHalfEdge->Next()->Prev( newHalfEdge );
00389     newPairHalfEdge->Pair()->Pair( newPairHalfEdge );
00390     newPairHalfEdge->Prev()->Next( newPairHalfEdge );
00391     newPairHalfEdge->Next()->Prev( newPairHalfEdge );
00392     newVertex->IncidentHalfEdge( newHalfEdge );
00393 }

template<typename T>
void HalfEdgeModel< T >::JFKE ( HEHalfEdge< T > *  he  )  [inline]

Definition at line 594 of file TAPsHalfEdgeModel.cpp.

00595 {
00596     //------------------------------------------------------------------
00597     HEFace<T> * f1 = he->Face();
00598     HEFace<T> * f2 = he->Pair()->Face();
00599     //------------------------------------------------------------------
00600     f1->IncidentHalfEdge( he->Prev() );
00601     //------------------------------------------------------------------
00602     // Rearrange all halfedges in f2 to have incident face f1
00603     int i = 0;
00604     HEHalfEdge<T> * pHalfEdge = he->Pair()->Next();
00605     while ( pHalfEdge != he->Pair() ) {
00606         std::cout << ++i << std::endl;
00607         pHalfEdge->Face( f1 );
00608         pHalfEdge = pHalfEdge->Next();
00609     }
00610 
00611     std::cout << "Start Rearranging Pointers" << std::endl;
00612 
00613     //------------------------------------------------------------------
00614     // Rearrange Pointers
00615     he->Vertex()->IncidentHalfEdge( he->Pair()->Next() );
00616     he->Pair()->Vertex()->IncidentHalfEdge( he->Next() );
00617     he->Prev()->Next( he->Pair()->Next() );
00618     he->Next()->Prev( he->Pair()->Prev() );
00619     he->Pair()->Prev()->Next( he->Next() );
00620     he->Pair()->Next()->Prev( he->Prev() );
00621 
00622     std::cout << "Start Deleting Pointers" << std::endl;
00623 
00624     //------------------------------------------------------------------
00625     // Delete Pointers
00626     int count = 0;
00627     std::cout << ++count << std::endl;
00628     GetFaceList()->Delete( f2 );    // delete the face (f2)
00629     std::cout << ++count << std::endl;
00630     delete he->Pair();              // delete the halfedge's pair
00631     std::cout << ++count << std::endl;
00632     delete he;                      // delete the halfedge
00633     std::cout << ++count << std::endl;
00634     //-----------------------------------------------------
00635     std::cout << "SetNoFaces" << std::endl;
00636     SetNoFaces( GetFaceList()->Size() );
00637     //------------------------------------------------------------------
00638     std::cout << "Finish" << std::endl;
00639 }

template<typename T>
void HalfEdgeModel< T >::JoinFaceKillEdge (  )  [inline]

Definition at line 227 of file TAPsHalfEdgeModel.hpp.

00227 {};

template<typename T>
void HalfEdgeModel< T >::JoinVertexKillEdge (  )  [inline]

Definition at line 225 of file TAPsHalfEdgeModel.hpp.

00225 {};

template<typename T>
void HalfEdgeModel< T >::JVKE ( HEHalfEdge< T > *  he,
Vector3< T > const *const   pos = NULL 
) [inline]

Definition at line 488 of file TAPsHalfEdgeModel.cpp.

00489 {
00490     if ( pos != NULL )  he->Vertex()->SetPosition( *pos );
00491     //-----------------------------------------------------
00492     // Change all halfedges that eminate from delete vertex to vertex of he
00493     // Except the starting halfedge, which is he->Pair(),
00494     // since we need to delete he->Pair()->Vertex().
00495     HEHalfEdge<T> * pStartHalfEdge = he->Pair();
00496     HEHalfEdge<T> * pCurrentHalfEdge = he->Next();
00497     while ( pCurrentHalfEdge != pStartHalfEdge ) {
00498         pCurrentHalfEdge->Vertex( he->Vertex() );
00499         pCurrentHalfEdge = pCurrentHalfEdge->Pair()->Next();
00500     }
00501     //-----------------------------------------------------
00502     // Rearrange and Delete Pointers
00503     he->Vertex()->IncidentHalfEdge( he->Next() );
00504     GetVertexList()->Delete( he->Pair()->Vertex() );    // delete the vertex
00505     he->Pair()->Face()->IncidentHalfEdge( he->Pair()->Next() );
00506     he->Face()->IncidentHalfEdge( he->Next() );
00507     he->Prev()->Next( he->Next() );
00508     he->Next()->Prev( he->Prev() );
00509     he->Pair()->Prev()->Next( he->Pair()->Next() );
00510     he->Pair()->Next()->Prev( he->Pair()->Prev() );
00511     delete he->Pair();          // delete the halfedge's pair
00512     delete he;                  // delete the halfedge
00513     //-----------------------------------------------------
00514     SetNoVertices( GetVertexList()->Size() );
00515     //std::cout << "NoVertices: " << GetNoVertices() << "\n";
00516 }

template<typename T>
void HalfEdgeModel< T >::NormalizeFaceNormals (  )  [inline, protected, virtual]

Reimplemented in HalfEdgeTrigonalModel< T >.

Definition at line 153 of file TAPsHalfEdgeModel.cpp.

00154 {
00155     // Normalize the normal of each face
00156     HEFace<T> * face = m_listFace->Head();
00157     while ( face != NULL ) {
00158         const_cast< Vector3<T> * >( &face->GetNormal() )->Normalized();
00159         face = face->Next();
00160     }
00161 }

template<typename T>
void HalfEdgeModel< T >::SFME ( HEHalfEdge< T > *  he1,
HEHalfEdge< T > *  he2 
) [inline]

Definition at line 533 of file TAPsHalfEdgeModel.cpp.

00534 {
00535     //------------------------------------------------------------------
00536     // Cancel if he1 and he2 are pointing to the same halfedge
00537     if ( he1 == he2 )   return;
00538     //------------------------------------------------------------------
00539     // Cancel if he1 and he2 have different incident face
00540     if ( he1->Face() != he2->Face() )   return;
00541     //------------------------------------------------------------------
00542     // Create a new face f2
00543     HEFace<T> * f1 = he1->Face();
00544     HEFace<T> * f2 = new HEFace<T>( f1->GetNormal() );
00545     //GetFaceList()->Append( f2 );          // append f2 to the face list
00546     GetFaceList()->InsertAfter( f2 );       // append f2 to the face list
00547     SetNoFaces( GetFaceList()->Size() );    // update face size
00548     //------------------------------------------------------------------
00549     // Create new halfedges spliting f1 into f1 and f2
00550     HEHalfEdge<T> * h = new HEHalfEdge<T>( 
00551                         he1->Next()->Vertex(),  // original vertex
00552                         f1,                     // incident face
00553                         he1,                    // previous halfedge
00554                         he2->Next(),            // next halfedge
00555                         NULL );                 // pair halfedge
00556     HEHalfEdge<T> * g = new HEHalfEdge<T>( 
00557                         he2->Next()->Vertex(),  // original vertex
00558                         f2,                     // incident face
00559                         he2,                    // previous halfedge
00560                         he1->Next(),            // next halfedge
00561                         h );                    // pair halfedge
00562     h->Pair( g );
00563     //------------------------------------------------------------------
00564     // Rearrange all halfedges between h to g to have incident face f2
00565     HEHalfEdge<T> * pHalfEdge = he1->Next();
00566     while ( pHalfEdge != he2 ) {
00567         pHalfEdge->Face( f2 );
00568         pHalfEdge = pHalfEdge->Next();
00569     }
00570     //------------------------------------------------------------------
00571     // Rearrange pointers
00572     h->Prev()->Next( h );
00573     h->Next()->Prev( h );
00574     g->Prev()->Next( g );
00575     g->Next()->Prev( g );
00576     f2->IncidentHalfEdge( g );
00577 }

template<typename T>
void HalfEdgeModel< T >::SplitFaceMakeEdge (  )  [inline]

Definition at line 226 of file TAPsHalfEdgeModel.hpp.

00226 {};

template<typename T>
void HalfEdgeModel< T >::SplitVertexMakeEdge (  )  [inline]

Definition at line 224 of file TAPsHalfEdgeModel.hpp.

00224 {};

template<typename T>
void HalfEdgeModel< T >::SVME ( HEHalfEdge< T > *  he1,
HEHalfEdge< T > *  he2,
Vector3< T > const *const   pos1 = NULL,
Vector3< T > const *const   pos2 = NULL 
) [inline]

Definition at line 409 of file TAPsHalfEdgeModel.cpp.

00411 {
00412     //---------------------------------------------------------------
00413     // Case the same halfedge, call Insert Vertex Split Edge
00414     if ( he1 == he2 ) {
00415         if ( pos2 != NULL ) {
00416             he1->Pair()->Vertex()->SetPosition( *pos2 );
00417         }
00418         IVSE( he1, pos1 );
00419         return;
00420     }
00421     //---------------------------------------------------------------
00422     // Case two different vertices, cancel spliting
00423     if ( he1->Pair()->Vertex() != he2->Pair()->Vertex() ) {
00424         return;
00425     }
00426     //---------------------------------------------------------------
00427     // Case one vertex, do spliting
00428     HEVertex<T> * vertex1, * newVertex;
00429     vertex1 = he1->Pair()->Vertex();
00430     //-----------------------------------------------------
00431     // Create a New Vertex and set the old vertex
00432     if ( pos1 != NULL ) {
00433         vertex1->SetPosition( *pos1 );
00434     }
00435     if ( pos2 != NULL ) {
00436         newVertex = new HEVertex<T>( *pos2, vertex1->GetNormal() );
00437     }
00438     else {
00439         newVertex = new HEVertex<T>( vertex1->GetPosition(), 
00440                                    vertex1->GetNormal() );
00441     }
00442     //-----------------------------------------------------
00443     // Update Vertex List and Number of Vertices
00444     //GetVertexList()->Append( newVertex );
00445     GetVertexList()->InsertAfter( newVertex );
00446     SetNoVertices( GetVertexList()->Size() );
00447     //SetNoVertices( GetNoVertices() + 1 );
00448     //-----------------------------------------------------
00449     // Crete New HalfEdges
00450     HEHalfEdge<T> * newHalfEdge = new HEHalfEdge<T>( 
00451                         vertex1,        // original vertex
00452                         he1->Face(),    // incident face
00453                         he1,            // previous halfedge
00454                         he1->Next(),    // next halfedge
00455                         NULL );         // pair halfedge
00456     HEHalfEdge<T> * newPairHalfEdge = new HEHalfEdge<T>( 
00457                         newVertex,      // original vertex
00458                         he2->Face(),    // incident face
00459                         he2,            // previous halfedge
00460                         he2->Next(),    // next halfedge
00461                         newHalfEdge );  // pair halfedge
00462     newHalfEdge->Pair( newPairHalfEdge );
00463     //-----------------------------------------------------
00464     // Rearrange Pointers
00465     newHalfEdge->Prev()->Next( newHalfEdge );
00466     newHalfEdge->Next()->Prev( newHalfEdge );
00467     newPairHalfEdge->Prev()->Next( newPairHalfEdge );
00468     newPairHalfEdge->Next()->Prev( newPairHalfEdge );
00469     newHalfEdge->Next()->Vertex( newVertex );
00470     newVertex->IncidentHalfEdge( newPairHalfEdge );
00471     //-----------------------------------------------------
00472 }


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
HalfEdgeModel< T > const &  o 
) [friend]

Definition at line 77 of file TAPsHalfEdgeModel.hpp.

00078     {
00079         output  << "\n======================\n"
00080                 <<   "TAPs::HalfEdgeModel<"
00081                 << typeid(T).name() << "> Class:\n"
00082                 <<   "======================\n";
00083         //----------------------------------------------------------------
00084         output << "Name: " << o.GetName() << "\n";
00085         // Vertex Nodes
00086         output  << "\n\nVertices " << o.m_listVertex->Size();
00087         /*
00088         int i;
00089         i = 0;
00090         HEVertex<T> *vertex = o.m_listVertex->Head();
00091         output << "\n{";
00092         while ( vertex ) {
00093             output << "\n  #" << ++i << "\t" << *vertex;
00094             vertex = vertex->Next();
00095         }
00096         output  << "\n}";
00097         //*/
00098         //----------------------------------------------------------------
00099         // Face Nodes
00100         output  << "\n\nFaces " << o.m_listFace->Size();
00101         /*
00102         i = 0;
00103         HEFace<T> *face = o.m_listFace->Head();
00104         output << "\n{";
00105         while ( face ) {
00106             output << "\n  #" << ++i << "\t" << *face;
00107             face = face->Next();
00108         }
00109         output  << "\n}";
00110         //*/
00111         //----------------------------------------------------------------
00112         // Hole Face Nodes
00113         output  << "\n\nHole Faces " << o.m_listHoleFace->Size();
00114         /*
00115         i = 0;
00116         face = o.m_listHoleFace->Head();
00117         output << "\n{";
00118         while ( face ) {
00119             output << "\n  #" << ++i << "\t" << *face;
00120             face = face->Next();
00121         }
00122         output  << "\n}";
00123         //*/
00124         //----------------------------------------------------------------
00125         return output;
00126     }


Member Data Documentation

template<typename T>
HEFaceList<T>* HalfEdgeModel< T >::m_listFace [protected]

Definition at line 248 of file TAPsHalfEdgeModel.hpp.

template<typename T>
HEFaceList<T>* HalfEdgeModel< T >::m_listHoleFace [protected]

Definition at line 249 of file TAPsHalfEdgeModel.hpp.

template<typename T>
HEVertexList<T>* HalfEdgeModel< T >::m_listVertex [protected]

Definition at line 247 of file TAPsHalfEdgeModel.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:44:56 2008 for TAPs by  doxygen 1.5.6