Changeset 1695 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 10/29/06 15:20:18 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1694 r1695 38 38 // HACK 39 39 const static bool SAMPLE_AFTER_SUBDIVISION = true; 40 const static bool CLAMP_TO_BOX = false;40 const static bool CLAMP_TO_BOX = true; 41 41 42 42 template <typename T> class myless … … 72 72 73 73 mViewCellsTree->SetViewCellsManager(this); 74 //mViewCellsTree = new ViewCellsTree(this);75 74 } 76 75 … … 112 111 113 112 // sampling type for view cells construction samples 114 if (strcmp(buf, "box") == 0) 113 if (strcmp(buf, "object") == 0) 114 { 115 mSamplingType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 116 } 117 else if (strcmp(buf, "box") == 0) 115 118 { 116 119 mSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; … … 123 126 { 124 127 mSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 128 } 129 else if (strcmp(buf, "reverse_object") == 0) 130 { 131 mSamplingType = SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION; 125 132 } 126 133 /*else if (strcmp(buf, "interior") == 0) … … 137 144 Environment::GetSingleton()->GetStringValue("ViewCells.Evaluation.samplingType", buf); 138 145 139 if (strcmp(buf, "box") == 0) 146 if (strcmp(buf, "object") == 0) 147 { 148 mEvaluationSamplingType = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 149 } 150 else if (strcmp(buf, "box") == 0) 140 151 { 141 152 mEvaluationSamplingType = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; … … 148 159 { 149 160 mEvaluationSamplingType = SamplingStrategy::OBJECT_DIRECTION_BASED_DISTRIBUTION; 161 } 162 else if (strcmp(buf, "reverse_object") == 0) 163 { 164 mEvaluationSamplingType = SamplingStrategy::REVERSE_OBJECT_BASED_DISTRIBUTION; 150 165 } 151 166 /*else if (strcmp(buf, "interior") == 0) … … 155 170 else 156 171 { 172 mEvaluationSamplingType = -1; 157 173 Debug << "error! wrong sampling type" << endl; 158 174 exit(0); … … 868 884 int castSamples = 0; 869 885 char str[64]; 886 int oldSamples = 0; 887 888 int samplesForStats; 870 889 871 890 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesPerPass", samplesPerPass); 891 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samplesForStats", samplesForStats); 872 892 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.samples", numSamples); 873 893 … … 924 944 925 945 Real timeDiff = TimeDiff(startTime, GetTime()); 926 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 927 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 928 946 947 cout << "finished in " << timeDiff * 1e-3f << " secs" << endl; 929 948 cout << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 949 950 Debug << "finished in " << timeDiff * 1e-3f << " secs" << endl; 930 951 Debug << "computing sample contributions of " << (int)evaluationSamples.size() << " samples ... "; 931 952 … … 938 959 Debug << "finished in " << timeDiff * 1e-3 << " secs" << endl; 939 960 940 startTime = GetTime(); 941 cout << "compute new statistics ... " << endl; 942 943 /////////// 944 //-- output stats 945 946 sprintf(str, "-%09d-eval.log", castSamples); 947 string fileName = string(statsPrefix) + string(str); 948 949 /////////////// 950 //-- propagate pvs or pvs size information 951 952 ObjectPvs pvs; 953 UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 954 955 ExportStats(fileName); 956 957 timeDiff = TimeDiff(startTime, GetTime()); 958 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 959 Debug << "statistis compted in " << timeDiff * 1e-3 << " secs" << endl; 960 961 if ((castSamples >= samplesForStats + oldSamples) || (castSamples >= numSamples)) 962 { 963 oldSamples += samplesForStats; 964 965 /////////// 966 //-- output stats 967 968 sprintf(str, "-%09d-eval.log", castSamples); 969 string fileName = string(statsPrefix) + string(str); 970 971 /////////////// 972 //-- propagate pvs or pvs size information 973 974 startTime = GetTime(); 975 ObjectPvs pvs; 976 977 cout << "updating pvs for contribution ... " << endl; 978 979 UpdatePvsForEvaluation(mViewCellsTree->GetRoot(), pvs); 980 981 timeDiff = TimeDiff(startTime, GetTime()); 982 cout << "finished updating the pvs in " << timeDiff * 1e-3 << " secs" << endl; 983 Debug << "pvs evaluated in " << timeDiff * 1e-3 << " secs" << endl; 984 985 startTime = GetTime(); 986 cout << "compute new statistics ... " << endl; 987 988 ExportStats(fileName); 989 990 timeDiff = TimeDiff(startTime, GetTime()); 991 cout << "finished in " << timeDiff * 1e-3 << " secs" << endl; 992 Debug << "statistis computed in " << timeDiff * 1e-3 << " secs" << endl; 993 } 994 961 995 disposeRays(evaluationSamples, NULL); 962 996 } … … 966 1000 //-- histogram 967 1001 1002 const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot()); 968 1003 bool useHisto; 969 1004 int histoStepSize; … … 971 1006 Environment::GetSingleton()->GetBoolValue("ViewCells.Evaluation.histogram", useHisto); 972 1007 Environment::GetSingleton()->GetIntValue("ViewCells.Evaluation.histoStepSize", histoStepSize); 973 974 const int numLeaves = mViewCellsTree->GetNumInitialViewCells(mViewCellsTree->GetRoot());975 976 1008 977 1009 if (useHisto) … … 2529 2561 // reset recursive pvs 2530 2562 pvs.Clear(); 2563 2564 // pvss of child nodes 2531 2565 vector<ObjectPvs> pvsList; 2532 2566 2533 2567 ViewCellContainer::const_iterator vit, vit_end = interior->mChildren.end(); 2534 2535 for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit) 2536 { 2537 ObjectPvs objPvs; 2568 pvsList.resize((int)interior->mChildren.size()); 2569 int i = 0; 2570 for (vit = interior->mChildren.begin(); vit != vit_end; ++ vit, ++ i) 2571 { 2572 //ObjectPvs objPvs; 2538 2573 2539 2574 ////////////////// 2540 2575 //-- recursivly compute child pvss 2541 2576 2542 UpdatePvsForEvaluation(*vit, objPvs);2577 UpdatePvsForEvaluation(*vit, pvsList[i]/*objPvs*/); 2543 2578 2544 2579 // store pvs in vector 2545 pvsList.push_back(objPvs);2580 //pvsList.push_back(objPvs); 2546 2581 } 2547 2582
Note: See TracChangeset
for help on using the changeset viewer.