MCPcopy Create free account
hub / github.com/carbonengine/trinity / IntersectTriangleOrientedBox

Function IntersectTriangleOrientedBox

trinity/Utilities/BoundingBox.cpp:599–619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599bool IntersectTriangleOrientedBox( const Vector3* triangleVertices, const Matrix& invOrientedBox )
600{
601 // put triangle points in "inverse bounding box" space
602 Vector3 v[3];
603 TransformCoords( v, triangleVertices, triangleVertices + 3, invOrientedBox );
604
605 if( ( v[0].x < -1.f ) && ( v[1].x < -1.f ) && ( v[2].x < -1.f ) )
606 return false;
607 if( ( v[0].x > 1.f ) && ( v[1].x > 1.f ) && ( v[2].x > 1.f ) )
608 return false;
609 if( ( v[0].y < -1.f ) && ( v[1].y < -1.f ) && ( v[2].y < -1.f ) )
610 return false;
611 if( ( v[0].y > 1.f ) && ( v[1].y > 1.f ) && ( v[2].y > 1.f ) )
612 return false;
613 if( ( v[0].z < -1.f ) && ( v[1].z < -1.f ) && ( v[2].z < -1.f ) )
614 return false;
615 if( ( v[0].z > 1.f ) && ( v[1].z > 1.f ) && ( v[2].z > 1.f ) )
616 return false;
617
618 return true;
619}
620
621// --------------------------------------------------------------------------------------
622// Description:

Callers 1

Calls 3

CrossFunction · 0.85
AxisTestFunction · 0.85
DotFunction · 0.70

Tested by

no test coverage detected