Changeset 7588 in orxonox.OLD for branches/cd/src/lib
- Timestamp:
- May 11, 2006, 1:38:14 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cd/src/lib/collision_detection/obb_tree_node.cc
r7587 r7588 289 289 float minLength[3]; //!< minimal length of the axis 290 290 const float* tmpVec; //!< variable taking tmp vectors 291 float centerOffset[3]; 291 292 292 293 293 294 /* get the maximal dimensions of the body in all directions */ 294 295 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 295 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 296 maxLength[0] = p0.distancePoint(tmpVec); 297 minLength[0] = p0.distancePoint(tmpVec); 298 for( int j = 0; j < length; ++j) 299 { 300 for( int i = 0; i < 3; ++i) 301 { 302 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 303 tmpLength = p0.distancePoint(tmpVec); 304 if( tmpLength > maxLength[0]) 305 maxLength[0] = tmpLength; 306 else if( tmpLength < minLength[0]) 307 minLength[0] = tmpLength; 308 } 309 } 310 311 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 312 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 313 maxLength[1] = p1.distancePoint(tmpVec); 314 minLength[1] = p1.distancePoint(tmpVec); 315 for( int j = 0; j < length; ++j) 316 { 317 for( int i = 0; i < 3; ++i) 318 { 319 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 320 tmpLength = p1.distancePoint(tmpVec); 321 if( tmpLength > maxLength[1]) 322 maxLength[1] = tmpLength; 323 else if( tmpLength < minLength[1]) 324 minLength[1] = tmpLength; 325 } 326 } 327 328 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 329 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 330 maxLength[2] = p2.distancePoint(tmpVec); 331 minLength[2] = p2.distancePoint(tmpVec); 332 for( int j = 0; j < length; ++j) 333 { 334 for( int i = 0; i < 3; ++i) 335 { 336 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 337 tmpLength = p2.distancePoint(tmpVec); 338 if( tmpLength > maxLength[2]) 339 maxLength[2] = tmpLength; 340 else if( tmpLength < minLength[2]) 341 minLength[2] = tmpLength; 342 } 343 } 296 for( int k = 0; k < 3; k++) 297 { 298 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 299 maxLength[0] = p0.distancePoint(tmpVec); 300 minLength[0] = p0.distancePoint(tmpVec); 301 for( int j = 0; j < length; ++j) 302 { 303 for( int i = 0; i < 3; ++i) 304 { 305 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 306 tmpLength = p0.distancePoint(tmpVec); 307 if( tmpLength > maxLength[0]) 308 maxLength[0] = tmpLength; 309 else if( tmpLength < minLength[0]) 310 minLength[0] = tmpLength; 311 } 312 } 313 } 314 315 316 // tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 317 // maxLength[1] = p1.distancePoint(tmpVec); 318 // minLength[1] = p1.distancePoint(tmpVec); 319 // for( int j = 0; j < length; ++j) 320 // { 321 // for( int i = 0; i < 3; ++i) 322 // { 323 // tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 324 // tmpLength = p1.distancePoint(tmpVec); 325 // if( tmpLength > maxLength[1]) 326 // maxLength[1] = tmpLength; 327 // else if( tmpLength < minLength[1]) 328 // minLength[1] = tmpLength; 329 // } 330 // } 331 // 332 // 333 // tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 334 // maxLength[2] = p2.distancePoint(tmpVec); 335 // minLength[2] = p2.distancePoint(tmpVec); 336 // for( int j = 0; j < length; ++j) 337 // { 338 // for( int i = 0; i < 3; ++i) 339 // { 340 // tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 341 // tmpLength = p2.distancePoint(tmpVec); 342 // if( tmpLength > maxLength[2]) 343 // maxLength[2] = tmpLength; 344 // else if( tmpLength < minLength[2]) 345 // minLength[2] = tmpLength; 346 // } 347 // } 344 348 345 349 346 350 /* calculate the real centre of the body by using the axis length */ 347 float centerOffset[3]; 351 348 352 349 353 for( int i = 0; i < 3; ++i)
Note: See TracChangeset
for help on using the changeset viewer.