- Timestamp:
- Nov 21, 2005, 12:01:17 PM (19 years ago)
- Location:
- trunk/src/lib/math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/math/matrix.cc
r5668 r5669 81 81 Vector eigVc[3]; 82 82 /* eigenvec test */ 83 for(int i = 0; i < 3; i++)83 for(int i = 0; i < 2; i++) 84 84 { 85 85 eigVc[i].x = -1/this->m13*(this->m33 - eigVal[i]) + (this->m32*(-this->m31*this->m32 + this->m12*this->m33 - this->m12*eigVal[i])) / … … 91 91 eigVc[i].z = 1.0f; 92 92 93 93 eigVc[i] /= eigVc[i].len(); 94 94 printf("home brew: %f, %f, %f\n", eigVc[i].x, eigVc[i].y, eigVc[i].z); 95 95 } 96 eigVc[2] = eigVc[0].cross(eigVc[1]); 97 printf("home brew: %f, %f, %f\n", eigVc[2].x, eigVc[2].y, eigVc[2].z); 96 98 97 98 // EigenVectors 99 // for (int i = 0; i < 3; ++i) 100 // { 101 // printf (":: i = %d\n", i); 102 // Matrix M = *this - Matrix::identity() * eigVal[i]; 103 // Vector m1, m2, m3; 104 // 105 // M.getTransposed().toVectors(m1, m2, m3); 106 // Matrix U ( M.m22*M.m33 - M.m23*M.m23, M.m13*M.m23 - M.m12*M.m33, M.m12*M.m23 - M.m13*M.m22, 107 // M.m13*M.m23 - M.m12*M.m33, M.m11*M.m33 - M.m13*M.m13, M.m12*M.m13 - M.m23*M.m11, 108 // M.m12*M.m23 - M.m13*M.m22, M.m13*M.m12 - M.m23*M.m11, M.m11*M.m22 - M.m12*M.m12); 109 // U.debug(); 110 // 111 // Vector u1, u2, u3; 112 // U.toVectors(u1, u2, u3); 113 // 114 // /* 115 // u1 = m2.cross(m3); 116 // u2 = m3.cross(m1); 117 // u3 = m1.cross(m2); 118 // */ 119 // 120 // u1 /= u1.len(); 121 // u2 /= u2.len(); 122 // u3 /= u3.len(); 123 // 124 // 125 // printf("%f, %f, %f\n", u1.x, u1.y, u1.z); 126 // printf("%f, %f, %f\n", u2.x, u2.y, u2.z); 127 // printf("%f, %f, %f\n", u3.x, u3.y, u3.z); 128 129 130 131 // u1 = M*u1; 132 // u2 = M*u2; 133 // u3 = M*u3; 134 // 135 // printf("%f, %f, %f\n", u1.x, u1.y, u1.z); 136 // printf("%f, %f, %f\n", u2.x, u2.y, u2.z); 137 // printf("%f, %f, %f\n", u3.x, u3.y, u3.z); 138 // printf("\n\n"); 139 // } 140 141 142 143 this->debug(); 99 a = eigVc[0]; 100 b = eigVc[1]; 101 c = eigVc[2]; 144 102 } 145 103 -
trunk/src/lib/math/test.cc
r5668 r5669 11 11 Vector eigVc[3]; 12 12 13 matrix.debug(); 13 14 // matrix.getEigenValues(); 15 matrix.getEigenVectors(eigVc[0], eigVc[1], eigVc[2]); 16 17 matrix = Matrix (0, 3, 1, 18 3, 1, 0, 19 1, 0, 1); 20 matrix.debug(); 14 21 matrix.getEigenVectors(eigVc[0], eigVc[1], eigVc[2]); 15 22 }
Note: See TracChangeset
for help on using the changeset viewer.