From 02b6421ab87d5cb470c09139427c2afc9ccd3e76 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 24 Nov 2012 22:02:21 +0100 Subject: [PATCH] Reordered some functions. --- .../PolyVoxCore/include/PolyVoxCore/Region.h | 16 +++--- library/PolyVoxCore/source/Region.cpp | 50 +++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Region.h b/library/PolyVoxCore/include/PolyVoxCore/Region.h index e5dc784f..c3e33347 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Region.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Region.h @@ -93,8 +93,6 @@ namespace PolyVox /// Gets the dimensions of the region measured in cells Vector3DInt32 getDimensionsInCells(void) const; - bool isValid(void); - void setLowerX(int32_t iX); void setLowerY(int32_t iY); void setLowerZ(int32_t iZ); @@ -107,28 +105,28 @@ namespace PolyVox bool containsPoint(const Vector3DFloat& pos, float boundary = 0.0f) const; bool containsPoint(const Vector3DInt32& pos, uint8_t boundary = 0) const; - //FIXME - Don't like these. Make containsPoint take flags indicating which axes to check? bool containsPointInX(float pos, float boundary = 0.0f) const; bool containsPointInX(int32_t pos, uint8_t boundary = 0) const; bool containsPointInY(float pos, float boundary = 0.0f) const; bool containsPointInY(int32_t pos, uint8_t boundary = 0) const; bool containsPointInZ(float pos, float boundary = 0.0f) const; bool containsPointInZ(int32_t pos, uint8_t boundary = 0) const; + void cropTo(const Region& other); - - void shift(const Vector3DInt32& amount); - void shiftLowerCorner(const Vector3DInt32& amount); - void shiftUpperCorner(const Vector3DInt32& amount); void dilate(int32_t iAmount); 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); - + + bool isValid(void); + + void shift(const Vector3DInt32& amount); + void shiftLowerCorner(const Vector3DInt32& amount); + void shiftUpperCorner(const Vector3DInt32& amount); private: int32_t m_iLowerX; diff --git a/library/PolyVoxCore/source/Region.cpp b/library/PolyVoxCore/source/Region.cpp index ed7b6419..1c560950 100644 --- a/library/PolyVoxCore/source/Region.cpp +++ b/library/PolyVoxCore/source/Region.cpp @@ -172,11 +172,6 @@ namespace PolyVox return m_iUpperZ - m_iLowerZ; } - bool Region::isValid(void) - { - return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ); - } - void Region::setLowerX(int32_t iX) { m_iLowerX = iX; @@ -287,26 +282,6 @@ namespace PolyVox m_iUpperZ = ((std::min)(m_iUpperZ, other.m_iUpperZ)); } - void Region::shift(const Vector3DInt32& amount) - { - shiftLowerCorner(amount); - shiftUpperCorner(amount); - } - - void Region::shiftLowerCorner(const Vector3DInt32& amount) - { - m_iLowerX += amount.getX(); - m_iLowerY += amount.getY(); - m_iLowerZ += amount.getZ(); - } - - void Region::shiftUpperCorner(const Vector3DInt32& amount) - { - m_iUpperX += amount.getX(); - m_iUpperY += amount.getY(); - m_iUpperZ += amount.getZ(); - } - void Region::dilate(int32_t iAmount) { m_iLowerX -= iAmount; @@ -360,4 +335,29 @@ namespace PolyVox { erode(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); } + + bool Region::isValid(void) + { + return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ); + } + + void Region::shift(const Vector3DInt32& amount) + { + shiftLowerCorner(amount); + shiftUpperCorner(amount); + } + + void Region::shiftLowerCorner(const Vector3DInt32& amount) + { + m_iLowerX += amount.getX(); + m_iLowerY += amount.getY(); + m_iLowerZ += amount.getZ(); + } + + void Region::shiftUpperCorner(const Vector3DInt32& amount) + { + m_iUpperX += amount.getX(); + m_iUpperY += amount.getY(); + m_iUpperZ += amount.getZ(); + } }