Changeset 1741


Ignore:
Timestamp:
11/12/06 23:04:47 (18 years ago)
Author:
mattausch
Message:

removed bug from pvs merge

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
3 edited

Legend:

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

    r1740 r1741  
    19431943                        //subStats.mEntriesInPvs += entriesIncr; 
    19441944 
    1945                         // if (rcDecr <= 0) 
    19461945                        if (nextCandidate->Type() == SubdivisionCandidate::VIEW_SPACE) 
    19471946                        { 
    19481947                                ++ subStats.mViewSpaceSplits; 
    1949                                 cout << "v";//cout << "vsp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
     1948                                cout << "v"; 
     1949                                //cout << "vsp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
    19501950                        } 
    19511951                        else 
    19521952                        { 
    19531953                                ++ subStats.mObjectSpaceSplits; 
    1954                                 cout << "o";//"osp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
     1954                                cout << "o"; 
     1955                                //"osp t: " << timeStamp << " rc: " << rcDecr << " pvs: " << entriesIncr << endl; 
    19551956                        } 
    19561957 
     
    19741975 
    19751976 
    1976 void HierarchyManager::EvaluateSubdivision(const VssRayContainer &sampleRays,                                                                                                                                               
     1977void HierarchyManager::EvaluateSubdivision(const VssRayContainer &sampleRays, 
    19771978                                                                                   const ObjectContainer &objects, 
    19781979                                                                                   const string &filename) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1740 r1741  
    2222{ 
    2323public: 
     24 
     25        PvsEntry() {} 
    2426 
    2527        PvsEntry(T sample, const S &data): mObject(sample), mData(data) {} 
     
    371373        std::vector<PvsEntry<T, S> >::const_iterator ait = a.mEntries.begin(), ait_end = a.mEntries.end(); 
    372374        std::vector<PvsEntry<T, S> >::const_iterator bit = b.mEntries.begin(), bit_end = b.mEntries.end(); 
    373  
    374         while (1) 
    375         { 
    376                 for (; (ait != ait_end) && ((*ait).mObject < (*bit).mObject); ++ ait) 
     375        Intersectable::NewMail(); 
     376        cout << "a: " << a.mEntries.size() << " b " << b.mEntries.size() << endl; 
     377         
     378        for (; (ait != ait_end); ++ ait) 
     379        { 
     380                Intersectable *aObj = (*ait).mObject; 
     381                Intersectable *bObj = NULL; 
     382                PvsEntry<T, S> aEntry = (*ait); 
     383 
     384                for (; (bit != bit_end) && ((*bit).mObject <= (*ait).mObject); ++ bit) 
    377385                { 
    378                         if ((*ait).mObject != (*bit).mObject) 
    379                                 mergedPvs.mEntries.push_back(*ait); 
    380                 } 
    381  
    382                 for (; (bit != bit_end) && ((ait == ait_end) || ((*bit).mObject <= (*bit).mObject)); ++ bit) 
    383                 { 
    384                         if ((*ait).mObject == (*bit).mObject) 
     386                        bObj = (*bit).mObject; 
     387 
     388                        // object found => add up probabilities 
     389                        if (bObj != aEntry.mObject) 
    385390                        { 
    386                                 PvsData newData((*ait).mData.mSumPdf + (*bit).mData.mSumPdf); 
    387                                 PvsEntry<T, S> entry((*ait).mObject, newData); 
     391                                PvsData newData(aEntry.mData.mSumPdf + (*bit).mData.mSumPdf); 
     392                                PvsEntry<T, S> entry(bObj, newData); 
    388393                                mergedPvs.mEntries.push_back(entry); 
     394                                if (bObj->Mailed()) 
     395                                        cout << "Error2 " << bObj << endl; 
     396                                bObj->Mail(); 
     397                                cout << "e: " << (int)bObj; 
    389398                        } 
    390399                        else 
    391400                        { 
     401                                if (bObj->Mailed()) 
     402                                        cout << "Error3 " << bObj << endl; 
     403                                bObj->Mail(); 
    392404                                mergedPvs.mEntries.push_back(*bit); 
     405                                cout << "e: " << (int)bObj; 
    393406                        } 
    394407                } 
    395         } 
     408 
     409                // only push back if objects different  
     410                // (equal case is handled by second loop) 
     411                if (aObj != bObj) 
     412                { 
     413                        mergedPvs.mEntries.push_back(*ait); 
     414                        if (aObj->Mailed()) 
     415                                cout << "Error1 " << aObj << endl; 
     416                        aObj->Mail(); 
     417                        cout << "e: " << (int)aObj; 
     418                } 
     419        } 
     420 
     421        // add the rest 
     422        for (; (bit != bit_end); ++ bit) 
     423        { 
     424                Intersectable *bObj = (*bit).mObject; 
     425                 
     426                mergedPvs.mEntries.push_back(*bit); 
     427                if (bObj->Mailed()) 
     428                        cout << "Error4 " << bObj << endl; 
     429                bObj->Mail(); 
     430                cout << "e: " << (int)bObj; 
     431        } 
     432 
     433/* 
     434        while ((ait != ait_end) || (bit != bit_end)) 
     435        {cout << "x"; 
     436 
     437                // first iterate through first vector until we find the objects 
     438                for (; (ait != ait_end) && ((bit == bit_end) || ((*ait).mObject <= (*bit).mObject)); ++ ait) 
     439                { 
     440                        Intersectable *obj = (*ait).mObject; 
     441                        aEntry = (*ait); 
     442                        //bObject = (bit != bit_end) ? (*bit).mObject : NULL; 
     443 
     444                        // only push back if objects different  
     445                        // (equal case is handled by second loop) 
     446                        if (obj != bEntry.mObject) 
     447                        { 
     448                                mergedPvs.mEntries.push_back(*ait); 
     449                                if (obj->Mailed()) 
     450                                        cout << "Error1 " << obj << endl; 
     451                                obj->Mail(); 
     452                                cout << "e: " << obj; 
     453                        } 
     454                } 
     455 
     456                // iterate through second pvs 
     457                for (; (bit != bit_end) && ((ait == ait_end) || ((*bit).mObject <= (*ait).mObject)); ++ bit) 
     458                { 
     459                        Intersectable *obj = (*bit).mObject; 
     460                        bEntry = (*bit); 
     461                        //aObject = (ait != ait_end) ? (*ait).mObject : NULL; 
     462 
     463                        // object found => add up probabilities 
     464                        if (obj != aEntry.mObject) 
     465                        { 
     466                                PvsData newData(aEntry.mData.mSumPdf + bEntry.mData.mSumPdf); 
     467                                PvsEntry<T, S> entry(obj, newData); 
     468                                mergedPvs.mEntries.push_back(entry); 
     469                                if (obj->Mailed()) 
     470                                        cout << "Error2 " << obj << endl; 
     471                                obj->Mail(); 
     472                                cout << "e: " << obj; 
     473                        } 
     474                        else 
     475                        { 
     476                                if (obj->Mailed()) 
     477                                        cout << "Error3 " << obj << endl; 
     478                                obj->Mail(); 
     479                                mergedPvs.mEntries.push_back(*bit); 
     480                                cout << "e: " << obj; 
     481                        } 
     482                } 
     483        }*/ 
    396484} 
    397485 
     
    457545                S &data = (*it).mData; 
    458546                data.mSumPdf += pdf; 
    459  
     547cout << "w"; 
    460548                return data.mSumPdf; 
    461549        } 
     
    463551        { 
    464552                PvsEntry<T, S> entry(sample, pdf); 
    465                  
     553                cout << "i"; 
    466554                mEntries.insert(it, entry); 
    467555                return pdf; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r1740 r1741  
    17231723        { 
    17241724                root = root->GetParent(); 
     1725                cout << "h"; 
    17251726                pvs.MergeInPlace(root->GetPvs()); 
    17261727        } 
Note: See TracChangeset for help on using the changeset viewer.