Ignore:
Timestamp:
01/31/07 01:51:57 (17 years ago)
Author:
mattausch
Message:

worked on integration manual

File:
1 edited

Legend:

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

    r2017 r2066  
    1616int KdNode::sMailId = 1; 
    1717int KdNode::sReservedMailboxes = 1; 
     18 
    1819 
    1920inline static bool ilt(Intersectable *obj1, Intersectable *obj2) 
     
    178179 
    179180 
    180  
    181181bool 
    182182KdTree::TerminationCriteriaMet(const KdLeaf *leaf) 
    183183{ 
    184   //  cerr<<"\n OBJECTS="<<leaf->mObjects.size()<<endl; 
    185   return 
    186     ((int)leaf->mObjects.size() <= mTermMinCost) || 
    187     (leaf->mDepth >= mTermMaxDepth); 
    188    
     184        const bool criteriaMet = 
     185                ((int)leaf->mObjects.size() <= mTermMinCost) || 
     186                 (leaf->mDepth >= mTermMaxDepth); 
     187  
     188        if (criteriaMet) 
     189                cerr<<"\n OBJECTS="<<leaf->mObjects.size()<<endl; 
     190 
     191        return criteriaMet; 
    189192} 
    190193 
     
    462465{ 
    463466        CLEAR_CONTAINER(*splitCandidates); 
    464   //splitCandidates->clear(); 
    465    
    466   int requestedSize = 2*(int)node->mObjects.size(); 
    467   // creates a sorted split candidates array 
    468   if (splitCandidates->capacity() > 500000 && 
    469       requestedSize < (int)(splitCandidates->capacity()/10) ) { 
    470     delete splitCandidates; 
    471     splitCandidates = new vector<SortableEntry *>; 
     467        //splitCandidates->clear(); 
     468 
     469    int requestedSize = 2*(int)node->mObjects.size(); 
     470         
     471        // creates a sorted split candidates array 
     472        if (splitCandidates->capacity() > 500000 && 
     473                requestedSize < (int)(splitCandidates->capacity()/10) ) {                
     474                        delete splitCandidates; 
     475                        splitCandidates = new vector<SortableEntry *>; 
    472476  } 
    473477   
     
    477481  for(ObjectContainer::const_iterator mi = node->mObjects.begin(); 
    478482      mi != node->mObjects.end(); 
    479       mi++) { 
    480     AxisAlignedBox3 box = (*mi)->GetBox(); 
    481  
    482     splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MIN, 
    483                                                                                          box.Min(axis), 
    484                                                                                          *mi) 
    485                                                            ); 
     483      mi++)  
     484  { 
     485          AxisAlignedBox3 box = (*mi)->GetBox(); 
     486 
     487          splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MIN, 
     488                                                                 box.Min(axis), 
     489                                                                 *mi) 
     490                                                                 ); 
    486491     
    487      
    488     splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MAX, 
    489                                                                                          box.Max(axis), 
    490                                                                                          *mi) 
    491                                                            ); 
    492   } 
    493    
    494   stable_sort(splitCandidates->begin(), splitCandidates->end()); 
     492      splitCandidates->push_back(new SortableEntry(SortableEntry::BOX_MAX, 
     493                                                                 box.Max(axis), 
     494                                                                 *mi) 
     495                                                                 ); 
     496  } 
     497   
     498  stable_sort(splitCandidates->begin(), splitCandidates->end(), iltS); 
    495499} 
    496500 
Note: See TracChangeset for help on using the changeset viewer.