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