#include <TAPsHelpCreateHalfEdgeModel.hpp>
Static Public Member Functions | |
| static void | ClearAllocatedMemory (OpenGL::HalfEdgeModel< T > *const prModel) |
| static void | CreateAHoleFace (OpenGL::HalfEdgeModel< T > *const prModel) |
| static void | CreateBoundaryHalfEdges () |
| static HEHalfEdge< T > *const | CreateHalfEdgeFrom (HEVertex< T > *const v1, HEVertex< T > *const v2, HEFace< T > *const face, HEHalfEdge< T > *const hePrev=NULL, HEHalfEdge< T > *const heNext=NULL) |
| static void | CreateHalfEdgeModel (OpenGL::HalfEdgeModel< T > *const prModel) |
| static void | CreateHoleFaces (OpenGL::HalfEdgeModel< T > *const prModel) |
| static void | PairAllHalfEdges () |
Static Public Attributes | |
| static HEHalfEdge< T > * | boundaryHalfEdgePtr = NULL |
| static DS::HashTableBySTLVector < HEHalfEdge< T > * > * | halfEdgeRingList = NULL |
| static HEVertex< T > ** | vertexList = NULL |
| static DS::HashTableBySTLVector< int > * | vertexRingList = NULL |
Definition at line 21 of file TAPsHelpCreateHalfEdgeModel.hpp.
| void HelpCreateHalfEdgeModel< T >::ClearAllocatedMemory | ( | OpenGL::HalfEdgeModel< T > *const | prModel | ) | [inline, static] |
Definition at line 70 of file TAPsHelpCreateHalfEdgeModel.cpp.
00072 { 00073 //---------------------------------------------------------------- 00074 // Deallocate memory for vertex list 00075 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00076 //HEVertex<T> * tmpVertex = prModel->GetVertexList()->Head(); 00077 //while ( tmpVertex ) { 00078 // std::cout << "Vertex#" << ++count << " " << *tmpVertex << "\n"; 00079 // tmpVertex = tmpVertex->Next(); 00080 //} 00081 #endif 00082 if ( vertexList != NULL ) { 00083 delete [] vertexList; 00084 vertexList = NULL; 00085 } 00086 //---------------------------------------------------------------- 00087 // Deallocate memory for vertex ring list 00088 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00089 std::cout << "vertexRingList ==> " << *vertexRingList; 00090 #endif 00091 if ( vertexRingList != NULL ) { 00092 delete vertexRingList; 00093 vertexRingList = NULL; 00094 } 00095 //---------------------------------------------------------------- 00096 // Deallocate memory for halfedge ring list 00097 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00098 std::cout << "halfEdgeRingList ==> " << *halfEdgeRingList; 00099 #endif 00100 if ( halfEdgeRingList != NULL ) { 00101 delete halfEdgeRingList; 00102 halfEdgeRingList = NULL; 00103 } 00104 //---------------------------------------------------------------- 00105 // Deallocate memory for boundary halfedge 00106 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00107 std::cout << "boundaryHalfEdgePtr ==> " << *boundaryHalfEdgePtr; 00108 #endif 00109 if ( boundaryHalfEdgePtr != NULL ) { 00110 delete boundaryHalfEdgePtr; 00111 boundaryHalfEdgePtr = NULL; 00112 } 00113 }
| void HelpCreateHalfEdgeModel< T >::CreateAHoleFace | ( | OpenGL::HalfEdgeModel< T > *const | prModel | ) | [inline, static] |
Definition at line 240 of file TAPsHelpCreateHalfEdgeModel.cpp.
00242 { 00243 HEHalfEdge<T> *curtHalfEdge = boundaryHalfEdgePtr; 00244 HEHalfEdge<T> *iterHalfEdge; 00245 #ifdef DEBUG_MESSAGE_TAPS_READ_3DSMAX_ASC_HPP 00246 std::cout << "REMOVE: " << curtHalfEdge << std::endl; 00247 #endif 00248 boundaryHalfEdgePtr = boundaryHalfEdgePtr->Next(); 00249 HEHalfEdge<T> *halfEdge = boundaryHalfEdgePtr; 00250 //boundaryHalfEdgePtr->Prev( NULL ); 00251 HEFace<T> *holeFace = new HEFace<T>( curtHalfEdge ); 00252 //std::cout << *holeFace << "\n"; 00253 curtHalfEdge->Face( holeFace ); 00254 curtHalfEdge->Prev( NULL ); 00255 curtHalfEdge->Next( NULL ); 00256 prModel->GetHoleFaceList()->Append( holeFace ); 00257 00258 // Find previous half-edges until the half-edge loop of the hole face is complete 00259 while ( !holeFace->IncidentHalfEdge()->Next() ) { 00260 // Found a previous half-edge 00261 if ( halfEdge->Pair()->Vertex() == curtHalfEdge->Vertex() ) { 00262 #ifdef DEBUG_MESSAGE_TAPS_READ_3DSMAX_ASC_HPP 00263 std::cout << "REMOVE: " << halfEdge << std::endl; 00264 #endif 00265 // Remove the half-edge from the boundary list 00266 if ( halfEdge == boundaryHalfEdgePtr ) { 00267 boundaryHalfEdgePtr = boundaryHalfEdgePtr->Next(); 00268 iterHalfEdge = boundaryHalfEdgePtr; 00269 } 00270 else { 00271 if ( halfEdge->Next() ) { 00272 halfEdge->Prev()->Next( halfEdge->Next() ); 00273 halfEdge->Next()->Prev( halfEdge->Prev() ); 00274 } 00275 else { 00276 halfEdge->Prev()->Next( NULL ); 00277 } 00278 iterHalfEdge = halfEdge->Next(); 00279 } 00280 halfEdge->Face( holeFace ); 00281 halfEdge->Next( curtHalfEdge ); // add half-edge to the loop 00282 curtHalfEdge = halfEdge; // new current half-edge 00283 // Loop is complete here 00284 if ( holeFace->IncidentHalfEdge()->Pair()->Vertex() == halfEdge->Vertex() ) { 00285 halfEdge->Prev( holeFace->IncidentHalfEdge() ); 00286 holeFace->IncidentHalfEdge()->Next( halfEdge ); 00287 } 00288 // Loop is not complete yet 00289 else { 00290 halfEdge->Prev( NULL ); 00291 } 00292 halfEdge = iterHalfEdge; 00293 } 00294 else { 00295 halfEdge = halfEdge->Next(); 00296 } 00297 // Back to the start of boundaryHalfEdgePtr 00298 if ( !halfEdge ) { 00299 halfEdge = boundaryHalfEdgePtr; 00300 } 00301 } 00302 }
| void HelpCreateHalfEdgeModel< T >::CreateBoundaryHalfEdges | ( | ) | [inline, static] |
Definition at line 189 of file TAPsHelpCreateHalfEdgeModel.cpp.
00190 { 00191 int i, p; 00192 HEHalfEdge<T> *halfEdge, *boundaryHalfEdge, *curtHalfEdge = NULL; 00193 for ( i = 0; i < vertexRingList->GetNoOfBuckets(); ++i ) { 00194 for ( p = 0; p < static_cast<int>(vertexRingList->GetBucketNo(i).size()); ++p ) { 00195 halfEdge = halfEdgeRingList->GetBucketNo(i)[p]; 00196 if ( !halfEdge->Pair() ) { 00197 if ( !boundaryHalfEdgePtr ) { 00198 boundaryHalfEdgePtr = 00199 curtHalfEdge = new HEHalfEdge<T>( 00200 halfEdge->Next()->Vertex(), // originating from vertex 00201 NULL, // incident (hole) face 00202 NULL, // previous 00203 NULL, // next 00204 halfEdge // pair 00205 ); 00206 } 00207 else { 00208 boundaryHalfEdge = new HEHalfEdge<T>( 00209 halfEdge->Next()->Vertex(), // originating from vertex 00210 NULL, // incident (hole) face 00211 curtHalfEdge, // previous 00212 NULL, // next 00213 halfEdge // pair 00214 ); 00215 curtHalfEdge->Next( boundaryHalfEdge ); 00216 curtHalfEdge = boundaryHalfEdge; 00217 } 00218 halfEdge->Pair( curtHalfEdge ); 00219 } 00220 } 00221 } 00222 }
| HEHalfEdge< T > *const HelpCreateHalfEdgeModel< T >::CreateHalfEdgeFrom | ( | HEVertex< T > *const | v1, | |
| HEVertex< T > *const | v2, | |||
| HEFace< T > *const | face, | |||
| HEHalfEdge< T > *const | hePrev = NULL, |
|||
| HEHalfEdge< T > *const | heNext = NULL | |||
| ) | [inline, static] |
Definition at line 119 of file TAPsHelpCreateHalfEdgeModel.cpp.
00125 { 00126 HEHalfEdge<T> * halfEdge = new HEHalfEdge<T>( v1, face, hePrev, heNext ); 00127 // Set prev half-edge next to this half-edge 00128 if ( hePrev != NULL ) { 00129 hePrev->Next( halfEdge ); 00130 } 00131 // Set next half-edge prev to this half-edge 00132 if ( heNext != NULL ) { 00133 heNext->Prev( halfEdge ); 00134 } 00135 // Connect this half-edge to new ring 00136 // Or NULL(s) if hePrev / heNext is NULL 00137 //halfEdge->Prev( hePrev ); 00138 //halfEdge->Next( heNext ); 00139 00140 if ( !v1->IncidentHalfEdge() ) v1->IncidentHalfEdge( halfEdge ); 00141 00142 return halfEdge; 00143 }
| void HelpCreateHalfEdgeModel< T >::CreateHalfEdgeModel | ( | OpenGL::HalfEdgeModel< T > *const | prModel | ) | [inline, static] |
Definition at line 37 of file TAPsHelpCreateHalfEdgeModel.cpp.
00039 { 00040 //---------------------------------------------------------------- 00041 // Pair all half-edges 00042 PairAllHalfEdges(); 00043 //---------------------------------------------------------------- 00044 // Create boundary half-edges 00045 CreateBoundaryHalfEdges(); 00046 HEHalfEdge<T> *tmpHalfEdge = boundaryHalfEdgePtr; 00047 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00048 std::cout << "\nBOUNDARY HALF-EDGES:\n"; 00049 #endif 00050 while ( tmpHalfEdge ) { 00051 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00052 std::cout << *tmpHalfEdge << "\n"; 00053 #endif 00054 tmpHalfEdge = tmpHalfEdge->Next(); 00055 } 00056 #ifdef DEBUG_MESSAGE_TAPS_HELP_CREATE_HALF_EDGE_MODEL_HPP 00057 std::cout << "\n"; 00058 #endif 00059 //---------------------------------------------------------------- 00060 // Create hole faces 00061 CreateHoleFaces( prModel ); 00062 //---------------------------------------------------------------- 00063 // Deallocate memory for vertex list 00064 ClearAllocatedMemory( prModel ); 00065 //---------------------------------------------------------------- 00066 }
| void HelpCreateHalfEdgeModel< T >::CreateHoleFaces | ( | OpenGL::HalfEdgeModel< T > *const | prModel | ) | [inline, static] |
Definition at line 226 of file TAPsHelpCreateHalfEdgeModel.cpp.
00228 { 00229 int count = 0; 00230 while ( boundaryHalfEdgePtr ) { 00231 #ifdef DEBUG_MESSAGE_TAPS_READ_3DSMAX_ASC_HPP 00232 std::cout << "Find Hole# " << ++count << "\n"; 00233 #endif 00234 CreateAHoleFace( prModel ); 00235 } 00236 }
| void HelpCreateHalfEdgeModel< T >::PairAllHalfEdges | ( | ) | [inline, static] |
Definition at line 147 of file TAPsHelpCreateHalfEdgeModel.cpp.
00148 { 00149 int i, j, p, q; 00150 HEHalfEdge<T> *halfEdgeVitoVj, *halfEdgeVjtoVi; 00151 for ( i = 0; i < vertexRingList->GetNoOfBuckets(); ++i ) { 00152 for ( p = 0; p < static_cast<int>(vertexRingList->GetBucketNo(i).size()); ++p ) { 00153 // find pair for the half-edge from Vi to Vj 00154 j = vertexRingList->GetBucketNo(i)[p]; 00155 halfEdgeVitoVj = halfEdgeRingList->GetBucketNo(i)[p]; 00156 if ( halfEdgeVitoVj->Pair() == NULL ) { 00157 // find the half-edge from Vj to Vi 00158 for ( q = 0; q < static_cast<int>(vertexRingList->GetBucketNo(j).size()); ++q ) { 00159 // found its pair -- half-edge from Vj to Vi 00160 if ( i == vertexRingList->GetBucketNo(j)[q] ) { 00161 halfEdgeVjtoVi = halfEdgeRingList->GetBucketNo(j)[q]; 00162 halfEdgeVitoVj->Pair( halfEdgeVjtoVi ); 00163 halfEdgeVjtoVi->Pair( halfEdgeVitoVj ); 00164 break; 00165 } 00166 } 00167 } 00168 if ( halfEdgeVitoVj->Pair() != NULL ) { 00169 #ifdef DEBUG_MESSAGE_TAPS_READ_3DSMAX_ASC_HPP 00170 std::cout << "Half-edge " << halfEdgeVitoVj << " from " << i << " to " << j 00171 << " has its pair at " << halfEdgeVitoVj->Pair() 00172 << "\n"; 00173 #endif 00174 } 00175 else { 00176 #ifdef DEBUG_MESSAGE_TAPS_READ_3DSMAX_ASC_HPP 00177 std::cout << "Half-edge " << halfEdgeVitoVj << " from " << i << " to " << j 00178 << " has no pair.\n"; 00179 #endif 00180 } 00181 00182 00183 } 00184 } 00185 }
HEHalfEdge< T > * HelpCreateHalfEdgeModel< T >::boundaryHalfEdgePtr = NULL [inline, static] |
Definition at line 63 of file TAPsHelpCreateHalfEdgeModel.hpp.
DS::HashTableBySTLVector< HEHalfEdge< T > * > * HelpCreateHalfEdgeModel< T >::halfEdgeRingList = NULL [inline, static] |
Definition at line 61 of file TAPsHelpCreateHalfEdgeModel.hpp.
BEGIN_NAMESPACE_TAPs HEVertex< T > ** HelpCreateHalfEdgeModel< T >::vertexList = NULL [inline, static] |
Definition at line 55 of file TAPsHelpCreateHalfEdgeModel.hpp.
DS::HashTableBySTLVector< int > * HelpCreateHalfEdgeModel< T >::vertexRingList = NULL [inline, static] |
Definition at line 58 of file TAPsHelpCreateHalfEdgeModel.hpp.
1.5.6