Ignore:
Timestamp:
10/03/06 22:03:58 (18 years ago)
Author:
mattausch
Message:

fixed bug with view space box

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellBsp.cpp

    r1558 r1563  
    171171mTimeStamp(1), 
    172172mViewCellsTree(NULL), 
    173 mOutOfBoundsCellPartOfTree(false) 
     173mOutOfBoundsCellPartOfTree(false), 
     174mOutOfBoundsCell(NULL) 
    174175{ 
    175176        Randomize(); // initialise random generator for heuristics 
     
    956957        { 
    957958                tData = tStack.top(); 
    958  
    959959            tStack.pop(); 
    960960 
     
    10101010                if (!mUsePredefinedViewCells) 
    10111011                {       // generate new view cell for each leaf 
    1012                         viewCell = new BspViewCell(); 
     1012                        viewCell = new BspViewCell();cout << "g"; 
    10131013                } 
    10141014                else 
    1015                 { 
     1015                {        
    10161016                        // add predefined view cell to leaf 
    10171017                        viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell); 
    1018  
    10191018                        // from now on out of bounds cell can be handled as any other cell, 
    10201019                        // responsibility for deleting has been shifted 
    1021                         if (viewCell == mOutOfBoundsCell) 
     1020                        if (IsOutOfBounds(viewCell)) 
    10221021                        { 
    10231022                                mOutOfBoundsCellPartOfTree = true; 
    10241023                        } 
     1024                 
    10251025                } 
    10261026 
     
    10351035                else 
    10361036                        viewCell->SetVolume(probability); 
    1037  
    10381037                 
    10391038                /////////// 
     
    10491048                } 
    10501049 
    1051                 if (1)EvaluateLeafStats(tData); 
    1052                  
    1053  
     1050                if (1) EvaluateLeafStats(tData); 
     1051                 
    10541052                //////// 
    10551053                //-- clean up 
     
    23992397        { 
    24002398                // per definition out of bounds cell has zero volume 
    2401                 if ((*it) == mOutOfBoundsCell) 
     2399                if (IsOutOfBounds(*it)) 
    24022400                        continue; 
    24032401 
     
    33253323ViewCell *BspTree::GetViewCell(const Vector3 &point) 
    33263324{ 
    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; 
    33563360} 
    33573361 
Note: See TracChangeset for help on using the changeset viewer.