Changeset 464 for trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
- Timestamp:
- 12/14/05 15:25:44 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp
r463 r464 121 121 environment->GetBoolValue("RssTree.randomize", randomize); 122 122 environment->GetBoolValue("RssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis); 123 environment->GetBoolValue("RssTree.useRss", mUseRss);124 123 125 124 environment->GetBoolValue("RssTree.interleaveDirSplits", mInterleaveDirSplits); … … 292 291 dirBBox.Initialize(); 293 292 294 if (mUseRss)295 forcedBoundingBox = NULL;296 293 297 294 mForcedBoundingBox = forcedBoundingBox; … … 990 987 // (leaf->GetAvgRayContribution() > termMaxRayContribution ) || 991 988 (leaf->depth >= termMaxDepth) || 992 (SqrMagnitude(GetBBox(leaf).Size()) <= termMinSize) || 993 (mUseRss && leaf->mPassingRays == leaf->rays.size()) 989 (SqrMagnitude(GetBBox(leaf).Size()) <= termMinSize) 994 990 ); 995 991 } … … 1769 1765 1770 1766 void 1767 RssTree::PickEdgeRays(RssTreeLeaf *leaf, 1768 int &r1, 1769 int &r2 1770 ) 1771 { 1772 int nrays = leaf->rays.size(); 1773 1774 if (nrays == 2) { 1775 r1 = 0; 1776 r2 = 1; 1777 return; 1778 } 1779 1780 int tries = min(20, nrays); 1781 1782 while (--tries) { 1783 r1 = Random(nrays); 1784 r2 = Random(nrays); 1785 if (leaf->rays[r1].mRay->mTerminationObject != leaf->rays[r2].mRay->mTerminationObject) 1786 break; 1787 } 1788 1789 if (r1 == r2) 1790 r2 = (r1+1)%leaf->rays.size(); 1791 } 1792 1793 1794 void 1771 1795 RssTree::GenerateLeafRays(RssTreeLeaf *leaf, 1772 1796 const int numberOfRays, … … 1776 1800 int nrays = leaf->rays.size(); 1777 1801 for (int i=0; i < numberOfRays; i++) { 1778 bool useExtendedConvexCombination = (nrays >= 3) && (i > numberOfRays/2);1802 bool useExtendedConvexCombination = (nrays >= 2) && (i > numberOfRays/2); 1779 1803 1780 1804 … … 1783 1807 if (useExtendedConvexCombination) { 1784 1808 // pickup 3 random rays 1785 int r1 = Random(nrays); 1786 int r2 = Random(nrays); 1787 int r3 = Random(nrays); 1809 int r1, r2; 1810 PickEdgeRays(leaf, r1, r2); 1788 1811 1789 1812 Vector3 o1 = leaf->rays[r1].GetOrigin(); 1790 1791 1813 Vector3 o2 = leaf->rays[r2].GetOrigin(); 1792 1814 1793 Vector3 o3 = leaf->rays[r3].GetOrigin(); 1794 1795 const float overlap = 0.0; 1796 1797 1798 float w1, w2, w3; 1799 GenerateExtendedConvexCombinationWeights(w1, w2, w3, overlap); 1800 origin = w1*o1 + w2*o2 + w3*o3; 1815 const float overlap = 0.1f; 1816 float w1, w2; 1817 GenerateExtendedConvexCombinationWeights2(w1, w2, overlap); 1818 origin = w1*o1 + w2*o2; 1801 1819 direction = 1802 1820 w1*leaf->rays[r1].mRay->GetDir() + 1803 w2*leaf->rays[r2].mRay->GetDir() + 1804 w3*leaf->rays[r3].mRay->GetDir(); 1821 w2*leaf->rays[r2].mRay->GetDir(); 1805 1822 // shift the origin a little bit 1806 1823 origin += direction*0.1f;
Note: See TracChangeset
for help on using the changeset viewer.