Added cCuboid::Engulf().
This commit is contained in:
parent
1fdeabcf78
commit
8889d3b733
@ -197,3 +197,37 @@ bool cCuboid::IsSorted(void) const
|
||||
|
||||
|
||||
|
||||
|
||||
void cCuboid::Engulf(const Vector3i & a_Point)
|
||||
{
|
||||
if (a_Point.x < p1.x)
|
||||
{
|
||||
p1.x = a_Point.x;
|
||||
}
|
||||
else if (a_Point.x > p2.x)
|
||||
{
|
||||
p2.x = a_Point.x;
|
||||
}
|
||||
|
||||
if (a_Point.y < p1.y)
|
||||
{
|
||||
p1.y = a_Point.y;
|
||||
}
|
||||
else if (a_Point.y > p2.y)
|
||||
{
|
||||
p2.y = a_Point.y;
|
||||
}
|
||||
|
||||
if (a_Point.z < p1.z)
|
||||
{
|
||||
p1.z = a_Point.z;
|
||||
}
|
||||
else if (a_Point.z > p2.z)
|
||||
{
|
||||
p2.z = a_Point.z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -86,6 +86,9 @@ public:
|
||||
|
||||
/** Returns true if the coords are properly sorted (lesser in p1, greater in p2) */
|
||||
bool IsSorted(void) const;
|
||||
|
||||
/** If needed, expands the cuboid so that it contains the specified point. Assumes sorted. Doesn't contract. */
|
||||
void Engulf(const Vector3i & a_Point);
|
||||
} ;
|
||||
// tolua_end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user