- Timestamp:
- Jun 20, 2005, 1:04:36 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4658 r4659 393 393 tmpLength = fabs(p1.distancePoint(vertices[j])); 394 394 if( tmpLength > halfLength[0]) 395 395 halfLength[0] = tmpLength; 396 396 } 397 397 … … 401 401 tmpLength = fabs(p1.distancePoint(vertices[j])); 402 402 if( tmpLength > halfLength[1]) 403 403 halfLength[1] = tmpLength; 404 404 } 405 405 … … 409 409 tmpLength = fabs(p1.distancePoint(vertices[j])); 410 410 if( tmpLength > halfLength[2]) 411 411 halfLength[2] = tmpLength; 412 412 } 413 413 … … 415 415 416 416 /* get the maximal dimensions of the body in all directions */ 417 maxLength[0] = 0.0f;418 minLength[0] = 0.0f;419 for(int j = 0; j < length; ++j)420 {421 tmpLength = p0.distancePoint(vertices[j]);422 if( tmpLength > maxLength[0])423 maxLength[0] = tmpLength;424 else if( tmpLength < minLength[0])425 minLength[0] = tmpLength;426 }427 428 maxLength[1] = 0.0f;429 minLength[1] = 0.0f;430 for(int j = 0; j < length; ++j)431 {432 tmpLength = p0.distancePoint(vertices[j]);433 if( tmpLength > maxLength[1])434 maxLength[1] = tmpLength;435 else if( tmpLength < minLength[1])436 minLength[1] = tmpLength;437 }438 439 maxLength[2] = 0.0f;440 minLength[2] = 0.0f;441 for(int j = 0; j < length; ++j)442 {443 tmpLength = p0.distancePoint(vertices[j]);444 if( tmpLength > maxLength[2])445 maxLength[2] = tmpLength;446 else if( tmpLength < minLength[2])447 minLength[2] = tmpLength;448 }449 450 451 /* calculate the real centre of the body by using the axis length */452 float center[3];453 float offset[3];454 for(int i = 0; i < 3; ++i)455 {456 center[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative457 offset[i] = halfLength[i] - center[i];458 box->center[i] += *box->axis[i] * offset[i]; // update the new center vector459 PRINTF(0)("Center Translation Operation: halfLength old: %f, new: %f\n", halfLength[i], center[i]);460 halfLength[i] = center[i];461 }462 463 417 // maxLength[0] = 0.0f; 418 // minLength[0] = 0.0f; 419 // for(int j = 0; j < length; ++j) 420 // { 421 // tmpLength = p0.distancePoint(vertices[j]); 422 // if( tmpLength > maxLength[0]) 423 // maxLength[0] = tmpLength; 424 // else if( tmpLength < minLength[0]) 425 // minLength[0] = tmpLength; 426 // } 427 // 428 // maxLength[1] = 0.0f; 429 // minLength[1] = 0.0f; 430 // for(int j = 0; j < length; ++j) 431 // { 432 // tmpLength = p0.distancePoint(vertices[j]); 433 // if( tmpLength > maxLength[1]) 434 // maxLength[1] = tmpLength; 435 // else if( tmpLength < minLength[1]) 436 // minLength[1] = tmpLength; 437 // } 438 // 439 // maxLength[2] = 0.0f; 440 // minLength[2] = 0.0f; 441 // for(int j = 0; j < length; ++j) 442 // { 443 // tmpLength = p0.distancePoint(vertices[j]); 444 // if( tmpLength > maxLength[2]) 445 // maxLength[2] = tmpLength; 446 // else if( tmpLength < minLength[2]) 447 // minLength[2] = tmpLength; 448 // } 449 // 450 // 451 // /* calculate the real centre of the body by using the axis length */ 452 // float center[3]; 453 // float offset[3]; 454 // for(int i = 0; i < 3; ++i) 455 // { 456 // center[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative 457 // offset[i] = halfLength[i] - center[i]; 458 // box->center[i] += *box->axis[i] * offset[i]; // update the new center vector 459 // PRINTF(0)("Center Translation Operation: halfLength old: %f, new: %f\n", halfLength[i], center[i]); 460 // halfLength[i] = center[i]; 461 // } 462 463 464 464 465 465 box->halfLength = halfLength;
Note: See TracChangeset
for help on using the changeset viewer.