Updated comment style to match KDE/Kate (for Doxygen syntax highlighting).

This commit is contained in:
David Williams 2012-12-09 15:09:35 +01:00
parent 8b91e55c84
commit a502e84764
2 changed files with 265 additions and 265 deletions

View File

@ -30,25 +30,25 @@ freely, subject to the following restrictions:
namespace PolyVox namespace PolyVox
{ {
/// Represents a part of a Volume. /** Represents a part of a Volume.
//////////////////////////////////////////////////////////////////////////////// *
/// Many operations in PolyVox are constrained to only part of a volume. For example, when running the surface extractors * Many operations in PolyVox are constrained to only part of a volume. For example, when running the surface extractors
/// it is unlikely that you will want to run it on the whole volume at once, as this will give a very large mesh which may * it is unlikely that you will want to run it on the whole volume at once, as this will give a very large mesh which may
/// be too much to render. Instead you will probably want to run a surface extractor a number of times on different parts * be too much to render. Instead you will probably want to run a surface extractor a number of times on different parts
/// of the volume, there by giving a number of meshes which can be culled and rendered seperately. * of the volume, there by giving a number of meshes which can be culled and rendered seperately.
/// *
/// The Region class is used to define these parts (regions) of the volume. Essentially it consists of an upper and lower * The Region class is used to define these parts (regions) of the volume. Essentially it consists of an upper and lower
/// bound which specify the range of voxels positions considered to be part of the region. Note that these bounds are * bound which specify the range of voxels positions considered to be part of the region. Note that these bounds are
/// <em>inclusive</em>. * <em>inclusive</em>.
/// *
/// As well as the expected set of getters and setters, this class also provide utility functions for increasing and decresing * As well as the expected set of getters and setters, this class also provide utility functions for increasing and decresing
/// the size of the Region, shifting the Region in 3D space, testing whether it contains a given position, enlarging it so that * the size of the Region, shifting the Region in 3D space, testing whether it contains a given position, enlarging it so that
/// it does contain a given position, croppng it to another Region, and various other utility functions. * it does contain a given position, croppng it to another Region, and various other utility functions.
/// *
/// \Note The dimensions of a region can be measured either in voxels or in cells. See the manual for more information * \Note The dimensions of a region can be measured either in voxels or in cells. See the manual for more information
/// about these definitions. * about these definitions.
/// *
//////////////////////////////////////////////////////////////////////////////// */
#ifdef SWIG #ifdef SWIG
class Region class Region
#else #else
@ -199,193 +199,193 @@ namespace PolyVox
// 'inline' keyword is used for the definition rather than the declaration. // 'inline' keyword is used for the definition rather than the declaration.
// See also http://www.parashift.com/c++-faq-lite/inline-functions.html // See also http://www.parashift.com/c++-faq-lite/inline-functions.html
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'x' position of the lower corner. * \return The 'x' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getLowerX(void) const inline int32_t Region::getLowerX(void) const
{ {
return m_iLowerX; return m_iLowerX;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'y' position of the lower corner. * \return The 'y' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getLowerY(void) const inline int32_t Region::getLowerY(void) const
{ {
return m_iLowerY; return m_iLowerY;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'z' position of the lower corner. * \return The 'z' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getLowerZ(void) const inline int32_t Region::getLowerZ(void) const
{ {
return m_iLowerZ; return m_iLowerZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'x' position of the upper corner. * \return The 'x' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getUpperX(void) const inline int32_t Region::getUpperX(void) const
{ {
return m_iUpperX; return m_iUpperX;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'y' position of the upper corner. * \return The 'y' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getUpperY(void) const inline int32_t Region::getUpperY(void) const
{ {
return m_iUpperY; return m_iUpperY;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The 'z' position of the upper corner. * \return The 'z' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getUpperZ(void) const inline int32_t Region::getUpperZ(void) const
{ {
return m_iUpperZ; return m_iUpperZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The position of the lower corner. * \return The position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline Vector3DInt32 Region::getLowerCorner(void) const inline Vector3DInt32 Region::getLowerCorner(void) const
{ {
return Vector3DInt32(m_iLowerX, m_iLowerY, m_iLowerZ); return Vector3DInt32(m_iLowerX, m_iLowerY, m_iLowerZ);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The position of the upper corner. * \return The position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline Vector3DInt32 Region::getUpperCorner(void) const inline Vector3DInt32 Region::getUpperCorner(void) const
{ {
return Vector3DInt32(m_iUpperX, m_iUpperY, m_iUpperZ); return Vector3DInt32(m_iUpperX, m_iUpperY, m_iUpperZ);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The width of the region measured in voxels. * \return The width of the region measured in voxels.
/// \sa getWidthInCells() * \sa getWidthInCells()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getWidthInVoxels(void) const inline int32_t Region::getWidthInVoxels(void) const
{ {
return getWidthInCells() + 1; return getWidthInCells() + 1;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The height of the region measured in voxels. * \return The height of the region measured in voxels.
/// \sa getHeightInCells() * \sa getHeightInCells()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getHeightInVoxels(void) const inline int32_t Region::getHeightInVoxels(void) const
{ {
return getHeightInCells() + 1; return getHeightInCells() + 1;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The depth of the region measured in voxels. * \return The depth of the region measured in voxels.
/// \sa getDepthInCells() * \sa getDepthInCells()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getDepthInVoxels(void) const inline int32_t Region::getDepthInVoxels(void) const
{ {
return getDepthInCells() + 1; return getDepthInCells() + 1;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The dimensions of the region measured in voxels. * \return The dimensions of the region measured in voxels.
/// \sa getDimensionsInCells() * \sa getDimensionsInCells()
//////////////////////////////////////////////////////////////////////////////// */
inline Vector3DInt32 Region::getDimensionsInVoxels(void) const inline Vector3DInt32 Region::getDimensionsInVoxels(void) const
{ {
return getDimensionsInCells() + Vector3DInt32(1, 1, 1); return getDimensionsInCells() + Vector3DInt32(1, 1, 1);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The width of the region measured in cells. * \return The width of the region measured in cells.
/// \sa getWidthInVoxels() * \sa getWidthInVoxels()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getWidthInCells(void) const inline int32_t Region::getWidthInCells(void) const
{ {
return m_iUpperX - m_iLowerX; return m_iUpperX - m_iLowerX;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The height of the region measured in cells. * \return The height of the region measured in cells.
/// \sa getHeightInVoxels() * \sa getHeightInVoxels()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getHeightInCells(void) const inline int32_t Region::getHeightInCells(void) const
{ {
return m_iUpperY - m_iLowerY; return m_iUpperY - m_iLowerY;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The depth of the region measured in cells. * \return The depth of the region measured in cells.
/// \sa getDepthInVoxels() * \sa getDepthInVoxels()
//////////////////////////////////////////////////////////////////////////////// */
inline int32_t Region::getDepthInCells(void) const inline int32_t Region::getDepthInCells(void) const
{ {
return m_iUpperZ - m_iLowerZ; return m_iUpperZ - m_iLowerZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \return The dimensions of the region measured in cells. * \return The dimensions of the region measured in cells.
/// \sa getDimensionsInVoxels() * \sa getDimensionsInVoxels()
//////////////////////////////////////////////////////////////////////////////// */
inline Vector3DInt32 Region::getDimensionsInCells(void) const inline Vector3DInt32 Region::getDimensionsInCells(void) const
{ {
return Vector3DInt32(getWidthInCells(), getHeightInCells(), getDepthInCells()); return Vector3DInt32(getWidthInCells(), getHeightInCells(), getDepthInCells());
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iX The new 'x' position of the lower corner. * \param iX The new 'x' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setLowerX(int32_t iX) inline void Region::setLowerX(int32_t iX)
{ {
m_iLowerX = iX; m_iLowerX = iX;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iY The new 'y' position of the lower corner. * \param iY The new 'y' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setLowerY(int32_t iY) inline void Region::setLowerY(int32_t iY)
{ {
m_iLowerY = iY; m_iLowerY = iY;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iZ The new 'z' position of the lower corner. * \param iZ The new 'z' position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setLowerZ(int32_t iZ) inline void Region::setLowerZ(int32_t iZ)
{ {
m_iLowerZ = iZ; m_iLowerZ = iZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iX The new 'x' position of the upper corner. * \param iX The new 'x' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setUpperX(int32_t iX) inline void Region::setUpperX(int32_t iX)
{ {
m_iUpperX = iX; m_iUpperX = iX;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iY The new 'y' position of the upper corner. * \param iY The new 'y' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setUpperY(int32_t iY) inline void Region::setUpperY(int32_t iY)
{ {
m_iUpperY = iY; m_iUpperY = iY;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iZ The new 'z' position of the upper corner. * \param iZ The new 'z' position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setUpperZ(int32_t iZ) inline void Region::setUpperZ(int32_t iZ)
{ {
m_iUpperZ = iZ; m_iUpperZ = iZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dLowerCorner The new position of the lower corner. * \param v3dLowerCorner The new position of the lower corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner) inline void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner)
{ {
m_iLowerX = v3dLowerCorner.getX(); m_iLowerX = v3dLowerCorner.getX();
@ -393,9 +393,9 @@ namespace PolyVox
m_iLowerZ = v3dLowerCorner.getZ(); m_iLowerZ = v3dLowerCorner.getZ();
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dUpperCorner The new position of the upper corner. * \param v3dUpperCorner The new position of the upper corner.
//////////////////////////////////////////////////////////////////////////////// */
inline void Region::setUpperCorner(const Vector3DInt32& v3dUpperCorner) inline void Region::setUpperCorner(const Vector3DInt32& v3dUpperCorner)
{ {
m_iUpperX = v3dUpperCorner.getX(); m_iUpperX = v3dUpperCorner.getX();

View File

@ -28,30 +28,30 @@ freely, subject to the following restrictions:
namespace PolyVox namespace PolyVox
{ {
//////////////////////////////////////////////////////////////////////////////// /**
//////////////////////////////////////////////////////////////////////////////// */
const Region Region::MaxRegion const Region Region::MaxRegion
( (
Vector3DInt32((std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)()), Vector3DInt32((std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)()),
Vector3DInt32((std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)()) Vector3DInt32((std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)())
); );
//////////////////////////////////////////////////////////////////////////////// /**
/// This Region is not considered valid as defined by isValid(). It's main application * This Region is not considered valid as defined by isValid(). It's main application
/// is to initialise a Region to this value and then() accumulate positions. The result * is to initialise a Region to this value and then() accumulate positions. The result
/// of this will be a Region which encompasses all positions specified. * of this will be a Region which encompasses all positions specified.
//////////////////////////////////////////////////////////////////////////////// */
const Region Region::InvertedRegion const Region Region::InvertedRegion
( (
Vector3DInt32((std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)()), Vector3DInt32((std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)(), (std::numeric_limits<int32_t>::max)()),
Vector3DInt32((std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)()) Vector3DInt32((std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)(), (std::numeric_limits<int32_t>::min)())
); );
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iX The 'x' component of the position to accumulate. * \param iX The 'x' component of the position to accumulate.
/// \param iY The 'y' component of the position to accumulate. * \param iY The 'y' component of the position to accumulate.
/// \param iZ The 'z' component of the position to accumulate. * \param iZ The 'z' component of the position to accumulate.
//////////////////////////////////////////////////////////////////////////////// */
void Region::accumulate(int32_t iX, int32_t iY, int32_t iZ) void Region::accumulate(int32_t iX, int32_t iY, int32_t iZ)
{ {
m_iLowerX = ((std::min)(m_iLowerX, iX)); m_iLowerX = ((std::min)(m_iLowerX, iX));
@ -62,21 +62,21 @@ namespace PolyVox
m_iUpperZ = ((std::max)(m_iUpperZ, iZ)); m_iUpperZ = ((std::max)(m_iUpperZ, iZ));
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dPos The position to accumulate. * \param v3dPos The position to accumulate.
//////////////////////////////////////////////////////////////////////////////// */
void Region::accumulate(const Vector3DInt32& v3dPos) void Region::accumulate(const Vector3DInt32& v3dPos)
{ {
accumulate(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ()); accumulate(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// Note that this is not the same as computing the union of two Regions (as the result of * Note that this is not the same as computing the union of two Regions (as the result of
/// such a union may not be a shape which can be exactly represented by a Region). Instead, * such a union may not be a shape which can be exactly represented by a Region). Instead,
/// the result is simply big enough to contain both this Region and the one passed as a parameter. * the result is simply big enough to contain both this Region and the one passed as a parameter.
/// \param reg The Region to accumulate. This must be valid as defined by the isValid() function. * \param reg The Region to accumulate. This must be valid as defined by the isValid() function.
/// \sa isValid() * \sa isValid()
//////////////////////////////////////////////////////////////////////////////// */
void Region::accumulate(const Region& reg) void Region::accumulate(const Region& reg)
{ {
assert(reg.isValid()); //The result of accumulating an invalid region is not defined. assert(reg.isValid()); //The result of accumulating an invalid region is not defined.
@ -89,9 +89,9 @@ namespace PolyVox
m_iUpperZ = ((std::max)(m_iUpperZ, reg.getUpperZ())); m_iUpperZ = ((std::max)(m_iUpperZ, reg.getUpperZ()));
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// Constructs a Region and clears all extents to zero. * Constructs a Region and clears all extents to zero.
//////////////////////////////////////////////////////////////////////////////// */
Region::Region() Region::Region()
:m_iLowerX(0) :m_iLowerX(0)
,m_iLowerY(0) ,m_iLowerY(0)
@ -102,11 +102,11 @@ namespace PolyVox
{ {
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// Constructs a Region and sets the lower and upper corners to the specified values. * Constructs a Region and sets the lower and upper corners to the specified values.
/// \param v3dLowerCorner The desired lower corner of the Region. * \param v3dLowerCorner The desired lower corner of the Region.
/// \param v3dUpperCorner The desired upper corner of the Region. * \param v3dUpperCorner The desired upper corner of the Region.
//////////////////////////////////////////////////////////////////////////////// */
Region::Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner) Region::Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner)
:m_iLowerX(v3dLowerCorner.getX()) :m_iLowerX(v3dLowerCorner.getX())
,m_iLowerY(v3dLowerCorner.getY()) ,m_iLowerY(v3dLowerCorner.getY())
@ -117,15 +117,15 @@ namespace PolyVox
{ {
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// Constructs a Region and sets the extents to the specified values. * Constructs a Region and sets the extents to the specified values.
/// \param iLowerX The desired lower 'x' extent of the Region. * \param iLowerX The desired lower 'x' extent of the Region.
/// \param iLowerY The desired lower 'y' extent of the Region. * \param iLowerY The desired lower 'y' extent of the Region.
/// \param iLowerZ The desired lower 'z' extent of the Region. * \param iLowerZ The desired lower 'z' extent of the Region.
/// \param iUpperX The desired upper 'x' extent of the Region. * \param iUpperX The desired upper 'x' extent of the Region.
/// \param iUpperY The desired upper 'y' extent of the Region. * \param iUpperY The desired upper 'y' extent of the Region.
/// \param iUpperZ The desired upper 'z' extent of the Region. * \param iUpperZ The desired upper 'z' extent of the Region.
//////////////////////////////////////////////////////////////////////////////// */
Region::Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ) Region::Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ)
:m_iLowerX(iLowerX) :m_iLowerX(iLowerX)
,m_iLowerY(iLowerY) ,m_iLowerY(iLowerY)
@ -136,12 +136,12 @@ namespace PolyVox
{ {
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// Two regions are considered equal if all their extents match. * Two regions are considered equal if all their extents match.
/// \param rhs The Region to compare to. * \param rhs The Region to compare to.
/// \return true if the Regions match. * \return true if the Regions match.
/// \sa operator!= * \sa operator!=
//////////////////////////////////////////////////////////////////////////////// */
bool Region::operator==(const Region& rhs) const bool Region::operator==(const Region& rhs) const
{ {
return ((m_iLowerX == rhs.m_iLowerX) && (m_iLowerY == rhs.m_iLowerY) && (m_iLowerZ == rhs.m_iLowerZ) return ((m_iLowerX == rhs.m_iLowerX) && (m_iLowerY == rhs.m_iLowerY) && (m_iLowerZ == rhs.m_iLowerZ)
@ -159,13 +159,13 @@ namespace PolyVox
return !(*this == rhs); return !(*this == rhs);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in all directions. Also, the test is inclusive such * the Region if it is that far in in all directions. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPoint(const Vector3DFloat& pos, float boundary) const bool Region::containsPoint(const Vector3DFloat& pos, float boundary) const
{ {
return (pos.getX() <= m_iUpperX - boundary) return (pos.getX() <= m_iUpperX - boundary)
@ -176,13 +176,13 @@ namespace PolyVox
&& (pos.getZ() >= m_iLowerZ + boundary); && (pos.getZ() >= m_iLowerZ + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in all directions. Also, the test is inclusive such * the Region if it is that far in in all directions. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPoint(const Vector3DInt32& pos, uint8_t boundary) const bool Region::containsPoint(const Vector3DInt32& pos, uint8_t boundary) const
{ {
return (pos.getX() <= m_iUpperX - boundary) return (pos.getX() <= m_iUpperX - boundary)
@ -193,89 +193,89 @@ namespace PolyVox
&& (pos.getZ() >= m_iLowerZ + boundary); && (pos.getZ() >= m_iLowerZ + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'x' direction. Also, the test is inclusive such * the Region if it is that far in in the 'x' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInX(float pos, float boundary) const bool Region::containsPointInX(float pos, float boundary) const
{ {
return (pos <= m_iUpperX - boundary) return (pos <= m_iUpperX - boundary)
&& (pos >= m_iLowerX + boundary); && (pos >= m_iLowerX + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'x' direction. Also, the test is inclusive such * the Region if it is that far in in the 'x' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInX(int32_t pos, uint8_t boundary) const bool Region::containsPointInX(int32_t pos, uint8_t boundary) const
{ {
return (pos <= m_iUpperX - boundary) return (pos <= m_iUpperX - boundary)
&& (pos >= m_iLowerX + boundary); && (pos >= m_iLowerX + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'y' direction. Also, the test is inclusive such * the Region if it is that far in in the 'y' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInY(float pos, float boundary) const bool Region::containsPointInY(float pos, float boundary) const
{ {
return (pos <= m_iUpperY - boundary) return (pos <= m_iUpperY - boundary)
&& (pos >= m_iLowerY + boundary); && (pos >= m_iLowerY + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'y' direction. Also, the test is inclusive such * the Region if it is that far in in the 'y' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInY(int32_t pos, uint8_t boundary) const bool Region::containsPointInY(int32_t pos, uint8_t boundary) const
{ {
return (pos <= m_iUpperY - boundary) return (pos <= m_iUpperY - boundary)
&& (pos >= m_iLowerY + boundary); && (pos >= m_iLowerY + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'z' direction. Also, the test is inclusive such * the Region if it is that far in in the 'z' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInZ(float pos, float boundary) const bool Region::containsPointInZ(float pos, float boundary) const
{ {
return (pos <= m_iUpperZ - boundary) return (pos <= m_iUpperZ - boundary)
&& (pos >= m_iLowerZ + boundary); && (pos >= m_iLowerZ + boundary);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The boundary value can be used to ensure a position is only considered to be inside * The boundary value can be used to ensure a position is only considered to be inside
/// the Region if it is that far in in the 'z' direction. Also, the test is inclusive such * the Region if it is that far in in the 'z' direction. Also, the test is inclusive such
/// that positions lying exactly on the edge of the Region are considered to be inside it. * that positions lying exactly on the edge of the Region are considered to be inside it.
/// \param pos The position to test. * \param pos The position to test.
/// \param boundary The desired boundary value. * \param boundary The desired boundary value.
//////////////////////////////////////////////////////////////////////////////// */
bool Region::containsPointInZ(int32_t pos, uint8_t boundary) const bool Region::containsPointInZ(int32_t pos, uint8_t boundary) const
{ {
return (pos <= m_iUpperZ - boundary) return (pos <= m_iUpperZ - boundary)
&& (pos >= m_iLowerZ + boundary); && (pos >= 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.
/// \param other The Region to crop to. * \param other The Region to crop to.
//////////////////////////////////////////////////////////////////////////////// */
void Region::cropTo(const Region& other) void Region::cropTo(const Region& other)
{ {
m_iLowerX = ((std::max)(m_iLowerX, other.m_iLowerX)); m_iLowerX = ((std::max)(m_iLowerX, other.m_iLowerX));
@ -286,11 +286,11 @@ namespace PolyVox
m_iUpperZ = ((std::min)(m_iUpperZ, other.m_iUpperZ)); m_iUpperZ = ((std::min)(m_iUpperZ, other.m_iUpperZ));
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The same amount of growth is applied in all directions. Negative growth * The same amount of growth is applied in all directions. Negative growth
/// is possible but you should prefer the shrink() function for clarity. * is possible but you should prefer the shrink() function for clarity.
/// \param iAmount The amount to grow by. * \param iAmount The amount to grow by.
//////////////////////////////////////////////////////////////////////////////// */
void Region::grow(int32_t iAmount) void Region::grow(int32_t iAmount)
{ {
m_iLowerX -= iAmount; m_iLowerX -= iAmount;
@ -302,13 +302,13 @@ namespace PolyVox
m_iUpperZ += iAmount; m_iUpperZ += iAmount;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The amount can be specified seperatly for each direction. Negative growth * The amount can be specified seperatly for each direction. Negative growth
/// is possible but you should prefer the shrink() function for clarity. * is possible but you should prefer the shrink() function for clarity.
/// \param iAmountX The amount to grow by in 'x'. * \param iAmountX The amount to grow by in 'x'.
/// \param iAmountY The amount to grow by in 'y'. * \param iAmountY The amount to grow by in 'y'.
/// \param iAmountZ The amount to grow by in 'z'. * \param iAmountZ The amount to grow by in 'z'.
//////////////////////////////////////////////////////////////////////////////// */
void Region::grow(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) void Region::grow(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
{ {
m_iLowerX -= iAmountX; m_iLowerX -= iAmountX;
@ -320,48 +320,48 @@ namespace PolyVox
m_iUpperZ += iAmountZ; m_iUpperZ += iAmountZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The amount can be specified seperatly for each direction. Negative growth * The amount can be specified seperatly for each direction. Negative growth
/// is possible but you should prefer the shrink() function for clarity. * is possible but you should prefer the shrink() function for clarity.
/// \param v3dAmount The amount to grow by (one component for each direction). * \param v3dAmount The amount to grow by (one component for each direction).
//////////////////////////////////////////////////////////////////////////////// */
void Region::grow(const Vector3DInt32& v3dAmount) void Region::grow(const Vector3DInt32& v3dAmount)
{ {
grow(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); grow(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
} }
//////////////////////////////////////////////////////////////////////////////// /**
//////////////////////////////////////////////////////////////////////////////// */
bool Region::isValid(void) const bool Region::isValid(void) const
{ {
return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ); return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iAmountX The amount to move the Region by in 'x'. * \param iAmountX The amount to move the Region by in 'x'.
/// \param iAmountY The amount to move the Region by in 'y'. * \param iAmountY The amount to move the Region by in 'y'.
/// \param iAmountZ The amount to move the Region by in 'z'. * \param iAmountZ The amount to move the Region by in 'z'.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shift(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) void Region::shift(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
{ {
shiftLowerCorner(iAmountX, iAmountY, iAmountZ); shiftLowerCorner(iAmountX, iAmountY, iAmountZ);
shiftUpperCorner(iAmountX, iAmountY, iAmountZ); shiftUpperCorner(iAmountX, iAmountY, iAmountZ);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dAmount The amount to move the Region by. * \param v3dAmount The amount to move the Region by.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shift(const Vector3DInt32& v3dAmount) void Region::shift(const Vector3DInt32& v3dAmount)
{ {
shiftLowerCorner(v3dAmount); shiftLowerCorner(v3dAmount);
shiftUpperCorner(v3dAmount); shiftUpperCorner(v3dAmount);
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iAmountX The amount to move the lower corner by in 'x'. * \param iAmountX The amount to move the lower corner by in 'x'.
/// \param iAmountY The amount to move the lower corner by in 'y'. * \param iAmountY The amount to move the lower corner by in 'y'.
/// \param iAmountZ The amount to move the lower corner by in 'z'. * \param iAmountZ The amount to move the lower corner by in 'z'.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shiftLowerCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) void Region::shiftLowerCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
{ {
m_iLowerX += iAmountX; m_iLowerX += iAmountX;
@ -369,19 +369,19 @@ namespace PolyVox
m_iLowerZ += iAmountZ; m_iLowerZ += iAmountZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dAmount The amount to move the lower corner by. * \param v3dAmount The amount to move the lower corner by.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shiftLowerCorner(const Vector3DInt32& v3dAmount) void Region::shiftLowerCorner(const Vector3DInt32& v3dAmount)
{ {
shiftLowerCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); shiftLowerCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param iAmountX The amount to move the upper corner by in 'x'. * \param iAmountX The amount to move the upper corner by in 'x'.
/// \param iAmountY The amount to move the upper corner by in 'y'. * \param iAmountY The amount to move the upper corner by in 'y'.
/// \param iAmountZ The amount to move the upper corner by in 'z'. * \param iAmountZ The amount to move the upper corner by in 'z'.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shiftUpperCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) void Region::shiftUpperCorner(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
{ {
m_iUpperX += iAmountX; m_iUpperX += iAmountX;
@ -389,19 +389,19 @@ namespace PolyVox
m_iUpperZ += iAmountZ; m_iUpperZ += iAmountZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// \param v3dAmount The amount to move the upper corner by. * \param v3dAmount The amount to move the upper corner by.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shiftUpperCorner(const Vector3DInt32& v3dAmount) void Region::shiftUpperCorner(const Vector3DInt32& v3dAmount)
{ {
shiftUpperCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); shiftUpperCorner(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The same amount of shrinkage is applied in all directions. Negative shrinkage * The same amount of shrinkage is applied in all directions. Negative shrinkage
/// is possible but you should prefer the grow() function for clarity. * is possible but you should prefer the grow() function for clarity.
/// \param iAmount The amount to shrink by. * \param iAmount The amount to shrink by.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shrink(int32_t iAmount) void Region::shrink(int32_t iAmount)
{ {
m_iLowerX += iAmount; m_iLowerX += iAmount;
@ -413,13 +413,13 @@ namespace PolyVox
m_iUpperZ -= iAmount; m_iUpperZ -= iAmount;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The amount can be specified seperatly for each direction. Negative shrinkage * The amount can be specified seperatly for each direction. Negative shrinkage
/// is possible but you should prefer the grow() function for clarity. * is possible but you should prefer the grow() function for clarity.
/// \param iAmountX The amount to shrink by in 'x'. * \param iAmountX The amount to shrink by in 'x'.
/// \param iAmountY The amount to shrink by in 'y'. * \param iAmountY The amount to shrink by in 'y'.
/// \param iAmountZ The amount to shrink by in 'z'. * \param iAmountZ The amount to shrink by in 'z'.
//////////////////////////////////////////////////////////////////////////////// */
void Region::shrink(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ) void Region::shrink(int32_t iAmountX, int32_t iAmountY, int32_t iAmountZ)
{ {
m_iLowerX += iAmountX; m_iLowerX += iAmountX;
@ -431,11 +431,11 @@ namespace PolyVox
m_iUpperZ -= iAmountZ; m_iUpperZ -= iAmountZ;
} }
//////////////////////////////////////////////////////////////////////////////// /**
/// The amount can be specified seperatly for each direction. Negative shrinkage * The amount can be specified seperatly for each direction. Negative shrinkage
/// is possible but you should prefer the grow() function for clarity. * is possible but you should prefer the grow() function for clarity.
/// \param v3dAmount The amount to shrink by (one component for each direction). * \param v3dAmount The amount to shrink by (one component for each direction).
//////////////////////////////////////////////////////////////////////////////// */
void Region::shrink(const Vector3DInt32& v3dAmount) void Region::shrink(const Vector3DInt32& v3dAmount)
{ {
shrink(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ()); shrink(v3dAmount.getX(), v3dAmount.getY(), v3dAmount.getZ());