Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5215 in orxonox.OLD for trunk/src/lib/graphics/spatial_separation


Ignore:
Timestamp:
Sep 22, 2005, 4:02:08 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some more fixing of the Errors reported by valgrind
removed some stuff in patrick's collision-detection.
also changed Vector* to Vector in Rectangle (patrick tell me, if this is not ok - but i doubt it :))

Location:
trunk/src/lib/graphics/spatial_separation
Files:
2 edited

Legend:

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

    r5075 r5215  
    5353  /* make an array with access to the leafs of the Quad-Tree */
    5454  this->nodes = new QuadtreeNode*[(int)pow(4, treeDepth)];
    55   int* index = new int; *index = 0;
     55  int index = 0; //new int; *index = 0; // !!changed by bensch!!
    5656  for(int i = 0; i < (int)pow(2, treeDepth); ++i)
    5757  {
    58     this->rootNode->buildHashTable(this->nodes, index);
     58    this->rootNode->buildHashTable(this->nodes, &index);
    5959  }
    6060  /* sort and revert the hash table to fit the right position */
     
    6565  this->quadLength = this->nodes[0]->getDimension()->getAxis() * 2.0f;
    6666  Rectangle* r = this->rootNode->getDimension();
    67   Vector* offset = new Vector();
    68   float xOff = r->getCenter()->x - r->getAxis();
    69   float yOff = r->getCenter()->z - r->getAxis();
     67  //  Vector* offset = new Vector(); // unused removed by bensch
     68  float xOff = r->getCenter().x - r->getAxis();
     69  float yOff = r->getCenter().z - r->getAxis();
    7070  this->offset = new Vector();
    7171  this->offset->x = xOff;
     
    136136      for( int k = j + 1; k < len; ++k)
    137137      {
    138         a = this->nodes[i * len + j]->getDimension()->getCenter()->z;
    139         b = this->nodes[i * len + k]->getDimension()->getCenter()->z;
     138        a = this->nodes[i * len + j]->getDimension()->getCenter().z;
     139        b = this->nodes[i * len + k]->getDimension()->getCenter().z;
    140140
    141141        if( b > a)
  • trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r5115 r5215  
    5757    PRINT(3)(" |");
    5858  PRINT(3)(" | +-| (II) Rectangle Center (%5.2f, %5.2f), half axis length: %5.2f\n",
    59   this->pDimension->getCenter()->x, this->pDimension->getCenter()->z, this->pDimension->getAxis());
     59  this->pDimension->getCenter().x, this->pDimension->getCenter().z, this->pDimension->getAxis());
    6060
    6161  this->init();
     
    205205  tList<sTriangleExt*>*           listD = new tList<sTriangleExt*>();    //!< triangle list of nodeD
    206206  const float*                    pVert;                                 //!< pointer to the vertices
    207   const Vector*                   rectCenter;                            //!< vector to the center of the rect
     207  Vector                          rectCenter;                            //!< vector to the center of the rect
    208208
    209209  rectCenter = this->pDimension->getCenter();
     
    213213    {
    214214      pVert = &this->pVertices[this->pTriangles[i]->indexToVertices[j]];
    215       if( pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
     215      if( pVert[0] > rectCenter.x + this->offset && pVert[2] > rectCenter.z + this->offset)
    216216        listA->add(&this->pTriangles[i]);
    217       if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
     217      if( pVert[0] < rectCenter.x + this->offset && pVert[2] > rectCenter.z + this->offset)
    218218        listB->add(&this->pTriangles[i]);
    219       if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
     219      if( pVert[0] < rectCenter.x + this->offset && pVert[2] < rectCenter.z + this->offset)
    220220        listC->add(&this->pTriangles[i]);
    221       if( pVert[0] > rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
     221      if( pVert[0] > rectCenter.x + this->offset && pVert[2] < rectCenter.z + this->offset)
    222222        listD->add(&this->pTriangles[i]);
    223223    }
     
    304304
    305305
    306   v.x = this->pDimension->getCenter()->x + this->pDimension->getAxis() / 2.0f;
     306  v.x = this->pDimension->getCenter().x + this->pDimension->getAxis() / 2.0f;
    307307  v.y = 0.0;
    308   v.z = this->pDimension->getCenter()->z + this->pDimension->getAxis() / 2.0f;
     308  v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f;
    309309  rA = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
    310   v.z = this->pDimension->getCenter()->z - this->pDimension->getAxis() / 2.0f;
     310  v.z = this->pDimension->getCenter().z - this->pDimension->getAxis() / 2.0f;
    311311  rB = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
    312   v.x = this->pDimension->getCenter()->x - this->pDimension->getAxis() / 2.0f;
     312  v.x = this->pDimension->getCenter().x - this->pDimension->getAxis() / 2.0f;
    313313  rC = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
    314   v.z = this->pDimension->getCenter()->z + this->pDimension->getAxis() / 2.0f;
     314  v.z = this->pDimension->getCenter().z + this->pDimension->getAxis() / 2.0f;
    315315  rD = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
    316316
     
    371371  for( int i = 0; i < this->treeDepth; ++i)
    372372    PRINT(3)(" |");
    373   PRINT(3)(" | +-| (II) Rectangle Dimension  (%5.2f, %5.2f) to (%5.2f, %5.2f), Center (%5.2f, %5.2f)\n", minX, minY, maxX, maxY, rect->getCenter()->x, rect->getCenter()->z, rect->getAxis());
     373  PRINT(3)(" | +-| (II) Rectangle Dimension  (%5.2f, %5.2f) to (%5.2f, %5.2f), Center (%5.2f, %5.2f)\n", minX, minY, maxX, maxY, rect->getCenter().x, rect->getCenter().z, rect->getAxis());
    374374  return rect;
    375375}
     
    383383bool QuadtreeNode::includesPoint(const Vector& v) const
    384384{
    385   Vector center = *this->pDimension->getCenter();
     385  Vector center = this->pDimension->getCenter();
    386386  float ax = this->pDimension->getAxis();
    387387
     
    492492  if( this->treeDepth == this->maxDepth)
    493493  {
    494     Vector t1 = *this->pDimension->getCenter();
     494    Vector t1 = this->pDimension->getCenter();
    495495    float ax = this->pDimension->getAxis();
    496496    float h = 50.0f;
     
    525525    return;
    526526
    527   Vector t1 = *this->pDimension->getCenter();
     527  Vector t1 = this->pDimension->getCenter();
    528528  float ax = this->pDimension->getAxis();
    529529  float h = 70.0f;
Note: See TracChangeset for help on using the changeset viewer.