Ignore:
Timestamp:
12/08/06 23:46:17 (18 years ago)
Author:
bittner
Message:

halton generator updates

File:
1 edited

Legend:

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

    r1874 r1876  
    17951795{ 
    17961796  stack<RssTreeNode *> tstack; 
    1797   PushRoots(tstack); 
    17981797         
    17991798  float sumPvsSize = 0.0f; 
     
    18091808  for (int i=0; i < mRoots.size(); i++) 
    18101809        UpdateImportance(mRoots[i]); 
    1811    
     1810 
     1811  PushRoots(tstack); 
     1812 
    18121813  while (!tstack.empty()) { 
    18131814    RssTreeNode *node = tstack.top(); 
     
    18821883  // works only with single root now! 
    18831884  node = mRoots[0]; 
    1884    
    18851885  while (!node->IsLeaf()) { 
    18861886        RssTreeInterior *in = (RssTreeInterior *)node; 
     
    18891889        //      float p = in->GetRelativePosition();  
    18901890        float p = in->back->GetImportance()/(in->back->GetImportance() + in->front->GetImportance()); 
    1891          
     1891 
     1892        //      cout<<"p = "<<p<<endl; 
    18921893        //      cout<<"axis="<<axis<<" pos="<<pos<<endl; 
    18931894        //      cout<<GetBBox(in)<<endl; 
     
    18971898        if (params[axis] < p) { 
    18981899          node = in->back; 
    1899           params[axis] = params[axis] / p; 
     1900          if (p > Limits::Small) 
     1901                params[axis] = params[axis] / p; 
    19001902        } else { 
    19011903          node = in->front; 
    1902           params[axis] = (params[axis] - p) / ( 1.0f - p); 
     1904          if (p < 1.0f - Limits::Small) 
     1905                params[axis] = (params[axis] - p) / (1.0f - p); 
    19031906        } 
    19041907  } 
     
    19071910   
    19081911  GenerateLeafRay(params, rays, node->bbox, node->dirBBox); 
     1912 
     1913 
    19091914} 
    19101915 
     
    19141919                                          SimpleRayContainer &rays) 
    19151920{ 
    1916  
    1917    
    1918  
    19191921 
    19201922  stack<RssTreeNode *> tstack; 
     
    22282230   
    22292231  int startIndex = (int)rays.size(); 
    2230  
    22312232  //  Debug<<"B"<<flush; 
    2232  
     2233   
    22332234  AxisAlignedBox3 box = GetBBox(leaf); 
    22342235  AxisAlignedBox3 dirBox = GetDirBBox(leaf); 
     
    22702271                                                 float *params, 
    22712272                                                 SimpleRayContainer &rays, 
    2272                                                  const AxisAlignedBox3 &box, 
    2273                                                  const AxisAlignedBox3 &dirBBox 
     2273                                                 const AxisAlignedBox3 &sbox, 
     2274                                                 const AxisAlignedBox3 &sDirBBox 
    22742275                                                 ) 
    22752276{ 
    2276   Vector3 origin = bbox.GetPoint(Vector3(params[0], params[1], params[2])); 
    2277   Vector3 dirVector = dirBBox.GetPoint(Vector3(params[3], params[4], 0.0f)); 
     2277  Vector3 origin = sbox.GetPoint(Vector3(params[0], params[1], params[2])); 
     2278 
     2279  Vector3 dirVector = sDirBBox.GetPoint(Vector3(params[3], params[4], 0.0f)); 
     2280 
    22782281  Vector3 direction = VssRay::GetInvDirParam(dirVector.x, dirVector.y); 
    22792282   
     
    22822285  float minT, maxT; 
    22832286   
    2284   float boxSize = Magnitude(bbox.Size()); 
     2287  float boxSize = Magnitude(sbox.Size()); 
    22852288  // compute interection of the ray with the box 
    22862289#if 1 
    2287   if (bbox.ComputeMinMaxT(origin, direction, &minT, &maxT) && minT < maxT) 
    2288         dist = (maxT + 1e-2*boxSize); 
     2290  if (sbox.ComputeMinMaxT(origin, direction, &minT, &maxT) && minT < maxT) 
     2291        dist = (maxT + 0.0f*boxSize); 
    22892292#else 
    22902293  dist = 0.5f*boxSize; 
     
    22922295   
    22932296  origin += direction*dist; 
    2294    
    2295    
     2297 
    22962298  //Debug<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl; 
    22972299  rays.push_back(SimpleRay(origin, direction)); 
     
    26662668{ 
    26672669 
    2668   float param[5]; 
    2669  
    2670   for (int i=0; i < numberOfRays; i++) { 
    2671         halton.GetNext(param); 
    2672         GenerateRay(param, rays); 
    2673   } 
    2674  
    2675   return rays.size(); 
     2670  if (1) { 
     2671        float param[5]; 
     2672         
     2673        for (int i=0; i < numberOfRays; i++) { 
     2674          mHalton.GetNext(5, param); 
     2675          GenerateRay(param, rays); 
     2676        } 
     2677 
     2678        return rays.size(); 
     2679  } 
    26762680   
    26772681  vector<RssTreeLeaf *> leaves; 
     
    27782782// if 1.0f then weighs = 1 1/2 1/3 1/4 
    27792783//float passSampleWeightDecay = 1.0f; 
    2780 float passSampleWeightDecay = 1.0f; 
     2784float passSampleWeightDecay = 1000.0f; 
    27812785 
    27822786float 
     
    27862790  float weight; 
    27872791  if (1)  
    2788                 weight = 1.0f/(passDiff + passSampleWeightDecay); 
     2792        weight = 1.0f/(passDiff + passSampleWeightDecay); 
    27892793  else  
    2790                 switch (passDiff) { 
    2791           case 0: 
    2792                         //        weight = 1.0f; 
    2793                         //        break; 
    2794                 default: 
    2795                         weight = 1.0f; 
    2796                         break; 
     2794        switch (passDiff) { 
     2795        case 0: 
     2796          //      weight = 1.0f; 
     2797          //      break; 
     2798        default: 
     2799          weight = 1.0f; 
     2800          break; 
    27972801          //    case 1: 
    2798 //        weight = 0.5f; 
    2799 //        break; 
    2800 //      case 2: 
    2801 //        weight = 0.25f; 
    2802 //        break; 
    2803 //      case 3: 
    2804 //        weight = 0.12f; 
    2805 //        break; 
    2806 //      case 4: 
    2807 //        weight = 0.06f; 
    2808 //        break; 
    2809 //      default: 
    2810 //        weight = 0.03f; 
    2811 //        break; 
     2802          //      weight = 0.5f; 
     2803          //      break; 
     2804          //    case 2: 
     2805          //      weight = 0.25f; 
     2806          //      break; 
     2807          //    case 3: 
     2808          //      weight = 0.12f; 
     2809          //      break; 
     2810          //    case 4: 
     2811          //      weight = 0.06f; 
     2812          //      break; 
     2813          //    default: 
     2814          //      weight = 0.03f; 
     2815          //      break; 
    28122816        } 
    28132817  return weight; 
Note: See TracChangeset for help on using the changeset viewer.