Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5488 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 4, 2005, 5:28:42 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk/src/lib/cd: woking on the jacobi matrix decomposition algorithm

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_detection/lin_alg.h

    r5449 r5488  
    55    compute the eigenpairs (eigenvalues and eigenvectors) of a real symmetric matrix "A" by the Jacobi method
    66 */
     7
    78
    89
     
    2223*                         C++ version by J-P Moreau, Paris. *
    2324************************************************************/
    24 void JacobI(float **A,int N,float *D, float **V, int *NROT) {
     25void JacobI(float **A, float *D, float **V, int *NROT) {
     26
     27int N = 3;
     28
    2529float  *B, *Z;
    2630double  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;
     
    2933  //allocate vectors B, Z
    3034
    31   B = (float *) calloc(100, 32);
    32   Z = (float *) calloc(100, 32);
    33 
    34   for(ip=0; ip<3; ip++) {  //initialize V to identity matrix
    35     for (iq=0; iq<3; iq++)  V[ip][iq]=0;
    36     V[ip][ip]=1;
    37   }
    38   for (ip=1; ip<=N; ip++) {
    39     B[ip]=A[ip][ip];
    40     D[ip]=B[ip];
    41     Z[ip]=0;
    42   }
    43   *NROT=0;
    44   for (i=1; i<=50; i++) {
    45     sm=0;
    46     for (ip=0; ip<2; ip++)    //sum off-diagonal elements
    47       for (iq=ip+1; iq<3; iq++)
     35  //B = (float *) calloc(100, 32);
     36  //Z = (float *) calloc(100, 32);
     37  B = new float[N];
     38  Z = new float[N];
     39
     40
     41  for( ip = 0; ip < 3; ip++) {  //initialize V to identity matrix
     42    for( iq = 0; iq < 3; iq++)
     43      V[ip][iq] = 0.0f;
     44    V[ip][ip] = 1.0f;
     45  }
     46  for( ip = 1; ip <= N; ip++) {
     47    B[ip] = A[ip][ip];
     48    D[ip] = B[ip];
     49    Z[ip] = 0;
     50  }
     51
     52  *NROT = 0;
     53  // make maximaly 50 iterations
     54  for( i = 1; i <= 50; i++) {
     55    sm = 0;
     56
     57    for( ip = 0; ip < 2; ip++)    //sum off-diagonal elements
     58      for( iq = ip + 1; iq < 3; iq++)
    4859        sm=sm+fabs(A[ip][iq]);
    49     if (sm==0)
     60
     61    if(sm == 0)
    5062    {
    5163      free(B);
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5487 r5488  
    386386
    387387  /* new jacobi tests */
    388   JacobI(OBBTreeNode::coMat, 3, OBBTreeNode::eigvlMat, OBBTreeNode::eigvMat, OBBTreeNode::rotCount);
     388  JacobI(OBBTreeNode::coMat, OBBTreeNode::eigvlMat, OBBTreeNode::eigvMat, OBBTreeNode::rotCount);
    389389  PRINTF(3)("-- Done Jacobi Decomposition\n");
    390390
  • trunk/src/orxonox.cc

    r5480 r5488  
    242242  EventHandler::getInstance()->subscribe(GraphicsEngine::getInstance(), ES_ALL, EV_VIDEO_RESIZE);
    243243
    244 
    245244  return 0;
    246245}
     
    268267  PRINT(3)("initializing ResourceManager\n");
    269268
     269  // init the resource manager
    270270  const char* dataPath;
    271271  if ((dataPath = this->iniParser->getVar(CONFIG_NAME_DATADIR, CONFIG_SECTION_DATA))!= NULL)
     
    296296  delete[] imageDir;
    297297
     298  // start the collision detection engine
    298299  CDEngine::getInstance();
    299300  return 0;
     
    429430  Orxonox *orx = Orxonox::getInstance();
    430431
    431   if((*orx).init(argc, argv) == -1)
     432  if(orx->init(argc, argv) == -1)
    432433    {
    433434      PRINTF(1)("! Orxonox initialization failed\n");
Note: See TracChangeset for help on using the changeset viewer.