Browse Source

Math: simplified Matrix::isOrthogonal().

No need to call std::abs() when comparing with zero, as dot() should
always be positive.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
da2bbac104
  1. 5
      src/Math/Matrix.h

5
src/Math/Matrix.h

@ -114,13 +114,12 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
bool isOrthogonal() const {
/* Normality */
for(std::size_t i = 0; i != size; ++i)
if(!TypeTraits<T>::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<T>::equals(Vector<size, T>::dot((*this)[i], (*this)[j]), T(0)))
if(Vector<size, T>::dot((*this)[i], (*this)[j]) > TypeTraits<T>::epsilon())
return false;
return true;

Loading…
Cancel
Save