Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2005, 12:09:36 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: creating lookup table with a very fancy algorithm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4907 r4911  
    101101
    102102  this->offset = 0.0f;
     103  this->nodeIter = 0;
    103104
    104105  this->parent = NULL;
     
    108109  this->nodeD = NULL;
    109110  this->nodes = new QuadtreeNode*[4];
     111  for(int i = 0; i < 4; ++i)
     112    this->nodes[i] = NULL;
    110113
    111114  if( this->treeDepth < this->maxDepth)
     
    127130  if( this->nodeD != NULL)
    128131    delete this->nodeD;
     132}
     133
     134
     135
     136void QuadtreeNode::buildHashTable(QuadtreeNode** nodeList, int* index)
     137{
     138  int loopLimit = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?2:4;
     139
     140  printf("buildHashTable depth: %i, nodeIter : %i, limit: %i, @nodeIndex: %i\n", this->treeDepth, nodeIter, loopLimit, indexNode);
     141  /* is it a leaf? */
     142  if( this->treeDepth < this->maxDepth)
     143  {
     144    for(int i = (this->nodeIter < ((int)pow(4, maxDepth - treeDepth) / 2))?0:2; i < loopLimit; ++i)
     145    {
     146      this->nodes[i]->buildHashTable(nodeList, index);
     147      ++this->nodeIter;
     148    }
     149  }
     150  else
     151  {
     152    printf("leaf, index: %i\n", *index);
     153    nodeList[(*index)++] = this;
     154  }
    129155}
    130156
Note: See TracChangeset for help on using the changeset viewer.