- Timestamp:
- 01/03/07 21:45:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1933 r1934 274 274 Environment::GetSingleton()->GetIntValue("BvHierarchy.Termination.minObjects", mTermMinObjects); 275 275 Environment::GetSingleton()->GetIntValue("BvHierarchy.Termination.minRays", mTermMinRays); 276 Environment::GetSingleton()->GetFloatValue( 277 "BvHierarchy.Termination.minProbability", mTermMinProbability); 276 Environment::GetSingleton()->GetFloatValue("BvHierarchy.Termination.minProbability", mTermMinProbability); 278 277 Environment::GetSingleton()->GetIntValue("BvHierarchy.Termination.missTolerance", mTermMissTolerance); 279 278 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r1923 r1934 1277 1277 "1.5"); 1278 1278 1279 1279 RegisterOption("GvsPreprocessor.stats", 1280 optString, 1281 "gvs_stats=", 1282 "gvsStats.log"); 1280 1283 1281 1284 /***********************************************************************************/ -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r1933 r1934 15 15 { 16 16 17 #define GVS_DEBUG 0 18 17 19 struct VizStruct 18 20 { … … 27 29 Preprocessor(), 28 30 //mSamplingType(SamplingStrategy::DIRECTION_BASED_DISTRIBUTION), 29 mSamplingType(SamplingStrategy::DIRECTION_BOX_BASED_DISTRIBUTION), 30 mSampleContriPerPass(0), 31 mTotalSampleContri(0), 32 mReverseSamples(0), 33 mBorderSamples(0) 31 mSamplingType(SamplingStrategy::DIRECTION_BOX_BASED_DISTRIBUTION) 34 32 { 35 33 Environment::GetSingleton()->GetIntValue("GvsPreprocessor.totalSamples", mTotalSamples); … … 39 37 Environment::GetSingleton()->GetFloatValue("GvsPreprocessor.threshold", mThreshold); 40 38 39 char gvsStatsLog[100]; 40 Environment::GetSingleton()->GetStringValue("GvsPreprocessor.stats", gvsStatsLog); 41 mGvsStatsStream.open(gvsStatsLog); 42 41 43 Debug << "Gvs preprocessor options" << endl; 42 44 Debug << "number of total samples: " << mTotalSamples << endl; … … 44 46 Debug << "number of samples per pass: " << mSamplesPerPass << endl; 45 47 Debug << "threshold: " << mThreshold << endl; 46 Debug << "eps: " << mEps << endl; 47 48 mGvsStats.open("gvspreprocessor.log"); 48 Debug << "epsilon: " << mEps << endl; 49 Debug << "stats: " << gvsStatsLog << endl; 50 51 if (0) 52 mOnlyRandomSampling = true; 53 else 54 mOnlyRandomSampling = false; 55 56 //mGvsStatsStream.open("gvspreprocessor.log"); 57 mGvsStats.Reset(); 49 58 } 50 59 … … 67 76 #endif 68 77 { 69 cout << "d";78 //cout << "r"; 70 79 // apply reverse sampling to find the gap 71 80 VssRay *newRay = ReverseSampling(currentRay, hitTriangle, oldRay); … … 82 91 delete newRay; 83 92 } 84 else if ( mVssRays.size() < 3)93 else if (GVS_DEBUG && (mVssRays.size() < 9)) 85 94 { 86 95 mVssRays.push_back(new VssRay(oldRay)); … … 99 108 { 100 109 // compute the contribution to the view cells 101 const bool storeRaysForViz = true;110 const bool storeRaysForViz = GVS_DEBUG; 102 111 103 112 mViewCellsManager->ComputeSampleContribution(*vssRay, … … 124 133 } 125 134 126 //mVssRays.push_back(new VssRay(*vssRay)); 127 ++ mSampleContriPerPass; 135 ++ mGvsStats.mPassContribution; 128 136 129 137 return true; … … 328 336 } 329 337 330 m BorderSamples += castRays;338 mGvsStats.mBorderSamples += castRays; 331 339 332 340 return castRays; … … 371 379 const bool intersects = occluder.GetPlaneIntersection(plane, pt1, pt2); 372 380 373 cout << "triangle: " << occluder << " pt1: " << pt1 << " pt2: " << pt2 << endl;374 381 if (!intersects) 375 382 cerr << "big error!! no intersection" << endl; … … 395 402 } 396 403 397 cout << "passing point: " << newPoint << endl << endl;404 //cout << "passing point: " << newPoint << endl << endl; 398 405 return newPoint; 399 406 } … … 407 414 Triangle3 occluder; 408 415 Intersectable *tObj = currentRay.mTerminationObject; 416 409 417 // q: why can this happen? 410 418 if (!tObj) … … 434 442 mRayCaster->CastRay(simpleRay, mViewCellsManager->GetViewSpaceBox()); 435 443 436 ++ m ReverseSamples;444 ++ mGvsStats.mReverseSamples; 437 445 438 446 return reverseRay; … … 475 483 // reset samples 476 484 int castSamples = 0; 477 m SampleContriPerPass= 0;485 mGvsStats.mPassContribution = 0; 478 486 479 487 while (castSamples < mSamplesPerPass) … … 482 490 // cast a number of uniform samples to fill ray queue 483 491 castSamples += CastInitialSamples(mInitialSamples, mSamplingType); 484 castSamples += ProcessQueue(); 485 //cout << "\ncast " << castSamples << " samples in a processing pass" << endl; 486 } 487 488 mTotalSampleContri += mSampleContriPerPass; 492 493 if (!mOnlyRandomSampling) 494 castSamples += ProcessQueue(); 495 } 496 497 mGvsStats.mTotalContribution += mGvsStats.mPassContribution; 489 498 return castSamples; 490 499 } … … 494 503 { 495 504 int castSamples = 0; 496 ++ mGvs Pass;505 ++ mGvsStats.mGvsPass; 497 506 498 507 while (!mRayQueue.empty()) … … 517 526 Randomize(0); 518 527 519 mPass = 0; 520 mGvsPass = 0; 521 mSampleContriPerPass = 0; 522 mTotalSampleContri = 0; 523 mReverseSamples = 0; 524 mBorderSamples = 0; 525 526 int castSamples = 0; 528 mGvsStats.Reset(); 529 mGvsStats.Start(); 527 530 528 531 if (!mLoadViewCells) … … 542 545 } 543 546 544 while (castSamples < mTotalSamples) 545 { 546 castSamples += Pass(); 547 mGvsStats.Stop(); 548 mGvsStats.Print(mGvsStatsStream); 549 550 while (mGvsStats.mTotalSamples < mTotalSamples) 551 { 552 ++ mPass; 553 554 mGvsStats.mTotalSamples += Pass(); 547 555 548 556 //////// 549 557 //-- stats 550 558 551 cout << "\nPass " << mPass << " #samples: " << castSamples << " of " << mTotalSamples << endl; 552 //mVssRays.PrintStatistics(mGvsStats); 553 mGvsStats 554 << "#Pass\n" << mPass << endl 555 << "#Time\n" << TimeDiff(startTime, GetTime())*1e-3 << endl 556 << "#TotalSamples\n" << castSamples << endl 557 << "#ScDiff\n" << mSampleContriPerPass << endl 558 << "#SamplesContri\n" << mTotalSampleContri << endl 559 << "#ReverseSamples\n" << mReverseSamples << endl 560 << "#BorderSamples\n" << mBorderSamples << endl 561 << "#GvsRuns\n" << mGvsPass << endl; 562 563 mViewCellsManager->PrintPvsStatistics(mGvsStats); 564 565 char str[64]; sprintf(str, "tmp/pass%04d-", mPass); 559 cout << "\nPass " << mPass << " #samples: " << mGvsStats.mTotalSamples << " of " << mTotalSamples << endl; 560 mGvsStats.mPass = mPass; 561 mGvsStats.Stop(); 562 mGvsStats.Print(mGvsStatsStream); 563 //mViewCellsManager->PrintPvsStatistics(mGvsStats); 564 565 if (GVS_DEBUG) 566 { 567 char str[64]; sprintf(str, "tmp/pass%04d-", mPass); 566 568 567 // visualization 568 if (mSampleContriPerPass > 0) 569 { 570 const bool exportRays = true; 571 const bool exportPvs = true; 572 573 mViewCellsManager->ExportSingleViewCells(mObjects, 10, false, exportPvs, exportRays, 1000, str); 569 // visualization 570 if (mGvsStats.mPassContribution > 0) 571 { 572 const bool exportRays = true; 573 const bool exportPvs = true; 574 575 mViewCellsManager->ExportSingleViewCells(mObjects, 576 10, 577 false, 578 exportPvs, 579 exportRays, 580 1000, 581 str); 582 } 583 584 // remove pass samples 585 ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end(); 586 for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit) 587 { 588 (*vit)->DelRayRefs(); 589 } 574 590 } 575 591 576 // remove pass samples577 ViewCellContainer::const_iterator vit, vit_end = mViewCellsManager->GetViewCells().end();578 for (vit = mViewCellsManager->GetViewCells().begin(); vit != vit_end; ++ vit)579 {580 (*vit)->DelRayRefs();581 }582 583 //CLEAR_CONTAINER(mVssRays);584 592 // ComputeRenderError(); 585 ++ mPass; 586 } 587 588 cout << "cast " << 2 * castSamples / (1e3f * TimeDiff(startTime, GetTime())) << "M rays/s" << endl; 589 Visualize(); 593 } 594 595 cout << "cast " << 2 * mGvsStats.mTotalSamples / (1e3f * TimeDiff(startTime, GetTime())) << "M rays/s" << endl; 596 597 if (GVS_DEBUG) 598 { 599 Visualize(); 600 CLEAR_CONTAINER(mVssRays); 601 } 590 602 591 603 return true; … … 649 661 } 650 662 651 } 663 664 void GvsStatistics::Print(ostream &app) const 665 { 666 app << "#Pass\n" << mPass << endl; 667 app << "#Time\n" << Time() << endl; 668 app << "#TotalSamples\n" << mTotalSamples << endl; 669 app << "#ScDiff\n" << mPassContribution << endl; 670 app << "#SamplesContri\n" << mTotalContribution << endl; 671 app << "#ReverseSamples\n" << mReverseSamples << endl; 672 app << "#BorderSamples\n" << mBorderSamples << endl; 673 app << "#GvsRuns\n" << mGvsPass << endl; 674 } 675 676 677 } -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h
r1932 r1934 13 13 class VssRay; 14 14 15 /** View space partition statistics. 16 */ 17 class GvsStatistics: public StatisticsBase 18 { 19 public: 20 21 /// Constructor 22 GvsStatistics() 23 { 24 Reset(); 25 } 26 27 void Reset() 28 { 29 mPass = 0; 30 mTotalSamples = 0; 31 mPassContribution = 0; 32 mTotalContribution = 0; 33 mReverseSamples = 0; 34 mBorderSamples = 0; 35 mGvsPass = 0; 36 } 37 38 39 public: 40 41 int mPass; 42 int mTotalSamples; 43 int mPassContribution; 44 int mTotalContribution; 45 int mReverseSamples; 46 int mBorderSamples; 47 int mGvsPass; 48 49 void Print(ostream &app) const; 50 51 friend ostream &operator<<(ostream &s, const GvsStatistics &stat) 52 { 53 stat.Print(s); 54 return s; 55 } 56 }; 15 57 16 58 … … 148 190 // stats 149 191 150 int mSampleContriPerPass;192 /*int mSampleContriPerPass; 151 193 int mTotalSampleContri; 152 194 int mReverseSamples; 153 195 int mBorderSamples; 154 int mGvsPass; 155 156 ofstream mGvsStats; 196 int mGvsPass;*/ 197 198 ofstream mGvsStatsStream; 199 GvsStatistics mGvsStats; 200 201 bool mOnlyRandomSampling; 157 202 }; 158 203
Note: See TracChangeset
for help on using the changeset viewer.