Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5489 in orxonox.OLD for trunk/src


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

orxonox/trunk/src/lib/collision: rearanged the memory management and working on wrong array indexes…

File:
1 edited

Legend:

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

    r5488 r5489  
    3535  //B = (float *) calloc(100, 32);
    3636  //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++)
     37  B = new float[N+1];
     38  Z = new float[N+1];
     39
     40  // initialize V to identity matrix
     41  for( ip = 0; ip < N; ip++) {
     42    for( iq = 0; iq < N; iq++)
    4343      V[ip][iq] = 0.0f;
    4444    V[ip][ip] = 1.0f;
    4545  }
    46   for( ip = 1; ip <= N; ip++) {
     46  // initialize B,D to the diagonal of A
     47  for( ip = 0; ip < N; ip++) {
    4748    B[ip] = A[ip][ip];
    4849    D[ip] = B[ip];
    49     Z[ip] = 0;
     50    Z[ip] = 0.0f;
    5051  }
    5152
     
    6162    if(sm == 0)
    6263    {
    63       free(B);
    64       free(Z);
     64      //free(B);
     65      //free(Z);
     66      delete[] B;
     67      delete[] Z;
    6568      return;       //normal return
    6669    }
     
    125128  } //end of main i loop
    126129//  printf("\n 50 iterations !\n");
    127   free(B);
    128   free(Z);
     130  //free(B);
     131  //free(Z);
     132  delete[] B;
     133  delete[] Z;
    129134  return;  //too many iterations
    130135}
Note: See TracChangeset for help on using the changeset viewer.