Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4668 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jun 23, 2005, 6:10:42 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the cubes have now minimal length

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

Legend:

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

    r4638 r4668  
    9999  int const length = 9;
    100100  sVec3D* vertList = new sVec3D[length];
    101   sVec3D data[length]  = {{0.0, 0.0, 0.0},{1.0, 2.0, 5.0},{0.0, 6.0, 9.0},
    102                           {1.0, 4.0, 12.0}, {1.0, 2.0, 16.0}, {0.0, 0.0, 19.0},
    103                           {0.0, 3.0, 23.0}, {1.0, 5.0, 30.0}, {0.0, 10.0, 35.0}};
     101//   sVec3D data[length]  = {{0.0, 0.0, 0.0},{1.0, 2.0, 5.0},{0.0, 6.0, 9.0},
     102//                           {1.0, 4.0, 12.0}, {1.0, 2.0, 16.0}, {0.0, 0.0, 19.0},
     103//                           {0.0, 3.0, 23.0}, {1.0, 5.0, 30.0}, {0.0, 10.0, 35.0}};
     104
     105  sVec3D data[length]  = {{0.0, 0.0, 0.0},{1.0, 2.0, 5.0},{1.0, 5.0, 30.0},
     106                          {0.0, 3.0, 23.0}, {0.0, 6.0, 9.0}, {0.0, 10.0, 35.0},
     107                          {1.0, 4.0, 12.0}, {1.0, 2.0, 16.0}, {0.0, 0.0, 19.0}};
    104108
    105109  for(int i = 0; i < length; ++i)
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4661 r4668  
    451451
    452452   /* calculate the real centre of the body by using the axis length */
    453    float center[3];
    454    float offset[3];
     453   float centerOffset[3];
     454   float newHalfLength[3];
    455455   for(int i = 0; i < 3; ++i)
    456456     {
    457457       PRINTF(0)("max: %f, min: %f \n", maxLength[i], minLength[i]);
    458        center[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative
    459        offset[i] = halfLength[i] - center[i];
     458       centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie
     459       newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative
    460460       //PRINTF(0)("Center Orig: %f, %f, %f ---- new: %f, %f, %f", box->center[]);
    461        *box->center +=  (box->axis[i] * offset[i]);            // update the new center vector
    462        PRINTF(0)("Center Translation Operation: halfLength old: %f, new: %f\n", halfLength[i], center[i]);
    463        halfLength[i] = center[i];
     461       *box->center +=  (box->axis[i] * centerOffset[i]);            // update the new center vector
     462       //PRINTF(0)("Center Translation Operation: halfLength old: %f, new: %f\n", halfLength[i], center[i]);
     463       halfLength[i] = newHalfLength[i];
    464464     }
    465465
Note: See TracChangeset for help on using the changeset viewer.