MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / iBoxIsectSphere

Function iBoxIsectSphere

src/SB/Core/gc/iMath3.cpp:561–710  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

559}
560
561void iBoxIsectSphere(const xBox* box, const xSphere* p, xIsect* isx)
562{
563 U32 xcode, ycode, zcode;
564
565 // non-matching: (p->center.x + p->r) computed inside if statement
566
567 if (p->center.x - p->r < box->lower.x)
568 {
569 if (p->center.x + p->r < box->lower.x)
570 {
571 xcode = 2;
572 }
573 else if (p->center.x + p->r > box->upper.x)
574 {
575 xcode = 0;
576 }
577 else
578 {
579 xcode = 1;
580 }
581 }
582 else
583 {
584 if (p->center.x - p->r > box->upper.x)
585 {
586 xcode = 5;
587 }
588 else if (p->center.x + p->r > box->upper.x)
589 {
590 xcode = 4;
591 }
592 else
593 {
594 xcode = 3;
595 }
596 }
597
598 // non-matching: missing division instructions
599
600 if (xcode / 3 == 2)
601 {
602 isx->penned = 1.0f;
603 return;
604 }
605
606 // non-matching: (p->center.y + p->r) computed inside if statement
607
608 if (p->center.y - p->r < box->lower.y)
609 {
610 if (p->center.y + p->r < box->lower.y)
611 {
612 ycode = 2;
613 }
614 else if (p->center.y + p->r > box->upper.y)
615 {
616 ycode = 0;
617 }
618 else

Callers 2

xSphereHitsBoxFunction · 0.50
xBoxHitsSphereFunction · 0.50

Calls 6

iBoxIsectVecFunction · 0.85
xVec3AddFunction · 0.85
xVec3SMulByFunction · 0.85
xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
iBoxVecDistFunction · 0.85

Tested by

no test coverage detected