Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4589 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 10, 2005, 11:42:38 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: solved last accuracy problem. all is well now. the box could be a little more tight

Location:
orxonox/trunk/src/lib/collision_detection
Files:
2 edited

Legend:

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

    r4588 r4589  
    9696
    9797  /* generate some test vertices */
    98   sVec3D* vertList = new sVec3D[4];
    99   sVec3D data[]  = {{0.0, 0.0, 0.0},{2.0, -8.0, 5.0},{10.0, 5.0, 0.0}, {5.0, 4.0, 1.0}};
     98  int const length = 5;
     99  sVec3D* vertList = new sVec3D[length];
     100  sVec3D data[length]  = {{5.0, 0.0, 0.0},{2.0, -8.0, 5.0},{14.0, 5.0, 0.0}, {5.0, 4.0, 1.0}, {12.0, 2.0, 8.0}};
    100101
    101   for(int i = 0; i < 4; ++i)
     102  for(int i = 0; i < length; ++i)
    102103    {
    103104      vertList[i][0] = data[i][0];
     
    106107    }
    107108
    108   this->spawnBVTree(1, vertList, 4);
     109  this->spawnBVTree(1, vertList, length);
    109110
    110111  PRINT(0)("=  Spawning Tree: Finished\n");
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4588 r4589  
    217217  float               tmpLength;                             //!< tmp save point for the length
    218218
    219   ax[0].r = *box->center; ax[0].a = *box->axis[0];
    220   ax[1].r = *box->center; ax[1].a = *box->axis[1];
    221   ax[2].r = *box->center; ax[2].a = *box->axis[2];
    222219
    223220  Plane p0(*box->axis[0], *box->center);
     
    225222  Plane p2(*box->axis[2], *box->center);
    226223
    227 
    228 
    229   halfLength[0] = 0.0f;
     224  halfLength[0] = -1.0f;
    230225  for(int j = 0; j < length; ++j)
    231226  {
    232     tmpLength = p0.distancePoint(vertices[j]);
     227    tmpLength = fabs(p0.distancePoint(vertices[j]));
    233228    if( tmpLength > halfLength[0])
    234229      halfLength[0] = tmpLength;
    235230  }
    236231
    237 
    238   halfLength[1] = 0.0f;
     232  halfLength[1] = -1.0f;
    239233  for(int j = 0; j < length; ++j)
    240234  {
    241     tmpLength = p1.distancePoint(vertices[j]);
     235    tmpLength = fabs(p1.distancePoint(vertices[j]));
    242236    if( tmpLength > halfLength[1])
    243237      halfLength[1] = tmpLength;
    244238  }
    245239
    246   halfLength[2] = 0.0f;
     240  halfLength[2] = -1.0f;
    247241  for(int j = 0; j < length; ++j)
    248242  {
    249     tmpLength = p2.distancePoint(vertices[j]);
     243    tmpLength = fabs(p2.distancePoint(vertices[j]));
    250244    if( tmpLength > halfLength[2])
    251245      halfLength[2] = tmpLength;
     
    253247
    254248  box->halfLength = halfLength;
    255 
    256249
    257250
     
    300293void OBBTreeNode::drawBVPolygon(int currentDepth, const int depth) const
    301294{
     295
     296  /* draw world axes */
     297  glBegin(GL_LINES);
     298  glColor3f(0.0, 0.4, 0.3);
     299  glVertex3f(0.0, 0.0, 0.0);
     300  glVertex3f(3.0, 0.0, 0.0);
     301
     302  glVertex3f(0.0, 0.0, 0.0);
     303  glVertex3f(0.0, 3.0, 0.0);
     304
     305  glVertex3f(0.0, 0.0, 0.0);
     306  glVertex3f(0.0, 0.0, 3.0);
     307  glEnd();
     308
     309
    302310
    303311  /* draw the obb axes */
Note: See TracChangeset for help on using the changeset viewer.