Ignore:
Timestamp:
12/14/05 15:25:44 (19 years ago)
Author:
bittner
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssTree.cpp

    r463 r464  
    121121  environment->GetBoolValue("RssTree.randomize", randomize); 
    122122  environment->GetBoolValue("RssTree.splitUseOnlyDrivingAxis", mSplitUseOnlyDrivingAxis); 
    123   environment->GetBoolValue("RssTree.useRss", mUseRss); 
    124123 
    125124  environment->GetBoolValue("RssTree.interleaveDirSplits", mInterleaveDirSplits); 
     
    292291  dirBBox.Initialize(); 
    293292 
    294   if (mUseRss) 
    295         forcedBoundingBox = NULL; 
    296293 
    297294  mForcedBoundingBox = forcedBoundingBox; 
     
    990987                   //                    (leaf->GetAvgRayContribution() > termMaxRayContribution ) || 
    991988                   (leaf->depth >= termMaxDepth) || 
    992                    (SqrMagnitude(GetBBox(leaf).Size()) <= termMinSize) || 
    993                    (mUseRss && leaf->mPassingRays == leaf->rays.size()) 
     989                   (SqrMagnitude(GetBBox(leaf).Size()) <= termMinSize)  
    994990                   ); 
    995991} 
     
    17691765 
    17701766void 
     1767RssTree::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 
     1794void 
    17711795RssTree::GenerateLeafRays(RssTreeLeaf *leaf, 
    17721796                                                  const int numberOfRays, 
     
    17761800  int nrays = leaf->rays.size(); 
    17771801  for (int i=0; i < numberOfRays; i++) { 
    1778         bool useExtendedConvexCombination = (nrays >= 3) && (i > numberOfRays/2); 
     1802        bool useExtendedConvexCombination = (nrays >= 2) && (i > numberOfRays/2); 
    17791803 
    17801804                 
     
    17831807        if (useExtendedConvexCombination) { 
    17841808          // 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); 
    17881811           
    17891812          Vector3 o1 = leaf->rays[r1].GetOrigin(); 
    1790            
    17911813          Vector3 o2 = leaf->rays[r2].GetOrigin(); 
    17921814           
    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; 
    18011819          direction = 
    18021820                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(); 
    18051822          // shift the origin a little bit 
    18061823          origin += direction*0.1f; 
Note: See TracChangeset for help on using the changeset viewer.