diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index aeab958de..74da25de0 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -469,7 +469,7 @@ template bool Matrix::isOrthogonal() const { /* Orthogonality */ for(std::size_t i = 0; i != size-1; ++i) for(std::size_t j = i+1; j != size; ++j) - if(dot(RectangularMatrix::_data[i], RectangularMatrix::_data[j]) > TypeTraits::epsilon()) + if(std::abs(dot(RectangularMatrix::_data[i], RectangularMatrix::_data[j])) > TypeTraits::epsilon()) return false; return true; diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index 438c53c68..6456d1966 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -519,10 +519,10 @@ void ComplexTest::matrixNotRotation() { std::ostringstream out; Error redirectError{&out}; - /* Shear, using rotation() instead of rotationScaling() as that isn't + /* Shear, using rotationShear() instead of rotationScaling() as that isn't supposed to "fix" the shear */ Complex::fromMatrix((Matrix3::scaling({2.0f, 1.0f})* - Matrix3::rotation(45.0_degf)).rotation()); + Matrix3::rotation(45.0_degf)).rotationShear()); /* Reflection, using rotation() instead of rotationScaling() as that isn't supposed to "fix" the reflection either */ Complex::fromMatrix((Matrix3::scaling({-1.0f, 1.0f})* diff --git a/src/Magnum/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp index 4f9b2db15..3709622bf 100644 --- a/src/Magnum/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -331,6 +331,9 @@ void MatrixTest::isOrthogonal() { CORRADE_VERIFY(!Matrix3x3(Vector3(1.0f, 0.0f, 0.0f), Vector3(0.0f, 1.0f, 0.0f), Vector3(0.0f, 1.0f, 0.0f)).isOrthogonal()); + CORRADE_VERIFY(!Matrix3x3(Vector3(1.0f, 0.0f, 0.0f), + Vector3(0.0f, 1.0f, 0.0f), + Vector3(0.0f, -1.0f, 0.0f)).isOrthogonal()); CORRADE_VERIFY(Matrix3x3(Vector3(1.0f, 0.0f, 0.0f), Vector3(0.0f, 1.0f, 0.0f), Vector3(0.0f, 0.0f, 1.0f)).isOrthogonal()); diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 793de30de..1a476864d 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -644,10 +644,10 @@ void QuaternionTest::matrixNotRotation() { std::ostringstream out; Error redirectError{&out}; - /* Shear, using rotation() instead of rotationScaling() as that isn't + /* Shear, using rotationShear() instead of rotationScaling() as that isn't supposed to "fix" the shear */ Quaternion::fromMatrix((Matrix4::scaling({2.0f, 1.0f, 1.0f})* - Matrix4::rotationZ(45.0_degf)).rotation()); + Matrix4::rotationZ(45.0_degf)).rotationShear()); /* Reflection, using rotation() instead of rotationScaling() as that isn't supposed to "fix" the reflection either */ Quaternion::fromMatrix((Matrix4::scaling({-1.0f, 1.0f, 1.0f})*