Changeset 1122


Ignore:
Timestamp:
07/12/06 01:30:05 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
5 edited

Legend:

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

    r1108 r1122  
    9191        mBox.Include((*mi)->GetBox()); 
    9292  } 
    93  
    94         ProcessLeafObjects(NULL, leaf, NULL); 
    9593 
    9694  cout <<"KdTree Root Box:"<<mBox<<endl; 
     
    307305    mStat.objectRefs += objectsBack + objectsFront; 
    308306  } 
    309    
    310    ProcessLeafObjects(leaf, front, back); 
    311    
    312307 
    313308  delete leaf; 
     
    10941089 
    10951090 
    1096 void KdTree::ProcessLeafObjects(KdLeaf *parent, KdLeaf *front, KdLeaf *back) const 
    1097 { 
    1098         if (parent) 
    1099         { 
    1100                 // remove the parents from the set 
    1101                 ObjectContainer::const_iterator oit, oit_end = parent->mObjects.end(); 
    1102  
    1103                 for (oit = parent->mObjects.begin(); oit != oit_end; ++ oit) 
    1104                 { 
    1105                         Intersectable *object = *oit; 
    1106  
    1107                         set<KdLeaf *>::iterator kdit = object->mKdLeaves.find(parent); 
    1108  
    1109                         // remove parent leaf 
    1110                         if (kdit != object->mKdLeaves.end()) 
    1111                                 object->mKdLeaves.erase(kdit); 
    1112                 } 
    1113         } 
    1114  
    1115         //Intersectable::NewMail(); 
    1116  
    1117         if (front) 
    1118         { 
    1119                 // Add front to leaf kd cells 
    1120                 ObjectContainer::const_iterator oit, oit_end = front->mObjects.end(); 
    1121  
    1122                 for (oit = front->mObjects.begin(); oit != oit_end; ++ oit) 
    1123                 { 
    1124                         Intersectable *object = *oit; 
    1125                         object->mKdLeaves.insert(front); 
    1126                 } 
    1127         } 
    1128  
    1129         if (back) 
    1130         { 
    1131                 // Add back to leaf kd cells 
    1132                 ObjectContainer::const_iterator oit, oit_end = back->mObjects.end(); 
    1133  
    1134                 for (oit = back->mObjects.begin(); oit != oit_end; ++ oit) 
    1135                 { 
    1136                         Intersectable *object = *oit; 
    1137                         object->mKdLeaves.insert(back);  
    1138                 } 
    1139         } 
    1140  
    1141         // note: can find out about multiple objects only now after adding and deleting 
    1142         // finished  
    1143         if (front) 
    1144         { 
    1145                 // find objects from multiple kd-leaves 
    1146                 ObjectContainer::const_iterator oit, oit_end = front->mObjects.end(); 
    1147  
    1148                 for (oit = front->mObjects.begin(); oit != oit_end; ++ oit) 
    1149                 { 
    1150                         Intersectable *object = *oit; 
    1151  
    1152                         if (object->mKdLeaves.size() > 1) 
    1153                                 front->mMultipleObjects.push_back(object); 
    1154                 } 
    1155         } 
    1156  
    1157         if (back)  
    1158         { 
    1159                 // find objects from multiple kd-leaves 
    1160                 ObjectContainer::const_iterator oit, oit_end = back->mObjects.end(); 
    1161  
    1162                 for (oit = back->mObjects.begin(); oit != oit_end; ++ oit) 
    1163                 { 
    1164                         Intersectable *object = *oit; 
    1165  
    1166                         if (object->mKdLeaves.size() > 1) 
    1167                                 back->mMultipleObjects.push_back(object); 
    1168                 } 
    1169         } 
    1170          
    1171 } 
    1172  
    1173  
    1174 } 
     1091} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1121 r1122  
    541541 
    542542 
    543   /** does some post processing on the objects in the new child leaves. 
    544   */ 
    545   void ProcessLeafObjects(KdLeaf *parent, KdLeaf *front, KdLeaf *back) const; 
    546  
    547543  int mTermMaxNodes; 
    548544  float mSplitBorder; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1121 r1122  
    26952695        } 
    26962696         
    2697         // only for debugging: test valitidy 
    2698         TestSubdivision(); 
     2697        // only for debugging purpose: test if the subdivision is valid 
     2698        if (0) TestSubdivision(); 
    26992699 
    27002700        mColorCode = savedColorCode; 
     
    39463946 
    39473947        // only for debugging purpose: test if the subdivision is valid 
    3948         TestSubdivision(); 
     3948        if (0) TestSubdivision(); 
    39493949 
    39503950        //-- refines the merged view cells 
     
    49014901        long startTime; 
    49024902 
    4903         mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox); 
    4904  
     4903        //mHierarchyManager->Construct2(constructionRays, objects, &mViewSpaceBox); 
     4904        mHierarchyManager->Construct(constructionRays, objects, &mViewSpaceBox); 
    49054905         
    49064906        //-- stats 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1121 r1122  
    28262826        SplitObjects(splitPlane, leaf->mObjects, front->mObjects, back->mObjects); 
    28272827 
    2828         ProcessLeafObjects(back, leaf); 
    2829     ProcessLeafObjects(front, leaf); 
    2830    
     2828        ProcessLeafObjects(leaf, front, back); 
     2829     
    28312830        backData.mNode = back; 
    28322831        frontData.mNode = front; 
     
    34083407 
    34093408 
    3410 void OspTree::ProcessLeafObjects(KdLeaf *leaf, KdLeaf *parent) const 
    3411 { 
    3412         ObjectContainer::const_iterator oit, oit_end = leaf->mObjects.end(); 
    3413  
    3414         for (oit = leaf->mObjects.begin(); oit != oit_end; ++ oit) 
    3415         { 
    3416                 Intersectable *object = *oit; 
    3417  
    3418                 if (parent) 
    3419                 { 
     3409void OspTree::ProcessLeafObjects(KdLeaf *parent, KdLeaf *front, KdLeaf *back) const 
     3410{ 
     3411        if (parent) 
     3412        { 
     3413                // remove the parents from the set 
     3414                ObjectContainer::const_iterator oit, oit_end = parent->mObjects.end(); 
     3415 
     3416                for (oit = parent->mObjects.begin(); oit != oit_end; ++ oit) 
     3417                { 
     3418                        Intersectable *object = *oit; 
     3419 
    34203420                        set<KdLeaf *>::iterator kdit = object->mKdLeaves.find(parent); 
    34213421 
     
    34243424                                object->mKdLeaves.erase(kdit); 
    34253425                } 
    3426  
    3427                 object->mKdLeaves.insert(leaf); 
    3428  
    3429                 if (object->mKdLeaves.size() > 1) 
    3430                         leaf->mMultipleObjects.push_back(object); 
    3431         } 
     3426        } 
     3427 
     3428        //Intersectable::NewMail(); 
     3429 
     3430        if (front) 
     3431        { 
     3432                // Add front to leaf kd cells 
     3433                ObjectContainer::const_iterator oit, oit_end = front->mObjects.end(); 
     3434 
     3435                for (oit = front->mObjects.begin(); oit != oit_end; ++ oit) 
     3436                { 
     3437                        Intersectable *object = *oit; 
     3438                        object->mKdLeaves.insert(front); 
     3439                } 
     3440        } 
     3441 
     3442        if (back) 
     3443        { 
     3444                // Add back to leaf kd cells 
     3445                ObjectContainer::const_iterator oit, oit_end = back->mObjects.end(); 
     3446 
     3447                for (oit = back->mObjects.begin(); oit != oit_end; ++ oit) 
     3448                { 
     3449                        Intersectable *object = *oit; 
     3450                        object->mKdLeaves.insert(back);  
     3451                } 
     3452        } 
     3453 
     3454        // note: can find out about multiple objects only now after adding and deleting 
     3455        // finished  
     3456        if (front) 
     3457        { 
     3458                // find objects from multiple kd-leaves 
     3459                ObjectContainer::const_iterator oit, oit_end = front->mObjects.end(); 
     3460 
     3461                for (oit = front->mObjects.begin(); oit != oit_end; ++ oit) 
     3462                { 
     3463                        Intersectable *object = *oit; 
     3464 
     3465                        if (object->mKdLeaves.size() > 1) 
     3466                                front->mMultipleObjects.push_back(object); 
     3467                } 
     3468        } 
     3469 
     3470        if (back)  
     3471        { 
     3472                // find objects from multiple kd-leaves 
     3473                ObjectContainer::const_iterator oit, oit_end = back->mObjects.end(); 
     3474 
     3475                for (oit = back->mObjects.begin(); oit != oit_end; ++ oit) 
     3476                { 
     3477                        Intersectable *object = *oit; 
     3478 
     3479                        if (object->mKdLeaves.size() > 1) 
     3480                                back->mMultipleObjects.push_back(object); 
     3481                } 
     3482        } 
     3483         
    34323484} 
    34333485 
     
    37023754 
    37033755                 
    3704         mOspTree.ProcessLeafObjects(kdleaf, NULL); 
     3756        mOspTree.ProcessLeafObjects(NULL, kdleaf, NULL); 
    37053757 
    37063758        // compute first split candidate 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1121 r1122  
    14391439                                          ObjectContainer &back); 
    14401440 
    1441         void ProcessLeafObjects(KdLeaf *leaf, KdLeaf *parent) const; 
     1441         /** does some post processing on the objects in the new child leaves. 
     1442         */ 
     1443        void ProcessLeafObjects(KdLeaf *parent, KdLeaf *front, KdLeaf *back) const; 
    14421444 
    14431445        /** Selects an axis aligned for the next split. 
Note: See TracChangeset for help on using the changeset viewer.