From 61c96a36f35bc67d9249224c93f21a3927a1b31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 23 Dec 2010 23:12:29 +0100 Subject: [PATCH] Not-so-precise matrix comparison. --- src/Matrix.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Matrix.h b/src/Matrix.h index fc2067d5e..1d2380100 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -21,6 +21,8 @@ #include +#include "constants.h" + namespace Magnum { /** @brief Matrix */ @@ -85,7 +87,12 @@ template class Matrix { /** @brief Equality operator */ inline bool operator==(const Matrix& other) const { - return memcmp(_data, other.data(), size*size*sizeof(T)) == 0; + for(size_t row = 0; row != size; ++row) { + for(size_t col = 0; col != size; ++col) + if(std::abs(at(col, row) - other.at(col, row)) >= EPSILON) return false; + } + + return true; } /** @brief Non-equality operator */