From da2bbac104f11c8fd13730ef7fefacdb1464ab83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 15 Mar 2013 15:21:10 +0100 Subject: [PATCH] Math: simplified Matrix::isOrthogonal(). No need to call std::abs() when comparing with zero, as dot() should always be positive. --- src/Math/Matrix.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 432ded0d8..1db788d34 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -114,13 +114,12 @@ template class Matrix: public RectangularMatrix::equals((*this)[i].dot(), T(1))) - return false; + if(!(*this)[i].isNormalized()) return false; /* Orthogonality */ for(std::size_t i = 0; i != size-1; ++i) for(std::size_t j = i+1; j != size; ++j) - if(!TypeTraits::equals(Vector::dot((*this)[i], (*this)[j]), T(0))) + if(Vector::dot((*this)[i], (*this)[j]) > TypeTraits::epsilon()) return false; return true;