Changeset 5449 in orxonox.OLD for trunk/src/lib/collision_detection/lin_alg.h
- Timestamp:
- Oct 29, 2005, 2:38:25 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/lin_alg.h
r5428 r5449 32 32 Z = (float *) calloc(100, 32); 33 33 34 for(ip= 1; ip<=N; ip++) { //initialize V to identity matrix35 for (iq= 1; iq<=N; iq++) V[ip][iq]=0;34 for(ip=0; ip<3; ip++) { //initialize V to identity matrix 35 for (iq=0; iq<3; iq++) V[ip][iq]=0; 36 36 V[ip][ip]=1; 37 37 } … … 44 44 for (i=1; i<=50; i++) { 45 45 sm=0; 46 for (ip= 1; ip<N; ip++) //sum off-diagonal elements47 for (iq=ip+1; iq< =N; iq++)46 for (ip=0; ip<2; ip++) //sum off-diagonal elements 47 for (iq=ip+1; iq<3; iq++) 48 48 sm=sm+fabs(A[ip][iq]); 49 49 if (sm==0) … … 53 53 return; //normal return 54 54 } 55 if (i < 4)56 55 tresh=0.2*sm*sm; 57 else 58 tresh=0; 59 for (ip=1; ip<N; ip++) { 60 for (iq=ip+1; iq<=N; iq++) { 56 for (ip=0; ip<2; ip++) { 57 for (iq=ip+1; iq<3; iq++) { 61 58 g=100*fabs(A[ip][iq]); 62 59 // after 4 sweeps, skip the rotation if the off-diagonal element is small … … 81 78 D[iq] += h; 82 79 A[ip][iq]=0; 83 for (j= 1; j<ip; j++) {80 for (j=0; j<ip; j++) { 84 81 g=A[j][ip]; 85 82 h=A[j][iq]; … … 99 96 A[iq][j] = h+s*(g-h*tau); 100 97 } 101 for (j= 1; j<=N; j++) {98 for (j=0; j<3; j++) { 102 99 g=V[j][ip]; 103 100 h=V[j][iq]; … … 109 106 } // main iq loop 110 107 } // main ip loop 111 for (ip= 1; ip<=N; ip++) {108 for (ip=0; ip<3; ip++) { 112 109 B[ip] += Z[ip]; 113 110 D[ip]=B[ip];
Note: See TracChangeset
for help on using the changeset viewer.