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

RevLine 
[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
10struct 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]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
[2911]30/** Class generating random samples on a disc or in a sphere, respectively.
[3343]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 ...
[2900]33*/
[2853]34class SampleGenerator
35{
36public:
37       
38        SampleGenerator(int numSamples, float radius);
39
[2900]40        virtual void Generate(float *samples) const = 0;
[2853]41
[3230]42        virtual ~SampleGenerator();
43
[2853]44protected:
45
46        SampleGenerator() {};
47
[3230]48        HaltonSequence *mHalton;
[2853]49        int mNumSamples;
50        float mRadius;
51};
52
53
[3227]54class RandomSampleGenerator2D: public SampleGenerator
[2902]55{
56public:
57       
[3227]58        RandomSampleGenerator2D(int numSamples, float radius);
[2902]59
60        virtual void Generate(float *samples) const;
61};
62
63
[2911]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*/
[3227]68class PoissonDiscSampleGenerator2D: public SampleGenerator
[2853]69{
70public:
[2886]71       
[3227]72        PoissonDiscSampleGenerator2D(int numSamples, float radius);
[2853]73
[2900]74        virtual void Generate(float *samples) const;
[2853]75};
76
[2930]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*/
[3313]82//class QuadraticDiscSampleGenerator2D: public PoissonDiscSampleGenerator2D
83class QuadraticDiscSampleGenerator2D: public RandomSampleGenerator2D
[2930]84{
85public:
86       
[3227]87        QuadraticDiscSampleGenerator2D(int numSamples, float radius);
[2930]88
89        virtual void Generate(float *samples) const;
90};
91
92
[2911]93/** This class generates random spherical samples.
94*/
[3227]95class SphericalSampleGenerator3D: public SampleGenerator
[2899]96{
97public:
98       
[3227]99        SphericalSampleGenerator3D(int numSamples, float radius);
[2899]100
[2900]101        virtual void Generate(float *samples) const;
[2899]102};
103
104
[2853]105#endif
Note: See TracBrowser for help on using the repository browser.