Browse Source

Not-so-precise matrix comparison.

vectorfields
Vladimír Vondruš 16 years ago
parent
commit
61c96a36f3
  1. 9
      src/Matrix.h

9
src/Matrix.h

@ -21,6 +21,8 @@
#include <cstring>
#include "constants.h"
namespace Magnum {
/** @brief Matrix */
@ -85,7 +87,12 @@ template<class T, size_t size> class Matrix {
/** @brief Equality operator */
inline bool operator==(const Matrix<T, size>& 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 */

Loading…
Cancel
Save