Changeset 4710 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 26, 2005, 10:10:48 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/collision_detection
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/cd_engine.cc
r4704 r4710 130 130 this->rootTree->spawnBVTree(depth, vertices, numVertices); 131 131 } 132 133 void CDEngine::debugDraw(int depth, int drawMode) 134 { 135 if(this-> rootTree != NULL) 136 this->rootTree->drawBV(depth, drawMode); 137 } -
orxonox/trunk/src/lib/collision_detection/cd_engine.h
r4688 r4710 52 52 void debug(); 53 53 void debugSpawnTree(int depth, sVec3D* vertices, int numVertices); 54 void debugDraw(int depth, int drawMode); 54 55 55 56 private: -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4708 r4710 114 114 115 115 116 if(this->tmpLen1 > 0)116 if(this->tmpLen1 > 2) 117 117 { 118 118 OBBTreeNode* node1 = new OBBTreeNode(); … … 125 125 } 126 126 127 if( this->tmpLen2 > 0)127 if( this->tmpLen2 > 2) 128 128 { 129 129 OBBTreeNode* node2 = new OBBTreeNode(); … … 133 133 else 134 134 { 135 PRINTF(0)("Abo arding tree walk: less than 3 vertices left\n");135 PRINTF(0)("Abording tree walk: less than 3 vertices left\n"); 136 136 } 137 137 … … 420 420 421 421 /* get the maximal dimensions of the body in all directions */ 422 maxLength[0] = 0.0f;423 minLength[0] = 0.0f;422 maxLength[0] = p0.distancePoint(vertices[0]); 423 minLength[0] = p0.distancePoint(vertices[0]); 424 424 for(int j = 0; j < length; ++j) 425 425 { … … 431 431 } 432 432 433 maxLength[1] = 0.0f;434 minLength[1] = 0.0f;433 maxLength[1] = p1.distancePoint(vertices[0]); 434 minLength[1] = p1.distancePoint(vertices[0]); 435 435 for(int j = 0; j < length; ++j) 436 436 { … … 442 442 } 443 443 444 maxLength[2] = 0.0f;445 minLength[2] = 0.0f;444 maxLength[2] = p2.distancePoint(vertices[0]); 445 minLength[2] = p2.distancePoint(vertices[0]); 446 446 for(int j = 0; j < length; ++j) 447 447 { … … 460 460 { 461 461 PRINTF(3)("max: %f, min: %f \n", maxLength[i], minLength[i]); 462 centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie463 newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative462 centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie 463 newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative 464 464 *box->center += (box->axis[i] * centerOffset[i]); // update the new center vector 465 465 halfLength[i] = newHalfLength[i]; … … 478 478 { 479 479 //if( box->halfLength[i] == 0.0) 480 PRINTF(3)("length[%i] = %f\n", i, box->halfLength[i]); 480 if(fabs(box->halfLength[i]) > 5.0f) 481 { 482 PRINTF(0)("length[%i] = %f\n", i, box->halfLength[i]); 483 PRINTF(0)("MaxLength = %f, MinLength = %f\n", maxLength[i], minLength[i]); 484 PRINTF(0)("\nVertex Data:\n"); 485 for(int i = 0; i < length; i++) 486 { 487 PRINTF(0)("vertex %i: %f, %f, %f\n", i, box->vertices[i][0], box->vertices[i][1], box->vertices[i][2]); 488 } 489 } 481 490 } 482 491 } … … 525 534 } 526 535 527 //PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);536 PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist); 528 537 529 538 … … 534 543 tList<sVec3D> partition2; //!< the vertex partition 2 535 544 545 536 546 PRINTF(3)("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices); 537 547 this->separationPlane = new Plane(box->axis[axisIndex], box->vertices[vertexIndex]); //!< separation plane … … 541 551 for(int i = 0; i < box->numOfVertices; ++i) 542 552 { 543 if( this->separationPlane->distancePoint(box->vertices[i]) > 0.0f) 544 partition1.add(&box->vertices[i]); 553 if( i == vertexIndex) continue; 554 tmpDist = this->separationPlane->distancePoint(box->vertices[i]); 555 if( tmpDist > 0.0) 556 partition1.add(&box->vertices[i]); /* positive numbers plus zero */ 545 557 else 546 partition2.add(&box->vertices[i]); 558 partition2.add(&box->vertices[i]); /* negatice numbers */ 547 559 } 548 560 partition1.add(&box->vertices[vertexIndex]); 549 550 // PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize()); 561 partition2.add(&box->vertices[vertexIndex]); 562 563 PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize()); 551 564 552 565 … … 827 840 if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL || drawMode & DRAW_BV_BLENDED) 828 841 { 842 if(this->nodeLeft == NULL && this->nodeRight == NULL) 843 depth = 0; 829 844 if( !(drawMode & DRAW_SINGLE && depth != 0)) 830 845 {
Note: See TracChangeset
for help on using the changeset viewer.