Changeset 1876 for GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
- Timestamp:
- 12/08/06 23:46:17 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/RssTree.cpp
r1874 r1876 1795 1795 { 1796 1796 stack<RssTreeNode *> tstack; 1797 PushRoots(tstack);1798 1797 1799 1798 float sumPvsSize = 0.0f; … … 1809 1808 for (int i=0; i < mRoots.size(); i++) 1810 1809 UpdateImportance(mRoots[i]); 1811 1810 1811 PushRoots(tstack); 1812 1812 1813 while (!tstack.empty()) { 1813 1814 RssTreeNode *node = tstack.top(); … … 1882 1883 // works only with single root now! 1883 1884 node = mRoots[0]; 1884 1885 1885 while (!node->IsLeaf()) { 1886 1886 RssTreeInterior *in = (RssTreeInterior *)node; … … 1889 1889 // float p = in->GetRelativePosition(); 1890 1890 float p = in->back->GetImportance()/(in->back->GetImportance() + in->front->GetImportance()); 1891 1891 1892 // cout<<"p = "<<p<<endl; 1892 1893 // cout<<"axis="<<axis<<" pos="<<pos<<endl; 1893 1894 // cout<<GetBBox(in)<<endl; … … 1897 1898 if (params[axis] < p) { 1898 1899 node = in->back; 1899 params[axis] = params[axis] / p; 1900 if (p > Limits::Small) 1901 params[axis] = params[axis] / p; 1900 1902 } else { 1901 1903 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); 1903 1906 } 1904 1907 } … … 1907 1910 1908 1911 GenerateLeafRay(params, rays, node->bbox, node->dirBBox); 1912 1913 1909 1914 } 1910 1915 … … 1914 1919 SimpleRayContainer &rays) 1915 1920 { 1916 1917 1918 1919 1921 1920 1922 stack<RssTreeNode *> tstack; … … 2228 2230 2229 2231 int startIndex = (int)rays.size(); 2230 2231 2232 // Debug<<"B"<<flush; 2232 2233 2233 2234 AxisAlignedBox3 box = GetBBox(leaf); 2234 2235 AxisAlignedBox3 dirBox = GetDirBBox(leaf); … … 2270 2271 float *params, 2271 2272 SimpleRayContainer &rays, 2272 const AxisAlignedBox3 & box,2273 const AxisAlignedBox3 & dirBBox2273 const AxisAlignedBox3 &sbox, 2274 const AxisAlignedBox3 &sDirBBox 2274 2275 ) 2275 2276 { 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 2278 2281 Vector3 direction = VssRay::GetInvDirParam(dirVector.x, dirVector.y); 2279 2282 … … 2282 2285 float minT, maxT; 2283 2286 2284 float boxSize = Magnitude( bbox.Size());2287 float boxSize = Magnitude(sbox.Size()); 2285 2288 // compute interection of the ray with the box 2286 2289 #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); 2289 2292 #else 2290 2293 dist = 0.5f*boxSize; … … 2292 2295 2293 2296 origin += direction*dist; 2294 2295 2297 2296 2298 //Debug<<"dir vector.x="<<dirVector.x<<"direction'.x="<<atan2(direction.x, direction.y)<<endl; 2297 2299 rays.push_back(SimpleRay(origin, direction)); … … 2666 2668 { 2667 2669 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 } 2676 2680 2677 2681 vector<RssTreeLeaf *> leaves; … … 2778 2782 // if 1.0f then weighs = 1 1/2 1/3 1/4 2779 2783 //float passSampleWeightDecay = 1.0f; 2780 float passSampleWeightDecay = 1 .0f;2784 float passSampleWeightDecay = 1000.0f; 2781 2785 2782 2786 float … … 2786 2790 float weight; 2787 2791 if (1) 2788 2792 weight = 1.0f/(passDiff + passSampleWeightDecay); 2789 2793 else 2790 2791 2792 2793 2794 2795 2796 2794 switch (passDiff) { 2795 case 0: 2796 // weight = 1.0f; 2797 // break; 2798 default: 2799 weight = 1.0f; 2800 break; 2797 2801 // 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; 2812 2816 } 2813 2817 return weight;
Note: See TracChangeset
for help on using the changeset viewer.