Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/trunk: FINALLY! MUAHHAHAHAA, i found a function to compute the eigenvec. just wanted to go to sleep, but…

File:
1 edited

Legend:

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

    r4627 r4628  
    103103  Vector    p, q, r;                                 //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d
    104104  Vector    t1, t2;                                  //!< temporary values
    105   double    covariance[3][3];                        //!< the covariance matrix
     105  float     covariance[3][3];                        //!< the covariance matrix
    106106
    107107  this->numOfVertices = length;
     
    194194
    195195
    196   double a[4][4];
    197 
    198   a[0][0] = C(1,1) = covariance[0][0];
    199   a[0][1] = C(1,2) = covariance[0][1];
    200   a[0][2] = C(1,3) = covariance[0][2];
    201   a[1][0] = C(2,1) = covariance[1][0];
    202   a[1][1] = C(2,2) = covariance[1][1];
    203   a[1][2] = C(2,3) = covariance[1][2];
    204   a[2][0] = C(3,1) = covariance[2][0];
    205   a[2][1] = C(3,2) = covariance[2][1];
    206   a[2][2] = C(3,3) = covariance[2][2];
     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];
    207205
    208206  Jacobi(C, D, V);                                            /* do the jacobi decomposition */
     
    211209
    212210  /* new jacobi tests */
    213   double eigenvectors[3][3];
    214   double eigval[3];
    215 
    216   EVJacobi jac;
    217   jac.setMatrix(2, covariance, 0, 0);
    218   jac.getEigenVector(eigenvectors);
    219 
     211  float** a = new float*[4];
     212  a[0] = new float[4]; a[1] = new float[4]; a[2] = new float[4]; a[3] = new float[4];
     213
     214  float** b = new float*[4];
     215  b[0] = new float[4]; b[1] = new float[4]; b[2] = new float[4]; b[3] = new float[4];
     216
     217  float eigval[3];
     218
     219  int* rot = new int;
     220
     221
     222  a[1][1] = covariance[0][0];
     223  a[1][2] = covariance[0][1];
     224  a[1][3] = covariance[0][2];
     225  a[2][1] = covariance[1][0];
     226  a[2][2] = covariance[1][1];
     227  a[2][3] = covariance[1][2];
     228  a[3][1] = covariance[2][0];
     229  a[3][2] = covariance[2][1];
     230  a[3][3] = covariance[2][2];
     231
     232
     233//   EVJacobi jac;
     234//   jac.setMatrix(2, covariance, 0, 0);
     235//   jac.getEigenVector(eigenvectors);
     236//
     237
     238  JacobI(a, 3, eigval, b, rot);
    220239
    221240  printf("Old Jacobi\n");
     
    231250
    232251  printf("New Jacobi\n");
    233   for(int j = 0; j < 3; ++j)
     252  for(int j = 1; j < 4; ++j)
    234253  {
    235254    printf(" |");
    236     for(int k = 0; k < 3; ++k)
     255    for(int k = 1; k < 4; ++k)
    237256    {
    238       printf(" \b%f ", eigenvectors[j][k]);
     257      printf(" \b%f ", b[j][k]);
    239258    }
    240259    printf(" |\n");
Note: See TracChangeset for help on using the changeset viewer.