PoissonDiskSampleGenerator.h

Go to the documentation of this file.
00001 #ifndef POISSONDISKSAMPLEGENERATOR_H
00002 #define POISSONDISKSAMPLEGENERATOR_H POISSONDISKSAMPLEGENERATOR_H
00003 
00004 #include "SampleGenerator.h"
00005 
00006 class PoissonDiskSampleGenerator : public SampleGenerator 
00007 {
00008 public:
00009 
00013     void GetSamples(int n,float* u, float* v, float* weight) const
00014     {
00015         int m = (int)(sqrt((float)n));
00016         for (int i=0 ; i < m; i++)
00017         {
00018             for (int j=0; j < m; j++)
00019             {
00020                 u[i + j*m] = ((float)i+0.5)/(float)m;
00021                 v[i + j*m] = ((float)j+0.5)/(float)m;
00022                 weight[i + j*m] = 1.0 / float(n);
00023             }
00024         }
00025     }
00026 };
00027 
00028 #endif

Generated on Thu Jan 31 21:48:49 2008 for RayTracer by  doxygen 1.5.4