Changeset 1233 for GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp
- Timestamp:
- 08/20/06 22:48:01 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/MeshKdTree.cpp
r1004 r1233 19 19 { 20 20 mRoot = new MeshKdLeaf; 21 mS plitCandidates = NULL;21 mSubdivisionCandidates = NULL; 22 22 } 23 23 … … 177 177 178 178 void 179 MeshKdTree::SortS plitCandidates(179 MeshKdTree::SortSubdivisionCandidates( 180 180 MeshKdLeaf *node, 181 181 const int axis 182 182 ) 183 183 { 184 mS plitCandidates->clear();184 mSubdivisionCandidates->clear(); 185 185 186 186 int requestedSize = 2*(int)node->mFaces.size(); 187 187 // creates a sorted split candidates array 188 if (mS plitCandidates->capacity() > 500000 &&189 requestedSize < (int)(mS plitCandidates->capacity()/10) ) {190 delete mS plitCandidates;191 mS plitCandidates = new vector<SortableEntry>;192 } 193 194 mS plitCandidates->reserve(requestedSize);188 if (mSubdivisionCandidates->capacity() > 500000 && 189 requestedSize < (int)(mSubdivisionCandidates->capacity()/10) ) { 190 delete mSubdivisionCandidates; 191 mSubdivisionCandidates = new vector<SortableEntry>; 192 } 193 194 mSubdivisionCandidates->reserve(requestedSize); 195 195 196 196 vector<int>::const_iterator fi; … … 202 202 AxisAlignedBox3 box = mMesh->GetFaceBox(*fi); 203 203 204 mS plitCandidates->push_back(SortableEntry(SortableEntry::FACE_MIN,204 mSubdivisionCandidates->push_back(SortableEntry(SortableEntry::FACE_MIN, 205 205 box.Min(axis), 206 206 *fi) … … 208 208 209 209 210 mS plitCandidates->push_back(SortableEntry(SortableEntry::FACE_MAX,210 mSubdivisionCandidates->push_back(SortableEntry(SortableEntry::FACE_MAX, 211 211 box.Max(axis), 212 212 *fi) … … 214 214 } 215 215 216 stable_sort(mS plitCandidates->begin(), mSplitCandidates->end());216 stable_sort(mSubdivisionCandidates->begin(), mSubdivisionCandidates->end()); 217 217 } 218 218 … … 229 229 { 230 230 231 SortS plitCandidates(node, axis);231 SortSubdivisionCandidates(node, axis); 232 232 233 233 // go through the lists, count the number of objects left and right … … 247 247 vector<SortableEntry>::const_iterator ci; 248 248 249 for(ci = mS plitCandidates->begin();250 ci != mS plitCandidates->end();249 for(ci = mSubdivisionCandidates->begin(); 250 ci != mSubdivisionCandidates->end(); 251 251 ci++) { 252 252 switch ((*ci).type) { … … 409 409 MeshKdTree::Construct() 410 410 { 411 if (!mS plitCandidates)412 mS plitCandidates = new vector<SortableEntry>;411 if (!mSubdivisionCandidates) 412 mSubdivisionCandidates = new vector<SortableEntry>; 413 413 414 414 // first construct a leaf that will get subdivide … … 418 418 419 419 // remove the allocated array 420 delete mS plitCandidates;421 mS plitCandidates = NULL;420 delete mSubdivisionCandidates; 421 mSubdivisionCandidates = NULL; 422 422 423 423 return true;
Note: See TracChangeset
for help on using the changeset viewer.