Added basic dilation and erosion functions.

This commit is contained in:
David Williams 2012-11-24 12:52:37 +01:00
parent 9671f19444
commit cbddc9cba4
2 changed files with 25 additions and 0 deletions

View File

@ -120,6 +120,9 @@ namespace PolyVox
void shiftLowerCorner(const Vector3DInt32& amount); void shiftLowerCorner(const Vector3DInt32& amount);
void shiftUpperCorner(const Vector3DInt32& amount); void shiftUpperCorner(const Vector3DInt32& amount);
//FIXME - Add dilate and erode functions? //FIXME - Add dilate and erode functions?
void dilate(int32_t amount);
void erode(int32_t amount);
private: private:

View File

@ -306,4 +306,26 @@ namespace PolyVox
m_iUpperY += amount.getY(); m_iUpperY += amount.getY();
m_iUpperZ += amount.getZ(); m_iUpperZ += amount.getZ();
} }
void Region::dilate(int32_t amount)
{
m_iLowerX -= amount;
m_iLowerY -= amount;
m_iLowerZ -= amount;
m_iUpperX += amount;
m_iUpperY += amount;
m_iUpperZ += amount;
}
void Region::erode(int32_t amount)
{
m_iLowerX += amount;
m_iLowerY += amount;
m_iLowerZ += amount;
m_iUpperX -= amount;
m_iUpperY -= amount;
m_iUpperZ -= amount;
}
} }