Renamed x(), y(), and z() to getX(), getY(), and getZ()

This commit is contained in:
David Williams 2008-05-26 19:49:21 +00:00
parent 2745d52dc5
commit d0ffdee870
9 changed files with 92 additions and 92 deletions

View File

@ -160,11 +160,11 @@ namespace PolyVox
template <typename VoxelType>
VoxelType BlockVolume<VoxelType>::getVoxelAt(const Vector3DUint16& v3dPos) const
{
assert(v3dPos.x() < m_uSideLength);
assert(v3dPos.y() < m_uSideLength);
assert(v3dPos.z() < m_uSideLength);
assert(v3dPos.getX() < m_uSideLength);
assert(v3dPos.getY() < m_uSideLength);
assert(v3dPos.getZ() < m_uSideLength);
return getVoxelAt(v3dPos.x(), v3dPos.y(), v3dPos.z());
return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
}
#pragma endregion
@ -172,23 +172,23 @@ namespace PolyVox
template <typename VoxelType>
bool BlockVolume<VoxelType>::containsPoint(const Vector3DFloat& pos, float boundary) const
{
return (pos.x() <= m_uSideLength - 1 - boundary)
&& (pos.y() <= m_uSideLength - 1 - boundary)
&& (pos.z() <= m_uSideLength - 1 - boundary)
&& (pos.x() >= boundary)
&& (pos.y() >= boundary)
&& (pos.z() >= boundary);
return (pos.getX() <= m_uSideLength - 1 - boundary)
&& (pos.getY() <= m_uSideLength - 1 - boundary)
&& (pos.getZ() <= m_uSideLength - 1 - boundary)
&& (pos.getX() >= boundary)
&& (pos.getY() >= boundary)
&& (pos.getZ() >= boundary);
}
template <typename VoxelType>
bool BlockVolume<VoxelType>::containsPoint(const Vector3DInt32& pos, boost::uint16_t boundary) const
{
return (pos.x() <= m_uSideLength - 1 - boundary)
&& (pos.y() <= m_uSideLength - 1 - boundary)
&& (pos.z() <= m_uSideLength - 1 - boundary)
&& (pos.x() >= boundary)
&& (pos.y() >= boundary)
&& (pos.z() >= boundary);
return (pos.getX() <= m_uSideLength - 1 - boundary)
&& (pos.getY() <= m_uSideLength - 1 - boundary)
&& (pos.getZ() <= m_uSideLength - 1 - boundary)
&& (pos.getX() >= boundary)
&& (pos.getY() >= boundary)
&& (pos.getZ() >= boundary);
}
template <typename VoxelType>

View File

@ -62,20 +62,20 @@ namespace PolyVox
Vector<Size,Type>& operator*=(const Type& rhs) throw();
///Division and Assignment Operator.
Vector<Size,Type>& operator/=(const Type& rhs) throw();
///Element Access
Type operator()(boost::uint32_t index) const throw();
///Element Access
Type getElement(boost::uint32_t index) const throw();
///Get the x component of the vector.
Type x(void) const throw();
Type getX(void) const throw();
///Get the y component of the vector.
Type y(void) const throw();
Type getY(void) const throw();
///Get the z component of the vector.
Type z(void) const throw();
Type getZ(void) const throw();
///Get the w component of the vector.
Type w(void) const throw();
Type getW(void) const throw();
///Element Access
void set(boost::uint32_t index, Type tValue) throw();
void setElement(boost::uint32_t index, Type tValue) throw();
///Set the x component of the vector.
void setX(Type tX) throw();
///Set the y component of the vector.

View File

@ -34,7 +34,7 @@ namespace PolyVox
The elements of the Vector are accessed via the overloaded () operator which takes
an index indicating the element to fetch. They are set using the set() function which
takes an index indicating the element to set and a new value for that element. For
convienience, the functions x(), setX(), y(), setY(), z(), setZ, w() and setW()
convienience, the functions getX(), setX(), getY(), setY(), getZ(), setZ, w() and setW()
do the same thing for the first 4 elements of the Vector.
A variety of overloaded operators are also provided for comparison and arithmetic
@ -125,7 +125,7 @@ namespace PolyVox
{
for(boost::uint32_t ct = 0; ct < Size; ++ct)
{
m_tElements[ct] = static_cast<CastType>(vector(ct));
m_tElements[ct] = static_cast<CastType>(vector.getElement(ct));
}
}
@ -268,7 +268,7 @@ namespace PolyVox
os << "(";
for(boost::uint32_t ct = 0; ct < Size; ++ct)
{
os << vector(ct);
os << vector.getElement(ct);
if(ct < (Size-1))
{
os << ",";
@ -276,7 +276,9 @@ namespace PolyVox
}
os << ")";
return os;
}
}
//----------------------------------- Getters ----------------------------------
/**
Returns the element at the given position.
@ -284,18 +286,16 @@ namespace PolyVox
\return The element.
*/
template <boost::uint32_t Size, typename Type>
inline Type Vector<Size, Type>::operator()(boost::uint32_t index) const throw()
inline Type Vector<Size, Type>::getElement(boost::uint32_t index) const throw()
{
return m_tElements[index];
}
//----------------------------------- Getters ----------------------------------
}
/**
\return A const reference to the X component of a 1, 2, 3, or 4 dimensional Vector.
*/
template <boost::uint32_t Size, typename Type>
inline Type Vector<Size, Type>::x(void) const throw()
inline Type Vector<Size, Type>::getX(void) const throw()
{
return m_tElements[0];
}
@ -304,7 +304,7 @@ namespace PolyVox
\return A const reference to the Y component of a 2, 3, or 4 dimensional Vector.
*/
template <boost::uint32_t Size, typename Type>
inline Type Vector<Size, Type>::y(void) const throw()
inline Type Vector<Size, Type>::getY(void) const throw()
{
return m_tElements[1];
}
@ -313,7 +313,7 @@ namespace PolyVox
\return A const reference to the Z component of a 3 or 4 dimensional Vector.
*/
template <boost::uint32_t Size, typename Type>
inline Type Vector<Size, Type>::z(void) const throw()
inline Type Vector<Size, Type>::getZ(void) const throw()
{
return m_tElements[2];
}
@ -322,7 +322,7 @@ namespace PolyVox
\return A const reference to the W component of a 4 dimensional Vector.
*/
template <boost::uint32_t Size, typename Type>
inline Type Vector<Size, Type>::w(void) const throw()
inline Type Vector<Size, Type>::getW(void) const throw()
{
return m_tElements[3];
}
@ -334,7 +334,7 @@ namespace PolyVox
\param tValue The new value for the element.
*/
template <boost::uint32_t Size, typename Type>
inline void Vector<Size, Type>::set(boost::uint32_t index, Type tValue) throw()
inline void Vector<Size, Type>::setElement(boost::uint32_t index, Type tValue) throw()
{
m_tElements[index] = tValue;
}
@ -432,9 +432,9 @@ namespace PolyVox
template <boost::uint32_t Size, typename Type>
inline Vector<Size, Type> Vector<Size, Type>::cross(const Vector<Size, Type>& vector) const throw()
{
Type i = vector.z() * this->y() - vector.y() * this->z();
Type j = vector.x() * this->z() - vector.z() * this->x();
Type k = vector.y() * this->x() - vector.x() * this->y();
Type i = vector.getZ() * this->getY() - vector.getY() * this->getZ();
Type j = vector.getX() * this->getZ() - vector.getZ() * this->getX();
Type k = vector.getY() * this->getX() - vector.getX() * this->getY();
return Vector<Size, Type>(i,j,k);
}

View File

@ -192,7 +192,7 @@ namespace PolyVox
template <typename VoxelType>
void VolumeIterator<VoxelType>::setValidRegion(const Region& region)
{
setValidRegion(region.getLowerCorner().x(),region.getLowerCorner().y(),region.getLowerCorner().z(),region.getUpperCorner().x(),region.getUpperCorner().y(),region.getUpperCorner().z());
setValidRegion(region.getLowerCorner().getX(),region.getLowerCorner().getY(),region.getLowerCorner().getZ(),region.getUpperCorner().getX(),region.getUpperCorner().getY(),region.getUpperCorner().getZ());
}
template <typename VoxelType>

View File

@ -122,19 +122,19 @@ namespace PolyVox
boost::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos)
{
assert(pos.x() >= 0.0f);
assert(pos.y() >= 0.0f);
assert(pos.z() >= 0.0f);
assert(pos.x() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.y() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.z() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
float xIntPart;
float xFracPart = std::modf(pos.x(), &xIntPart);
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.y(), &yIntPart);
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.z(), &zIntPart);
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)
@ -154,21 +154,21 @@ namespace PolyVox
void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, boost::int32_t newIndex)
{
assert(pos.x() >= 0.0f);
assert(pos.y() >= 0.0f);
assert(pos.z() >= 0.0f);
assert(pos.x() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.y() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.z() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getX() >= 0.0f);
assert(pos.getY() >= 0.0f);
assert(pos.getZ() >= 0.0f);
assert(pos.getX() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getY() <= POLYVOX_REGION_SIDE_LENGTH);
assert(pos.getZ() <= POLYVOX_REGION_SIDE_LENGTH);
assert(newIndex < 10000);
float xIntPart;
float xFracPart = std::modf(pos.x(), &xIntPart);
float xFracPart = std::modf(pos.getX(), &xIntPart);
float yIntPart;
float yFracPart = std::modf(pos.y(), &yIntPart);
float yFracPart = std::modf(pos.getY(), &yIntPart);
float zIntPart;
float zFracPart = std::modf(pos.z(), &zIntPart);
float zFracPart = std::modf(pos.getZ(), &zIntPart);
//Of all the fractional parts, two should be zero and one should have a value.
if(xFracPart > 0.000001f)

View File

@ -36,31 +36,31 @@ namespace PolyVox
bool Region::containsPoint(const Vector3DFloat& pos, float boundary) const
{
return (pos.x() <= m_v3dUpperCorner.x() - boundary)
&& (pos.y() <= m_v3dUpperCorner.y() - boundary)
&& (pos.z() <= m_v3dUpperCorner.z() - boundary)
&& (pos.x() >= m_v3dLowerCorner.x() + boundary)
&& (pos.y() >= m_v3dLowerCorner.y() + boundary)
&& (pos.z() >= m_v3dLowerCorner.z() + boundary);
return (pos.getX() <= m_v3dUpperCorner.getX() - boundary)
&& (pos.getY() <= m_v3dUpperCorner.getY() - boundary)
&& (pos.getZ() <= m_v3dUpperCorner.getZ() - boundary)
&& (pos.getX() >= m_v3dLowerCorner.getX() + boundary)
&& (pos.getY() >= m_v3dLowerCorner.getY() + boundary)
&& (pos.getZ() >= m_v3dLowerCorner.getZ() + boundary);
}
bool Region::containsPoint(const Vector3DInt32& pos, boost::uint8_t boundary) const
{
return (pos.x() <= m_v3dUpperCorner.x() - boundary)
&& (pos.y() <= m_v3dUpperCorner.y() - boundary)
&& (pos.z() <= m_v3dUpperCorner.z() - boundary)
&& (pos.x() >= m_v3dLowerCorner.x() + boundary)
&& (pos.y() >= m_v3dLowerCorner.y() + boundary)
&& (pos.z() >= m_v3dLowerCorner.z() + boundary);
return (pos.getX() <= m_v3dUpperCorner.getX() - boundary)
&& (pos.getY() <= m_v3dUpperCorner.getY() - boundary)
&& (pos.getZ() <= m_v3dUpperCorner.getZ() - boundary)
&& (pos.getX() >= m_v3dLowerCorner.getX() + boundary)
&& (pos.getY() >= m_v3dLowerCorner.getY() + boundary)
&& (pos.getZ() >= m_v3dLowerCorner.getZ() + boundary);
}
void Region::cropTo(const Region& other)
{
m_v3dLowerCorner.setX((std::max)(m_v3dLowerCorner.x(), other.m_v3dLowerCorner.x()));
m_v3dLowerCorner.setY((std::max)(m_v3dLowerCorner.y(), other.m_v3dLowerCorner.y()));
m_v3dLowerCorner.setZ((std::max)(m_v3dLowerCorner.z(), other.m_v3dLowerCorner.z()));
m_v3dUpperCorner.setX((std::min)(m_v3dUpperCorner.x(), other.m_v3dUpperCorner.x()));
m_v3dUpperCorner.setY((std::min)(m_v3dUpperCorner.y(), other.m_v3dUpperCorner.y()));
m_v3dUpperCorner.setZ((std::min)(m_v3dUpperCorner.z(), other.m_v3dUpperCorner.z()));
m_v3dLowerCorner.setX((std::max)(m_v3dLowerCorner.getX(), other.m_v3dLowerCorner.getX()));
m_v3dLowerCorner.setY((std::max)(m_v3dLowerCorner.getY(), other.m_v3dLowerCorner.getY()));
m_v3dLowerCorner.setZ((std::max)(m_v3dLowerCorner.getZ(), other.m_v3dLowerCorner.getZ()));
m_v3dUpperCorner.setX((std::min)(m_v3dUpperCorner.getX(), other.m_v3dUpperCorner.getX()));
m_v3dUpperCorner.setY((std::min)(m_v3dUpperCorner.getY(), other.m_v3dUpperCorner.getY()));
m_v3dUpperCorner.setZ((std::min)(m_v3dUpperCorner.getZ(), other.m_v3dUpperCorner.getZ()));
}
}

View File

@ -60,7 +60,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
//Iterate over each cell in the region
for(volIter.setPosition(region.getLowerCorner().x(),region.getLowerCorner().y(), region.getLowerCorner().z());volIter.isValidForRegion();volIter.moveForwardInRegion())
for(volIter.setPosition(region.getLowerCorner().getX(),region.getLowerCorner().getY(), region.getLowerCorner().getZ());volIter.isValidForRegion();volIter.moveForwardInRegion())
{
//Current position
const uint16_t x = volIter.getPosX();
@ -345,9 +345,9 @@ namespace PolyVox
Vector3DFloat computeNormal(BlockVolume<uint8_t>* volumeData, const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod)
{
const float posX = position.x();
const float posY = position.y();
const float posZ = position.z();
const float posX = position.getX();
const float posY = position.getY();
const float posZ = position.getZ();
const uint16_t floorX = static_cast<uint16_t>(posX);
const uint16_t floorY = static_cast<uint16_t>(posY);
@ -460,7 +460,7 @@ namespace PolyVox
//////////////////////////////////////////////////////////////////////////
//Iterate over each cell in the region
for(volIter.setPosition(region.getLowerCorner().x(),region.getLowerCorner().y(), region.getLowerCorner().z());volIter.isValidForRegion();volIter.moveForwardInRegion())
for(volIter.setPosition(region.getLowerCorner().getX(),region.getLowerCorner().getY(), region.getLowerCorner().getZ());volIter.isValidForRegion();volIter.moveForwardInRegion())
{
//Current position
const uint16_t x = volIter.getPosX();
@ -747,9 +747,9 @@ namespace PolyVox
{
const float posX = position.x();
const float posY = position.y();
const float posZ = position.z();
const float posX = position.getX();
const float posY = position.getY();
const float posZ = position.getZ();
const uint16_t floorX = static_cast<uint16_t>(posX);
const uint16_t floorY = static_cast<uint16_t>(posY);

View File

@ -83,7 +83,7 @@ namespace PolyVox
std::string SurfaceVertex::tostring(void) const
{
std::stringstream ss;
ss << "SurfaceVertex: Position = (" << position.x() << "," << position.y() << "," << position.z() << "), Normal = " << normal;
ss << "SurfaceVertex: Position = (" << position.getX() << "," << position.getY() << "," << position.getZ() << "), Normal = " << normal;
return ss.str();
}
}

View File

@ -115,7 +115,7 @@ namespace PolyVox
uint8_t VolumeChangeTracker::getVoxelAt(const Vector3DUint16& pos)
{
return getVoxelAt(pos.x(), pos.y(), pos.z());
return getVoxelAt(pos.getX(), pos.getY(), pos.getZ());
}
uint8_t VolumeChangeTracker::getVoxelAt(uint16_t uX, uint16_t uY, uint16_t uZ)
@ -206,13 +206,13 @@ namespace PolyVox
throw std::logic_error("No region is locked. You must lock a region before you can unlock it.");
}
const uint16_t firstRegionX = m_regLastLocked.getLowerCorner().x() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t firstRegionY = m_regLastLocked.getLowerCorner().y() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t firstRegionZ = m_regLastLocked.getLowerCorner().z() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t firstRegionX = m_regLastLocked.getLowerCorner().getX() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t firstRegionY = m_regLastLocked.getLowerCorner().getY() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t firstRegionZ = m_regLastLocked.getLowerCorner().getZ() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionX = m_regLastLocked.getUpperCorner().x() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionY = m_regLastLocked.getUpperCorner().y() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionZ = m_regLastLocked.getUpperCorner().z() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionX = m_regLastLocked.getUpperCorner().getX() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionY = m_regLastLocked.getUpperCorner().getY() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
const uint16_t lastRegionZ = m_regLastLocked.getUpperCorner().getZ() >> POLYVOX_REGION_SIDE_LENGTH_POWER;
for(uint16_t zCt = firstRegionZ; zCt <= lastRegionZ; zCt++)
{