Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4915 in orxonox.OLD


Ignore:
Timestamp:
Jul 21, 2005, 12:02:50 PM (19 years ago)
Author:
patrick
Message:

oxonox/trunk: now swapping the coordinates

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  
    7272
    7373/**
     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 */
     78void 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/**
    74104 *  draws the debug quadtree boxes around the model
    75105 */
     
    81111    this->nodes[i]->drawTree(0, 0);
    82112  }
     113
     114
    83115}
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h

    r4907 r4915  
    2929  inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; }
    3030
     31  private:
     32    void revertHashTable(QuadtreeNode** nodes);
     33
    3134 private:
    3235   QuadtreeNode*                   rootNode;              //!< reference to the root node of the quadtree
Note: See TracChangeset for help on using the changeset viewer.