1 | #ifndef _SamplingStategy_H__
|
---|
2 | #define _SamplingStategy_H__
|
---|
3 |
|
---|
4 |
|
---|
5 | namespace GtpVisibilityPreprocessor {
|
---|
6 |
|
---|
7 |
|
---|
8 | class Preprocessor;
|
---|
9 | struct SimpleRay;
|
---|
10 | class SimpleRayContainer;
|
---|
11 |
|
---|
12 | /** This class generates a specific sampling strategy.
|
---|
13 | */
|
---|
14 | class SamplingStrategy
|
---|
15 | {
|
---|
16 | public:
|
---|
17 |
|
---|
18 | /** Sample rays of particular type
|
---|
19 | */
|
---|
20 | enum
|
---|
21 | {
|
---|
22 | OBJECT_BASED_DISTRIBUTION,
|
---|
23 | DIRECTION_BASED_DISTRIBUTION,
|
---|
24 | DIRECTION_BOX_BASED_DISTRIBUTION,
|
---|
25 | SPATIAL_BOX_BASED_DISTRIBUTION,
|
---|
26 | RSS_BASED_DISTRIBUTION,
|
---|
27 | RSS_SILHOUETTE_BASED_DISTRIBUTION,
|
---|
28 | VSS_BASED_DISTRIBUTION,
|
---|
29 | OBJECT_DIRECTION_BASED_DISTRIBUTION,
|
---|
30 | OBJECTS_INTERIOR_DISTRIBUTION,
|
---|
31 | REVERSE_OBJECT_BASED_DISTRIBUTION,
|
---|
32 | VIEWCELL_BORDER_BASED_DISTRIBUTION,
|
---|
33 | VIEWSPACE_BORDER_BASED_DISTRIBUTION,
|
---|
34 | REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION
|
---|
35 | };
|
---|
36 |
|
---|
37 | /** Default constructor
|
---|
38 | */
|
---|
39 | SamplingStrategy(const Preprocessor &preprocessor);
|
---|
40 |
|
---|
41 | virtual ~SamplingStrategy();
|
---|
42 |
|
---|
43 | /** Each strategy has to implement this function.
|
---|
44 | @returns true if generated valid sample.
|
---|
45 | */
|
---|
46 |
|
---|
47 | virtual int GenerateSamples(const int number, SimpleRayContainer &rays) const;
|
---|
48 |
|
---|
49 | private:
|
---|
50 |
|
---|
51 | virtual bool GenerateSample(SimpleRay &ray) const = 0;
|
---|
52 |
|
---|
53 | public:
|
---|
54 | /// variables usefull for mixed distribution sampling
|
---|
55 | int mType;
|
---|
56 | int mRays;
|
---|
57 | float mContribution;
|
---|
58 | float mTime;
|
---|
59 | float mRatio;
|
---|
60 |
|
---|
61 | protected:
|
---|
62 |
|
---|
63 | const Preprocessor &mPreprocessor;
|
---|
64 |
|
---|
65 | };
|
---|
66 |
|
---|
67 |
|
---|
68 | class ObjectBasedDistribution: public SamplingStrategy
|
---|
69 | {
|
---|
70 | public:
|
---|
71 |
|
---|
72 | ObjectBasedDistribution(const Preprocessor &preprocessor):
|
---|
73 | SamplingStrategy(preprocessor) {
|
---|
74 | mType = OBJECT_BASED_DISTRIBUTION;
|
---|
75 | }
|
---|
76 |
|
---|
77 | private:
|
---|
78 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
79 | };
|
---|
80 |
|
---|
81 |
|
---|
82 | class ReverseObjectBasedDistribution: public SamplingStrategy
|
---|
83 | {
|
---|
84 | public:
|
---|
85 |
|
---|
86 | ReverseObjectBasedDistribution(const Preprocessor &preprocessor):
|
---|
87 | SamplingStrategy(preprocessor) {
|
---|
88 | mType = REVERSE_OBJECT_BASED_DISTRIBUTION;
|
---|
89 | }
|
---|
90 |
|
---|
91 | private:
|
---|
92 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
93 | };
|
---|
94 |
|
---|
95 |
|
---|
96 | class ObjectDirectionBasedDistribution: public SamplingStrategy
|
---|
97 | {
|
---|
98 | public:
|
---|
99 | ObjectDirectionBasedDistribution(const Preprocessor &preprocessor):
|
---|
100 | SamplingStrategy(preprocessor) {
|
---|
101 | mType = OBJECT_DIRECTION_BASED_DISTRIBUTION;
|
---|
102 | }
|
---|
103 | private:
|
---|
104 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
105 | };
|
---|
106 |
|
---|
107 |
|
---|
108 | class DirectionBasedDistribution: public SamplingStrategy
|
---|
109 | {
|
---|
110 | public:
|
---|
111 | DirectionBasedDistribution(const Preprocessor &preprocessor):
|
---|
112 | SamplingStrategy(preprocessor){
|
---|
113 | mType = DIRECTION_BASED_DISTRIBUTION;
|
---|
114 | }
|
---|
115 | private:
|
---|
116 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
117 | };
|
---|
118 |
|
---|
119 |
|
---|
120 | class DirectionBoxBasedDistribution: public SamplingStrategy
|
---|
121 | {
|
---|
122 | public:
|
---|
123 | DirectionBoxBasedDistribution(const Preprocessor &preprocessor):
|
---|
124 | SamplingStrategy(preprocessor){
|
---|
125 | mType = DIRECTION_BOX_BASED_DISTRIBUTION;
|
---|
126 | }
|
---|
127 |
|
---|
128 | private:
|
---|
129 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
130 | };
|
---|
131 |
|
---|
132 |
|
---|
133 | class SpatialBoxBasedDistribution: public SamplingStrategy
|
---|
134 | {
|
---|
135 | public:
|
---|
136 | SpatialBoxBasedDistribution(const Preprocessor &preprocessor):
|
---|
137 | SamplingStrategy(preprocessor){
|
---|
138 | mType = DIRECTION_BOX_BASED_DISTRIBUTION;
|
---|
139 | }
|
---|
140 |
|
---|
141 | private:
|
---|
142 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
143 | };
|
---|
144 |
|
---|
145 |
|
---|
146 | class ViewSpaceBorderBasedDistribution: public SamplingStrategy
|
---|
147 | {
|
---|
148 | public:
|
---|
149 | ViewSpaceBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
150 | SamplingStrategy(preprocessor){
|
---|
151 | mType = SPATIAL_BOX_BASED_DISTRIBUTION;
|
---|
152 | }
|
---|
153 |
|
---|
154 | private:
|
---|
155 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
156 | };
|
---|
157 |
|
---|
158 |
|
---|
159 | class ReverseViewSpaceBorderBasedDistribution: public SamplingStrategy
|
---|
160 | {
|
---|
161 | public:
|
---|
162 | ReverseViewSpaceBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
163 | SamplingStrategy(preprocessor){
|
---|
164 | mType = SPATIAL_BOX_BASED_DISTRIBUTION;
|
---|
165 | }
|
---|
166 |
|
---|
167 | private:
|
---|
168 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
169 | };
|
---|
170 |
|
---|
171 |
|
---|
172 | class RssBasedDistribution: public SamplingStrategy
|
---|
173 | {
|
---|
174 | public:
|
---|
175 | RssBasedDistribution(const Preprocessor &preprocessor):
|
---|
176 | SamplingStrategy(preprocessor){
|
---|
177 | mType = RSS_BASED_DISTRIBUTION;
|
---|
178 | }
|
---|
179 |
|
---|
180 |
|
---|
181 | virtual int GenerateSamples(const int number, SimpleRayContainer &ray) const {
|
---|
182 | // TBD!!!
|
---|
183 | return 0;
|
---|
184 | }
|
---|
185 |
|
---|
186 | private:
|
---|
187 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
188 |
|
---|
189 | };
|
---|
190 |
|
---|
191 |
|
---|
192 | class ViewCellBorderBasedDistribution: public SamplingStrategy
|
---|
193 | {
|
---|
194 | public:
|
---|
195 | ViewCellBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
196 | SamplingStrategy(preprocessor) {}
|
---|
197 |
|
---|
198 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
199 | };
|
---|
200 |
|
---|
201 |
|
---|
202 | /** This strategy generates samples inside of the objects, e.g.,
|
---|
203 | for sampling the inside of a colon.
|
---|
204 | */
|
---|
205 | /*class ObjectsInteriorDistribution: public SamplingStrategy
|
---|
206 | {
|
---|
207 | public:
|
---|
208 | ObjectsInteriorDistribution(const Preprocessor &preprocessor):
|
---|
209 | SamplingStrategy(preprocessor) {}
|
---|
210 |
|
---|
211 | virtual bool GenerateSample(SimpleRay &ray) const;
|
---|
212 | };
|
---|
213 | */
|
---|
214 | };
|
---|
215 |
|
---|
216 | #endif
|
---|