HEFace< T > Class Template Reference

#include <TAPsHEFace.hpp>

List of all members.

Public Member Functions

void AppendTexCoord (T s, T t)
int CountNumberOfVertices () const
void Delete ()
std::vector< Vector3< T > > GetCopyOfVertexPositions (int i) const
std::vector< Vector3< T > > GetCopyOfVertexPositions () const
Vector3< T > const & GetNormal () const
int GetNoTexCoords () const
int GetNumTexCoords () const
std::vector< HEVertex< T >
const *const > 
GetPtrsToVertices (int i) const
std::vector< HEVertex< T >
*const > 
GetPtrsToVertices (int i)
std::vector< HEVertex< T >
const *const > 
GetPtrsToVertices () const
std::vector< HEVertex< T >
*const > 
GetPtrsToVertices ()
std::vector< HEVertex< T >
const *const > 
GetPtrsToVerticesAndNumberOfVertices (int &numberOfVertices) const
std::vector< HEVertex< T >
*const > 
GetPtrsToVerticesAndNumberOfVertices (int &numberOfVertices)
void GetTexCoordHalfNo (int i, T &v) const
GetTexCoordHalfNo (int i) const
void GetTexCoordNo (int i, T &s, T &t) const
void GetTexCoordNoS (int i, T &s) const
GetTexCoordNoS (int i) const
void GetTexCoordNoT (int i, T &t) const
GetTexCoordNoT (int i) const
 HEFace (HEFace< T > const &he)
 HEFace (HEHalfEdge< T > *const incidentHalfEdge)
 HEFace (Vector3< T > normal=Vector3< T >())
HEHalfEdge< T > * IncidentHalfEdge () const
void IncidentHalfEdge (HEHalfEdge< T > *const incidentHalfEdge)
HEFace< T > * Insert (HEFace< T > *const n)
void InsertTexCoordNo (int i, T s, T t)
void Next (HEFace< T > *const v)
HEFace< T > * Next () const
void Prev (HEFace< T > *const v)
HEFace< T > * Prev () const
HEFace< T > * Remove ()
void RemoveTexCoordNo (int i)
void SetNormal (T x, T y, T z)
void SetNormal (Vector3< T > normal)
void SetTexCoordHalfNo (int i, T v)
void SetTexCoordNo (int i, T s, T t)
void SetTexCoordNoS (int i, T s)
void SetTexCoordNoT (int i, T t)
HEFace< T > * Splice (HEFace< T > *const n)
virtual ~HEFace ()

Protected Attributes

std::vector< T > m_2DTexCoordsVector
 texture coordinate list
Vector3< T > m_vNormal
 normal vector
HEHalfEdge< T > * nIncidentHalfEdge
 incident half-edge
HEFace< T > * nNext
 next face in a doubly linked list
HEFace< T > * nPrev
 previous face in a doubly linked list

Friends

std::ostream & operator<< (std::ostream &output, HEFace< T > const &f)


Detailed Description

template<typename T>
class HEFace< T >

Definition at line 41 of file TAPsHEFace.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs HEFace< T >::HEFace ( Vector3< T >  normal = Vector3<T>()  )  [inline]

Definition at line 39 of file TAPsHEFace.cpp.

00040     : m_vNormal( normal ), 
00041       nIncidentHalfEdge( NULL ),
00042       nPrev( NULL ),
00043       nNext( NULL )
00044 {}

template<typename T>
HEFace< T >::HEFace ( HEHalfEdge< T > *const   incidentHalfEdge  )  [inline]

Definition at line 47 of file TAPsHEFace.cpp.

00048     : m_vNormal(), 
00049       nIncidentHalfEdge( incidentHalfEdge ),
00050       nPrev( NULL ),
00051       nNext( NULL )
00052 {}  

template<typename T>
HEFace< T >::HEFace ( HEFace< T > const &  he  )  [inline]

Definition at line 55 of file TAPsHEFace.cpp.

00056     : m_2DTexCoordsVector( he.m_2DTexCoordsVector ),
00057       m_vNormal( normal ),
00058       nIncidentHalfEdge( he.nIncidentHalfEdge ),
00059       nPrev( he.nPrev ),
00060       nNext( he.nNext )
00061 {}

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

Definition at line 64 of file TAPsHEFace.cpp.

00065 {
00066 //  nIncidentHalfEdge->ClearExceptItself();
00067 //  delete nIncidentHalfEdge;
00068 }


Member Function Documentation

template<typename T>
void HEFace< T >::AppendTexCoord ( s,
t 
) [inline]

Definition at line 169 of file TAPsHEFace.cpp.

00170 {   
00171     m_2DTexCoordsVector.push_back( s );
00172     m_2DTexCoordsVector.push_back( t );
00173 }

template<typename T>
int HEFace< T >::CountNumberOfVertices (  )  const [inline]

Definition at line 235 of file TAPsHEFace.cpp.

00236 {
00237     int numberOfVertices = 0;
00238     if ( nIncidentHalfEdge == NULL )    return 0;
00239     //--------------------------------------------------------------------
00240     HEHalfEdge<T> firstHalfEdge = nIncidentHalfEdge;
00241     HEHalfEdge<T> currentHalfEdge = nIncidentHalfEdge;
00242     do {
00243         ++numberOfVertices;
00244         currentHalfEdge = currentHalfEdge->Next();
00245     } while ( firstHalfEdge != currentHalfEdge );
00246     //--------------------------------------------------------------------
00247     return numberOfVertices;
00248 }

template<typename T>
void HEFace< T >::Delete (  )  [inline]

Definition at line 214 of file TAPsHEFace.cpp.

00215 {
00216     delete Remove();
00217 }

template<typename T>
std::vector< Vector3< T > > HEFace< T >::GetCopyOfVertexPositions ( int  i  )  const [inline]

Definition at line 374 of file TAPsHEFace.cpp.

00375 {
00376     std::vector< Vector3<T> > vertexPositions;
00377     if ( nIncidentHalfEdge == NULL )    return vertexPositions;
00378     //--------------------------------------------------------------------
00379     int count = 0;
00380     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00381     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00382     do {
00383         ++count;
00384         vertexPositions.push_back( currentHalfEdge->Vertex()->GetPosition() );
00385         currentHalfEdge = currentHalfEdge->Next();
00386     } while ( firstHalfEdge != currentHalfEdge && count < i );
00387     //--------------------------------------------------------------------
00388     return vertexPositions;
00389 }

template<typename T>
std::vector< Vector3< T > > HEFace< T >::GetCopyOfVertexPositions (  )  const [inline]

Definition at line 357 of file TAPsHEFace.cpp.

00358 {
00359     std::vector< Vector3<T> > vertexPositions;
00360     if ( nIncidentHalfEdge == NULL )    return vertexPositions;
00361     //--------------------------------------------------------------------
00362     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00363     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00364     do {
00365         ++count;
00366         vertexPositions.push_back( currentHalfEdge->Vertex()->GetPosition() );
00367         currentHalfEdge = currentHalfEdge->Next();
00368     } while ( firstHalfEdge != currentHalfEdge );
00369     //--------------------------------------------------------------------
00370     return vertexPositions;
00371 }

template<typename T>
Vector3<T> const& HEFace< T >::GetNormal (  )  const [inline]

Definition at line 106 of file TAPsHEFace.hpp.

00106 { return m_vNormal; }

template<typename T>
int HEFace< T >::GetNoTexCoords (  )  const [inline]

Definition at line 78 of file TAPsHEFace.cpp.

00079 {   return static_cast<int>(m_2DTexCoordsVector.size()) / 2;    }

template<typename T>
int HEFace< T >::GetNumTexCoords (  )  const [inline]

Definition at line 110 of file TAPsHEFace.hpp.

00110 { return GetNoTexCoords(); }

template<typename T>
std::vector< HEVertex< T > const *const > HEFace< T >::GetPtrsToVertices ( int  i  )  const [inline]

Definition at line 339 of file TAPsHEFace.cpp.

00340 {
00341     std::vector< HEVertex<T> const * const > ptrsToVertices;
00342     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00343     //--------------------------------------------------------------------
00344     int count = 0;
00345     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00346     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00347     do {
00348         ++count;
00349         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00350         currentHalfEdge = currentHalfEdge->Next();
00351     } while ( firstHalfEdge != currentHalfEdge && count < i );
00352     //--------------------------------------------------------------------
00353     return ptrsToVertices;
00354 }

template<typename T>
std::vector< HEVertex< T > *const > HEFace< T >::GetPtrsToVertices ( int  i  )  [inline]

Definition at line 321 of file TAPsHEFace.cpp.

00322 {
00323     std::vector< HEVertex<T> * const > ptrsToVertices;
00324     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00325     //--------------------------------------------------------------------
00326     int count = 0;
00327     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00328     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00329     do {
00330         ++count;
00331         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00332         currentHalfEdge = currentHalfEdge->Next();
00333     } while ( firstHalfEdge != currentHalfEdge && count < i );
00334     //--------------------------------------------------------------------
00335     return ptrsToVertices;
00336 }

template<typename T>
std::vector< HEVertex< T > const *const > HEFace< T >::GetPtrsToVertices (  )  const [inline]

Definition at line 267 of file TAPsHEFace.cpp.

00268 {
00269     std::vector< HEVertex<T> const * const > ptrsToVertices;
00270     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00271     //--------------------------------------------------------------------
00272     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00273     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00274     do {
00275         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00276         currentHalfEdge = currentHalfEdge->Next();
00277     } while ( firstHalfEdge != currentHalfEdge );
00278     //--------------------------------------------------------------------
00279     return ptrsToVertices;
00280 }

template<typename T>
std::vector< HEVertex< T > *const > HEFace< T >::GetPtrsToVertices (  )  [inline]

Definition at line 251 of file TAPsHEFace.cpp.

00252 {
00253     std::vector< HEVertex<T> * const > ptrsToVertices;
00254     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00255     //--------------------------------------------------------------------
00256     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00257     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00258     do {
00259         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00260         currentHalfEdge = currentHalfEdge->Next();
00261     } while ( firstHalfEdge != currentHalfEdge );
00262     //--------------------------------------------------------------------
00263     return ptrsToVertices;
00264 }

template<typename T>
std::vector< HEVertex< T > const *const > HEFace< T >::GetPtrsToVerticesAndNumberOfVertices ( int &  numberOfVertices  )  const [inline]

Definition at line 303 of file TAPsHEFace.cpp.

00304 {
00305     numberOfVertices = 0;
00306     std::vector< HEVertex<T> const * const > ptrsToVertices;
00307     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00308     //--------------------------------------------------------------------
00309     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00310     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00311     do {
00312         ++numberOfVertices;
00313         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00314         currentHalfEdge = currentHalfEdge->Next();
00315     } while ( firstHalfEdge != currentHalfEdge );
00316     //--------------------------------------------------------------------
00317     return ptrsToVertices;
00318 }

template<typename T>
std::vector< HEVertex< T > *const > HEFace< T >::GetPtrsToVerticesAndNumberOfVertices ( int &  numberOfVertices  )  [inline]

Definition at line 284 of file TAPsHEFace.cpp.

00285 {
00286     numberOfVertices = 0;
00287     std::vector< HEVertex<T> * const > ptrsToVertices;
00288     if ( nIncidentHalfEdge == NULL )    return ptrsToVertices;
00289     //--------------------------------------------------------------------
00290     HEHalfEdge<T> * firstHalfEdge = nIncidentHalfEdge;
00291     HEHalfEdge<T> * currentHalfEdge = nIncidentHalfEdge;
00292     do {
00293         ++numberOfVertices;
00294         ptrsToVertices.push_back( currentHalfEdge->Vertex() );
00295         currentHalfEdge = currentHalfEdge->Next();
00296     } while ( firstHalfEdge != currentHalfEdge );
00297     //--------------------------------------------------------------------
00298     return ptrsToVertices;
00299 }

template<typename T>
void HEFace< T >::GetTexCoordHalfNo ( int  i,
T &  v 
) const [inline]

Definition at line 147 of file TAPsHEFace.cpp.

00148 {   
00149     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size()) );
00150     v = m_2DTexCoordsVector[i];
00151 }

template<typename T>
T HEFace< T >::GetTexCoordHalfNo ( int  i  )  const [inline]

Definition at line 140 of file TAPsHEFace.cpp.

00141 {   
00142     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size()) );
00143     return m_2DTexCoordsVector[i];
00144 }

template<typename T>
void HEFace< T >::GetTexCoordNo ( int  i,
T &  s,
T &  t 
) const [inline]

Definition at line 124 of file TAPsHEFace.cpp.

00125 {
00126     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00127     s = m_2DTexCoordsVector[i*2    ];
00128     t = m_2DTexCoordsVector[i*2 + 1];
00129 }

template<typename T>
void HEFace< T >::GetTexCoordNoS ( int  i,
T &  s 
) const [inline]

Definition at line 96 of file TAPsHEFace.cpp.

00097 {
00098     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00099     s = m_2DTexCoordsVector[i*2];
00100 }

template<typename T>
T HEFace< T >::GetTexCoordNoS ( int  i  )  const [inline]

Definition at line 82 of file TAPsHEFace.cpp.

00083 {
00084     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00085     return m_2DTexCoordsVector[i*2];
00086 }

template<typename T>
void HEFace< T >::GetTexCoordNoT ( int  i,
T &  t 
) const [inline]

Definition at line 103 of file TAPsHEFace.cpp.

00104 {
00105     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00106     t = m_2DTexCoordsVector[i*2 + 1];
00107 }

template<typename T>
T HEFace< T >::GetTexCoordNoT ( int  i  )  const [inline]

Definition at line 89 of file TAPsHEFace.cpp.

00090 {
00091     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00092     return m_2DTexCoordsVector[i*2 + 1];
00093 }

template<typename T>
HEHalfEdge<T>* HEFace< T >::IncidentHalfEdge (  )  const [inline]

Definition at line 149 of file TAPsHEFace.hpp.

00150     { return nIncidentHalfEdge; }

template<typename T>
void HEFace< T >::IncidentHalfEdge ( HEHalfEdge< T > *const   incidentHalfEdge  )  [inline]

Definition at line 147 of file TAPsHEFace.hpp.

00148     { nIncidentHalfEdge = incidentHalfEdge; }

template<typename T>
HEFace< T > * HEFace< T >::Insert ( HEFace< T > *const   n  )  [inline]

Definition at line 189 of file TAPsHEFace.cpp.

00190 {
00191     HEFace<T> *c = nNext;
00192     n->nNext = c;
00193     n->nPrev = this;
00194     nNext    = n;
00195     c->nPrev = n;
00196     return n;
00197 }

template<typename T>
void HEFace< T >::InsertTexCoordNo ( int  i,
s,
t 
) [inline]

Definition at line 161 of file TAPsHEFace.cpp.

00162 {   
00163     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00164     m_2DTexCoordsVector.insert( i*2,   s );
00165     m_2DTexCoordsVector.insert( i*2+1, t );
00166 }

template<typename T>
void HEFace< T >::Next ( HEFace< T > *const   v  )  [inline]

Definition at line 156 of file TAPsHEFace.hpp.

00156 { nNext = v; }

template<typename T>
HEFace<T>* HEFace< T >::Next (  )  const [inline]

Definition at line 154 of file TAPsHEFace.hpp.

00154 { return nNext; }

template<typename T>
void HEFace< T >::Prev ( HEFace< T > *const   v  )  [inline]

Definition at line 155 of file TAPsHEFace.hpp.

00155 { nPrev = v; }

template<typename T>
HEFace<T>* HEFace< T >::Prev (  )  const [inline]

Definition at line 153 of file TAPsHEFace.hpp.

00153 { return nPrev; }

template<typename T>
HEFace< T > * HEFace< T >::Remove (  )  [inline]

Definition at line 200 of file TAPsHEFace.cpp.

00201 {
00202     if ( nPrev ) {
00203         nPrev->nNext = nNext;
00204         nPrev = NULL;
00205     }
00206     if ( nNext ) {
00207         nNext->nPrev = nPrev;
00208         nNext = NULL;
00209     }
00210     return this;
00211 }

template<typename T>
void HEFace< T >::RemoveTexCoordNo ( int  i  )  [inline]

Definition at line 176 of file TAPsHEFace.cpp.

00177 {   
00178     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00179     m_2DTexCoordsVector.erase(i*2, i*2+2);
00180 }

template<typename T>
void HEFace< T >::SetNormal ( x,
y,
z 
) [inline]

Definition at line 105 of file TAPsHEFace.hpp.

00105 { m_vNormal.SetXYZ( x, y, z ); }

template<typename T>
void HEFace< T >::SetNormal ( Vector3< T >  normal  )  [inline]

Definition at line 104 of file TAPsHEFace.hpp.

00104 { m_vNormal = normal; }

template<typename T>
void HEFace< T >::SetTexCoordHalfNo ( int  i,
v 
) [inline]

Definition at line 154 of file TAPsHEFace.cpp.

00155 {   
00156     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size()) );
00157     m_2DTexCoordsVector[i] = v;
00158 }

template<typename T>
void HEFace< T >::SetTexCoordNo ( int  i,
s,
t 
) [inline]

Definition at line 132 of file TAPsHEFace.cpp.

00133 {   
00134     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00135     m_2DTexCoordsVector[i*2    ] = s;
00136     m_2DTexCoordsVector[i*2 + 1] = t;
00137 }

template<typename T>
void HEFace< T >::SetTexCoordNoS ( int  i,
s 
) [inline]

Definition at line 110 of file TAPsHEFace.cpp.

00111 {
00112     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00113     m_2DTexCoordsVector[i*2] = s;
00114 }

template<typename T>
void HEFace< T >::SetTexCoordNoT ( int  i,
t 
) [inline]

Definition at line 117 of file TAPsHEFace.cpp.

00118 {
00119     assert( 0 <= i && i < static_cast<int>(m_2DTexCoordsVector.size())/2 );
00120     m_2DTexCoordsVector[i*2 + 1] = t;
00121 }

template<typename T>
HEFace< T > * HEFace< T >::Splice ( HEFace< T > *const   n  )  [inline]

Definition at line 220 of file TAPsHEFace.cpp.

00221 {
00222     HEFace<T> *a  = this;
00223     HEFace<T> *an = a->nNext;
00224     HEFace<T> *bn = b->nNext;
00225     a->nNext = bn;
00226     b->nNext = an;
00227     an->nPrev = b;
00228     bn->nPrev = a;
00229 }


Friends And Related Function Documentation

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

Definition at line 70 of file TAPsHEFace.hpp.

00071     {
00072         output  << "HEFace<" << typeid(T).name() << "> has ";
00073 //              << f.m_ptrVertexLoopVector.size() << " vertices:";
00074         //------------------------------------------------------------
00075         // Output vertex loop
00076 //      for ( int i = 0; i < f.m_ptrVertexLoopVector.size(); ++i )
00077 //      {
00078 //          output << "  " << *(f.m_ptrVertexLoopVector[i]);
00079 //      }
00080         //------------------------------------------------------------
00081         // Output normal
00082         output << "  with Normal:" << f.m_vNormal;
00083         //------------------------------------------------------------
00084         // Output texture coordinates
00085         output << "\n  and 2-D Texture Coordinates (" 
00086                << static_cast<int>(f.m_2DTexCoordsVector.size()) << "):";
00087         for ( int i = 0; i < static_cast<int>(f.m_2DTexCoordsVector.size()); ++i )
00088         {
00089             output << "  " << f.m_2DTexCoordsVector[i];
00090         }
00091         //------------------------------------------------------------
00092         // Output incident half-edge
00093         output << "  and Incident half-edge:" << f.nIncidentHalfEdge;
00094         return output;
00095     }


Member Data Documentation

template<typename T>
std::vector<T> HEFace< T >::m_2DTexCoordsVector [protected]

texture coordinate list

Definition at line 51 of file TAPsHEFace.hpp.

template<typename T>
Vector3<T> HEFace< T >::m_vNormal [protected]

normal vector

Definition at line 44 of file TAPsHEFace.hpp.

template<typename T>
HEHalfEdge<T>* HEFace< T >::nIncidentHalfEdge [protected]

incident half-edge

Definition at line 45 of file TAPsHEFace.hpp.

template<typename T>
HEFace<T>* HEFace< T >::nNext [protected]

next face in a doubly linked list

Definition at line 47 of file TAPsHEFace.hpp.

template<typename T>
HEFace<T>* HEFace< T >::nPrev [protected]

previous face in a doubly linked list

Definition at line 46 of file TAPsHEFace.hpp.


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

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