Ignore:
Timestamp:
05/21/08 01:18:40 (16 years ago)
Author:
mattausch
Message:

fixed several errors

File:
1 edited

Legend:

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

    r2614 r2691  
    296296        Vector3 origin, direction;  
    297297 
    298         ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells(); 
     298        //ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells(); 
    299299 
    300300        Vector3 point; 
    301301        Vector3 normal, normal2; 
    302302         
    303         const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f); 
     303        //const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f); 
    304304        const int objIdx = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 
    305305 
    306306        Intersectable *object = mPreprocessor.mObjects[objIdx]; 
    307         ViewCell *viewCell = viewCells[vcIdx]; 
     307        ViewCell *viewCell = mViewCell;//viewCells[vcIdx]; 
    308308 
    309309        object->GetRandomSurfacePoint(point, normal); 
     
    843843        Vector3 origin, direction;  
    844844 
    845         ViewCellContainer &viewCells =  
    846                 mPreprocessor.mViewCellsManager->GetViewCells(); 
    847  
    848845        Vector3 point; 
    849846        Vector3 normal; 
    850847                 
    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  
    859848        float r[2]; 
     849        //for (int i=0; i < 2; i++) 
     850        // r[i] = RandomValue(0, 1); 
     851 
    860852        sHalton.GetNext(2, r); 
    861853 
     
    869861 
    870862        // 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(); 
    872874 
    873875        //direction = point - origin; 
    874  
    875         // move a little bit back to avoid piercing through walls 
    876         // that bound the view cell 
    877         origin -= 0.01f * normal; 
    878876 
    879877        // $$ jb the pdf is yet not correct for all sampling methods! 
Note: See TracChangeset for help on using the changeset viewer.