Changeset 4701 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 26, 2005, 1:10:20 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4700 r4701 626 626 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, PNode* nodeA, PNode* nodeB) 627 627 { 628 629 628 629 630 630 /* first check all axis */ 631 631 Vector t = nodeA->getAbsCoor() + *boxA->center - ( nodeB->getAbsCoor() + *boxB->center); … … 634 634 Vector l; 635 635 636 for( int j = 0; j < 3; ++j)636 for( int j = 0; j < 3; ++j) 637 637 { 638 638 rA = 0.0f; … … 641 641 642 642 for(int i = 0; i < 3; ++i) 643 644 645 646 643 { 644 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 645 } 646 647 647 for(int i = 0; i < 3; ++i) 648 649 650 651 648 { 649 rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l)); 650 } 651 652 652 PRINTF(0)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 653 653 654 654 if( (rA + rB) < fabs(t.dot(l))) 655 PRINTF(0)(" - The Boxes are disjoint!\n"); 656 else 657 PRINTF(0)(" - The Boxes are not disjoint\n"); 658 659 PRINTF(0)("rA = %f, rB = %f\n", rA, rB); 655 { 656 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 657 return false; 658 } 659 } 660 661 662 for( int j = 0; j < 3; ++j) 663 { 664 rA = 0.0f; 665 rB = 0.0f; 666 l = boxB->axis[j]; 667 668 for(int i = 0; i < 3; ++i) 669 { 670 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 671 } 672 673 for(int i = 0; i < 3; ++i) 674 { 675 rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l)); 676 } 677 678 PRINTF(0)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 679 680 if( (rA + rB) < fabs(t.dot(l))) 681 { 682 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 683 return false; 684 } 685 686 687 // else 688 // PRINTF(0)(" - The Boxes are not disjoint\n"); 689 690 //PRINTF(0)("rA = %f, rB = %f\n", rA, rB); 660 691 661 692 662 693 /* now check all orthogonals from the axis */ 663 664 } 665 return false;694 } 695 696 return true; 666 697 } 667 698
Note: See TracChangeset
for help on using the changeset viewer.