More dilation and erosion functions for region.
This commit is contained in:
parent
e048f7c2f6
commit
6d7246f907
@ -119,10 +119,15 @@ namespace PolyVox
|
|||||||
void shift(const Vector3DInt32& amount);
|
void shift(const Vector3DInt32& amount);
|
||||||
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?
|
|
||||||
|
|
||||||
void dilate(int32_t amount);
|
void dilate(int32_t iAmount);
|
||||||
void erode(int32_t amount);
|
void dilate(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ);
|
||||||
|
void dilate(const Vector3DInt32& v3dAmount);
|
||||||
|
|
||||||
|
|
||||||
|
void erode(int32_t iAmount);
|
||||||
|
void erode(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ);
|
||||||
|
void erode(const Vector3DInt32& v3dAmount);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -307,25 +307,57 @@ namespace PolyVox
|
|||||||
m_iUpperZ += amount.getZ();
|
m_iUpperZ += amount.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::dilate(int32_t amount)
|
void Region::dilate(int32_t iAmount)
|
||||||
{
|
{
|
||||||
m_iLowerX -= amount;
|
m_iLowerX -= iAmount;
|
||||||
m_iLowerY -= amount;
|
m_iLowerY -= iAmount;
|
||||||
m_iLowerZ -= amount;
|
m_iLowerZ -= iAmount;
|
||||||
|
|
||||||
m_iUpperX += amount;
|
m_iUpperX += iAmount;
|
||||||
m_iUpperY += amount;
|
m_iUpperY += iAmount;
|
||||||
m_iUpperZ += amount;
|
m_iUpperZ += iAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Region::erode(int32_t amount)
|
void Region::dilate(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
|
||||||
{
|
{
|
||||||
m_iLowerX += amount;
|
m_iLowerX -= iAmountX;
|
||||||
m_iLowerY += amount;
|
m_iLowerY -= iAmountY;
|
||||||
m_iLowerZ += amount;
|
m_iLowerZ -= iAmountZ;
|
||||||
|
|
||||||
m_iUpperX -= amount;
|
m_iUpperX += iAmountX;
|
||||||
m_iUpperY -= amount;
|
m_iUpperY += iAmountY;
|
||||||
m_iUpperZ -= amount;
|
m_iUpperZ += iAmountZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Region::dilate(const Vector3DInt32& v3dAmount)
|
||||||
|
{
|
||||||
|
dilate(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Region::erode(int32_t iAmount)
|
||||||
|
{
|
||||||
|
m_iLowerX += iAmount;
|
||||||
|
m_iLowerY += iAmount;
|
||||||
|
m_iLowerZ += iAmount;
|
||||||
|
|
||||||
|
m_iUpperX -= iAmount;
|
||||||
|
m_iUpperY -= iAmount;
|
||||||
|
m_iUpperZ -= iAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Region::erode(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
|
||||||
|
{
|
||||||
|
m_iLowerX += iAmountX;
|
||||||
|
m_iLowerY += iAmountY;
|
||||||
|
m_iLowerZ += iAmountZ;
|
||||||
|
|
||||||
|
m_iUpperX -= iAmountX;
|
||||||
|
m_iUpperY -= iAmountY;
|
||||||
|
m_iUpperZ -= iAmountZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Region::erode(const Vector3DInt32& v3dAmount)
|
||||||
|
{
|
||||||
|
erode(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user