Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5491 in orxonox.OLD for trunk/src/lib/collision_detection


Ignore:
Timestamp:
Nov 4, 2005, 6:14:13 PM (18 years ago)
Author:
patrick
Message:

orxonox/trunk/src/lib/cd: rebuilt the jacobi function. There are still some false reads in the function. There perhaps another bug also

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

Legend:

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

    r5490 r5491  
    3232
    3333  //allocate vectors B, Z
    34 
    35   //B = (float *) calloc(100, 32);
    36   //Z = (float *) calloc(100, 32);
    37   B = new float[N+1];
    38   Z = new float[N+1];
     34  B = new float[N];
     35  Z = new float[N];
    3936
    4037  // initialize V to identity matrix
     
    7067    // just adjust this on the first 3 sweeps
    7168    if( i < 4)
    72       tresh = 0.2 * sm / (N*N) ;
     69      tresh = 0.2 * sm / (N * N) ;
    7370    else
    7471      tresh = 0.0f;
     
    9491          s = t * c;
    9592          tau = s / (1.0f + c);
    96           h=t*A[ip][iq];
     93          h = t * A[ip][iq];
    9794          Z[ip] -= h;
    9895          Z[iq] += h;
    9996          D[ip] -= h;
    10097          D[iq] += h;
    101           A[ip][iq]=0;
    102           for (j=0; j<ip; j++) {
    103             g=A[j][ip];
    104             h=A[j][iq];
    105             A[j][ip] = g-s*(h+g*tau);
    106             A[j][iq] = h+s*(g-h*tau);
     98          A[ip][iq] = 0.0f;
     99
     100          for( j = 0; j < (ip - 1); j++) {
     101            g = A[j][ip];
     102            h = A[j][iq];
     103            A[j][ip] = g - s * (h + g * tau);
     104            A[j][iq] = h + s * (g - h * tau);
    107105          }
    108           for (j=ip+1; j<iq; j++) {
    109             g=A[ip][j];
    110             h=A[j][iq];
    111             A[ip][j] = g-s*(h+g*tau);
    112             A[j][iq] = h+s*(g-h*tau);
     106          for( j = (ip + 1); j < (iq - 1); j++) {
     107            g = A[ip][j];
     108            h = A[j][iq];
     109            A[ip][j] = g - s * (h + g * tau);
     110            A[j][iq] = h + s * (g - h * tau);
    113111          }
    114           for (j=iq+1; j<=N; j++) {
    115             g=A[ip][j];
    116             h=A[iq][j];
    117             A[ip][j] = g-s*(h+g*tau);
    118             A[iq][j] = h+s*(g-h*tau);
     112          for( j = (iq + 1); j < N; j++) {
     113            g = A[ip][j];
     114            h = A[iq][j];
     115            A[ip][j] = g - s * (h + g * tau);
     116            A[iq][j] = h + s * (g - h * tau);
    119117          }
    120           for (j=0; j<3; j++) {
    121             g=V[j][ip];
    122             h=V[j][iq];
    123             V[j][ip] = g-s*(h+g*tau);
    124             V[j][iq] = h+s*(g-h*tau);
     118          for( j = 0; j < N; j++) {
     119            g = V[j][ip];
     120            h = V[j][iq];
     121            V[j][ip] = g - s * (h + g * tau);
     122            V[j][iq] = h + s * (g - h * tau);
    125123          }
    126           *NROT=*NROT+1;
     124          *NROT += 1;
    127125        } //end ((i.gt.4)...else if
    128126      } // main iq loop
    129127    } // main ip loop
    130     for (ip=0; ip<3; ip++) {
     128    for( ip = 0; ip < N; ip++) {
    131129      B[ip] += Z[ip];
    132       D[ip]=B[ip];
    133       Z[ip]=0;
     130      D[ip] = B[ip];
     131      Z[ip] = 0.0f;
    134132    }
    135133  } //end of main i loop
    136 //  printf("\n 50 iterations !\n");
    137   //free(B);
    138   //free(Z);
    139134  delete[] B;
    140135  delete[] Z;
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5488 r5491  
    390390
    391391
    392 //   PRINTF(3)("Jacobi\n");
    393 //   for(int j = 1; j < 4; ++j)
     392//   PRINTF(0)("Jacobi\n");
     393//   for(int j = 0; j < 3; ++j)
    394394//   {
    395 //     PRINTF(3)(" |");
    396 //     for(int k = 1; k < 4; ++k)
     395//     printf(" |");
     396//     for(int k = 0; k < 3; ++k)
    397397//     {
    398 //       PRINTF(3)(" \b%f ", OBBTreeNode::OBBTreeNode::eigvMat[j][k]);
     398//       printf(" \t%f ", OBBTreeNode::OBBTreeNode::eigvMat[j][k]);
    399399//     }
    400 //     PRINTF(3)(" |\n");
     400//     printf(" |\n");
    401401//   }
    402402
     
    409409  box->axis = axis;
    410410
    411   PRINTF(3)("-- Got Axis\n");
    412 
    413   PRINTF(3)("eigenvector: %f, %f, %f\n", box->axis[0].x, box->axis[0].y, box->axis[0].z);
    414   PRINTF(3)("eigenvector: %f, %f, %f\n", box->axis[1].x, box->axis[1].y, box->axis[1].z);
    415   PRINTF(3)("eigenvector: %f, %f, %f\n", box->axis[2].x, box->axis[2].y, box->axis[2].z);
     411  PRINTF(0)("-- Got Axis\n");
     412
     413  PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[0].x, box->axis[0].y, box->axis[0].z);
     414  PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[1].x, box->axis[1].y, box->axis[1].z);
     415  PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[2].x, box->axis[2].y, box->axis[2].z);
    416416}
    417417
Note: See TracChangeset for help on using the changeset viewer.