Added new functions for findings the dimensions of regions. These replace the deprecated versions.
This commit is contained in:
parent
17054c6747
commit
af0643ce80
@ -30,6 +30,21 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
bound which specify the range of voxels positions considered to be part of the region. Note that these bounds are
|
||||||
|
<em>inclusive</em>. The class also provides functions for modifying the regions in a variety of ways.
|
||||||
|
|
||||||
|
\Note The dimensions of a region can be measured either in voxels or in cells. See the manual for more information
|
||||||
|
about these definitions.
|
||||||
|
*/
|
||||||
#ifdef SWIG
|
#ifdef SWIG
|
||||||
class Region
|
class Region
|
||||||
#else
|
#else
|
||||||
@ -52,6 +67,24 @@ namespace PolyVox
|
|||||||
const Vector3DInt32& getLowerCorner(void) const;
|
const Vector3DInt32& getLowerCorner(void) const;
|
||||||
const Vector3DInt32& getUpperCorner(void) const;
|
const Vector3DInt32& getUpperCorner(void) const;
|
||||||
|
|
||||||
|
/// Gets the width of the region measured in voxels
|
||||||
|
int32_t getWidthInVoxels(void) const;
|
||||||
|
/// Gets the height of the region measured in voxels
|
||||||
|
int32_t getHeightInVoxels(void) const;
|
||||||
|
/// Gets the depth of the region measured in voxels
|
||||||
|
int32_t getDepthInVoxels(void) const;
|
||||||
|
/// Gets the dimensions of the region measured in voxels
|
||||||
|
Vector3DInt32 getDimensionsInVoxels(void) const;
|
||||||
|
|
||||||
|
/// Gets the width of the region measured in cells
|
||||||
|
int32_t getWidthInCells(void) const;
|
||||||
|
/// Gets the height of the region measured in cells
|
||||||
|
int32_t getHeightInCells(void) const;
|
||||||
|
/// Gets the depth of the region measured in cells
|
||||||
|
int32_t getDepthInCells(void) const;
|
||||||
|
/// Gets the dimensions of the region measured in cells
|
||||||
|
Vector3DInt32 getDimensionsInCells(void) const;
|
||||||
|
|
||||||
void setLowerCorner(const Vector3DInt32& v3dLowerCorner);
|
void setLowerCorner(const Vector3DInt32& v3dLowerCorner);
|
||||||
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
|
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
|
||||||
|
|
||||||
|
@ -92,6 +92,46 @@ namespace PolyVox
|
|||||||
return m_v3dUpperCorner;
|
return m_v3dUpperCorner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t Region::getWidthInVoxels(void) const
|
||||||
|
{
|
||||||
|
return getWidthInCells() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Region::getHeightInVoxels(void) const
|
||||||
|
{
|
||||||
|
return getHeightInCells() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Region::getDepthInVoxels(void) const
|
||||||
|
{
|
||||||
|
return getDepthInCells() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3DInt32 Region::getDimensionsInVoxels(void) const
|
||||||
|
{
|
||||||
|
return getDimensionsInCells() + Vector3DInt32(1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Region::getWidthInCells(void) const
|
||||||
|
{
|
||||||
|
return m_v3dUpperCorner.getX() - m_v3dLowerCorner.getX();
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Region::getHeightInCells(void) const
|
||||||
|
{
|
||||||
|
return m_v3dUpperCorner.getY() - m_v3dLowerCorner.getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3DInt32 Region::getDimensionsInCells(void) const
|
||||||
|
{
|
||||||
|
return m_v3dUpperCorner - m_v3dLowerCorner;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t Region::getDepthInCells(void) const
|
||||||
|
{
|
||||||
|
return m_v3dUpperCorner.getZ() - m_v3dLowerCorner.getZ();
|
||||||
|
}
|
||||||
|
|
||||||
void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner)
|
void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner)
|
||||||
{
|
{
|
||||||
m_v3dLowerCorner = v3dLowerCorner;
|
m_v3dLowerCorner = v3dLowerCorner;
|
||||||
@ -168,7 +208,7 @@ namespace PolyVox
|
|||||||
m_v3dUpperCorner.setZ((std::min)(m_v3dUpperCorner.getZ(), other.m_v3dUpperCorner.getZ()));
|
m_v3dUpperCorner.setZ((std::min)(m_v3dUpperCorner.getZ(), other.m_v3dUpperCorner.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \deprecated Use getLowerCorner and getUpperCorner instead
|
/// \deprecated Use getDepthInVoxels() or getDepthInCells() instead
|
||||||
int32_t Region::depth(void) const
|
int32_t Region::depth(void) const
|
||||||
{
|
{
|
||||||
//This function is deprecated and wrong.
|
//This function is deprecated and wrong.
|
||||||
@ -176,7 +216,7 @@ namespace PolyVox
|
|||||||
return m_v3dUpperCorner.getZ() - m_v3dLowerCorner.getZ();
|
return m_v3dUpperCorner.getZ() - m_v3dLowerCorner.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \deprecated Use getLowerCorner and getUpperCorner instead
|
/// \deprecated Use getHeightInVoxels() or getHeightInCells() instead
|
||||||
int32_t Region::height(void) const
|
int32_t Region::height(void) const
|
||||||
{
|
{
|
||||||
//This function is deprecated and wrong.
|
//This function is deprecated and wrong.
|
||||||
@ -200,7 +240,7 @@ namespace PolyVox
|
|||||||
m_v3dUpperCorner += amount;
|
m_v3dUpperCorner += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \deprecated Use getLowerCorner and getUpperCorner instead
|
/// \deprecated Use getDimensionsInVoxels() or getDimensionsInCells() instead
|
||||||
Vector3DInt32 Region::dimensions(void)
|
Vector3DInt32 Region::dimensions(void)
|
||||||
{
|
{
|
||||||
//This function is deprecated and wrong.
|
//This function is deprecated and wrong.
|
||||||
@ -208,7 +248,7 @@ namespace PolyVox
|
|||||||
return m_v3dUpperCorner - m_v3dLowerCorner;
|
return m_v3dUpperCorner - m_v3dLowerCorner;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \deprecated Use getLowerCorner and getUpperCorner instead
|
/// \deprecated Use getWidthInVoxels() or getWidthInCells() instead
|
||||||
int32_t Region::width(void) const
|
int32_t Region::width(void) const
|
||||||
{
|
{
|
||||||
//This function is deprecated and wrong.
|
//This function is deprecated and wrong.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user