Ignore:
Timestamp:
01/20/07 00:29:03 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1999 r2000  
    750750        Vector3 normal, normal2; 
    751751         
    752         float r[1]; 
    753         sHalton.GetNext(1, r); 
    754  
    755         const int objIdx = (int)(r[0] * (float)mPreprocessor.mObjects.size() - 1.0f); 
    756                                 //      = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 
    757         Intersectable *object = mPreprocessor.mObjects[objIdx]; 
    758  
    759         //cout << "obj: " << objIdx << endl; 
    760  
    761         object->GetRandomSurfacePoint(point, normal); 
     752        // float r[1]; 
     753        // sHalton.GetNext(1, r); 
     754        // const int objIdx = (int)(r[0] * (float)mPreprocessor.mObjects.size() - 1.0f); 
     755        // Intersectable *object = mPreprocessor.mObjects[objIdx]; 
     756        // object->GetRandomSurfacePoint(point, normal); 
     757        // cout << "obj: " << objIdx << endl; 
     758 
     759        float r[2]; 
     760        sHalton.GetNext(2, r); 
     761 
     762        direction = UniformRandomVector(r[0], r[1]); 
     763        const float c = Magnitude(direction); 
     764 
     765    if (c <= Limits::Small)  
     766                return false; 
     767 
     768        direction *= 1.0f / c; 
     769 
     770        // get point on view cell surface 
    762771        mViewCell->GetRandomSurfacePoint(origin, normal2); 
    763772 
    764         direction = point - origin; 
     773        //direction = point - origin; 
    765774 
    766775        // move a little bit back to avoid piercing through walls 
     
    769778 
    770779        // $$ jb the pdf is yet not correct for all sampling methods! 
    771         const float c = Magnitude(direction); 
    772  
    773         if ((c <= Limits::Small) /*|| (DotProd(direction, normal) < 0)*/) 
    774         { 
    775                 return false; 
    776         } 
    777  
    778         // $$ jb the pdf is yet not correct for all sampling methods! 
    779780        const float pdf = 1.0f; 
    780781 
    781         direction *= 1.0f / c; 
    782782        ray = SimpleRay(origin, direction, VIEWCELL_BASED_DISTRIBUTION, pdf); 
    783783 
Note: See TracChangeset for help on using the changeset viewer.