Ignore:
Timestamp:
10/03/06 10:10:01 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1553 r1557  
    174174{ 
    175175        Randomize(); // initialise random generator for heuristics 
    176         mOutOfBoundsCell = new BspViewCell(); 
    177         mOutOfBoundsCell->SetId(-1); 
     176        mOutOfBoundsCell = GetOrCreateOutOfBoundsCell(); 
     177 
    178178        ///////// 
    179179        //-- termination criteria for autopartition 
     
    277277 
    278278 
     279BspViewCell *BspTree::GetOrCreateOutOfBoundsCell() 
     280{ 
     281        if (!mOutOfBoundsCell) 
     282        { 
     283                mOutOfBoundsCell = new BspViewCell(); 
     284                mOutOfBoundsCell->SetId(OUT_OF_BOUNDS_ID); 
     285                mOutOfBoundsCell->SetValid(false); 
     286        } 
     287 
     288        return mOutOfBoundsCell; 
     289} 
     290 
    279291int BspTree::SplitPolygons(const Plane3 &plane, 
    280292                                                   PolygonContainer &polys,  
     
    420432        if (mOutOfBoundsCellPartOfTree) 
    421433        { 
    422                 cout << "here223 " << mOutOfBoundsCell << endl; 
    423434                // out of bounds cell not part of tree => 
    424435                // delete manually 
    425436                DEL_PTR(mOutOfBoundsCell); 
    426         }else cout << "here991 " << endl; 
     437        } 
    427438} 
    428439 
     
    9991010                        // add predefined view cell to leaf 
    10001011                        viewCell = dynamic_cast<BspViewCell *>(tData.mViewCell); 
    1001                  
    1002                         /// out of bounds cell can be handled as any other cell 
     1012 
     1013                        // from now on out of bounds cell can be handled as any other cell, 
     1014                        // responsibility for deleting has been shifted 
    10031015                        if (viewCell == mOutOfBoundsCell) 
     1016                        { 
    10041017                                mOutOfBoundsCellPartOfTree = true; 
     1018                        } 
    10051019                } 
    10061020 
     
    23642378 
    23652379 
    2366  
    23672380void BspTree::ConstructGeometry(ViewCell *vc,  
    23682381                                                                BspNodeGeometry &vcGeom) const 
     
    23792392        for (it = leaves.begin(); it != it_end; ++ it) 
    23802393        { 
     2394                // per definition out of bounds cell has zero volume 
     2395                if ((*it) == mOutOfBoundsCell) 
     2396                        continue; 
     2397 
    23812398                BspViewCell *bspVc = dynamic_cast<BspViewCell *>(*it); 
    23822399                vector<BspLeaf *>::const_iterator bit, bit_end = bspVc->mLeaves.end(); 
Note: See TracChangeset for help on using the changeset viewer.