diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index c37d31738..245b19229 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -766,19 +766,17 @@ template Matrix3 Matrix3::projection(const Vector2& bottomLeft } template Matrix2x2 Matrix3::rotation() const { - Matrix2x2 rotation{(*this)[0].xy().normalized(), - (*this)[1].xy().normalized()}; - CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(), - "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotation, {}); - return rotation; + Matrix2x2 rotationShear = this->rotationShear(); + CORRADE_DEBUG_ASSERT(rotationShear.isOrthogonal(), + "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotationShear, {}); + return rotationShear; } template Matrix2x2 Matrix3::rotationNormalized() const { - Matrix2x2 rotation{(*this)[0].xy(), - (*this)[1].xy()}; - CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(), - "Math::Matrix3::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotation, {}); - return rotation; + Matrix2x2 rotationScaling = this->rotationScaling(); + CORRADE_DEBUG_ASSERT(rotationScaling.isOrthogonal(), + "Math::Matrix3::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotationScaling, {}); + return rotationScaling; } template T Matrix3::uniformScalingSquared() const { diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 5cd930cb4..ca4bab468 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -1328,21 +1328,17 @@ template Matrix4 Matrix4::lookAt(const Vector3& eye, const Vec } template Matrix3x3 Matrix4::rotation() const { - Matrix3x3 rotation{(*this)[0].xyz().normalized(), - (*this)[1].xyz().normalized(), - (*this)[2].xyz().normalized()}; - CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(), - "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotation, {}); - return rotation; + Matrix3x3 rotationShear = this->rotationShear(); + CORRADE_DEBUG_ASSERT(rotationShear.isOrthogonal(), + "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:" << Debug::newline << rotationShear, {}); + return rotationShear; } template Matrix3x3 Matrix4::rotationNormalized() const { - Matrix3x3 rotation{(*this)[0].xyz(), - (*this)[1].xyz(), - (*this)[2].xyz()}; - CORRADE_DEBUG_ASSERT(rotation.isOrthogonal(), - "Math::Matrix4::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotation, {}); - return rotation; + Matrix3x3 rotationScaling = this->rotationScaling(); + CORRADE_DEBUG_ASSERT(rotationScaling.isOrthogonal(), + "Math::Matrix4::rotationNormalized(): the rotation part is not orthogonal:" << Debug::newline << rotationScaling, {}); + return rotationScaling; } template T Matrix4::uniformScalingSquared() const {