Ignore:
Timestamp:
10/29/06 15:20:18 (18 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1692 r1695  
    151151} 
    152152 
     153 
     154bool ReverseObjectBasedDistribution::GenerateSample(SimpleRay &ray) const 
     155{ 
     156        Vector3 origin, direction;  
     157 
     158        mPreprocessor.mViewCellsManager->GetViewPoint(origin); 
     159 
     160        Vector3 point; 
     161        Vector3 normal; 
     162        //cout << "y"; 
     163        const int i = (int)RandomValue(0, (float)mPreprocessor.mObjects.size() - 0.5f); 
     164 
     165        Intersectable *object = mPreprocessor.mObjects[i]; 
     166 
     167        object->GetRandomSurfacePoint(point, normal); 
     168        direction = origin - point; 
     169 
     170        // $$ jb the pdf is yet not correct for all sampling methods! 
     171        const float c = Magnitude(direction); 
     172 
     173        if (c <= Limits::Small)  
     174                return false; 
     175 
     176        // $$ jb the pdf is yet not correct for all sampling methods! 
     177        const float pdf = 1.0f; 
     178        //cout << "p: " << point << " "; 
     179        direction *= 1.0f / c; 
     180        ray = SimpleRay(point, direction, pdf); 
     181         
     182        return true; 
     183} 
     184 
    153185#if 0 
    154186bool ObjectsInteriorDistribution::GenerateSample(SimpleRay &ray) const 
Note: See TracChangeset for help on using the changeset viewer.