Changeset 1563 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
- Timestamp:
- 10/03/06 22:03:58 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp
r1558 r1563 171 171 mTimeStamp(1), 172 172 mViewCellsTree(NULL), 173 mOutOfBoundsCellPartOfTree(false) 173 mOutOfBoundsCellPartOfTree(false), 174 mOutOfBoundsCell(NULL) 174 175 { 175 176 Randomize(); // initialise random generator for heuristics … … 956 957 { 957 958 tData = tStack.top(); 958 959 959 tStack.pop(); 960 960 … … 1010 1010 if (!mUsePredefinedViewCells) 1011 1011 { // generate new view cell for each leaf 1012 viewCell = new BspViewCell(); 1012 viewCell = new BspViewCell();cout << "g"; 1013 1013 } 1014 1014 else 1015 { 1015 { 1016 1016 // add predefined view cell to leaf 1017 1017 viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell); 1018 1019 1018 // from now on out of bounds cell can be handled as any other cell, 1020 1019 // responsibility for deleting has been shifted 1021 if ( viewCell == mOutOfBoundsCell)1020 if (IsOutOfBounds(viewCell)) 1022 1021 { 1023 1022 mOutOfBoundsCellPartOfTree = true; 1024 1023 } 1024 1025 1025 } 1026 1026 … … 1035 1035 else 1036 1036 viewCell->SetVolume(probability); 1037 1038 1037 1039 1038 /////////// … … 1049 1048 } 1050 1049 1051 if (1)EvaluateLeafStats(tData); 1052 1053 1050 if (1) EvaluateLeafStats(tData); 1051 1054 1052 //////// 1055 1053 //-- clean up … … 2399 2397 { 2400 2398 // per definition out of bounds cell has zero volume 2401 if ( (*it) == mOutOfBoundsCell)2399 if (IsOutOfBounds(*it)) 2402 2400 continue; 2403 2401 … … 3325 3323 ViewCell *BspTree::GetViewCell(const Vector3 &point) 3326 3324 { 3327 if (mRoot == NULL) 3328 return NULL; 3329 3330 3331 stack<BspNode *> nodeStack; 3332 nodeStack.push(mRoot); 3333 3334 ViewCellLeaf *viewcell = NULL; 3335 3336 while (!nodeStack.empty()) { 3337 BspNode *node = nodeStack.top(); 3338 nodeStack.pop(); 3339 3340 if (node->IsLeaf()) { 3341 viewcell = dynamic_cast<BspLeaf *>(node)->mViewCell; 3342 break; 3343 } else { 3344 3345 BspInterior *interior = dynamic_cast<BspInterior *>(node); 3346 3347 // random decision 3348 if (interior->GetPlane().Side(point) < 0) 3349 nodeStack.push(interior->GetBack()); 3350 else 3351 nodeStack.push(interior->GetFront()); 3352 } 3353 } 3354 3355 return viewcell; 3325 if (mRoot == NULL) 3326 return NULL; 3327 3328 stack<BspNode *> nodeStack; 3329 nodeStack.push(mRoot); 3330 3331 ViewCellLeaf *viewcell = NULL; 3332 3333 while (!nodeStack.empty()) { 3334 BspNode *node = nodeStack.top(); 3335 nodeStack.pop(); 3336 3337 if (node->IsLeaf()) 3338 { 3339 viewcell = dynamic_cast<BspLeaf *>(node)->mViewCell; 3340 break; 3341 } 3342 else 3343 { 3344 3345 BspInterior *interior = dynamic_cast<BspInterior *>(node); 3346 3347 // random decision 3348 if (interior->GetPlane().Side(point) < 0) 3349 { 3350 nodeStack.push(interior->GetBack()); 3351 } 3352 else 3353 { 3354 nodeStack.push(interior->GetFront()); 3355 } 3356 } 3357 } 3358 3359 return viewcell; 3356 3360 } 3357 3361
Note: See TracChangeset
for help on using the changeset viewer.