Public Member Functions | Protected Member Functions | Protected Attributes | Private Types

MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge > Class Template Reference

CBoundary Boundary class. More...

#include <boundary.h>

Collaboration diagram for MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBoundary (CBaseMesh< CVertex, CEdge, CFace, CHalfEdge > *pMesh)
 ~CBoundary ()
std::vector< TLoop * > & loops ()

Protected Member Functions

void _bubble_sort (std::vector< CLoop< CVertex, CEdge, CFace, CHalfEdge > * > &loops)

Protected Attributes

CBaseMesh< CVertex, CEdge,
CFace, CHalfEdge > * 
m_pMesh
std::vector< TLoop * > m_loops

Private Types

typedef CLoop< CVertex, CEdge,
CFace, CHalfEdge
TLoop

Detailed Description

template<typename CVertex, typename CEdge, typename CFace, typename CHalfEdge>
class MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >

CBoundary Boundary class.

Template Parameters:
CVertex Vertex type
CEdge Edge type
CFace Face type
CHalfEdge HalfEdge type

Definition at line 88 of file boundary.h.


Member Typedef Documentation

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
typedef CLoop<CVertex,CEdge, CFace, CHalfEdge> MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::TLoop [private]

Definition at line 90 of file boundary.h.


Constructor & Destructor Documentation

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::CBoundary ( CBaseMesh< CVertex, CEdge, CFace, CHalfEdge > *  pMesh  ) 

CBoundary constructor

Parameters:
pMesh pointer to the current mesh

CBoundary constructor

Parameters:
pMesh the current mesh

Definition at line 190 of file boundary.h.

{
        m_pMesh = pMesh;
        //collect all boundary halfedges
        std::set<CHalfEdge*> boundary_hes;
        for( MeshEdgeIterator<CVertex, CEdge, CFace, CHalfEdge> eiter( m_pMesh); !eiter.end(); eiter ++ )
        {
                CEdge * e = *eiter;
                if( !m_pMesh->isBoundary(e) ) continue;

                CHalfEdge * he = m_pMesh->edgeHalfedge( e, 0);
                boundary_hes.insert( he );
        }
        //trace all the boundary loops
        while( !boundary_hes.empty() )
        {
                //get the first boundary halfedge
                std::set<CHalfEdge*>::iterator siter = boundary_hes.begin();
                CHalfEdge * he = *siter;
                //trace along this boundary halfedge
                CLoop<CVertex, CEdge, CFace, CHalfEdge> * pL = new CLoop<CVertex, CEdge, CFace, CHalfEdge>( m_pMesh, he );
                assert(pL);
                m_loops.push_back( pL );
                //remove all the boundary halfedges, which are in the same boundary loop as the head, from the halfedge list
                for( std::list<CHalfEdge*>::iterator hiter = pL->halfedges().begin(); 
                        hiter != pL->halfedges().end(); hiter ++ )
                {
                        CHalfEdge * he = *hiter;
                        siter = boundary_hes.find( he );
                        if( siter == boundary_hes.end() ) continue;
                        boundary_hes.erase( siter );
                }
        }
        
        //std::sort( vlps.begin(), vlps.end(), loop_compare<CVertex,CFace,CEdge,CHalfEdge> );

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::~CBoundary (  ) 

CBoundary destructor

CBoundary destructor, delete all boundary loop objects.

Definition at line 231 of file boundary.h.

{
        for( int i = 0; i < (int)m_loops.size(); i ++ )
        {
                CLoop<CVertex, CEdge, CFace, CHalfEdge> * pL = m_loops[i];
                delete pL;


Member Function Documentation

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
void MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::_bubble_sort ( std::vector< CLoop< CVertex, CEdge, CFace, CHalfEdge > * > &  loops  )  [protected]

Bubble sort the loops

Parameters:
loops the vector of loops

_bubble_sort bubble sort a vector of boundary loop objects, according to their lengths

Parameters:
loops vector of loops

Definition at line 164 of file boundary.h.

{
      int i, j, flag = 1;    // set flag to 1 to start first pass
      CLoop<CVertex,CEdge,CFace,CHalfEdge> * temp;             // holding variable
      int numLength = (int)loops.size( ); 
      for(i = 1; (i <= numLength) && flag; i++)
     {
          flag = 0;
          for (j=0; j < (numLength -1); j++)
         {
               if (loops[j+1]->length() > loops[j]->length() )      // ascending order simply changes to <
              { 
                    temp = loops[j];                                                            // swap elements
                    loops[j] = loops[j+1];
                    loops[j+1] = temp;
                    flag = 1;                                                                           // indicates that a swap occurred.
               }
          }

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
std::vector<TLoop*>& MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::loops (  )  [inline]

The list of boundary loops.

Definition at line 105 of file boundary.h.

        { 


Member Data Documentation

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
std::vector<TLoop*> MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::m_loops [protected]

List of boundary loops.

Definition at line 118 of file boundary.h.

template<typename CVertex , typename CEdge , typename CFace , typename CHalfEdge >
CBaseMesh<CVertex,CEdge,CFace,CHalfEdge>* MeshLib::CBoundary< CVertex, CEdge, CFace, CHalfEdge >::m_pMesh [protected]

Pointer to the current mesh.

Definition at line 114 of file boundary.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines