Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4611 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection


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

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

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

Legend:

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

    r4609 r4611  
    9898  int const length = 3;
    9999  sVec3D* vertList = new sVec3D[length];
    100   sVec3D data[length]  = {{5.0, 0.0, 0.0},{2.0, 0.0, 0.5},{14.0, 0.0, 0.0}};//, {5.0, 0.0, 1.0}, {12.0, 0.0, 8.0}, {3.0, 5.0, 4.9}};
     100  sVec3D data[length]  = {{5.0, 0.0, 0.0},{2.0, 0.0, 5.0},{14.0, 0.0, 0.0}};//, {5.0, 0.0, 1.0}, {12.0, 0.0, 8.0}, {3.0, 5.0, 4.9}};
    101101
    102102  for(int i = 0; i < length; ++i)
  • 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.