RegularSampleGenerator.h

Go to the documentation of this file.
00001 
00007 #ifndef REGULARSAMPLEGENERATOR_H
00008 #define REGULARSAMPLEGENERATOR_H REGULARSAMPLEGENERATOR_H
00009 
00010 #include "SampleGenerator.h"
00011 
00016 class RegularSampleGenerator : public SampleGenerator 
00017 {
00018 public:
00019 
00028     void GetSamples(int n,float* u, float* v, float* weight) const
00029     {
00030         int m = (int)(sqrt((float)n));
00031         for (int i=0 ; i < m; i++)
00032         {
00033             for (int j=0; j < m; j++)
00034             {
00035                 u[i + j*m] = ((float)i+0.5)/(float)m;
00036                 v[i + j*m] = ((float)j+0.5)/(float)m;
00037                 weight[i + j*m] = 1.0 / float(n);
00038             }
00039         }
00040     }
00041 };
00042 
00043 #endif

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