Changeset 4703 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 26, 2005, 2:14:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4702 r4703 634 634 Vector l; 635 635 636 /* All 3 axis of the object A */ 636 637 for( int j = 0; j < 3; ++j) 637 638 { … … 641 642 642 643 for(int i = 0; i < 3; ++i) 643 { 644 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 645 } 646 644 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 647 645 for(int i = 0; i < 3; ++i) 648 { 649 rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l)); 650 } 651 652 PRINTF(0)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 646 rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l)); 647 648 649 PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 653 650 654 651 if( (rA + rB) < fabs(t.dot(l))) … … 659 656 } 660 657 661 658 /* All 3 axis of the object B */ 662 659 for( int j = 0; j < 3; ++j) 663 660 { … … 667 664 668 665 for(int i = 0; i < 3; ++i) 669 {670 666 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 671 }672 673 667 for(int i = 0; i < 3; ++i) 674 {675 668 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);669 670 671 PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 679 672 680 673 if( (rA + rB) < fabs(t.dot(l))) … … 683 676 return false; 684 677 } 685 686 687 // else 688 // PRINTF(0)(" - The Boxes are not disjoint\n"); 689 690 //PRINTF(0)("rA = %f, rB = %f\n", rA, rB); 691 692 693 /* now check all orthogonals from the axis */ 694 } 678 } 679 680 681 /* Now check for all face cross products */ 682 683 for( int j = 0; j < 3; ++j) 684 { 685 for(int k = 0; k < 3; ++k ) 686 { 687 rA = 0.0f; 688 rB = 0.0f; 689 l = boxA->axis[j].cross(boxB->axis[k]); 690 691 for(int i = 0; i < 3; ++i) 692 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); 693 for(int i = 0; i < 3; ++i) 694 rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l)); 695 696 697 PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 698 699 if( (rA + rB) < fabs(t.dot(l))) 700 { 701 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 702 return false; 703 } 704 } 705 } 706 707 708 695 709 696 710 boxA->bCollided = true; /* use this ONLY!!!! for drawing operations */
Note: See TracChangeset
for help on using the changeset viewer.