[2853] | 1 | #ifndef __SAMPLEGENERATOR_H
|
---|
| 2 | #define __SAMPLEGENERATOR_H
|
---|
| 3 |
|
---|
[2901] | 4 | #include "Halton.h"
|
---|
[2853] | 5 |
|
---|
[2901] | 6 |
|
---|
[2853] | 7 | /** Class that generates samples on a circle
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | struct Sample2
|
---|
| 11 | {
|
---|
[2886] | 12 | Sample2() {}
|
---|
| 13 | Sample2(float _x, float _y): x(_x), y(_y) {}
|
---|
| 14 |
|
---|
[2853] | 15 | float x;
|
---|
| 16 | float y;
|
---|
| 17 | };
|
---|
| 18 |
|
---|
| 19 |
|
---|
[2900] | 20 | struct Sample3
|
---|
| 21 | {
|
---|
| 22 | Sample3() {}
|
---|
| 23 | Sample3(float _x, float _y, float _z): x(_x), y(_y), z(_z) {}
|
---|
| 24 |
|
---|
| 25 | float x;
|
---|
| 26 | float y;
|
---|
| 27 | float z;
|
---|
| 28 | };
|
---|
| 29 |
|
---|
[2911] | 30 | /** Class generating random samples on a disc or in a sphere, respectively.
|
---|
[2900] | 31 | */
|
---|
[2853] | 32 | class SampleGenerator
|
---|
| 33 | {
|
---|
| 34 | public:
|
---|
| 35 |
|
---|
| 36 | SampleGenerator(int numSamples, float radius);
|
---|
| 37 |
|
---|
[2900] | 38 | virtual void Generate(float *samples) const = 0;
|
---|
[2853] | 39 |
|
---|
| 40 | protected:
|
---|
| 41 |
|
---|
| 42 | SampleGenerator() {};
|
---|
| 43 |
|
---|
| 44 | int mNumSamples;
|
---|
| 45 | float mRadius;
|
---|
| 46 | };
|
---|
| 47 |
|
---|
| 48 |
|
---|
[2930] | 49 | class RandomSampleGenerator2: public SampleGenerator
|
---|
[2902] | 50 | {
|
---|
| 51 | public:
|
---|
| 52 |
|
---|
[2930] | 53 | RandomSampleGenerator2(int numSamples, float radius);
|
---|
[2902] | 54 |
|
---|
| 55 | virtual void Generate(float *samples) const;
|
---|
| 56 |
|
---|
| 57 | protected:
|
---|
| 58 |
|
---|
| 59 | static HaltonSequence sHalton;
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
[2911] | 63 | /** This class generates random samples on a disc respecting
|
---|
| 64 | the poisson disc condition (all samples at least distance d apart)
|
---|
| 65 | according to some d related to the number of samples.
|
---|
| 66 | */
|
---|
[2930] | 67 | class PoissonDiscSampleGenerator2: public SampleGenerator
|
---|
[2853] | 68 | {
|
---|
| 69 | public:
|
---|
[2886] | 70 |
|
---|
[2930] | 71 | PoissonDiscSampleGenerator2(int numSamples, float radius);
|
---|
[2853] | 72 |
|
---|
[2900] | 73 | virtual void Generate(float *samples) const;
|
---|
[2901] | 74 |
|
---|
| 75 | protected:
|
---|
| 76 |
|
---|
| 77 | static HaltonSequence sHalton;
|
---|
[2853] | 78 | };
|
---|
| 79 |
|
---|
[2930] | 80 |
|
---|
| 81 | /** This class generates random samples on a disc
|
---|
| 82 | that have the property that their density decreases quadratically
|
---|
| 83 | with the distance
|
---|
| 84 | */
|
---|
| 85 | class QuadraticDiscSampleGenerator2: public SampleGenerator
|
---|
| 86 | {
|
---|
| 87 | public:
|
---|
| 88 |
|
---|
| 89 | QuadraticDiscSampleGenerator2(int numSamples, float radius);
|
---|
| 90 |
|
---|
| 91 | virtual void Generate(float *samples) const;
|
---|
| 92 |
|
---|
| 93 | protected:
|
---|
| 94 |
|
---|
| 95 | static HaltonSequence sHalton;
|
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 |
|
---|
[2911] | 99 | /** This class generates random spherical samples.
|
---|
| 100 | */
|
---|
[2930] | 101 | class SphericalSampleGenerator3: public SampleGenerator
|
---|
[2899] | 102 | {
|
---|
| 103 | public:
|
---|
| 104 |
|
---|
[2930] | 105 | SphericalSampleGenerator3(int numSamples, float radius);
|
---|
[2899] | 106 |
|
---|
[2900] | 107 | virtual void Generate(float *samples) const;
|
---|
[2901] | 108 |
|
---|
| 109 | protected:
|
---|
| 110 |
|
---|
| 111 | static HaltonSequence sHalton;
|
---|
[2899] | 112 | };
|
---|
| 113 |
|
---|
| 114 |
|
---|
[2853] | 115 | #endif |
---|