diff --git a/src/Magnum/Math/Bezier.h b/src/Magnum/Math/Bezier.h index 59721e259..4aeedc273 100644 --- a/src/Magnum/Math/Bezier.h +++ b/src/Magnum/Math/Bezier.h @@ -183,14 +183,24 @@ template class Bezier { constexpr auto data() const -> const VectorType(&)[order + 1] { return _data; } #endif - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare. + */ bool operator==(const Bezier& other) const { for(std::size_t i = 0; i != order + 1; ++i) if(_data[i] != other._data[i]) return false; return true; } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare. + */ bool operator!=(const Bezier& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Complex.h b/src/Magnum/Math/Complex.h index 475aa2e6c..2a57365af 100644 --- a/src/Magnum/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -212,13 +212,21 @@ template class Complex { } #endif - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator==(const Complex& other) const { return TypeTraits::equals(_real, other._real) && TypeTraits::equals(_imaginary, other._imaginary); } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator!=(const Complex& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/CubicHermite.h b/src/Magnum/Math/CubicHermite.h index bf02a5f95..4d6a99757 100644 --- a/src/Magnum/Math/CubicHermite.h +++ b/src/Magnum/Math/CubicHermite.h @@ -172,10 +172,18 @@ template class CubicHermite { } #endif - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator==(const CubicHermite& other) const; - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator!=(const CubicHermite& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Dual.h b/src/Magnum/Math/Dual.h index cdccb3764..10728b2d3 100644 --- a/src/Magnum/Math/Dual.h +++ b/src/Magnum/Math/Dual.h @@ -148,13 +148,23 @@ template class Dual { } #endif - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. + */ bool operator==(const Dual& other) const { return TypeTraits::equals(_real, other._real) && TypeTraits::equals(_dual, other._dual); } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. + */ bool operator!=(const Dual& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Frustum.h b/src/Magnum/Math/Frustum.h index 186face38..2b0c31dc6 100644 --- a/src/Magnum/Math/Frustum.h +++ b/src/Magnum/Math/Frustum.h @@ -117,7 +117,12 @@ template class Frustum { return Implementation::FrustumConverter::to(*this); } - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare. + */ bool operator==(const Frustum& other) const { for(std::size_t i = 0; i != 6; ++i) if(_data[i] != other._data[i]) return false; @@ -125,7 +130,12 @@ template class Frustum { return true; } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare. + */ bool operator!=(const Frustum& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Half.h b/src/Magnum/Math/Half.h index d6a50a7bd..89a3ffc68 100644 --- a/src/Magnum/Math/Half.h +++ b/src/Magnum/Math/Half.h @@ -112,7 +112,9 @@ class Half { * @brief Equality comparison * * Returns `false` if one of the values is half-float representation of - * NaN, otherwise does bitwise comparison. + * NaN, otherwise does bitwise comparison. Note that, unlike with other + * floating-point Magnum math types, due to the limited precision of + * half floats it's *not* a fuzzy compare. */ constexpr bool operator==(Half other) const { return ((( _data & 0x7c00) == 0x7c00 && ( _data & 0x03ff)) || diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index e805a7574..ab1dfddaa 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -447,12 +447,20 @@ template class Quaternion { } #endif - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator==(const Quaternion& other) const { return _vector == other._vector && TypeTraits::equals(_scalar, other._scalar); } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare. + */ bool operator!=(const Quaternion& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Range.h b/src/Magnum/Math/Range.h index cf4bc25c8..11180097a 100644 --- a/src/Magnum/Math/Range.h +++ b/src/Magnum/Math/Range.h @@ -183,10 +183,22 @@ template class Range { return Implementation::RangeConverter::to(*this); } - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare for floating-point + * types. + */ bool operator==(const Range& other) const; - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare for floating-point + * types. + */ bool operator!=(const Range& other) const { return !operator==(other); } diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index 0f73d90bb..166523342 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -307,7 +307,13 @@ template class RectangularMatrix { */ void setRow(std::size_t row, const Vector& data); - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare for floating-point + * types. + */ bool operator==(const RectangularMatrix& other) const { for(std::size_t i = 0; i != cols; ++i) if(_data[i] != other._data[i]) return false; @@ -318,6 +324,9 @@ template class RectangularMatrix { /** * @brief Non-equality comparison * + * Done by comparing the underlying vectors, which internally uses + * @ref TypeTraits::equals(), i.e. a fuzzy compare for floating-point + * types. * @see @ref Vector::operator<(), @ref Vector::operator<=(), * @ref Vector::operator>=(), @ref Vector::operator>() */ diff --git a/src/Magnum/Math/Unit.h b/src/Magnum/Math/Unit.h index 6e9033d79..4a1b6c8e7 100644 --- a/src/Magnum/Math/Unit.h +++ b/src/Magnum/Math/Unit.h @@ -69,12 +69,22 @@ template class Derived, class T> class Unit { /** @brief Explicit conversion to underlying type */ constexpr explicit operator T() const { return _value; } - /** @brief Equality comparison */ + /** + * @brief Equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. + */ constexpr bool operator==(Unit other) const { return TypeTraits::equals(_value, other._value); } - /** @brief Non-equality comparison */ + /** + * @brief Non-equality comparison + * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. + */ constexpr bool operator!=(Unit other) const { return !operator==(other); } diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 1e75dbf7f..3690f2d0c 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -309,6 +309,8 @@ template class Vector { /** * @brief Equality comparison * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. * @see @ref Math::equal() */ bool operator==(const Vector& other) const { @@ -321,6 +323,8 @@ template class Vector { /** * @brief Non-equality comparison * + * Done using @ref TypeTraits::equals(), i.e. with fuzzy compare for + * floating-point types. * @see @ref Math::notEqual() */ bool operator!=(const Vector& other) const {