Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7583 in orxonox.OLD for branches/cd/src/lib/collision_detection


Ignore:
Timestamp:
May 11, 2006, 12:06:06 AM (19 years ago)
Author:
patrick
Message:

cd: changing to new coordinate format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cd/src/lib/collision_detection/obb_tree_node.cc

    r7582 r7583  
    299299  float               maxLength[3];                          //!< maximal lenth of the axis
    300300  float               minLength[3];                          //!< minimal length of the axis
    301   const sVec3D*       tmpVec;                                //!< variable taking tmp vectors
     301  const float*       tmpVec;                                //!< variable taking tmp vectors
    302302
    303303
    304304  /* get the maximal dimensions of the body in all directions */
    305305  /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */
    306   tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
    307   maxLength[0] = p0.distancePoint(*tmpVec);
    308   minLength[0] = p0.distancePoint(*tmpVec);
     306  tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
     307  maxLength[0] = p0.distancePoint(tmpVec);
     308  minLength[0] = p0.distancePoint(tmpVec);
    309309  for( int j = 0; j < length; ++j)
    310310  {
    311311    for( int i = 0; i < 3; ++i)
    312312    {
    313       tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
    314       tmpLength = p0.distancePoint(*tmpVec);
     313      tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
     314      tmpLength = p0.distancePoint(tmpVec);
    315315      PRINTF(0)("point[%i][%i]: %f, %f, %f with distance to plane: %f\n", j, i, tmpVec[0], tmpVec[1], tmpVec[2], tmpLength);
    316316      if( tmpLength > maxLength[0])
     
    322322
    323323  /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */
    324   tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
    325   maxLength[1] = p1.distancePoint(*tmpVec);
    326   minLength[1] = p1.distancePoint(*tmpVec);
     324  tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
     325  maxLength[1] = p1.distancePoint(tmpVec);
     326  minLength[1] = p1.distancePoint(tmpVec);
    327327  for( int j = 0; j < length; ++j)
    328328  {
    329329    for( int i = 0; i < 3; ++i)
    330330    {
    331       tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
    332       tmpLength = p1.distancePoint(*tmpVec);
     331      tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
     332      tmpLength = p1.distancePoint(tmpVec);
    333333      if( tmpLength > maxLength[1])
    334334        maxLength[1] = tmpLength;
     
    339339
    340340  /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */
    341   tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
    342   maxLength[2] = p2.distancePoint(*tmpVec);
    343   minLength[2] = p2.distancePoint(*tmpVec);
     341  tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);
     342  maxLength[2] = p2.distancePoint(tmpVec);
     343  minLength[2] = p2.distancePoint(tmpVec);
    344344  for( int j = 0; j < length; ++j)
    345345  {
    346346    for( int i = 0; i < 3; ++i)
    347347    {
    348       tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
    349       tmpLength = p2.distancePoint(*tmpVec);
     348      tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);
     349      tmpLength = p2.distancePoint(tmpVec);
    350350      if( tmpLength > maxLength[2])
    351351        maxLength[2] = tmpLength;
     
    362362  {
    363363    centerOffset[i] = (fabs(maxLength[i]) - fabs(minLength[i])) / 2.0f;       // min length is negatie
    364     box.halfLength[i] = (maxLength[i] - minLength[i]) / 3.0f;                 // min length is negative
     364    box.halfLength[i] = (maxLength[i] - minLength[i]) / 2.0f;                 // min length is negative
    365365  }
    366366  // FIXME: += anstatt -= ????????? verwirr
Note: See TracChangeset for help on using the changeset viewer.