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 | int mTotalRays;
|
---|
64 | float mTotalContribution;
|
---|
65 | protected:
|
---|
66 |
|
---|
67 | const Preprocessor &mPreprocessor;
|
---|
68 |
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 | class ObjectBasedDistribution: public SamplingStrategy
|
---|
73 | {
|
---|
74 | public:
|
---|
75 | HaltonSequence mHalton;
|
---|
76 |
|
---|
77 | ObjectBasedDistribution(const Preprocessor &preprocessor):
|
---|
78 | SamplingStrategy(preprocessor) {
|
---|
79 | mType = OBJECT_BASED_DISTRIBUTION;
|
---|
80 | }
|
---|
81 |
|
---|
82 | private:
|
---|
83 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
84 | };
|
---|
85 |
|
---|
86 |
|
---|
87 | class ReverseObjectBasedDistribution: public SamplingStrategy
|
---|
88 | {
|
---|
89 | public:
|
---|
90 |
|
---|
91 | ReverseObjectBasedDistribution(const Preprocessor &preprocessor):
|
---|
92 | SamplingStrategy(preprocessor) {
|
---|
93 | mType = REVERSE_OBJECT_BASED_DISTRIBUTION;
|
---|
94 | }
|
---|
95 |
|
---|
96 | private:
|
---|
97 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
98 | };
|
---|
99 |
|
---|
100 |
|
---|
101 | class ObjectDirectionBasedDistribution: public SamplingStrategy
|
---|
102 | {
|
---|
103 | public:
|
---|
104 | ObjectDirectionBasedDistribution(const Preprocessor &preprocessor):
|
---|
105 | SamplingStrategy(preprocessor) {
|
---|
106 | mType = OBJECT_DIRECTION_BASED_DISTRIBUTION;
|
---|
107 | }
|
---|
108 | private:
|
---|
109 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
110 | };
|
---|
111 |
|
---|
112 |
|
---|
113 | class DirectionBasedDistribution: public SamplingStrategy
|
---|
114 | {
|
---|
115 | public:
|
---|
116 | DirectionBasedDistribution(const Preprocessor &preprocessor):
|
---|
117 | SamplingStrategy(preprocessor){
|
---|
118 | mType = DIRECTION_BASED_DISTRIBUTION;
|
---|
119 | }
|
---|
120 | private:
|
---|
121 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
122 | };
|
---|
123 |
|
---|
124 |
|
---|
125 | class DirectionBoxBasedDistribution: public SamplingStrategy
|
---|
126 | {
|
---|
127 | public:
|
---|
128 | DirectionBoxBasedDistribution(const Preprocessor &preprocessor):
|
---|
129 | SamplingStrategy(preprocessor){
|
---|
130 | mType = DIRECTION_BOX_BASED_DISTRIBUTION;
|
---|
131 | }
|
---|
132 |
|
---|
133 | private:
|
---|
134 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
135 | };
|
---|
136 |
|
---|
137 |
|
---|
138 | class SpatialBoxBasedDistribution: public SamplingStrategy
|
---|
139 | {
|
---|
140 | public:
|
---|
141 | HaltonSequence mHalton;
|
---|
142 | SpatialBoxBasedDistribution(const Preprocessor &preprocessor):
|
---|
143 | SamplingStrategy(preprocessor){
|
---|
144 | mType = DIRECTION_BOX_BASED_DISTRIBUTION;
|
---|
145 | }
|
---|
146 |
|
---|
147 | private:
|
---|
148 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
149 | };
|
---|
150 |
|
---|
151 |
|
---|
152 | class ViewSpaceBorderBasedDistribution: public SamplingStrategy
|
---|
153 | {
|
---|
154 | public:
|
---|
155 | ViewSpaceBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
156 | SamplingStrategy(preprocessor){
|
---|
157 | mType = SPATIAL_BOX_BASED_DISTRIBUTION;
|
---|
158 | }
|
---|
159 |
|
---|
160 | private:
|
---|
161 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
162 | };
|
---|
163 |
|
---|
164 |
|
---|
165 | class ReverseViewSpaceBorderBasedDistribution: public SamplingStrategy
|
---|
166 | {
|
---|
167 | public:
|
---|
168 | ReverseViewSpaceBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
169 | SamplingStrategy(preprocessor){
|
---|
170 | mType = SPATIAL_BOX_BASED_DISTRIBUTION;
|
---|
171 | }
|
---|
172 |
|
---|
173 | private:
|
---|
174 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
175 | };
|
---|
176 |
|
---|
177 |
|
---|
178 | class RssBasedDistribution: public SamplingStrategy
|
---|
179 | {
|
---|
180 | public:
|
---|
181 | RssBasedDistribution(const Preprocessor &preprocessor):
|
---|
182 | SamplingStrategy(preprocessor){
|
---|
183 | mType = RSS_BASED_DISTRIBUTION;
|
---|
184 | }
|
---|
185 |
|
---|
186 |
|
---|
187 | virtual int GenerateSamples(const int number, SimpleRayContainer &ray) {
|
---|
188 | // TBD!!!
|
---|
189 | return 0;
|
---|
190 | }
|
---|
191 |
|
---|
192 | private:
|
---|
193 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
194 |
|
---|
195 | };
|
---|
196 |
|
---|
197 |
|
---|
198 | class ViewCellBorderBasedDistribution: public SamplingStrategy
|
---|
199 | {
|
---|
200 | public:
|
---|
201 | ViewCellBorderBasedDistribution(const Preprocessor &preprocessor):
|
---|
202 | SamplingStrategy(preprocessor) {}
|
---|
203 |
|
---|
204 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
205 | };
|
---|
206 |
|
---|
207 | class GlobalLinesDistribution: public SamplingStrategy
|
---|
208 | {
|
---|
209 | public:
|
---|
210 | HaltonSequence mHalton;
|
---|
211 | //HaltonSequence mHalton;
|
---|
212 |
|
---|
213 | GlobalLinesDistribution(const Preprocessor &preprocessor):
|
---|
214 | SamplingStrategy(preprocessor) {
|
---|
215 | mType = GLOBAL_LINES_DISTRIBUTION;
|
---|
216 | }
|
---|
217 |
|
---|
218 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
219 | };
|
---|
220 |
|
---|
221 |
|
---|
222 | /** This strategy generates samples inside of the objects, e.g.,
|
---|
223 | for sampling the inside of a colon.
|
---|
224 | */
|
---|
225 | /*class ObjectsInteriorDistribution: public SamplingStrategy
|
---|
226 | {
|
---|
227 | public:
|
---|
228 | ObjectsInteriorDistribution(const Preprocessor &preprocessor):
|
---|
229 | SamplingStrategy(preprocessor) {}
|
---|
230 |
|
---|
231 | virtual bool GenerateSample(SimpleRay &ray);
|
---|
232 | };
|
---|
233 | */
|
---|
234 | };
|
---|
235 |
|
---|
236 | #endif
|
---|