MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / computeMTD_BoxBox

Function computeMTD_BoxBox

deps/physx/physx/source/geomutils/src/GuMTD.cpp:458–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458static bool computeMTD_BoxBox(PxVec3& _mtd, PxF32& _depth, const Box& box0, const Box& box1)
459{
460 PxVec3 mtd;
461 PxF32 depth = PX_MAX_F32;
462
463 if(!testBoxBoxAxis(mtd, depth, box0.rot.column0, box0, box1))
464 return false;
465 if(!testBoxBoxAxis(mtd, depth, box0.rot.column1, box0, box1))
466 return false;
467 if(!testBoxBoxAxis(mtd, depth, box0.rot.column2, box0, box1))
468 return false;
469
470 if(!testBoxBoxAxis(mtd, depth, box1.rot.column0, box0, box1))
471 return false;
472 if(!testBoxBoxAxis(mtd, depth, box1.rot.column1, box0, box1))
473 return false;
474 if(!testBoxBoxAxis(mtd, depth, box1.rot.column2, box0, box1))
475 return false;
476
477 for(PxU32 j=0;j<3;j++)
478 {
479 for(PxU32 i=0;i<3;i++)
480 {
481 PxVec3 cross = box0.rot[i].cross(box1.rot[j]);
482 if(!Ps::isAlmostZero(cross))
483 {
484 cross = cross.getNormalized();
485
486 if(!testBoxBoxAxis(mtd, depth, cross, box0, box1))
487 return false;
488 }
489 }
490 }
491
492
493 reorderMTD(mtd, box1.center, box0.center);
494
495 _mtd = -mtd;
496 _depth = validateDepth(depth);
497
498 return true;
499}
500
501///////////////////////////////////////////////////////////////////////////////
502

Callers 1

GeomMTDCallback_BoxBoxFunction · 0.85

Calls 6

testBoxBoxAxisFunction · 0.85
isAlmostZeroFunction · 0.85
reorderMTDFunction · 0.85
validateDepthFunction · 0.85
crossMethod · 0.45
getNormalizedMethod · 0.45

Tested by

no test coverage detected