Added function to check whether one region is inside of another.
This commit is contained in:
parent
61dd59c9bc
commit
869f5f6c49
@ -149,6 +149,9 @@ namespace PolyVox
|
|||||||
/// Tests whether the given position is contained in the 'z' range of this Region.
|
/// Tests whether the given position is contained in the 'z' range of this Region.
|
||||||
bool containsPointInZ(int32_t pos, uint8_t boundary = 0) const;
|
bool containsPointInZ(int32_t pos, uint8_t boundary = 0) const;
|
||||||
|
|
||||||
|
/// Tests whether the given Region is contained in this Region.
|
||||||
|
bool containsRegion(const Region& reg, uint8_t boundary = 0) const;
|
||||||
|
|
||||||
/// Enlarges the Region so that it contains the specified position.
|
/// Enlarges the Region so that it contains the specified position.
|
||||||
void accumulate(int32_t iX, int32_t iY, int32_t iZ);
|
void accumulate(int32_t iX, int32_t iY, int32_t iZ);
|
||||||
/// Enlarges the Region so that it contains the specified position.
|
/// Enlarges the Region so that it contains the specified position.
|
||||||
|
@ -301,6 +301,23 @@ namespace PolyVox
|
|||||||
&& (pos >= m_iLowerZ + boundary);
|
&& (pos >= m_iLowerZ + boundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The boundary value can be used to ensure a region is only considered to be inside
|
||||||
|
* another Region if it is that far in in all directions. Also, the test is inclusive such
|
||||||
|
* that a region is considered to be inside of itself.
|
||||||
|
* \param reg The region to test.
|
||||||
|
* \param boundary The desired boundary value.
|
||||||
|
*/
|
||||||
|
bool Region::containsRegion(const Region& reg, uint8_t boundary) const
|
||||||
|
{
|
||||||
|
return (reg.m_iUpperX <= m_iUpperX - boundary)
|
||||||
|
&& (reg.m_iUpperY <= m_iUpperY - boundary)
|
||||||
|
&& (reg.m_iUpperZ <= m_iUpperZ - boundary)
|
||||||
|
&& (reg.m_iLowerX >= m_iLowerX + boundary)
|
||||||
|
&& (reg.m_iLowerY >= m_iLowerY + boundary)
|
||||||
|
&& (reg.m_iLowerZ >= m_iLowerZ + boundary);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After calling this functions, the extents of this Region are given by the intersection
|
* After calling this functions, the extents of this Region are given by the intersection
|
||||||
* of this Region and the one it was cropped to.
|
* of this Region and the one it was cropped to.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user