#include <TAPsHalfEdgeTrigonalModel.hpp>


Public Member Functions | |
| virtual void | BuildBVHTree (TAPs::Enum::CD treeType) |
| virtual void | CalAndSetNormals () |
| HalfEdgeTrigonalModel () | |
| virtual void | Initialize () |
| virtual | ~HalfEdgeTrigonalModel () |
Protected Member Functions | |
| virtual void | CalAndSetFaceNormalsNotNormalized () |
| virtual void | CalAndSetVertexNormals () |
| virtual void | NormalizeFaceNormals () |
Friends | |
| std::ostream & | operator<< (std::ostream &output, HalfEdgeTrigonalModel< T > const &o) |
Definition at line 74 of file TAPsHalfEdgeTrigonalModel.hpp.
| BEGIN_NAMESPACE_TAPs__OpenGL HalfEdgeTrigonalModel< T >::HalfEdgeTrigonalModel | ( | ) | [inline] |
| HalfEdgeTrigonalModel< T >::~HalfEdgeTrigonalModel | ( | ) | [inline, virtual] |
Definition at line 38 of file TAPsHalfEdgeTrigonalModel.cpp.
00039 { 00040 #ifdef DEBUG_MESSAGE_TAPS_HALF_EDGE_TRIGONAL_MODEL 00041 std::cout << "HalfEdgeTrigonalModel<" << typeid(T).name() << "> Destructor\n"; 00042 #endif 00043 }
| void HalfEdgeTrigonalModel< T >::BuildBVHTree | ( | TAPs::Enum::CD | treeType | ) | [inline, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 348 of file TAPsHalfEdgeTrigonalModel.cpp.
00349 { 00350 //BVHTree<T>:: 00351 // Call a static fn from BVHTree class 00352 // m_pBVHTree is inherited from ColDetSupport class 00353 00354 //m_pBVHTree = BVHTree<T>::BuildBVHTree( GetTransform(), m_listFace, treeType, m_pBVHTree ); 00355 00356 m_pBVHTree = TAPs::CD::BuildBVHTree<T>( GetTransform(), m_listFace, treeType ); 00357 00358 //std::cout << "m_pVBHTree: " << m_pBVHTree << std::cout; 00359 }
| void HalfEdgeTrigonalModel< T >::CalAndSetFaceNormalsNotNormalized | ( | ) | [inline, protected, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 95 of file TAPsHalfEdgeTrigonalModel.cpp.
00096 { 00097 // Calculate and set the normal of each face 00098 HEFace<T> * face = m_listFace->Head(); 00099 while ( face != NULL ) { 00100 Vector3<T> const & v0 = face->IncidentHalfEdge()->Prev()->Vertex()->GetPosition(); 00101 Vector3<T> const & v1 = face->IncidentHalfEdge()->Vertex()->GetPosition(); 00102 Vector3<T> const & v2 = face->IncidentHalfEdge()->Next()->Vertex()->GetPosition(); 00103 face->SetNormal( (v1 - v0) ^ (v2 - v1) ); 00104 face = face->Next(); 00105 } 00106 00107 /* 00108 for ( int i = 0; i < m_iNoFaces; ++i ) { 00109 m_prFace[i].SetNormal( 00110 ( m_prXVertex[ m_prFace[i].GetVertexNo( 1 ) ].GetPosition() 00111 - m_prXVertex[ m_prFace[i].GetVertexNo( 0 ) ].GetPosition() ) 00112 ^ ( m_prXVertex[ m_prFace[i].GetVertexNo( 2 ) ].GetPosition() 00113 - m_prXVertex[ m_prFace[i].GetVertexNo( 1 ) ].GetPosition() ) 00114 ); 00115 } 00116 */ 00117 }
| void HalfEdgeTrigonalModel< T >::CalAndSetNormals | ( | ) | [inline, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 85 of file TAPsHalfEdgeTrigonalModel.cpp.
00086 { 00087 CalAndSetFaceNormalsNotNormalized(); 00088 // DetermineFaceRings(); 00089 CalAndSetVertexNormals(); 00090 NormalizeFaceNormals(); 00091 }
| void HalfEdgeTrigonalModel< T >::CalAndSetVertexNormals | ( | ) | [inline, protected, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 138 of file TAPsHalfEdgeTrigonalModel.cpp.
00139 { 00140 HEVertex<T> *vertex = m_listVertex->Head(); 00141 HEHalfEdge<T> *halfEdge; 00142 #ifdef DEBUG_MESSAGE_TAPS_HALF_EDGE_TRIGONAL_MODEL 00143 std::cout << "FIND VERTEX NORMAL" << std::endl; 00144 #endif 00145 while ( vertex ) { 00146 Vector3<T> vNormal; 00147 halfEdge = vertex->IncidentHalfEdge(); 00148 #ifdef DEBUG_MESSAGE_TAPS_HALF_EDGE_TRIGONAL_MODEL_HPP 00149 std::cout << *halfEdge << std::endl; 00150 #endif 00151 /* 00152 if ( halfEdge->Pair()->Next() != NULL ) { 00153 do { 00154 vNormal += halfEdge->Face()->GetNormal(); 00155 halfEdge = halfEdge->Pair()->Next(); 00156 } while ( halfEdge != vertex->IncidentHalfEdge() ); 00157 } 00158 else { 00159 do { 00160 vNormal += halfEdge->Face()->GetNormal(); 00161 halfEdge = halfEdge->Pair()->Prev(); 00162 } while ( halfEdge != vertex->IncidentHalfEdge() ); 00163 } 00164 //*/ 00165 //* 00166 vNormal = Vector3<T>(0,0,0); 00167 int count1 = 0; 00168 int count2 = 0; 00169 do { 00170 vNormal += halfEdge->Face()->GetNormal(); 00171 halfEdge = halfEdge->Pair()->Next(); 00172 // Cannot use previous, because of half-edge data structure 00173 //halfEdge = halfEdge->Pair()->Prev(); 00174 //if ( halfEdge == NULL ) { 00175 // std::cout << "--------------------=================>>>>>>> NULL\n"; 00176 //assert( false ); 00177 // break; 00178 //} 00179 } while ( halfEdge != vertex->IncidentHalfEdge() ); 00180 //*/ 00181 vertex->SetNormal( vNormal.Normalized() ); 00182 vertex = vertex->Next(); 00183 } 00184 00185 /* 00186 for ( int v = 0; v < m_iNoVertices; ++v ) { 00187 Vector3<T> vNormal; 00188 for ( int f = 0; f < static_cast<int>( m_prXVertex[v].GetFaceRing().size() ); ++f ) { 00189 vNormal += m_prFace[ m_prXVertex[v].GetFaceRing()[f] ].GetNormal(); 00190 } 00191 m_prXVertex[v].SetNormal( vNormal.Normalized() ); 00192 } 00193 */ 00194 }
| void HalfEdgeTrigonalModel< T >::Initialize | ( | ) | [inline, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 48 of file TAPsHalfEdgeTrigonalModel.cpp.
00049 { 00050 // Model Initialization 00051 CalAndSetNormals(); 00052 ApplyMaterial(); 00053 CalBoundingAABB(); 00054 CalBoundingEllipsoid(); 00055 CalBoundingSphere(); 00056 00057 // For Fast Access 00058 //SetListOfVertexPositionsAndNormals(); 00059 00060 std::cout << *this << std::endl; 00061 }
| void HalfEdgeTrigonalModel< T >::NormalizeFaceNormals | ( | ) | [inline, protected, virtual] |
Reimplemented from HalfEdgeModel< T >.
Definition at line 121 of file TAPsHalfEdgeTrigonalModel.cpp.
00122 { 00123 // Normalize the normal of each face 00124 HEFace<T> * face = m_listFace->Head(); 00125 while ( face != NULL ) { 00126 const_cast< Vector3<T> * >( &face->GetNormal() )->Normalized(); 00127 face = face->Next(); 00128 } 00129 00130 //for ( int i = 0; i < m_iNoFaces; ++i ) { 00131 // const_cast< Vector3<T> * >( &m_prFace[i].GetNormal() )->Normalized(); 00132 // //m_prFace[i].GetNormal().Normalized(); 00133 //} 00134 }
| std::ostream& operator<< | ( | std::ostream & | output, | |
| HalfEdgeTrigonalModel< T > const & | o | |||
| ) | [friend] |
Definition at line 77 of file TAPsHalfEdgeTrigonalModel.hpp.
00078 { 00079 output << "\n===========================\n" 00080 << "TAPs::HalfEdgeTrigonalModel<" 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 }
1.5.6