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