Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4611 in orxonox.OLD for orxonox


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

Location:
orxonox/trunk/src/lib
Files:
4 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
  • orxonox/trunk/src/lib/math/vector.cc

    r4585 r4611  
    652652}
    653653
     654
     655/**
     656    \brief create a plane from anchor point and normal
     657    \param norm: normal vector
     658    \param p: anchor point
     659*/
     660Plane::Plane (Vector norm, sVec3D g)
     661{
     662  Vector p(g[0], g[1], g[2]);
     663  n = norm;
     664  k = -(n.x*p.x+n.y*p.y+n.z*p.z);
     665}
     666
     667
    654668/**
    655669   \brief returns the intersection point between the plane and a line
  • orxonox/trunk/src/lib/math/vector.h

    r4609 r4611  
    227227  Plane (Vector a, Vector b, Vector c);
    228228  Plane (Vector norm, Vector p);
     229  Plane (Vector norm, sVec3D p);
    229230  Plane (Vector n, float k) : n(n), k(k) {} //!< assignment constructor
    230231  Plane () : n(Vector(1,1,1)), k(0) {}
Note: See TracChangeset for help on using the changeset viewer.