Changeset 4914 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 21, 2005, 11:17:54 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/spatial_separation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4913 r4914 52 52 int* index = new int; *index = 0; 53 53 for(int i = 0; i < (int)pow(2, treeDepth); ++i) 54 { 55 printf("============================\n"); 54 56 this->rootNode->buildHashTable(this->nodes, index); 57 } 55 58 } 56 59 … … 74 77 { 75 78 //this->rootNode->drawTree(depth, drawMode); 76 for(int i = 0; i < 4; ++i)79 for(int i = 0; i < (int)pow(4, this->treeDepth); ++i) 77 80 { 78 81 this->nodes[i]->drawTree(0, 0); -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r4913 r4914 101 101 102 102 this->offset = 0.0f; 103 this->nodeIter = 0;103 this->nodeIter = -1; 104 104 105 105 this->parent = NULL; … … 136 136 void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index) 137 137 { 138 i nt elCount = (int)pow(4, maxDepth - treeDepth) / 2;139 int loopLimit = (this->nodeIter < elCount)?2:4;140 141 for( int i = 0; i < this->treeDepth; ++i)142 printf(" ");143 printf("entering %i: hit counts: %i/%i\n", treeDepth, nodeIter, elCount);138 if( this->nodeIter == -1) 139 this->nodeIter = *index; 140 141 /* offset #of elements in a row #of rows in a quadtree */ 142 int threshold = this->nodeIter + (int)pow(2, this->maxDepth) * (int)pow(2, maxDepth - treeDepth - 1); 143 int loopLimit = (*index < threshold)?2:4; 144 144 145 145 /* is it a leaf? */ 146 146 if( this->treeDepth < this->maxDepth) 147 { 148 for(int i = (this->nodeIter < elCount)?0:2; i < loopLimit; ++i) 149 { 150 for( int j = 0; j < this->treeDepth; ++j) 151 printf(" "); 152 printf("-> %i @ depth: %i, %i/%i \n", i, this->treeDepth, nodeIter, elCount); 153 147 for(int i = (*index < threshold)?0:2; i < loopLimit; ++i) 154 148 this->nodes[i]->buildHashTable(nodeList, index); 155 ++this->nodeIter;156 }157 }158 149 else 159 {160 for( int j = 0; j < this->treeDepth; ++j)161 printf(" ");162 printf(" leaf, index: %i, pointer: %p\n", *index, this);163 150 nodeList[(*index)++] = this; 164 }165 151 } 166 152 -
orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc
r4913 r4914 99 99 Quadtree* SpatialSeparation::createQuadtree(AbstractModel* model) 100 100 { 101 this->quadtree = new Quadtree(model->getModelInfo(), 1);101 this->quadtree = new Quadtree(model->getModelInfo(), 4); 102 102 103 103 return this->quadtree;
Note: See TracChangeset
for help on using the changeset viewer.