Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5428 in orxonox.OLD


Ignore:
Timestamp:
Oct 24, 2005, 7:07:00 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: fixed a bug in the CD engine

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.in

    r5417 r5428  
    3939        $(srcdir)/doc/documentation.am $(top_srcdir)/configure AUTHORS \
    4040        COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
    41         install-sh ltmain.sh missing mkinstalldirs
     41        install-sh missing mkinstalldirs
    4242subdir = .
    4343ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
  • trunk/src/lib/collision_detection/lin_alg.h

    r5398 r5428  
    2424void JacobI(float **A,int N,float *D, float **V, int *NROT) {
    2525float  *B, *Z;
    26 double  c,g,h,s,sm,t,tau,theta,tresh;
    27 int     i,j,ip,iq;
    28 
    29 // void *vmblock1 = NULL;
     26double  c=0.0f, g=0.0f, h=0.0f, s=0.0f, sm=0.0f, t=0.0f, tau=0.0f, theta=0.0f, tresh=0.0f;
     27int     i=0,j=0,ip=0,iq=0;
    3028
    3129  //allocate vectors B, Z
    32   //vmblock1 = vminit();
     30
    3331  B = (float *) calloc(100, 32);
    3432  Z = (float *) calloc(100, 32);
    3533
    36   for (ip=1; ip<=N; ip++) {  //initialize V to identity matrix
     34  for(ip=1; ip<=N; ip++) {  //initialize V to identity matrix
    3735    for (iq=1; iq<=N; iq++)  V[ip][iq]=0;
    3836    V[ip][ip]=1;
     
    118116  } //end of main i loop
    119117//  printf("\n 50 iterations !\n");
     118  free(B);
     119  free(Z);
    120120  return;  //too many iterations
    121121}
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5210 r5428  
    160160{
    161161  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
    162   float     face;                                    //!< surface area of the entire convex hull
     162  float     face = 0.0f;                             //!< surface area of the entire convex hull
    163163  Vector    centroid[length];                        //!< centroid of the i'th convex hull
    164164  Vector    center;                                  //!< the center of the entire hull
     
    175175  {
    176176    /* fist compute all the convex hull face/facelets and centroids */
    177     for(int i = 0; i+3 < length ; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     177    for( int i = 0; i+3 < length ; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
    178178    {
    179179      p = verticesList[i];
     
    199199
    200200    /* now calculate the covariance matrix - if not written in three for-loops, it would compute faster: minor */
    201     for(int j = 0; j < 3; ++j)
    202     {
    203       for(int k = 0; k < 3; ++k)
     201    for( int j = 0; j < 3; ++j)
     202    {
     203      for( int k = 0; k < 3; ++k)
    204204      {
    205         for(int i = 0; i < length; i+=3)
     205        for( int i = 0; i + 3 < length; i+=3)
    206206        {
    207207          p = verticesList[i];
     
    218218  else if( mode == 1)
    219219  {
    220     for( int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     220    for( int i = 0; i + 3 < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
    221221    {
    222222      p = verticesList[i];
     
    233233      for( int k = 0; k < 3; ++k)
    234234      {
    235         for( int i = 0; i < length; i+=3)
     235        for( int i = 0; i + 3 < length; i+=3)
    236236        {
    237237          p = verticesList[i];
     
    249249  {
    250250    /* fist compute all the convex hull face/facelets and centroids */
    251     for(int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
     251    for(int i = 0; i + 3 < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
    252252    {
    253253      p = verticesList[i];
     
    275275      for( int k = 0; k < 3; ++k)
    276276      {
    277         for( int i = 0; i < length; i+=3)
     277        for( int i = 0; i + 3 < length; i+=3)
    278278        {
    279279          p = verticesList[i];
     
    300300      for( int k = 0; k < 3; ++k)
    301301      {
    302         for( int i = 0; i < length; i+=3)
     302        for( int i = 0; i + 3 < length; i+=3)
    303303        {
    304304          p = verticesList[i];
  • trunk/src/world_entities/environment.cc

    r5419 r5428  
    3838  this->loadModel("models/ships/bolido.obj");
    3939
    40 /*  if(this->obbTree == NULL)
    41     this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());*/
     40  if(this->obbTree == NULL)
     41    this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
    4242}
    4343
  • trunk/src/world_entities/test_entity.cc

    r5427 r5428  
    3737//   this->md2Model = new MD2Model("models/tris.md2", "models/tris.pcx");
    3838// this->md2Model = new MD2Model("models/goblin.md2", "maps/goblin.bmp");
    39 //  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
     39  this->obbTree = new OBBTree(4, (sVec3D*)this->md2Model->data->pVertices, this->md2Model->data->numVertices);
    4040
    4141  this->md2Model->setAnim(RUN);
  • trunk/src/world_entities/world_entity.cc

    r5419 r5428  
    9898bool WorldEntity::buildObbTree(unsigned int depth)
    9999{
    100 //   if (this->obbTree)
    101 //     delete this->obbTree;
    102 //
    103 //   if (this->model)
    104 //   {
    105 //     PRINTF(4)("creating obb tree\n");
    106 //     this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
    107 //     return true;
    108 //   }
    109 //   else
    110 //   {
    111 //     PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
    112 //     this->obbTree = NULL;
    113 //     return false;
    114 //  }
     100  if (this->obbTree)
     101    delete this->obbTree;
     102
     103  if (this->model)
     104  {
     105    PRINTF(4)("creating obb tree\n");
     106    this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
     107    return true;
     108  }
     109  else
     110  {
     111    PRINTF(2)("could not create obb-tree, because no model was loaded yet\n");
     112    this->obbTree = NULL;
     113    return false;
     114  }
    115115}
    116116
Note: See TracChangeset for help on using the changeset viewer.