Browse Source

Use fuzzy compare also for Vector.

vectorfields
Vladimír Vondruš 16 years ago
parent
commit
cd568375f0
  1. 7
      src/Math/Vector.h

7
src/Math/Vector.h

@ -22,6 +22,8 @@
#include <cstring> #include <cstring>
#include <cmath> #include <cmath>
#include "constants.h"
namespace Magnum { namespace Math { namespace Magnum { namespace Math {
/** @brief Vector */ /** @brief Vector */
@ -80,7 +82,10 @@ template<class T, size_t size> class Vector {
/** @brief Equality operator */ /** @brief Equality operator */
inline bool operator==(const Vector<T, size>& other) const { inline bool operator==(const Vector<T, size>& other) const {
return memcmp(_data, other.data(), size*sizeof(T)) == 0; for(size_t pos = 0; pos != size; ++pos)
if(std::abs(at(pos) - other.at(pos)) >= EPSILON) return false;
return true;
} }
/** @brief Non-equality operator */ /** @brief Non-equality operator */

Loading…
Cancel
Save