Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4701 in orxonox.OLD


Ignore:
Timestamp:
Jun 26, 2005, 1:10:20 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now checking 6 of 15 axis

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r4700 r4701  
    626626bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, PNode* nodeA, PNode* nodeB)
    627627{
    628  
    629  
     628
     629
    630630  /* first check all axis */
    631631  Vector t = nodeA->getAbsCoor() + *boxA->center - ( nodeB->getAbsCoor() + *boxB->center);
     
    634634  Vector l;
    635635
    636   for(int j = 0; j < 3; ++j)
     636  for( int j = 0; j < 3; ++j)
    637637    {
    638638      rA = 0.0f;
     
    641641
    642642      for(int i = 0; i < 3; ++i)
    643         {
    644           rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l));
    645         }
    646  
     643        {
     644          rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l));
     645        }
     646
    647647      for(int i = 0; i < 3; ++i)
    648         {
    649           rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l));
    650         }
    651  
     648        {
     649          rB += fabs(boxB->halfLength[i] * boxB->axis[i].dot(l));
     650        }
     651
    652652      PRINTF(0)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);
    653653
    654654      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);
    660691
    661692
    662693      /* now check all orthogonals from the axis */
    663 
    664     }
    665   return false;
     694    }
     695
     696  return true;
    666697}
    667698
  • orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc

    r4696 r4701  
    4343bool drawModel;
    4444
     45TestEntity* a;
     46Environment* b;
     47
    4548void Framework::moduleInit(int argc, char** argv)
    4649{
     
    6568  entityList = new tList<WorldEntity>();
    6669
    67   TestEntity* a = new TestEntity(); a->setName("Clown1");
    68   Environment* b = new Environment(); b->setName("Jaeger");
     70  a = new TestEntity(); a->setName("Clown1");
     71  b = new Environment(); b->setName("Jaeger");
    6972  b->setRelCoor(0.0, 0.0, -10.0);
    7073
     
    223226    dt = 10;
    224227  }
     228
     229  b->shiftCoor(Vector(0.0, 0.0, 0.1));
    225230
    226231
Note: See TracChangeset for help on using the changeset viewer.