1
0

Hardened cCuboid with asserts for its assumptions.

This commit is contained in:
madmaxoft
2014-03-09 22:02:08 +01:00
parent 81bf846e64
commit dacb6cef1d
2 changed files with 11 additions and 3 deletions

View File

@@ -72,6 +72,9 @@ int cCuboid::GetVolume(void) const
bool cCuboid::DoesIntersect(const cCuboid & a_Other) const
{
ASSERT(IsSorted());
ASSERT(a_Other.IsSorted());
// In order for cuboids to intersect, each of their coord intervals need to intersect
return (
DoIntervalsIntersect(p1.x, p2.x, a_Other.p1.x, a_Other.p2.x) &&
@@ -86,6 +89,9 @@ bool cCuboid::DoesIntersect(const cCuboid & a_Other) const
bool cCuboid::IsCompletelyInside(const cCuboid & a_Outer) const
{
ASSERT(IsSorted());
ASSERT(a_Outer.IsSorted());
return (
(p1.x >= a_Outer.p1.x) &&
(p2.x <= a_Outer.p2.x) &&