Changeset 2529 for GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
- Timestamp:
- 07/06/07 00:38:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h
r2199 r2529 59 59 60 60 /** creates pvs and initializes it with the given entries. 61 Assumes that entries are sorted-61 Assumes that entries are sorted. 62 62 */ 63 63 VerbosePvs(const vector<PvsEntry<T, S> > &samples); … … 66 66 /** Compresses PVS lossless or lossy. 67 67 */ 68 int Compress() 69 { 70 return 0; 71 } 72 73 int GetSize() const 74 { 75 return (int)mEntries.size(); 76 } 77 78 bool Empty() const 79 { 80 return mEntries.empty(); 81 } 82 83 void Reserve(const int n) 84 { 85 mEntries.reserve(n); 86 } 87 68 int Compress() { return 0; } 69 70 inline int GetSize() const { return (int)mEntries.size(); } 71 72 inline bool Empty() const { return mEntries.empty(); } 73 74 inline void Reserve(const int n) { mEntries.reserve(n); } 88 75 /** Normalize the visibility of entries in order to get 89 comparable results.76 comparable results. 90 77 */ 91 78 void NormalizeMaximum(); 92 93 79 /** Merges pvs of a into this pvs. 94 Warning: very slow!80 Warning: very slow! 95 81 */ 96 82 void MergeInPlace(const VerbosePvs<T, S> &a); 97 98 83 /** Difference of pvs to pvs b. 99 84 @returns number of different entries. 100 85 */ 101 86 int Diff(const VerbosePvs<T, S> &b); 102 103 87 /** Finds sample in PVS. 104 88 @param checkDirty if dirty part of the pvs should be checked for entry … … 112 96 113 97 bool GetSampleContribution(T sample, const float pdf, float &contribution); 114 115 98 /** Adds sample to PVS. 116 99 @returns contribution of sample (0 or 1) 117 100 */ 118 101 float AddSample(T sample, const float pdf); 119 120 102 /** Adds sample to PVS without checking for presence of the sample 121 103 warning: pvs remains unsorted! 122 104 */ 123 105 void AddSampleDirty(T sample, const float pdf); 124 125 106 /** Adds sample dirty (on the end of the vector) but 126 107 first checks if sample is already in clean part of the pvs. 127 108 */ 128 109 bool AddSampleDirtyCheck(T sample, const float pdf); 129 130 /** Sort pvs entries - this should always be called after a 110 /** Sort pvs entries. This should always be called after a 131 111 sequence of AddSampleDirty calls 132 112 */ 133 113 void Sort(); 134 135 114 /** Sort pvs entries assume that the pvs contains unique entries 136 115 */ 137 116 void SimpleSort(); 138 139 117 /** Adds sample to PVS. 140 118 @returns PvsData … … 142 120 typename std::vector<PvsEntry<T, S> >::iterator 143 121 AddSample2(T sample, const float pdf); 144 145 122 /** Subtracts one pvs from another one. 146 123 WARNING: could contains bugs … … 172 149 */ 173 150 void Clear(const bool trim = true); 174 151 /** Trim the vector containing the pvs. 152 */ 175 153 void Trim(); 176 154 … … 186 164 const VerbosePvs<T, S> &b); 187 165 188 int GetSamples() const 189 { 190 return mSamples; 191 } 192 193 bool IsDirty() const 194 { 195 return mLastSorted < mEntries.size(); 196 } 197 166 inline int GetSamples() const { return mSamples; } 167 168 /** If there is an unsorted part in the pvs. 169 */ 170 bool IsDirty() const { return mLastSorted < mEntries.size(); } 171 172 /** If this pvs requires a resort to stay efficient. 173 */ 198 174 bool RequiresResort() const 199 175 { … … 212 188 mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) 213 189 { 214 //cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl;190 // cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 215 191 return true; 216 192 } … … 219 195 } 220 196 197 /** If this pvs requires a resort to stay efficient. 198 */ 221 199 bool RequiresResortLog() const 222 200 { … … 227 205 } 228 206 229 int GetLastSorted() const 230 { 231 return mLastSorted; 232 } 207 inline int GetLastSorted() const { return mLastSorted; } 233 208 234 209 typename PvsIterator<T, S> GetIterator() const; … … 236 211 protected: 237 212 213 /** Merge pvs 1 from begin iterator to end iterator with 214 pvs 2 from begin iterator to end iterator. 215 */ 238 216 static void Merge(VerbosePvs<T, S> &mergedPvs, 239 217 const typename std::vector<PvsEntry<T, S> >::const_iterator &aBegin, … … 243 221 const int aSamples, 244 222 const int bSamples); 223 245 224 246 225 //////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.