Main Page | Class List | File List | Class Members | Examples

example.cpp

This a simple example of how to use the Quasisampler class.
/* File: example.cpp An example of the use of the Quasisampler class. Reminder: This is a toy implementation, created to aid in understanding how the system works. This example generates a set of points for a constant-value function. Usage: example [magnitude_factor=1000] This is a toy (non-optimized) implementation of the importance sampling technique proposed in the paper: "Fast Hierarchical Importance Sampling with Blue Noise Properties", by Victor Ostromoukhov, Charles Donohue and Pierre-Marc Jodoin, to be presented at SIGGRAPH 2004. Implementation by Charles Donohue, Based on Mathematica code by Victor Ostromoukhov. Universite de Montreal 05.08.04 */ #include <iostream> #include "quasisampler_prototype.h" class MyQuasisampler : public Quasisampler { unsigned const_val; public: MyQuasisampler(unsigned val) : Quasisampler(100,100), const_val(val) {} unsigned getImportanceAt( Point2D pt ) { return const_val; // This function returns a constant value. } }; typedef std::vector<Point2D> PointList; int main(int argc, char* argv[]) { unsigned mag_factor = 1000; if (argc>1) mag_factor = atoi(argv[1]); // initialize sampler MyQuasisampler test(mag_factor); // generate points PointList points = test.getSamplingPoints(); // print points for ( PointList::iterator it=points.begin(); it!=points.end(); it++ ) std::cout << it->x << "," << it->y << std::endl; return 0; }
00001 /* 00002 00003 File: example.cpp 00004 00005 An example of the use of the Quasisampler class. 00006 Reminder: This is a toy implementation, created 00007 to aid in understanding how the system works. 00008 00009 This example generates a set of points for a 00010 constant-value function. 00011 00012 Usage: example [magnitude_factor=1000] 00013 00014 This is a toy (non-optimized) implementation of the importance sampling 00015 technique proposed in the paper: 00016 "Fast Hierarchical Importance Sampling with Blue Noise Properties", 00017 by Victor Ostromoukhov, Charles Donohue and Pierre-Marc Jodoin, 00018 to be presented at SIGGRAPH 2004. 00019 00020 00021 Implementation by Charles Donohue, 00022 Based on Mathematica code by Victor Ostromoukhov. 00023 Universite de Montreal 00024 05.08.04 00025 00026 */ 00027 00028 #include <iostream> 00029 #include "quasisampler_prototype.h" 00030 00031 00032 class MyQuasisampler : public Quasisampler 00033 { 00034 unsigned const_val; 00035 00036 public: 00037 MyQuasisampler(unsigned val) : Quasisampler(100,100), const_val(val) {} 00038 00039 unsigned getImportanceAt( Point2D pt ) 00040 { 00041 return const_val; // This function returns a constant value. 00042 } 00043 }; 00044 00045 00046 typedef std::vector<Point2D> PointList; 00047 00048 int main(int argc, char* argv[]) 00049 { 00050 unsigned mag_factor = 1000; 00051 if (argc>1) mag_factor = atoi(argv[1]); 00052 00053 // initialize sampler 00054 MyQuasisampler test(mag_factor); 00055 00056 // generate points 00057 PointList points = test.getSamplingPoints(); 00058 00059 // print points 00060 for ( PointList::iterator it=points.begin(); it!=points.end(); it++ ) 00061 std::cout << it->x << "," << it->y << std::endl; 00062 00063 return 0; 00064 } 00065

Generated on Wed Aug 18 12:37:51 2004 for Quasi-Sampler by doxygen 1.3.7