Ignore:
Timestamp:
11/16/06 19:41:44 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1695 r1763  
    183183} 
    184184 
     185 
     186bool ViewCellBorderBasedDistribution::GenerateSample(SimpleRay &ray) const 
     187{ 
     188        Vector3 origin, direction;  
     189 
     190        ViewCellContainer &viewCells = mPreprocessor.mViewCellsManager->GetViewCells(); 
     191 
     192        Vector3 point; 
     193        Vector3 normal, normal2; 
     194         
     195        //cout << "y"; 
     196        const int vcIdx = (int)RandomValue(0, (float)viewCells.size() - 0.5f); 
     197        const int objIdx = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 
     198 
     199        Intersectable *object = mPreprocessor.mObjects[objIdx]; 
     200        ViewCell *viewCell = viewCells[vcIdx]; 
     201 
     202        object->GetRandomSurfacePoint(point, normal); 
     203        viewCell->GetRandomEdgePoint(origin, normal2); 
     204 
     205        direction = point - origin; 
     206 
     207        // $$ jb the pdf is yet not correct for all sampling methods! 
     208        const float c = Magnitude(direction); 
     209 
     210        if (c <= Limits::Small)  
     211                return false; 
     212 
     213        // $$ jb the pdf is yet not correct for all sampling methods! 
     214        const float pdf = 1.0f; 
     215        //cout << "p: " << point << " "; 
     216        direction *= 1.0f / c; 
     217        ray = SimpleRay(origin, direction, pdf); 
     218         
     219        return true; 
     220} 
     221 
    185222#if 0 
    186223bool ObjectsInteriorDistribution::GenerateSample(SimpleRay &ray) const 
Note: See TracChangeset for help on using the changeset viewer.