Changeset 2187 for GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
- Timestamp:
- 03/05/07 11:07:44 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/SamplingStrategy.cpp
r2116 r2187 52 52 // terminate the whole method? 53 53 for (; i < number; i++) 54 54 { 55 55 int j = 0; 56 56 bool sampleGenerated = false; 57 57 58 58 for (j = 0; !sampleGenerated && (j < maxTries); ++ j) 59 59 { 60 60 sampleGenerated = GenerateSample(ray); 61 61 62 62 if (sampleGenerated) 63 63 { 64 64 ++ samples; 65 65 rays.push_back(ray); 66 } 67 } 68 } 69 70 71 66 } 67 } 68 } 72 69 73 70 return samples; … … 313 310 return true; 314 311 } 315 316 317 #if 0318 bool ObjectsInteriorDistribution::GenerateSample(SimpleRay &ray)319 {320 Vector3 origin, direction;321 322 // get random object323 const int i = RandomValue(0, mPreprocessor.mObjects.size() - 1);324 325 const Intersectable *obj = mPreprocessor.mObjects[i];326 327 // note: if we load the polygons as meshes,328 // asymtotically every second sample is lost!329 origin = obj->GetBox().GetRandomPoint();330 331 // uniformly distributed direction332 direction = UniformRandomVector();333 334 const float c = Magnitude(direction);335 336 if (c <= Limits::Small)337 return false;338 339 const float pdf = 1.0f;340 341 direction *= 1.0f / c;342 ray = SimpleRay(origin, direction, pdf);343 344 return true;345 }346 347 #endif348 312 349 313
Note: See TracChangeset
for help on using the changeset viewer.