Changeset 4627 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
- Timestamp:
- Jun 14, 2005, 1:39:31 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4626 r4627 36 36 #include "newmatio.h" 37 37 38 #include "lin_alg.h" 39 38 40 39 41 … … 101 103 Vector p, q, r; //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d 102 104 Vector t1, t2; //!< temporary values 103 floatcovariance[3][3]; //!< the covariance matrix105 double covariance[3][3]; //!< the covariance matrix 104 106 105 107 this->numOfVertices = length; … … 191 193 Vector** axis = new Vector*[3]; //!< the references to the obb axis 192 194 193 C(1,1) = covariance[0][0]; 194 C(1,2) = covariance[0][1]; 195 C(1,3) = covariance[0][2]; 196 C(2,1) = covariance[1][0]; 197 C(2,2) = covariance[1][1]; 198 C(2,3) = covariance[1][2]; 199 C(3,1) = covariance[2][0]; 200 C(3,2) = covariance[2][1]; 201 C(3,3) = covariance[2][2]; 195 196 double a[4][4]; 197 198 a[0][0] = C(1,1) = covariance[0][0]; 199 a[0][1] = C(1,2) = covariance[0][1]; 200 a[0][2] = C(1,3) = covariance[0][2]; 201 a[1][0] = C(2,1) = covariance[1][0]; 202 a[1][1] = C(2,2) = covariance[1][1]; 203 a[1][2] = C(2,3) = covariance[1][2]; 204 a[2][0] = C(3,1) = covariance[2][0]; 205 a[2][1] = C(3,2) = covariance[2][1]; 206 a[2][2] = C(3,3) = covariance[2][2]; 202 207 203 208 Jacobi(C, D, V); /* do the jacobi decomposition */ 204 209 PRINTF(0)("-- Done Jacobi Decomposition\n"); 205 210 206 // printf("\nwe got a result! YES: \n"); 207 // 208 // for(int j = 1; j < 4; ++j) 209 // { 210 // printf(" |"); 211 // for(int k = 1; k < 4; ++k) 212 // { 213 // printf(" \b%f ", V(j, k)); 214 // } 215 // printf(" |\n"); 216 // } 211 212 /* new jacobi tests */ 213 double eigenvectors[3][3]; 214 double eigval[3]; 215 216 EVJacobi jac; 217 jac.setMatrix(2, covariance, 0, 0); 218 jac.getEigenVector(eigenvectors); 219 220 221 printf("Old Jacobi\n"); 222 for(int j = 1; j < 4; ++j) 223 { 224 printf(" |"); 225 for(int k = 1; k < 4; ++k) 226 { 227 printf(" \b%f ", V(j, k)); 228 } 229 printf(" |\n"); 230 } 231 232 printf("New Jacobi\n"); 233 for(int j = 0; j < 3; ++j) 234 { 235 printf(" |"); 236 for(int k = 0; k < 3; ++k) 237 { 238 printf(" \b%f ", eigenvectors[j][k]); 239 } 240 printf(" |\n"); 241 } 217 242 218 243 axis[0] = new Vector(V(1, 1), V(2, 1), V(3, 1));
Note: See TracChangeset
for help on using the changeset viewer.