Ignore:
Timestamp:
12/03/06 20:55:53 (18 years ago)
Author:
mattausch
Message:

fixed compress

File:
1 edited

Legend:

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

    r1789 r1842  
    14881488                } 
    14891489 
     1490                /*cout << "***************\nbefore pulling up:\n"; 
     1491                for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1492                { 
     1493                        cout << "vc:\n" << (*it)->GetPvs() << endl; 
     1494                }*/ 
     1495 
    14901496                // compress root node 
    14911497                PullUpVisibility(interior); 
     1498 
     1499                /*cout << "after pulling up:\n"; 
     1500                cout << "interior:\n" << interior->GetPvs() << endl; 
     1501 
     1502                for (it = interior->mChildren.begin(); it != it_end; ++ it) 
     1503                { 
     1504                        cout << "vc:\n" << (*it)->GetPvs() << endl; 
     1505                }*/ 
    14921506        } 
    14931507} 
     
    16501664void ViewCellsTree::PullUpVisibility(ViewCellInterior *interior) 
    16511665{ 
    1652         Intersectable::NewMail((int)interior->mChildren.size()); 
     1666        const int mail = (int)interior->mChildren.size(); 
     1667        Intersectable::NewMail(mail); 
    16531668 
    16541669        ViewCellContainer::const_iterator cit, cit_end = interior->mChildren.end(); 
    16551670 
    1656         // mail all objects in the leaf sets 
     1671    // mail all objects in the leaf sets 
    16571672        // we are interested in the objects which are present in all leaves 
    16581673        // => count how often an object is part of a child set 
     
    16601675        { 
    16611676                ViewCell *vc = *cit; 
    1662  
    16631677                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
    16641678 
    16651679                while (pit.HasMoreEntries()) 
    16661680                {                
    1667                         ObjectPvsEntry entry = pit.Next(); 
     1681                        const ObjectPvsEntry &entry = pit.Next(); 
    16681682                        Intersectable *obj = entry.mObject; 
    1669  
    1670                         if ((cit == interior->mChildren.begin()) && !obj->Mailed()) 
    1671                         { 
    1672                                 obj->Mail(); 
    1673                         } 
    1674  
    1675                         int incm = obj->IncMail(); 
    1676                 } 
    1677         } 
    1678  
    1679         interior->GetPvs().Clear(); 
     1683                        obj->Mail(); 
     1684                } 
     1685        } 
     1686 
     1687        for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
     1688        { 
     1689                ViewCell *vc = *cit; 
     1690 
     1691                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1692 
     1693                while (pit.HasMoreEntries()) 
     1694                {                
     1695                        const ObjectPvsEntry &entry = pit.Next(); 
     1696                        Intersectable *obj = entry.mObject; 
     1697 
     1698                        obj->IncMail(); 
     1699                } 
     1700        } 
     1701 
     1702        // reset pvs 
     1703    interior->GetPvs().Clear(false); 
    16801704                 
    16811705        // only the objects which are present in all leaf pvs  
     
    16921716                        ObjectPvsEntry entry = pit.Next(); 
    16931717 
    1694                         if (entry.mObject->Mailed((int)interior->mChildren.size())) 
     1718                        if (entry.mObject->Mailed(mail)) 
    16951719                        {        
    16961720                                interior->GetPvs().AddSample(entry.mObject, entry.mData.mSumPdf); 
     
    16991723        } 
    17001724 
    1701         // delete all the objects from the leaf sets which were moved to parent pvs 
    1702         ObjectPvsIterator pit = interior->GetPvs().GetIterator(); 
    1703  
    1704         while (pit.HasMoreEntries()) 
    1705         {                
    1706                 ObjectPvsEntry entry = pit.Next(); 
    1707  
    1708                 for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
    1709                 { 
    1710                         if (!(*cit)->GetPvs().RemoveSample(entry.mObject, Limits::Infinity)) 
     1725        // delete entries which are pulled up 
     1726        // note: could be inefficent, rather gather unmailed pvs and reassign 
     1727        for (cit = interior->mChildren.begin(); cit != cit_end; ++ cit) 
     1728        { 
     1729                ViewCell *vc = *cit; 
     1730                ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1731 
     1732                ObjectPvs newPvs; 
     1733 
     1734                while (pit.HasMoreEntries()) 
     1735                {                
     1736                        const ObjectPvsEntry &entry = pit.Next(); 
     1737                        Intersectable *obj = entry.mObject; 
     1738 
     1739                        /*if (obj->Mailed(mail)) 
    17111740                        { 
    1712                                 Debug << "should not come here!" << endl; 
     1741                                vc->GetPvs().RemoveSample(entry.mObject, Limits::Infinity)) 
     1742                        }*/ 
     1743                        if (!obj->Mailed(mail)) 
     1744                        { 
     1745                                newPvs.AddSampleDirty(obj, entry.mData.mSumPdf); 
    17131746                        } 
    17141747                } 
     1748 
     1749                vc->SetPvs(newPvs); 
    17151750        } 
    17161751} 
     
    24652500 
    24662501 
     2502 
    24672503/**************************************************************************/ 
    24682504/*                     MergeCandidate implementation                      */ 
Note: See TracChangeset for help on using the changeset viewer.