Changeset 2592 for GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
- Timestamp:
- 01/14/08 15:54:15 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp
r2590 r2592 94 94 95 95 Intersectable *oldObject = mRays[vssRays[i]->mGeneratorId].mRay->mTerminationObject; 96 96 // the ray generated a contribution although it hits the same object 97 // mark this using a counter 97 98 if (oldObject == newObject) 98 99 dummyCMutations++; … … 106 107 mRays.push_back(RayEntry(newRay)); 107 108 } else { 108 // unref the old ray 109 // unref the old ray and add the new ray into the mutation buffer 109 110 *mRays[mBufferStart].mRay = *vssRays[i]; 110 111 mRays[mBufferStart].mMutations = 0; … … 117 118 } 118 119 } else { 120 // the ray did not generate any contribution 119 121 if (vssRays[i]->mDistribution == MUTATION_BASED_DISTRIBUTION && 120 122 vssRays[i]->mGeneratorId != -1 121 123 ) { 122 124 // check whether not to store a new backward mutation candidate 125 // this happens if the new ray is occluded significantly closer than 126 // the generator ray 123 127 VssRay *oldRay = mRays[vssRays[i]->mGeneratorId].mRay; 124 128 VssRay *newRay = vssRays[i]; 125 129 126 127 130 Intersectable *oldObject = oldRay->mTerminationObject; 128 129 131 132 // only allow one reverse mutation per generator ray 130 133 if (!mRays[newRay->mGeneratorId].HasReverseMutation()) { 131 134 if (DotProd(oldRay->GetDir(), newRay->GetDir()) > 0.0f) { … … 149 152 Intersectable *newObject = vssRays[i]->mTerminationObject; 150 153 151 152 154 if (oldObject == newObject) 153 155 dummyNcMutations++; … … 163 165 cout<<"Dummy NC mutations ratio:"<<100.0f*dummyNcMutations/(float)mutationRays<<"%"<<endl; 164 166 cout<<"Dummy C mutations ratio:"<<100.0f*dummyCMutations/(float)mutationRays<<"%"<<endl; 165 cout<<"Reverse candidates:"<< reverseCandidates<<endl;167 cout<<"Reverse candidates:"<<100.0f*reverseCandidates/(float)mutationRays<<endl; 166 168 } 167 169 168 170 float pContributingRays = contributingRays/(float)vssRays.size(); 169 171 170 cout<<" Percentageof contributing rays:"<<pContributingRays<<endl;172 cout<<"Ratio of contributing rays:"<<pContributingRays<<endl; 171 173 172 174 if (mUseUnsuccCountImportance) { … … 233 235 ) 234 236 { 235 #if 0236 Vector3 v;237 if (d.DrivingAxis() == 0)238 v = Vector3(0, r[0]-0.5f, r[1]-0.5f);239 else240 if (d.DrivingAxis() == 1)241 v = Vector3(r[0]-0.5f, 0, r[1]-0.5f);242 else243 v = Vector3(r[0]-0.5f, r[1]-0.5f, 0);244 return v*(2*radius);245 #endif246 237 #if 0 247 238 return (U*(r[0] - 0.5f) + V*(r[1] - 0.5f))*(2*radius); … … 339 330 340 331 AxisAlignedBox3 box = occluder->GetBox(); 332 // consider slightly larger neighborhood of the occluder 333 // in search for unocclude reverse ray 341 334 box.Scale(2.0f); 342 335 … … 430 423 } 431 424 425 return true; 432 426 #else 433 427 cerr << "warning: reverse mutation not supported!" << endl; 434 #endif 435 436 return true;428 return false; 429 #endif 430 437 431 438 432 // now the origin and termination is swapped compred to the generator ray … … 510 504 511 505 #else 512 513 506 //cerr << "warning: shiluette mutation not supported" << endl; 507 return Vector3(0, 0, 0); 514 508 #endif 515 509 … … 523 517 if (mRays.size() == 0) { 524 518 float rr[5]; 525 // use direction based distribution 519 // use direction based distribution until we have some mutation candidates 526 520 Vector3 origin, direction; 527 521 … … 532 526 Vector3(rr[0], rr[1], rr[2])); 533 527 534 528 535 529 direction = UniformRandomVector(rr[3], rr[4]); 536 530 … … 538 532 sray = SimpleRay(origin, direction, MUTATION_BASED_DISTRIBUTION, pdf); 539 533 sray.mGeneratorId = -1; 540 534 541 535 return true; 542 } 536 } 543 537 544 538 int index; … … 552 546 if ( 553 547 mRays[index].GetSamplingFactor() >= mRays[mLastIndex].GetSamplingFactor()) { 554 // make another round 548 // make another round to equalize the oversampling factor 555 549 556 550 // cout<<"R2"<<endl; … … 666 660 667 661 if (mUseSilhouetteSamples && a < mSilhouetteProb) { 668 669 662 termination += ComputeSilhouetteTerminationMutation(*ray, 670 663 origin, … … 692 685 693 686 // shift the origin a little bit 687 #if 1 694 688 origin += direction*0.5f; 689 #else 690 // $$JB - 14.1. 2008 increase shift to test HavranRayCaster 691 origin = 0.5f*(origin + termination); 692 #endif 695 693 696 694 direction.Normalize(); … … 718 716 mRays[index].mMutations++; 719 717 mRays[index].mUnsuccessfulMutations++; 720 721 718 return true; 722 719 }
Note: See TracChangeset
for help on using the changeset viewer.