Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4629 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jun 14, 2005, 2:20:56 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now working with smaller jacobi algorithm. got some other very vard to debug segfaults

File:
1 edited

Legend:

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

    r4628 r4629  
    7373void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
    7474{
    75   printf("OBB Depth: %i\n", depth);
     75  printf("OBB Depth: %i, numVertices: %i\n", depth, length);
    7676  this->depth = depth;
    7777
     
    159159//   }
    160160
    161   printf("\nCovariance Matrix:\n");
    162   for(int j = 0; j < 3; ++j)
    163   {
    164     printf(" |");
    165     for(int k = 0; k < 3; ++k)
    166     {
    167       printf(" \b%f ", covariance[j][k]);
    168     }
    169     printf(" |\n");
    170   }
    171   printf("center: %f, %f, %f\n\n", center.x, center.y, center.z);
     161//   printf("\nCovariance Matrix:\n");
     162//   for(int j = 0; j < 3; ++j)
     163//   {
     164//     printf(" |");
     165//     for(int k = 0; k < 3; ++k)
     166//     {
     167//       printf(" \b%f ", covariance[j][k]);
     168//     }
     169//     printf(" |\n");
     170//   }
     171//   printf("center: %f, %f, %f\n\n", center.x, center.y, center.z);
    172172
    173173
     
    188188  vectors
    189189  */
    190   Matrix                V(3,3);                               //!< for eigenvectors
    191   DiagonalMatrix        D(3);                                 //!< for eigenvalues
    192   SymmetricMatrix       C(3);                                 //!< for the covariance symmetrical matrix
     190 /* Matrix                V(3,3);    */                           //!< for eigenvectors
     191 /* DiagonalMatrix        D(3);   */                              //!< for eigenvalues
     192/*  SymmetricMatrix       C(3); */                                //!< for the covariance symmetrical matrix
    193193  Vector**              axis = new Vector*[3];                //!< the references to the obb axis
    194 
    195 
    196   C(1,1) = covariance[0][0];
    197   C(1,2) = covariance[0][1];
    198   C(1,3) = covariance[0][2];
    199   C(2,1) = covariance[1][0];
    200   C(2,2) = covariance[1][1];
    201   C(2,3) = covariance[1][2];
    202   C(3,1) = covariance[2][0];
    203   C(3,2) = covariance[2][1];
    204   C(3,3) = covariance[2][2];
    205 
    206   Jacobi(C, D, V);                                            /* do the jacobi decomposition */
    207   PRINTF(0)("-- Done Jacobi Decomposition\n");
    208194
    209195
     
    231217
    232218
    233 //   EVJacobi jac;
    234 //   jac.setMatrix(2, covariance, 0, 0);
    235 //   jac.getEigenVector(eigenvectors);
    236 //
    237 
    238219  JacobI(a, 3, eigval, b, rot);
    239 
    240   printf("Old Jacobi\n");
    241   for(int j = 1; j < 4; ++j)
    242   {
    243     printf(" |");
    244     for(int k = 1; k < 4; ++k)
    245     {
    246       printf(" \b%f ", V(j, k));
    247     }
    248     printf(" |\n");
    249   }
    250 
    251   printf("New Jacobi\n");
    252   for(int j = 1; j < 4; ++j)
    253   {
    254     printf(" |");
    255     for(int k = 1; k < 4; ++k)
    256     {
    257       printf(" \b%f ", b[j][k]);
    258     }
    259     printf(" |\n");
    260   }
    261 
    262   axis[0] = new Vector(V(1, 1), V(2, 1), V(3, 1));
    263   axis[1] = new Vector(V(1, 2), V(2, 2), V(3, 2));
    264   axis[2] = new Vector(V(1, 3), V(2, 3), V(3, 3));
     220  PRINTF(0)("-- Done Jacobi Decomposition\n");
     221
     222
     223
     224//   printf("Jacobi\n");
     225//   for(int j = 1; j < 4; ++j)
     226//   {
     227//     printf(" |");
     228//     for(int k = 1; k < 4; ++k)
     229//     {
     230//       printf(" \b%f ", b[j][k]);
     231//     }
     232//     printf(" |\n");
     233//   }
     234
     235  axis[0] = new Vector(b[1][1], b[2][1], b[3][1]);
     236  axis[1] = new Vector(b[1][2], b[2][2], b[3][2]);
     237  axis[2] = new Vector(b[1][3], b[2][3], b[3][3]);
    265238  box->axis = axis;
    266239  PRINTF(0)("-- Got Axis\n");
    267240
    268 //   delete &V;
    269 //   delete &D;
    270 //   delete &V;
     241  delete [] a[0];
     242  delete [] a[1];
     243  delete [] a[2];
     244  delete [] a[3];
     245  delete [] a;
     246
     247  delete [] b[0];
     248  delete [] b[1];
     249  delete [] b[2];
     250  delete [] b[3];
     251  delete [] b;
     252
    271253
    272254//   printf("\neigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z);
     
    339321  }
    340322
    341   printf("\nlongest axis is: nr %i with a half-length of: %f\n", axisIndex, aLength);
     323//   printf("\nlongest axis is: nr %i with a half-length of: %f\n", axisIndex, aLength);
    342324
    343325
     
    358340  }
    359341
    360   printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
     342//   printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
    361343
    362344
     
    377359  partition1.add(&box->vertices[vertexIndex]);
    378360
    379   printf("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
     361//   printf("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
    380362
    381363
Note: See TracChangeset for help on using the changeset viewer.