StochasticSampleGenerator.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   StochasticSampleGenerator.cpp
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @date   Fall 2008
00005    
00006    @brief
00007       Stochastic point sample generation over a given 2D domain where samples 
00008    are generated completely randomly over the entire domain
00009    <!-------------------------------------------------------------------->**/
00010 
00011 #include "StochasticSampleGenerator.h"
00012 #include <Random.h>
00013 #include <QtCore>
00014 
00015 template <class SG>
00016 void StochasticSG<SG>::generate(PointSampleList &outSamples, 
00017                                 const Viewport &viewport)
00018 {
00019    unsigned noSamples = viewport.getWidth() * viewport.getHeight();
00020    
00021    while(noSamples--) {
00022       const real_t x = Random::sample();
00023       const real_t y = Random::sample();
00024       
00025       SG::_addSample(PointSample(x, y), outSamples);
00026    }
00027 }
00028 
00029 // force explicit template specialization of StochasticSampleGenerator and 
00030 // StochasticSampleGeneratorThread
00031 #include <generators.h>
00032 DECLARE_SAMPLE_GENERATOR(Stochastic);
00033 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6