Changeset 5215 in orxonox.OLD for trunk/src/lib/graphics/spatial_separation
- Timestamp:
- Sep 22, 2005, 4:02:08 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/spatial_separation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/spatial_separation/quadtree.cc
r5075 r5215 53 53 /* make an array with access to the leafs of the Quad-Tree */ 54 54 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!! 56 56 for(int i = 0; i < (int)pow(2, treeDepth); ++i) 57 57 { 58 this->rootNode->buildHashTable(this->nodes, index);58 this->rootNode->buildHashTable(this->nodes, &index); 59 59 } 60 60 /* sort and revert the hash table to fit the right position */ … … 65 65 this->quadLength = this->nodes[0]->getDimension()->getAxis() * 2.0f; 66 66 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(); 70 70 this->offset = new Vector(); 71 71 this->offset->x = xOff; … … 136 136 for( int k = j + 1; k < len; ++k) 137 137 { 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; 140 140 141 141 if( b > a) -
trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r5115 r5215 57 57 PRINT(3)(" |"); 58 58 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()); 60 60 61 61 this->init(); … … 205 205 tList<sTriangleExt*>* listD = new tList<sTriangleExt*>(); //!< triangle list of nodeD 206 206 const float* pVert; //!< pointer to the vertices 207 const Vector*rectCenter; //!< vector to the center of the rect207 Vector rectCenter; //!< vector to the center of the rect 208 208 209 209 rectCenter = this->pDimension->getCenter(); … … 213 213 { 214 214 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) 216 216 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) 218 218 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) 220 220 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) 222 222 listD->add(&this->pTriangles[i]); 223 223 } … … 304 304 305 305 306 v.x = this->pDimension->getCenter() ->x + this->pDimension->getAxis() / 2.0f;306 v.x = this->pDimension->getCenter().x + this->pDimension->getAxis() / 2.0f; 307 307 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; 309 309 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; 311 311 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; 313 313 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; 315 315 rD = new Rectangle(v, this->pDimension->getAxis() / 2.0f); 316 316 … … 371 371 for( int i = 0; i < this->treeDepth; ++i) 372 372 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()); 374 374 return rect; 375 375 } … … 383 383 bool QuadtreeNode::includesPoint(const Vector& v) const 384 384 { 385 Vector center = *this->pDimension->getCenter();385 Vector center = this->pDimension->getCenter(); 386 386 float ax = this->pDimension->getAxis(); 387 387 … … 492 492 if( this->treeDepth == this->maxDepth) 493 493 { 494 Vector t1 = *this->pDimension->getCenter();494 Vector t1 = this->pDimension->getCenter(); 495 495 float ax = this->pDimension->getAxis(); 496 496 float h = 50.0f; … … 525 525 return; 526 526 527 Vector t1 = *this->pDimension->getCenter();527 Vector t1 = this->pDimension->getCenter(); 528 528 float ax = this->pDimension->getAxis(); 529 529 float h = 70.0f;
Note: See TracChangeset
for help on using the changeset viewer.