Ignore:
Timestamp:
11/03/05 18:49:59 (19 years ago)
Author:
mattausch
Message:

added bsp view cells statistics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r374 r375  
    343343} 
    344344 
     345void BspViewCellsStatistics::Print(ostream &app) const 
     346{ 
     347        app << "===== BspViewCells statistics ===============\n"; 
     348 
     349        app << setprecision(4); 
     350 
     351        app << "#N_PMAXPVS ( largest PVS )\n" << maxPvs << endl; 
     352 
     353        app << "#N_PMINPVS ( smallest PVS )\n" << minPvs << endl; 
     354 
     355        app << "#N_PAVGPVS ( average PVS )\n" << AvgPvs() << endl; 
     356 
     357        app << "#N_PEMPTYPVS ( view cells with PVS smaller 2 )\n" << emptyPvs << endl; 
     358 
     359        app << "#N_VIEWCELLS ( number of view cells)\n" << viewCells << endl; 
     360 
     361        app << "#N_AVGBSPLEAVES (average number of BSP leaves per view cell )\n" << AvgBspLeaves() << endl; 
     362 
     363        app << "#N_MAXBSPLEAVES ( maximal number of BSP leaves per view cell )\n" << maxBspLeaves << endl; 
     364         
     365        app << "===== END OF BspViewCells statistics ==========\n"; 
     366} 
     367 
    345368void BspTreeStatistics::Print(ostream &app) const 
    346369{ 
     
    368391        app << "#N_INPUT_POLYGONS (number of input polygons )\n" <<     polys << endl; 
    369392 
    370         app << "#N_PVS: " << pvs << endl; 
     393        //app << "#N_PVS: " << pvs << endl; 
    371394 
    372395        app << "#N_ROUTPUT_INPUT_POLYGONS ( ratio polygons after subdivision / input polygons )\n" << 
     
    375398        app << "===== END OF BspTree statistics ==========\n"; 
    376399} 
     400 
    377401 
    378402BspTree::~BspTree() 
     
    10441068                ((int)rays.size() > sTermMaxRaysForAxisAligned) && 
    10451069                ((sTermMaxObjectsForAxisAligned < 0) ||  
    1046                   (Polygon3::CountIntersectables(polys) > sTermMaxObjectsForAxisAligned))) 
     1070                  (Polygon3::ParentObjectsSize(polys) > sTermMaxObjectsForAxisAligned))) 
    10471071        { 
    10481072                Plane3 plane; 
     
    15291553        if (data.mDepth >= sTermMaxDepth) 
    15301554                ++ mStat.maxDepthNodes; 
     1555         
    15311556        // store maximal and minimal depth 
    15321557        if (data.mDepth > mStat.maxDepth) 
    15331558                mStat.maxDepth = data.mDepth; 
     1559 
    15341560        if (data.mDepth < mStat.minDepth) 
    15351561                mStat.minDepth = data.mDepth; 
     
    15371563        // accumulate depth to compute average 
    15381564        mStat.accumDepth += data.mDepth; 
    1539  
    1540         if (leaf->mViewCell != mRootCell) 
    1541         {        
    1542                 ++ mStat.viewCells; 
    1543                 mStat.pvs += leaf->mViewCell->GetPvs().GetSize(); 
    1544         } 
    15451565         
    15461566#ifdef _DEBUG 
     
    16951715} 
    16961716 
    1697 int BspTree::CountViewCellPvs() const 
    1698 { 
    1699         int count = 0; 
     1717void BspTree::EvaluateViewCellsStats(BspViewCellsStatistics &stat) const 
     1718{ 
     1719        stat.Reset(); 
     1720 
    17001721        stack<BspNode *> nodeStack; 
    17011722        nodeStack.push(mRoot); 
     
    17131734                if (node->IsLeaf())  
    17141735                { 
    1715                         ViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 
     1736                        ++ stat.bspLeaves; 
     1737 
     1738                        BspViewCell *viewCell = dynamic_cast<BspLeaf *>(node)->mViewCell; 
    17161739 
    17171740                        if (!viewCell->Mailed())  
    17181741                        { 
    17191742                                viewCell->Mail(); 
    1720                                 count += viewCell->GetPvs().GetSize(); 
     1743                                 
     1744                                ++ stat.viewCells; 
     1745                                int pvsSize = viewCell->GetPvs().GetSize(); 
     1746 
     1747                stat.pvs += pvsSize; 
     1748 
     1749                                if (pvsSize < 2) 
     1750                                        ++ stat.emptyPvs; 
     1751 
     1752                                if (pvsSize > stat.maxPvs) 
     1753                                        stat.maxPvs = pvsSize; 
     1754 
     1755                                if (pvsSize < stat.minPvs) 
     1756                                        stat.minPvs = pvsSize; 
     1757 
     1758                                if ((int)viewCell->mBspLeaves.size() > stat.maxBspLeaves) 
     1759                                        stat.maxBspLeaves = (int)viewCell->mBspLeaves.size();            
    17211760                        } 
    17221761                } 
     
    17291768                } 
    17301769        } 
    1731         return count; 
    17321770} 
    17331771 
     
    23082346                Ray *ray = (*rit)->mRay; 
    23092347                 
    2310                 for (iit = ray->bspIntersections.begin(); iit != ray->bspIntersections.end(); ++ iit) 
     2348                for (iit = ray->bspIntersections.begin();  
     2349                         iit != ray->bspIntersections.end(); ++ iit) 
    23112350                { 
    23122351                        BspViewCell *vc = (*iit).mLeaf->mViewCell; 
Note: See TracChangeset for help on using the changeset viewer.