From d0ffdee87008d2cd1f3fe1a72f66b375a5c3789c Mon Sep 17 00:00:00 2001 From: David Williams Date: Mon, 26 May 2008 19:49:21 +0000 Subject: [PATCH] Renamed x(), y(), and z() to getX(), getY(), and getZ() --- include/BlockVolume.inl | 32 +++++++++++++++--------------- include/Vector.h | 14 ++++++------- include/Vector.inl | 32 +++++++++++++++--------------- include/VolumeIterator.inl | 2 +- source/IndexedSurfacePatch.cpp | 36 +++++++++++++++++----------------- source/Region.cpp | 36 +++++++++++++++++----------------- source/SurfaceExtractors.cpp | 16 +++++++-------- source/SurfaceVertex.cpp | 2 +- source/VolumeChangeTracker.cpp | 14 ++++++------- 9 files changed, 92 insertions(+), 92 deletions(-) diff --git a/include/BlockVolume.inl b/include/BlockVolume.inl index 935bfec0..a87768a7 100644 --- a/include/BlockVolume.inl +++ b/include/BlockVolume.inl @@ -160,11 +160,11 @@ namespace PolyVox template VoxelType BlockVolume::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 bool BlockVolume::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 bool BlockVolume::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 diff --git a/include/Vector.h b/include/Vector.h index 488955fa..a9176cee 100644 --- a/include/Vector.h +++ b/include/Vector.h @@ -62,20 +62,20 @@ namespace PolyVox Vector& operator*=(const Type& rhs) throw(); ///Division and Assignment Operator. Vector& 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. diff --git a/include/Vector.inl b/include/Vector.inl index c084edca..5856c0a0 100644 --- a/include/Vector.inl +++ b/include/Vector.inl @@ -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(vector(ct)); + m_tElements[ct] = static_cast(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 - inline Type Vector::operator()(boost::uint32_t index) const throw() + inline Type Vector::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 - inline Type Vector::x(void) const throw() + inline Type Vector::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 - inline Type Vector::y(void) const throw() + inline Type Vector::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 - inline Type Vector::z(void) const throw() + inline Type Vector::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 - inline Type Vector::w(void) const throw() + inline Type Vector::getW(void) const throw() { return m_tElements[3]; } @@ -334,7 +334,7 @@ namespace PolyVox \param tValue The new value for the element. */ template - inline void Vector::set(boost::uint32_t index, Type tValue) throw() + inline void Vector::setElement(boost::uint32_t index, Type tValue) throw() { m_tElements[index] = tValue; } @@ -432,9 +432,9 @@ namespace PolyVox template inline Vector Vector::cross(const Vector& 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(i,j,k); } diff --git a/include/VolumeIterator.inl b/include/VolumeIterator.inl index 7f174c14..5eca640e 100644 --- a/include/VolumeIterator.inl +++ b/include/VolumeIterator.inl @@ -192,7 +192,7 @@ namespace PolyVox template void VolumeIterator::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 diff --git a/source/IndexedSurfacePatch.cpp b/source/IndexedSurfacePatch.cpp index c1848ad3..ab581693 100644 --- a/source/IndexedSurfacePatch.cpp +++ b/source/IndexedSurfacePatch.cpp @@ -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) diff --git a/source/Region.cpp b/source/Region.cpp index 6ce274ba..88ffc218 100644 --- a/source/Region.cpp +++ b/source/Region.cpp @@ -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())); } } diff --git a/source/SurfaceExtractors.cpp b/source/SurfaceExtractors.cpp index 07cda5f3..89ce0d3d 100644 --- a/source/SurfaceExtractors.cpp +++ b/source/SurfaceExtractors.cpp @@ -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* 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(posX); const uint16_t floorY = static_cast(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(posX); const uint16_t floorY = static_cast(posY); diff --git a/source/SurfaceVertex.cpp b/source/SurfaceVertex.cpp index 00084c24..25887a4d 100644 --- a/source/SurfaceVertex.cpp +++ b/source/SurfaceVertex.cpp @@ -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(); } } diff --git a/source/VolumeChangeTracker.cpp b/source/VolumeChangeTracker.cpp index b05f8a94..86cfab94 100644 --- a/source/VolumeChangeTracker.cpp +++ b/source/VolumeChangeTracker.cpp @@ -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++) {