Changeset 7583 in orxonox.OLD for branches/cd/src/lib/collision_detection
- Timestamp:
- May 11, 2006, 12:06:06 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cd/src/lib/collision_detection/obb_tree_node.cc
r7582 r7583 299 299 float maxLength[3]; //!< maximal lenth of the axis 300 300 float minLength[3]; //!< minimal length of the axis 301 const sVec3D* tmpVec; //!< variable taking tmp vectors301 const float* tmpVec; //!< variable taking tmp vectors 302 302 303 303 304 304 /* get the maximal dimensions of the body in all directions */ 305 305 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 306 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);307 maxLength[0] = p0.distancePoint( *tmpVec);308 minLength[0] = p0.distancePoint( *tmpVec);306 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 307 maxLength[0] = p0.distancePoint(tmpVec); 308 minLength[0] = p0.distancePoint(tmpVec); 309 309 for( int j = 0; j < length; ++j) 310 310 { 311 311 for( int i = 0; i < 3; ++i) 312 312 { 313 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);314 tmpLength = p0.distancePoint( *tmpVec);313 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 314 tmpLength = p0.distancePoint(tmpVec); 315 315 PRINTF(0)("point[%i][%i]: %f, %f, %f with distance to plane: %f\n", j, i, tmpVec[0], tmpVec[1], tmpVec[2], tmpLength); 316 316 if( tmpLength > maxLength[0]) … … 322 322 323 323 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 324 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);325 maxLength[1] = p1.distancePoint( *tmpVec);326 minLength[1] = p1.distancePoint( *tmpVec);324 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 325 maxLength[1] = p1.distancePoint(tmpVec); 326 minLength[1] = p1.distancePoint(tmpVec); 327 327 for( int j = 0; j < length; ++j) 328 328 { 329 329 for( int i = 0; i < 3; ++i) 330 330 { 331 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);332 tmpLength = p1.distancePoint( *tmpVec);331 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 332 tmpLength = p1.distancePoint(tmpVec); 333 333 if( tmpLength > maxLength[1]) 334 334 maxLength[1] = tmpLength; … … 339 339 340 340 /* for the initialisation the value just has to be inside of the polygon soup -> first vertices (rand) */ 341 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]);342 maxLength[2] = p2.distancePoint( *tmpVec);343 minLength[2] = p2.distancePoint( *tmpVec);341 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[0]].indexToVertices[0]]); 342 maxLength[2] = p2.distancePoint(tmpVec); 343 minLength[2] = p2.distancePoint(tmpVec); 344 344 for( int j = 0; j < length; ++j) 345 345 { 346 346 for( int i = 0; i < 3; ++i) 347 347 { 348 tmpVec = ( sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]);349 tmpLength = p2.distancePoint( *tmpVec);348 tmpVec = (&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[j]].indexToVertices[i]]); 349 tmpLength = p2.distancePoint(tmpVec); 350 350 if( tmpLength > maxLength[2]) 351 351 maxLength[2] = tmpLength; … … 362 362 { 363 363 centerOffset[i] = (fabs(maxLength[i]) - fabs(minLength[i])) / 2.0f; // min length is negatie 364 box.halfLength[i] = (maxLength[i] - minLength[i]) / 3.0f; // min length is negative364 box.halfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative 365 365 } 366 366 // FIXME: += anstatt -= ????????? verwirr
Note: See TracChangeset
for help on using the changeset viewer.