Changeset 2691 for GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
- Timestamp:
- 05/21/08 01:18:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2614 r2691 296 296 Vector3 origin, direction; 297 297 298 ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells();298 //ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells(); 299 299 300 300 Vector3 point; 301 301 Vector3 normal, normal2; 302 302 303 const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f);303 //const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f); 304 304 const int objIdx = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 305 305 306 306 Intersectable *object = mPreprocessor.mObjects[objIdx]; 307 ViewCell *viewCell = viewCells[vcIdx];307 ViewCell *viewCell = mViewCell;//viewCells[vcIdx]; 308 308 309 309 object->GetRandomSurfacePoint(point, normal); … … 843 843 Vector3 origin, direction; 844 844 845 ViewCellContainer &viewCells =846 mPreprocessor.mViewCellsManager->GetViewCells();847 848 845 Vector3 point; 849 846 Vector3 normal; 850 847 851 //Vector normalObj;852 // float r[1];853 // sHalton.GetNext(1, r);854 // const int objIdx = (int)(r[0] * (float)mPreprocessor.mObjects.size() - 1.0f);855 // Intersectable *object = mPreprocessor.mObjects[objIdx];856 // object->GetRandomSurfacePoint(point, normal);857 // cout << "obj: " << objIdx << endl;858 859 848 float r[2]; 849 //for (int i=0; i < 2; i++) 850 // r[i] = RandomValue(0, 1); 851 860 852 sHalton.GetNext(2, r); 861 853 … … 869 861 870 862 // get point on view cell surface 871 mViewCell->GetRandomSurfacePoint(origin, normal); 863 if (0) 864 { 865 //mViewCell->GetRandomEdgePoint(origin, normal); 866 mViewCell->GetRandomSurfacePoint(origin, normal); 867 868 // move a little bit back to avoid piercing through walls 869 // that bound the view cell 870 if (0) origin -= 0.01f * normal; 871 } 872 else 873 origin = mViewCell->GetBox().GetUniformRandomSurfacePoint(); 872 874 873 875 //direction = point - origin; 874 875 // move a little bit back to avoid piercing through walls876 // that bound the view cell877 origin -= 0.01f * normal;878 876 879 877 // $$ jb the pdf is yet not correct for all sampling methods!
Note: See TracChangeset
for help on using the changeset viewer.