Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2005, 11:52:45 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: definition of the separation plane and partition of the vertex. some vector sVec3D modification

File:
1 edited

Legend:

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

    r4609 r4611  
    279279
    280280  /* get the closest vertex near the center */
    281   float               dist = 0.0f;                         //!< the smallest distance to each vertex
     281  float               dist = 999999.0f;                    //!< the smallest distance to each vertex
    282282  float               tmpDist;                             //!< temporary distance
    283283  int                 vertexIndex;
    284   Plane               separationPlane(*box->axis[axisIndex], *box->center); //!< the separation plane definition
     284  Plane               middlePlane(*box->axis[axisIndex], *box->center); //!< the middle plane
    285285
    286286  for(int i = 0; i < box->numOfVertices; ++i)
    287287  {
    288     tmpDist = fabs(separationPlane.distancePoint(vertices[i]));
    289     if( tmpDist > dist)
     288    tmpDist = fabs(middlePlane.distancePoint(box->vertices[i]));
     289    if( tmpDist < dist)
     290    {
    290291      dist = tmpDist;
    291   }
    292 
     292      vertexIndex = i;
     293    }
     294  }
    293295
    294296  printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
     297
     298
     299  /* now definin the separation plane through this specified nearest point and partition
     300    the points depending on which side they are located
     301  */
     302  Plane              separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
     303  tList<sVec3D>      partition1;                           //!< the vertex partition 1
     304  tList<sVec3D>      partition2;                           //!< the vertex partition 2
    295305
    296306
Note: See TracChangeset for help on using the changeset viewer.