Changeset 1842 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
- Timestamp:
- 12/03/06 20:55:53 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r1789 r1842 1488 1488 } 1489 1489 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 1490 1496 // compress root node 1491 1497 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 }*/ 1492 1506 } 1493 1507 } … … 1650 1664 void ViewCellsTree::PullUpVisibility(ViewCellInterior *interior) 1651 1665 { 1652 Intersectable::NewMail((int)interior->mChildren.size()); 1666 const int mail = (int)interior->mChildren.size(); 1667 Intersectable::NewMail(mail); 1653 1668 1654 1669 ViewCellContainer::const_iterator cit, cit_end = interior->mChildren.end(); 1655 1670 1656 1671 // mail all objects in the leaf sets 1657 1672 // we are interested in the objects which are present in all leaves 1658 1673 // => count how often an object is part of a child set … … 1660 1675 { 1661 1676 ViewCell *vc = *cit; 1662 1663 1677 ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 1664 1678 1665 1679 while (pit.HasMoreEntries()) 1666 1680 { 1667 ObjectPvsEntryentry = pit.Next();1681 const ObjectPvsEntry &entry = pit.Next(); 1668 1682 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); 1680 1704 1681 1705 // only the objects which are present in all leaf pvs … … 1692 1716 ObjectPvsEntry entry = pit.Next(); 1693 1717 1694 if (entry.mObject->Mailed( (int)interior->mChildren.size()))1718 if (entry.mObject->Mailed(mail)) 1695 1719 { 1696 1720 interior->GetPvs().AddSample(entry.mObject, entry.mData.mSumPdf); … … 1699 1723 } 1700 1724 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)) 1711 1740 { 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); 1713 1746 } 1714 1747 } 1748 1749 vc->SetPvs(newPvs); 1715 1750 } 1716 1751 } … … 2465 2500 2466 2501 2502 2467 2503 /**************************************************************************/ 2468 2504 /* MergeCandidate implementation */
Note: See TracChangeset
for help on using the changeset viewer.