Ignore:
Timestamp:
09/20/06 18:32:10 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1420 r1421  
    3434 
    3535 
    36 HierarchyManager::HierarchyManager(VspTree *vspTree,  
    37                                                                    const int objectSpaceSubdivisionType): 
     36HierarchyManager::HierarchyManager(const int objectSpaceSubdivisionType): 
    3837mObjectSpaceSubdivisionType(objectSpaceSubdivisionType), 
    39 mVspTree(vspTree),  
    4038mOspTree(NULL),  
    4139mBvHierarchy(NULL) 
     
    5755 
    5856        // hierarchy manager links view space partition and object space partition 
     57        mVspTree = new VspTree(); 
    5958        mVspTree->mHierarchyManager = this; 
    6059         
     
    6362 
    6463 
    65 HierarchyManager::HierarchyManager(VspTree *vspTree, KdTree *kdTree):  
     64HierarchyManager::HierarchyManager(KdTree *kdTree):  
    6665mObjectSpaceSubdivisionType(KD_BASED_OBJ_SUBDIV), 
    67 mVspTree(vspTree),  
    6866mBvHierarchy(NULL) 
    6967{ 
     
    7169        mOspTree->mVspTree = mVspTree; 
    7270 
     71        mVspTree = new VspTree(); 
    7372        mVspTree->mHierarchyManager = this; 
    7473 
     
    120119{ 
    121120        DEL_PTR(mOspTree); 
    122         //DEL_PTR(mVspTree); 
     121        DEL_PTR(mVspTree); 
    123122        DEL_PTR(mBvHierarchy); 
    124123} 
     
    232231bool HierarchyManager::GlobalTerminationCriteriaMet(SubdivisionCandidate *candidate) const 
    233232{ 
    234         return (0 
     233        const bool terminationCriteriaMet =  
     234                (0 
    235235                || (mHierarchyStats.Leaves() >= mTermMaxLeaves)  
    236                 //|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 
    237                 ||      candidate->GlobalTerminationCriteriaMet() 
     236                || (mGlobalCostMisses >= mTermGlobalCostMissTolerance) 
     237                ||(candidate->GlobalTerminationCriteriaMet()) 
    238238                ); 
     239 
     240        if (0 && terminationCriteriaMet) 
     241        { 
     242                Debug << "hierarchy global termination criteria met:" << endl; 
     243                Debug << "leaves: " << mHierarchyStats.Leaves() << " " << mTermMaxLeaves << endl; 
     244                Debug << "cost misses: " << mGlobalCostMisses << " " << mTermGlobalCostMissTolerance << endl; 
     245        } 
     246        return terminationCriteriaMet; 
    239247} 
    240248 
     
    306314                mVspTree->PrepareConstruction(sampleRays, *viewSpaceRays); 
    307315 
     316        mTotalCost = mVspTree->mTotalCost; 
     317        Debug << "\nreseting cost, new total cost: " << mTotalCost << endl; 
     318 
    308319        mTQueue.Push(vsc); 
    309320} 
     
    328339 
    329340{ 
    330         cout << "starting bv hierarchy construction ... " << endl; 
     341        const long startTime = GetTime(); 
     342 
     343        cout << "preparing bv hierarchy construction ... " << endl; 
    331344        mBvHierarchy->CreateRoot(objects); 
    332345 
     
    339352 
    340353    mTQueue.Push(sc); 
     354        cout << "finished bv hierarchy preparation in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    341355} 
    342356 
     
    357371 
    358372        mTotalCost = mOspTree->mTotalCost; 
    359         Debug << "reseting cost, new total cost: " << mTotalCost << endl; 
     373        Debug << "\nreseting cost, new total cost: " << mTotalCost << endl; 
    360374         
    361375    mTQueue.Push(osc); 
     
    739753 
    740754 
    741 void HierarchyManager::PrintHierarchyStatistics(ofstream &stream) const 
     755void HierarchyManager::PrintHierarchyStatistics(ostream &stream) const 
    742756{ 
    743757        stream << mHierarchyStats << endl; 
    744  
    745758        stream << "\nview space:" << endl << endl; 
    746759        stream << mVspTree->GetStatistics() << endl; 
Note: See TracChangeset for help on using the changeset viewer.