Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4703 in orxonox.OLD


Ignore:
Timestamp:
Jun 26, 2005, 2:14:31 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now all three axis are checked, there seem to be some problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4702 r4703  
    634634  Vector l;
    635635
     636  /* All 3 axis of the object A */
    636637  for( int j = 0; j < 3; ++j)
    637638    {
     
    641642
    642643      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));
    647645      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);
    653650
    654651      if( (rA + rB) < fabs(t.dot(l)))
     
    659656    }
    660657
    661 
     658    /* All 3 axis of the object B */
    662659    for( int j = 0; j < 3; ++j)
    663660    {
     
    667664
    668665      for(int i = 0; i < 3; ++i)
    669       {
    670666        rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l));
    671       }
    672 
    673667      for(int i = 0; i < 3; ++i)
    674       {
    675668        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);
    679672
    680673      if( (rA + rB) < fabs(t.dot(l)))
     
    683676        return false;
    684677      }
    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
    695709
    696710    boxA->bCollided = true; /* use this ONLY!!!! for drawing operations */
Note: See TracChangeset for help on using the changeset viewer.