Changeset 4704 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 26, 2005, 4:13:11 PM (20 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
r4695 r4704 66 66 WorldEntity* entity1 = iterator1->nextElement(); 67 67 WorldEntity* entity2 = iterator2->seekElement(entity1); 68 printf("checking for collisions\n");68 PRINTF(3)("checking for collisions\n"); 69 69 while( entity1 != NULL) 70 70 { 71 printf("entering l1\n");72 71 while( entity2 != NULL) 73 72 { 74 printf("entering l2 -checking object %s against %s\n", entity1->getName(), entity2->getName());73 PRINTF(3)("checking object %s against %s\n", entity1->getName(), entity2->getName()); 75 74 entity1->collideWith(entity2); 76 75 entity2 = iterator2->nextElement(); -
orxonox/trunk/src/lib/collision_detection/obb.cc
r4660 r4704 31 31 this->axis = new Vector[3]; 32 32 this->halfLength = new float[3]; 33 this->bCollided = false; 33 34 } 34 35 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4703 r4704 609 609 PRINTF(0)("collideWith\n"); 610 610 /* if the obb overlap, make subtests: check which node is realy overlaping */ 611 PRINT(0)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex()); 611 612 if( this->overlapTest(this->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 612 613 { 613 614 /* check if left node overlaps */ 614 if( unlikely( this->nodeLeft != NULL)) 615 if( likely( this->nodeLeft != NULL)) 616 { 617 PRINT(0)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex()); 615 618 if( this->overlapTest(this->nodeLeft->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 619 { 616 620 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB); 621 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 622 } 623 } 617 624 /* check if right node overlaps */ 618 if( unlikely( this->nodeRight != NULL)) 625 if( likely( this->nodeRight != NULL)) 626 { 627 PRINT(0)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex()); 619 628 if(this->overlapTest(this->nodeRight->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 620 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 629 { 630 this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB); 631 this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 632 } 633 } 621 634 } 622 635 } … … 626 639 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, PNode* nodeA, PNode* nodeB) 627 640 { 641 628 642 629 643 … … 641 655 l = boxA->axis[j]; 642 656 657 /* \todo unroll all loops */ 643 658 for(int i = 0; i < 3; ++i) 644 659 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); … … 651 666 if( (rA + rB) < fabs(t.dot(l))) 652 667 { 653 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 668 PRINT(0)("keine Kollision\n"); 669 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 654 670 return false; 655 671 } … … 673 689 if( (rA + rB) < fabs(t.dot(l))) 674 690 { 675 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 691 PRINT(0)("keine Kollision\n"); 692 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 676 693 return false; 677 694 } … … 699 716 if( (rA + rB) < fabs(t.dot(l))) 700 717 { 701 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 718 PRINT(0)("keine Kollision\n"); 719 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 702 720 return false; 703 721 } … … 710 728 boxA->bCollided = true; /* use this ONLY!!!! for drawing operations */ 711 729 boxB->bCollided = true; 730 PRINT(0)("Kollision!\n"); 712 731 return true; 713 732 }
Note: See TracChangeset
for help on using the changeset viewer.