Changeset 5488 in orxonox.OLD for trunk/src/lib/collision_detection
- Timestamp:
- Nov 4, 2005, 5:28:42 PM (19 years ago)
- Location:
- trunk/src/lib/collision_detection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/lin_alg.h
r5449 r5488 5 5 compute the eigenpairs (eigenvalues and eigenvectors) of a real symmetric matrix "A" by the Jacobi method 6 6 */ 7 7 8 8 9 … … 22 23 * C++ version by J-P Moreau, Paris. * 23 24 ************************************************************/ 24 void JacobI(float **A,int N,float *D, float **V, int *NROT) { 25 void JacobI(float **A, float *D, float **V, int *NROT) { 26 27 int N = 3; 28 25 29 float *B, *Z; 26 30 double 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; … … 29 33 //allocate vectors B, Z 30 34 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++) 48 59 sm=sm+fabs(A[ip][iq]); 49 if (sm==0) 60 61 if(sm == 0) 50 62 { 51 63 free(B); -
trunk/src/lib/collision_detection/obb_tree_node.cc
r5487 r5488 386 386 387 387 /* new jacobi tests */ 388 JacobI(OBBTreeNode::coMat, 3,OBBTreeNode::eigvlMat, OBBTreeNode::eigvMat, OBBTreeNode::rotCount);388 JacobI(OBBTreeNode::coMat, OBBTreeNode::eigvlMat, OBBTreeNode::eigvMat, OBBTreeNode::rotCount); 389 389 PRINTF(3)("-- Done Jacobi Decomposition\n"); 390 390
Note: See TracChangeset
for help on using the changeset viewer.