Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7583 in orxonox.OLD


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

cd: changing to new coordinate format

Location:
branches/cd/src/lib
Files:
3 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
  • branches/cd/src/lib/math/plane.cc

    r6617 r7583  
    222222}
    223223
     224
    224225/**
    225226 *  calculate the two points of minimal distance of two lines
     
    324325 * @return the distance between the plane and the point (can be negative)
    325326 */
    326 float Plane::distancePoint (const sVec3D& p) const
     327// float Plane::distancePoint (const sVec3D& p) const
     328// {
     329//   Vector s(p[0], p[1], p[2]);
     330//   float l = n.len();
     331//   if( l == 0.0) return 0.0;
     332//   return (n.dot(s) + k) / n.len();
     333// }
     334
     335
     336/**
     337 *  returns the distance between the plane and a point
     338 * @param p: a Point
     339 * @return the distance between the plane and the point (can be negative)
     340 */
     341float Plane::distancePoint (const float* p) const
    327342{
    328343  Vector s(p[0], p[1], p[2]);
  • branches/cd/src/lib/math/plane.h

    r6617 r7583  
    5151  Vector intersectLine (const Line& l) const;
    5252  float distancePoint (const Vector& p) const;
    53   float distancePoint (const sVec3D& p) const;
     53//   float distancePoint (const sVec3D& p) const;
     54  float distancePoint (const float* p) const;
    5455  float locatePoint (const Vector& p) const;
    5556};
Note: See TracChangeset for help on using the changeset viewer.