Changeset 4915 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 21, 2005, 12:02:50 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/spatial_separation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4914 r4915 72 72 73 73 /** 74 75 since the original matrix is counted from the right upper edge to the right lower one, we have to reorganize the elements 76 to be able to easily correlate the hashtable array indexes with the coorindates. 77 */ 78 void Quadtree::revertHashTable(QuadtreeNode** nodes) 79 { 80 int len = (int)pow(2, this->treeDepth); //!< the length of a quadtree side 81 int iterator = 0; //!< iterator used for mapping 82 QuadtreeNode* tmpNode = NULL; //!< temp saving place 83 int offset = 0; //!< offset used in the calc 84 85 for(int i = len - 1; i >= 0; --i) 86 { 87 for(int j = len - 1; j >= 0; --j) 88 { 89 offset = j * len + i; 90 /* only swap the elements in one direction */ 91 if( offset > iterator) 92 { 93 tmpNode = nodes[offset]; 94 nodes[offset] = nodes[iterator]; 95 nodes[iterator] = tmpNode; 96 } 97 ++iterator; 98 } 99 } 100 } 101 102 103 /** 74 104 * draws the debug quadtree boxes around the model 75 105 */ … … 81 111 this->nodes[i]->drawTree(0, 0); 82 112 } 113 114 83 115 } -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h
r4907 r4915 29 29 inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; } 30 30 31 private: 32 void revertHashTable(QuadtreeNode** nodes); 33 31 34 private: 32 35 QuadtreeNode* rootNode; //!< reference to the root node of the quadtree
Note: See TracChangeset
for help on using the changeset viewer.