source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h @ 3343

Revision 3343, 2.1 KB checked in by mattausch, 15 years ago (diff)

working really nicely

Line 
1#ifndef __SAMPLEGENERATOR_H
2#define __SAMPLEGENERATOR_H
3
4#include "Halton.h"
5
6
7/** Class that generates samples on a circle
8*/
9
10struct Sample2
11{
12        Sample2() {}
13        Sample2(float _x, float _y): x(_x), y(_y) {}
14
15        float x;
16        float y;
17};
18
19
20struct 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
30/** Class generating random samples on a disc or in a sphere, respectively.
31        Note: Rewrite this!! it does not work well enough, rather, sample generator should
32        be either poisson or halton or random that can be used to create samples on a disc ...
33*/
34class SampleGenerator
35{
36public:
37       
38        SampleGenerator(int numSamples, float radius);
39
40        virtual void Generate(float *samples) const = 0;
41
42        virtual ~SampleGenerator();
43
44protected:
45
46        SampleGenerator() {};
47
48        HaltonSequence *mHalton;
49        int mNumSamples;
50        float mRadius;
51};
52
53
54class RandomSampleGenerator2D: public SampleGenerator
55{
56public:
57       
58        RandomSampleGenerator2D(int numSamples, float radius);
59
60        virtual void Generate(float *samples) const;
61};
62
63
64/** This class generates random samples on a disc respecting
65        the poisson disc condition (all samples at least distance d apart)
66        according to some d related to the number of samples.
67*/
68class PoissonDiscSampleGenerator2D: public SampleGenerator
69{
70public:
71       
72        PoissonDiscSampleGenerator2D(int numSamples, float radius);
73
74        virtual void Generate(float *samples) const;
75};
76
77
78/** This class generates random samples on a disc
79        that have the property that their density decreases quadratically
80        with the distance
81*/
82//class QuadraticDiscSampleGenerator2D: public PoissonDiscSampleGenerator2D
83class QuadraticDiscSampleGenerator2D: public RandomSampleGenerator2D
84{
85public:
86       
87        QuadraticDiscSampleGenerator2D(int numSamples, float radius);
88
89        virtual void Generate(float *samples) const;
90};
91
92
93/** This class generates random spherical samples.
94*/
95class SphericalSampleGenerator3D: public SampleGenerator
96{
97public:
98       
99        SphericalSampleGenerator3D(int numSamples, float radius);
100
101        virtual void Generate(float *samples) const;
102};
103
104
105#endif
Note: See TracBrowser for help on using the repository browser.