Added equality/inequality tests for vector and region.
This commit is contained in:
@ -44,6 +44,11 @@ namespace PolyVox
|
||||
Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner);
|
||||
Region(int32_t iLowerX, int32_t iLowerY, int32_t iLowerZ, int32_t iUpperX, int32_t iUpperY, int32_t iUpperZ);
|
||||
|
||||
///Equality Operator.
|
||||
bool operator==(const Region& rhs) const throw();
|
||||
///Inequality Operator.
|
||||
bool operator!=(const Region& rhs) const throw();
|
||||
|
||||
const Vector3DInt32& getLowerCorner(void) const;
|
||||
const Vector3DInt32& getUpperCorner(void) const;
|
||||
|
||||
|
@ -81,6 +81,8 @@ namespace PolyVox
|
||||
Vector<Size,Type>& operator=(const Vector<Size,Type>& rhs) throw();
|
||||
///Equality Operator.
|
||||
bool operator==(const Vector<Size,Type>& rhs) const throw();
|
||||
///Inequality Operator.
|
||||
bool operator!=(const Vector<Size,Type>& rhs) const throw();
|
||||
///Comparison Operator.
|
||||
bool operator<(const Vector<Size,Type>& rhs) const throw();
|
||||
///Addition and Assignment Operator.
|
||||
|
@ -150,6 +150,18 @@ namespace PolyVox
|
||||
return equal;
|
||||
}
|
||||
|
||||
/**
|
||||
Checks whether two Vectors are not equal.
|
||||
\param rhs The Vector to compare to.
|
||||
\return true if the Vectors do not match.
|
||||
\see operator==
|
||||
*/
|
||||
template <uint32_t Size, typename Type>
|
||||
inline bool Vector<Size, Type>::operator!=(const Vector<Size, Type> &rhs) const throw()
|
||||
{
|
||||
return !(*this == rhs); //Just call equality operator and invert the result.
|
||||
}
|
||||
|
||||
/**
|
||||
Checks whether this vector is less than the parameter. The metric is
|
||||
meaningless but it allows Vectors to me used as key in sdt::map, etc.
|
||||
|
@ -60,6 +60,28 @@ namespace PolyVox
|
||||
assert(m_v3dUpperCorner.getZ() >= m_v3dLowerCorner.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
Checks whether two Regions are equal.
|
||||
\param rhs The Region to compare to.
|
||||
\return true if the Regions match.
|
||||
\see operator!=
|
||||
*/
|
||||
bool Region::operator==(const Region& rhs) const throw()
|
||||
{
|
||||
return ((m_v3dLowerCorner == rhs.m_v3dLowerCorner) && (m_v3dUpperCorner == rhs.m_v3dUpperCorner));
|
||||
}
|
||||
|
||||
/**
|
||||
Checks whether two Regions are not equal.
|
||||
\param rhs The Region to compare to.
|
||||
\return true if the Regions do not match.
|
||||
\see operator==
|
||||
*/
|
||||
bool Region::operator!=(const Region& rhs) const throw()
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
const Vector3DInt32& Region::getLowerCorner(void) const
|
||||
{
|
||||
return m_v3dLowerCorner;
|
||||
|
Reference in New Issue
Block a user