XPolygonalModel< T > Class Template Reference

#include <TAPsXPolygonalModel.hpp>

Inheritance diagram for XPolygonalModel< T >:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void ApplyAndResetTransform ()
virtual void CalAndSetNormals ()
void DetermineAndSortRings ()
Face< T > *const GetFaceList () const
virtual T GetMaxHalfLength () const
XVertex< T > *const GetVertexList () const
virtual void Initialize ()
void NewFaceListByNoFaces ()
void NewVertexListByNoVertices ()
void SetFaceList (Face< T > *p)
void SetVertexList (XVertex< T > *p)
 XPolygonalModel ()
virtual ~XPolygonalModel ()

Protected Member Functions

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

Protected Attributes

Face< T > * m_prFace
XVertex< T > * m_prXVertex
std::vector< int > * m_pviVertexRing1List

Friends

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


Detailed Description

template<typename T>
class XPolygonalModel< T >

Definition at line 34 of file TAPsXPolygonalModel.hpp.


Constructor & Destructor Documentation

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

Definition at line 21 of file TAPsXPolygonalModel.cpp.

00022     : OpenGLMeshModel<T>(),
00023       m_prXVertex( NULL ), m_prFace( NULL ), m_pviVertexRing1List( NULL )
00024 {
00025     #ifdef  TAPs_DEBUG_MODE
00026     std::cout << "XPolygonalModel<" << typeid(T).name() << "> Constructor\n";
00027     #endif//TAPs_ENABLE_DEBUG
00028 }

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

Definition at line 32 of file TAPsXPolygonalModel.cpp.

00033 {
00034     if ( m_prXVertex != NULL ) {
00035         delete [] m_prXVertex;
00036         m_prXVertex = NULL;
00037     }
00038     if ( m_prFace != NULL ) {
00039         delete [] m_prFace;
00040         m_prFace = NULL;
00041     }
00042     if ( m_pviVertexRing1List != NULL ) {
00043         delete [] m_pviVertexRing1List;
00044         m_pviVertexRing1List = NULL;
00045     }
00046 
00047     #ifdef  TAPs_DEBUG_MODE
00048     std::cout << "XPolygonalModel<" << typeid(T).name() << "> Destructor\n";
00049     #endif//TAPs_ENABLE_DEBUG
00050 }


Member Function Documentation

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

First apply the transformation matrix (from TAPsTransformationSupport.hpp (has a)) to the model, then reset the transformation matrix. (Apply means permanently change the positions of the model's vertices, etc.)

Reimplemented from Model< T >.

Reimplemented in VolPresPolygonalModel< T >.

Definition at line 308 of file TAPsXPolygonalModel.cpp.

00309 {
00310     for ( int i = 0; i < m_iNoVertices; ++i ) {
00311         m_prXVertex[i].SetPosition( 
00312             (     GetTransform().ReturnMatrixTransform() 
00313                 * Vector4<T>( m_prXVertex[i].GetPosition() )
00314             ).GetVector3()
00315         );
00316     }
00317 
00318 
00319     /*
00320     int i;
00321     //--------------------------------------------------------------------
00322     Vector3<T> Center = GetTransform().GetTranslation();
00323     if ( Center[0] != Math<T>::ZERO ) {
00324         for ( i = 0; i < m_iNoVertices; ++i )
00325             m_prXVertex[i][0] += Center[0];
00326         GetTransform().SetTranslation( 0, Math<T>::ZERO );
00327     }
00328     if ( Center[1] != Math<T>::ZERO ) {
00329         for ( i = 0; i < m_iNoVertices; ++i )
00330             m_prXVertex[i][1] += Center[1];
00331         GetTransform().SetTranslation( 1, Math<T>::ZERO );
00332     }
00333     if ( Center[2] != Math<T>::ZERO ) {
00334         for ( i = 0; i < m_iNoVertices; ++i )
00335             m_prXVertex[i][2] += Center[2];
00336         GetTransform().SetTranslation( 2, Math<T>::ZERO );
00337     }
00338     //--------------------------------------------------------------------
00339     Vector3<T> Rotation = GetTransform().GetRotationAngles();
00340     if ( Rotation[0] != Math<T>::ZERO ) {
00341         T deg = static_cast<T>( Rotation[0] * Math<T>::PI / 180.0 );
00342         T c = Math<T>::Cos( deg );
00343         T s = Math<T>::Sin( deg );
00344         T tmpX;
00345         for ( i = 0; i < m_iNoVertices; ++i ) {
00346             tmpX = m_prXVertex[i][1]*c - m_prXVertex[i][2]*s;
00347             m_prXVertex[i][2] = m_prXVertex[i][1]*s + m_prXVertex[i][2]*c;
00348             m_prXVertex[i][1] = tmpX;
00349         }
00350         GetTransform().SetRotationAxisAngle( 0, Math<T>::ZERO );
00351     }
00352     if ( Rotation[1] != Math<T>::ZERO ) {
00353         T deg = static_cast<T>( Rotation[1] * Math<T>::PI / 180.0 );
00354         T c = Math<T>::Cos( deg );
00355         T s = Math<T>::Sin( deg );
00356         T tmpX;
00357         for ( i = 0; i < m_iNoVertices; ++i ) {
00358             tmpX = m_prXVertex[i][0]*c + m_prXVertex[i][2]*s;
00359             m_prXVertex[i][2] = -(m_prXVertex[i][0]*s) + m_prXVertex[i][2]*c;
00360             m_prXVertex[i][0] = tmpX;
00361         }
00362         GetTransform().SetRotationAxisAngle( 1, Math<T>::ZERO );
00363     }
00364     if ( Rotation[2] != Math<T>::ZERO ) {
00365         T deg = static_cast<T>( Rotation[2] * Math<T>::PI / 180.0 );
00366         T c = Math<T>::Cos( deg );
00367         T s = Math<T>::Sin( deg );
00368         T tmpX;
00369         for ( i = 0; i < m_iNoVertices; ++i ) {
00370             tmpX = m_prXVertex[i][0]*c - m_prXVertex[i][1]*s;
00371             m_prXVertex[i][1] = m_prXVertex[i][0]*s + m_prXVertex[i][1]*c;
00372             m_prXVertex[i][0] = tmpX;
00373         }
00374         GetTransform().SetRotationAxisAngle( 2, Math<T>::ZERO );
00375     }
00376     //--------------------------------------------------------------------
00377     Vector3<T> Scale = GetTransform().GetScale();
00378     for ( int d = 0; d < 3; ++d ) {
00379         if ( Scale[d] != Math<T>::ONE ) {
00380             for ( i = 0; i < m_iNoVertices; ++i )
00381                 m_prXVertex[i][d] *= Scale[d];
00382             GetTransform().SetScale( d, Math<T>::ONE );
00383         }
00384     }
00385     //--------------------------------------------------------------------
00386     //*/
00387 
00388     //--------------------------------------------------------------------
00389     // Set Transformation to Identity Matrix
00390     GetTransform().MakeIdentity();
00391     //--------------------------------------------------------------------
00392     // Recalculate Bounding Volume(s)
00393     CalBoundingAABB();
00394     CalBoundingEllipsoid();
00395     CalBoundingSphere();
00396 }

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

Definition at line 117 of file TAPsXPolygonalModel.cpp.

00118 {
00119     // Calculate and set the normal of each face
00120     for ( int i = 0; i < m_iNoFaces; ++i ) {
00121         m_prFace[i].SetNormal(
00122               (   m_prXVertex[ m_prFace[i].GetVertexNo( 1 ) ].GetPosition() 
00123                 - m_prXVertex[ m_prFace[i].GetVertexNo( 0 ) ].GetPosition() )
00124             ^ (   m_prXVertex[ m_prFace[i].GetVertexNo( 2 ) ].GetPosition() 
00125                 - m_prXVertex[ m_prFace[i].GetVertexNo( 1 ) ].GetPosition() )
00126         );
00127     }
00128 }

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

Definition at line 107 of file TAPsXPolygonalModel.cpp.

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

Definition at line 164 of file TAPsXPolygonalModel.cpp.

00165 {
00166     for ( int v = 0; v < m_iNoVertices; ++v ) {
00167         Vector3<T> vNormal;
00168         for ( int f = 0; f < static_cast<int>( m_prXVertex[v].GetFaceRing().size() ); ++f ) {
00169             vNormal += m_prFace[ m_prXVertex[v].GetFaceRing()[f] ].GetNormal();
00170         }
00171         m_prXVertex[v].SetNormal( vNormal.Normalized() );
00172     }
00173 }

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

Reimplemented from ColDetSupport< T >.

Definition at line 405 of file TAPsXPolygonalModel.cpp.

00406 {
00407     m_paBoundingAABB[0][0] = m_paBoundingAABB[1][0] = m_prXVertex[0][0];
00408     m_paBoundingAABB[0][1] = m_paBoundingAABB[1][1] = m_prXVertex[0][1];
00409     m_paBoundingAABB[0][2] = m_paBoundingAABB[1][2] = m_prXVertex[0][2];
00410     for ( int i = 1; i < m_iNoVertices; ++i )
00411     {
00412         // Find lowest x, y, and z
00413         if ( m_paBoundingAABB[0][0] > m_prXVertex[i][0] )
00414              m_paBoundingAABB[0][0] = m_prXVertex[i][0];
00415         if ( m_paBoundingAABB[0][1] > m_prXVertex[i][1] )
00416              m_paBoundingAABB[0][1] = m_prXVertex[i][1];
00417         if ( m_paBoundingAABB[0][2] > m_prXVertex[i][2] )
00418              m_paBoundingAABB[0][2] = m_prXVertex[i][2];
00419         // Find highest x, y, and z
00420         if ( m_paBoundingAABB[1][0] < m_prXVertex[i][0] )
00421              m_paBoundingAABB[1][0] = m_prXVertex[i][0];
00422         if ( m_paBoundingAABB[1][1] < m_prXVertex[i][1] )
00423              m_paBoundingAABB[1][1] = m_prXVertex[i][1];
00424         if ( m_paBoundingAABB[1][2] < m_prXVertex[i][2] )
00425              m_paBoundingAABB[1][2] = m_prXVertex[i][2];
00426     }
00427     // Find the bounding volume center
00428     m_pBoundingCenter[0] = ( m_paBoundingAABB[0][0] + m_paBoundingAABB[1][0] ) / 2.0;
00429     m_pBoundingCenter[1] = ( m_paBoundingAABB[0][1] + m_paBoundingAABB[1][1] ) / 2.0;
00430     m_pBoundingCenter[2] = ( m_paBoundingAABB[0][2] + m_paBoundingAABB[1][2] ) / 2.0;
00431 }

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

Reimplemented from ColDetSupport< T >.

Definition at line 434 of file TAPsXPolygonalModel.cpp.

00435 {
00436     /*
00437     m_pBoundingCenter[0] = ( m_paBoundingAABB[0][0] + m_paBoundingAABB[1][0] ) / 2.0;
00438     m_pBoundingCenter[1] = ( m_paBoundingAABB[0][1] + m_paBoundingAABB[1][1] ) / 2.0;
00439     m_pBoundingCenter[2] = ( m_paBoundingAABB[0][2] + m_paBoundingAABB[1][2] ) / 2.0;
00440     m_pBoundingEllipsoid[0] = fabs( (m_paBoundingAABB[0][0] - m_paBoundingAABB[1][0])/2.0 );
00441     m_pBoundingEllipsoid[1] = fabs( (m_paBoundingAABB[0][1] - m_paBoundingAABB[1][1])/2.0 );
00442     m_pBoundingEllipsoid[2] = fabs( (m_paBoundingAABB[0][2] - m_paBoundingAABB[1][2])/2.0 );
00443     //*/
00444 
00445     /*
00446     T xLength = m_paBoundingAABB[0][0] - m_paBoundingAABB[1][0];
00447     T yLength = m_paBoundingAABB[0][1] - m_paBoundingAABB[1][1];
00448     T zLength = m_paBoundingAABB[0][2] - m_paBoundingAABB[1][2];
00449     xLength *= xLength;
00450     yLength *= yLength;
00451     zLength *= zLength;
00452     m_pBoundingEllipsoid[0] = sqrt( yLength + zLength ) / 2.0;
00453     m_pBoundingEllipsoid[1] = sqrt( zLength + xLength ) / 2.0;
00454     m_pBoundingEllipsoid[2] = sqrt( xLength + yLength ) / 2.0;
00455     //*/
00456 
00457     T x = m_paBoundingAABB[1][0] - m_pBoundingCenter[0];
00458     x *= x;
00459     T y = m_paBoundingAABB[1][1] - m_pBoundingCenter[1];
00460     y *= y;
00461     T z = m_paBoundingAABB[1][2] - m_pBoundingCenter[2];
00462     z *= z;
00463     m_pBoundingEllipsoid[1] = sqrt( y + z );
00464     m_pBoundingEllipsoid[2] = sqrt( z + x );
00465     m_pBoundingEllipsoid[0] = sqrt( x + y );
00466 }

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

Reimplemented from ColDetSupport< T >.

Definition at line 469 of file TAPsXPolygonalModel.cpp.

00470 {
00471     /*
00472     T xLength = m_paBoundingAABB[0][0] - m_paBoundingAABB[1][0];
00473     T yLength = m_paBoundingAABB[0][1] - m_paBoundingAABB[1][1];
00474     T zLength = m_paBoundingAABB[0][2] - m_paBoundingAABB[1][2];
00475     xLength *= xLength;
00476     yLength *= yLength;
00477     zLength *= zLength;
00478     m_pBoundingSphere = sqrt( xLength + yLength + zLength ) / 2.0;
00479     //*/
00480     T squaredLength;
00481     m_pBoundingSphere = 0;
00482     for ( int i = 0; i < m_iNoVertices; ++i ) {
00483         squaredLength = (m_prXVertex[i].GetPosition() - m_pBoundingCenter).SquaredLength();
00484         if ( squaredLength > m_pBoundingSphere )
00485             m_pBoundingSphere = squaredLength;
00486     }
00487     m_pBoundingSphere = sqrt( m_pBoundingSphere );
00488 }

template<typename T>
void XPolygonalModel< T >::DetermineAndSortRings (  )  [inline]

Definition at line 177 of file TAPsXPolygonalModel.cpp.

00178 {
00179     #ifdef  TAPs_DEBUG_MODE_DETAIL_1
00180     std::cout << "Xpolygonal Model: Determine and sort the first rings" << std::endl;
00181     #endif//TAPs_DEBUG_MODE_DETAIL_1
00182     //----------------------------------------------------------------
00183     /*  CCW
00184              2 --------- 1
00185             / \         / \
00186            /   \  f_2  /   \
00187           /     \     /     \
00188          /  f_3  \   /  f_1  \
00189         /         \ /         \
00190        3 --------- V --------- 0
00191         \         / \         /
00192          \  f_4  /   \  f_0  /
00193           \     /     \     /
00194            \   /  f_5  \   /
00195             \ /         \ /
00196              4 --------- 5
00197     */
00198     //----------------------------------------------------------------
00199     DetermineFaceRings ();
00200     //----------------------------------------------------------------
00201     // Local Variables
00202     int v, f, i, t1, n, k;
00203     int vertexAt[128];
00204     Face<T> * face;
00205     int lastVertexNo;
00206     //----------------------------------------------------------------
00207     // For each vertex v
00208     m_pviVertexRing1List = new std::vector<int>[m_iNoVertices];
00209     for ( v = 0; v < m_iNoVertices; ++v ) {
00210         //============================================================
00211         // Find the vertex number in each face ring of this vertex
00212         //------------------------------------------------------------
00213         int size = static_cast<int>( m_prXVertex[v].GetFaceRing().size() );
00214         if ( size <= 0 ) {
00215             continue;   // skip this vertex if it doesn't have a face ring
00216         }
00217         int current = 0;
00218         int noOfVertices;
00219         // For each face f in the ring of the vertex v
00220         // find the number of this v vertex in it
00221         for ( f = 0; f < size; ++f ) {
00222             face = &m_prFace[ m_prXVertex[v].GetFaceRing()[f] ];
00223             noOfVertices = face->GetNoVertices();
00224             // Get the number of this v vertex in the f face
00225             // keep the info in vertexAt[f]
00226             for ( i = 0; i < noOfVertices; ++i ) {
00227                 if ( v == face->GetVertexNo(i) ) {
00228                     vertexAt[f] = i;
00229                     break;
00230                 }
00231             }
00232         }
00233         //------------------------------------------------------------
00234         //============================================================
00235         // Arrange the face and vertex rings of this vertex
00236         //------------------------------------------------------------
00237         //------------------------------------------------------------
00238         // Face 0
00239         f = 0;
00240         face = &m_prFace[ m_prXVertex[v].GetFaceRing()[f] ];
00241         lastVertexNo = -1;
00242         // Use the fact that the vertices are listed CCW
00243         for ( i = vertexAt[f]+1; i < face->GetNoVertices(); ++i ) {
00244                 m_pviVertexRing1List[v].push_back( face->GetVertexNo(i) );
00245         }
00246         for ( i = 0; i < vertexAt[f]; ++i ) {
00247                 m_pviVertexRing1List[v].push_back( face->GetVertexNo(i) );
00248         }
00249         lastVertexNo  = ( vertexAt[f]-1 < 0 
00250                         ? face->GetVertexNo( face->GetNoVertices()-1 ) 
00251                         : face->GetVertexNo( vertexAt[f]-1 ) );
00252         //------------------------------------------------------------
00253         // Face 1 to size-1
00254         int iFaceNo;
00255         for ( f = 1; f < size; ++f ) {
00256             // Use the fact that only the next face contains 
00257             // the last inserted vertex to find the next face
00258             i = f;
00259             bool search = true;
00260             while ( i < size && search ) {
00261                 iFaceNo = m_prXVertex[v].GetFaceRing()[i];  // Face#
00262                 face = &m_prFace[ iFaceNo ];            // Face
00263 
00264                 for ( n = 0; n < face->GetNoVertices(); ++n ) {
00265                     if ( lastVertexNo == face->GetVertexNo(n) ) {
00266                         search = false;
00267 
00268                         // Swap (sort) the face
00269                         if ( f != i ) {
00270                             t1 = m_prXVertex[v].GetFaceRing()[f];
00271                             m_prXVertex[v].GetFaceRing()[f] = m_prXVertex[v].GetFaceRing()[i];
00272                             m_prXVertex[v].GetFaceRing()[i] = t1;
00273                             t1 = vertexAt[f];
00274                             vertexAt[f] = vertexAt[i];
00275                             vertexAt[i] = t1;
00276                         }
00277 
00278                         // Use the fact that the vertices are listed CCW
00279                         for ( k = vertexAt[f]+1; k < face->GetNoVertices(); ++k ) {
00280                             if ( face->GetVertexNo(k) != v && face->GetVertexNo(k) != lastVertexNo ) {
00281                                 m_pviVertexRing1List[v].push_back( face->GetVertexNo(k) );
00282                             }
00283                         }
00284                         for ( k = 0; k < vertexAt[f]; ++k ) {
00285                             if ( face->GetVertexNo(k) != v && face->GetVertexNo(k) != lastVertexNo ) {
00286                                 m_pviVertexRing1List[v].push_back( face->GetVertexNo(k) );
00287                             }
00288                         }
00289                         lastVertexNo  = ( vertexAt[f]-1 < 0 
00290                                         ? face->GetVertexNo( face->GetNoVertices()-1 ) 
00291                                         : face->GetVertexNo( vertexAt[f]-1 ) );
00292                         break;
00293                     }
00294                 }
00295                 ++i;
00296             }
00297         }
00298         m_pviVertexRing1List[v].pop_back();
00299         //------------------------------------------------------------
00300     }
00301 }

template<typename T>
void XPolygonalModel< T >::DetermineFaceRings (  )  [inline, protected, virtual]

Definition at line 142 of file TAPsXPolygonalModel.cpp.

00143 {
00144     bool notYetStored;
00145     // Insert the faces contain each vertex
00146     for ( int f = 0; f < m_iNoFaces; ++f ) {
00147         for ( int v = 0; v < m_prFace[f].GetNoVertices(); ++v ) {
00148             notYetStored = true;
00149             for ( int i = 0; i < static_cast<int>(m_prXVertex[m_prFace[f].GetVertexNo(v)].GetFaceRing().size()); ++i ) {
00150                 if ( m_prXVertex[m_prFace[f].GetVertexNo(v)].GetFaceRing()[i] == f ) {
00151                     notYetStored = false;
00152                     break;
00153                 }
00154             }
00155             if ( notYetStored ) {
00156                 m_prXVertex[m_prFace[f].GetVertexNo(v)].GetFaceRing().push_back( f );
00157             }
00158         }
00159     }
00160 }

template<typename T>
Face<T>* const XPolygonalModel< T >::GetFaceList (  )  const [inline]

Definition at line 112 of file TAPsXPolygonalModel.hpp.

00112 { return m_prFace; }

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

Implements Model< T >.

Definition at line 90 of file TAPsXPolygonalModel.cpp.

00091 {
00092     T maxHalfSize = 0.0;
00093     for ( int i = 0; i < m_iNoVertices; ++i )
00094     {
00095         if ( fabs( m_prXVertex[i][0] ) > maxHalfSize )
00096             maxHalfSize = fabs( m_prXVertex[i][0] );
00097         if ( fabs( m_prXVertex[i][1] ) > maxHalfSize )
00098             maxHalfSize = fabs( m_prXVertex[i][1] );
00099         if ( fabs( m_prXVertex[i][2] ) > maxHalfSize )
00100             maxHalfSize = fabs( m_prXVertex[i][2] );
00101     }
00102     return maxHalfSize;
00103 }

template<typename T>
XVertex<T>* const XPolygonalModel< T >::GetVertexList (  )  const [inline]

Definition at line 111 of file TAPsXPolygonalModel.hpp.

00111 { return m_prXVertex; }

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

Implements Model< T >.

Reimplemented in ExtendedOpenGLPNTriangleVolPresModel< T >, ExtendedOpenGLVolPresPolygonalModel< T >, OpenGLPNTriangleModel< T >, OpenGLPNTriangleVolPresModel< T >, VolPresPolygonalModel< T >, and VolPresTriModel< T >.

Definition at line 54 of file TAPsXPolygonalModel.cpp.

00055 {
00056     // Model Initialization
00057     DetermineAndSortRings();
00058     //DetermineFaceRings ();
00059     CalAndSetNormals();
00060     // DetermineAndSortRings();
00061     ApplyMaterial( Enum::FRONT );
00062     //DetermineEdgeList();
00063     CalBoundingAABB();
00064     CalBoundingEllipsoid();
00065     CalBoundingSphere();
00066 }

template<typename T>
void XPolygonalModel< T >::NewFaceListByNoFaces (  )  [inline]

Definition at line 80 of file TAPsXPolygonalModel.cpp.

00081 {
00082     if ( m_prFace != NULL ) {
00083         delete [] m_prFace;
00084     }
00085     m_prFace = new Face<T>[m_iNoFaces];
00086 }

template<typename T>
void XPolygonalModel< T >::NewVertexListByNoVertices (  )  [inline]

Definition at line 70 of file TAPsXPolygonalModel.cpp.

00071 {
00072     if ( m_prXVertex != NULL ) {
00073         delete [] m_prXVertex;
00074     }
00075     m_prXVertex = new XVertex<T>[m_iNoVertices];
00076 }

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

Definition at line 132 of file TAPsXPolygonalModel.cpp.

00133 {
00134     for ( int i = 0; i < m_iNoFaces; ++i ) {
00135         const_cast< Vector3<T> * >( &m_prFace[i].GetNormal() )->Normalized();
00136         //m_prFace[i].GetNormal().Normalized();
00137     }
00138 }

template<typename T>
void XPolygonalModel< T >::SetFaceList ( Face< T > *  p  )  [inline]

Definition at line 114 of file TAPsXPolygonalModel.hpp.

00114 { m_prFace = p; }

template<typename T>
void XPolygonalModel< T >::SetVertexList ( XVertex< T > *  p  )  [inline]

Definition at line 113 of file TAPsXPolygonalModel.hpp.

00113 { m_prXVertex = p; }


Friends And Related Function Documentation

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

Definition at line 37 of file TAPsXPolygonalModel.hpp.

00038     {
00039         output  << "\n======================\n"
00040                 <<   "TAPs::XPolygonalModel<"
00041                 << typeid(T).name() << "> Class:\n"
00042                 <<   "======================\n";
00043         //----------------------------------------------------------------
00044         // Vertices Node
00045         output  << "\n\nVertices " << o.m_iNoVertices << "\n{";
00046         for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00047             output << "\n  #" << i << "\t" << o.m_prXVertex[i];
00048         }
00049         output  << "\n}";
00050         //----------------------------------------------------------------
00051         // Neighbor vertex ring#1
00052         if ( o.m_pviVertexRing1List ) {
00053             std::vector<int>::const_iterator iterator;
00054             output  << "\n\nVertexRing1 " << o.m_iNoVertices << "\n{";
00055             for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00056                 output << "\n  #" << i;
00057                 for (   iterator = o.m_pviVertexRing1List[i].begin(); 
00058                         iterator != o.m_pviVertexRing1List[i].end();
00059                         ++iterator )
00060                 {
00061                     output << "\t" << *iterator;
00062                 }
00063             }
00064             output  << "\n}";
00065         }
00066         //----------------------------------------------------------------
00067         // Faces Node
00068         output  << "\n\nFaces " << o.m_iNoFaces  << "\n{";
00069         for ( int i = 0; i < o.m_iNoFaces; ++i ) {
00070             output << "\n  #" << i << "\t" << o.m_prFace[i];
00071         }
00072         output  << "\n}";
00073         return output;
00074     }


Member Data Documentation

template<typename T>
Face<T>* XPolygonalModel< T >::m_prFace [protected]

Definition at line 123 of file TAPsXPolygonalModel.hpp.

template<typename T>
XVertex<T>* XPolygonalModel< T >::m_prXVertex [protected]

Definition at line 122 of file TAPsXPolygonalModel.hpp.

template<typename T>
std::vector<int>* XPolygonalModel< T >::m_pviVertexRing1List [protected]

Definition at line 124 of file TAPsXPolygonalModel.hpp.


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

Generated on Mon Oct 13 11:46:14 2008 for TAPs by  doxygen 1.5.6