diff --git a/src/Magnum/Math/Constants.h b/src/Magnum/Math/Constants.h index 0b2803fe4..17b873340 100644 --- a/src/Magnum/Math/Constants.h +++ b/src/Magnum/Math/Constants.h @@ -58,8 +58,8 @@ template struct Constants { */ static constexpr T tau(); - static constexpr T sqrt2(); /**< @brief Square root of 2 */ - static constexpr T sqrt3(); /**< @brief Square root of 3 */ + static constexpr T sqrt2(); /**< @brief Square root of 2 */ + static constexpr T sqrt3(); /**< @brief Square root of 3 */ #endif }; @@ -68,19 +68,19 @@ template struct Constants { template<> struct Constants { Constants() = delete; - static constexpr Double pi() { return 3.141592653589793; } - static constexpr Double tau() { return 6.283185307179586; } - static constexpr Double sqrt2() { return 1.414213562373095; } - static constexpr Double sqrt3() { return 1.732050807568877; } + static constexpr Double pi() { return 3.141592653589793; } + static constexpr Double tau() { return 6.283185307179586; } + static constexpr Double sqrt2() { return 1.414213562373095; } + static constexpr Double sqrt3() { return 1.732050807568877; } }; #endif template<> struct Constants { Constants() = delete; - static constexpr Float pi() { return 3.141592654f; } - static constexpr Float tau() { return 6.283185307f; } - static constexpr Float sqrt2() { return 1.414213562f; } - static constexpr Float sqrt3() { return 1.732050808f; } + static constexpr Float pi() { return 3.141592654f; } + static constexpr Float tau() { return 6.283185307f; } + static constexpr Float sqrt2() { return 1.414213562f; } + static constexpr Float sqrt3() { return 1.732050808f; } }; #endif diff --git a/src/Magnum/Math/Geometry/Test/DistanceTest.cpp b/src/Magnum/Math/Geometry/Test/DistanceTest.cpp index de4d5a205..97cf07a7e 100644 --- a/src/Magnum/Math/Geometry/Test/DistanceTest.cpp +++ b/src/Magnum/Math/Geometry/Test/DistanceTest.cpp @@ -23,7 +23,6 @@ DEALINGS IN THE SOFTWARE. */ -#include #include #include "Magnum/Math/Constants.h" diff --git a/src/Magnum/Math/Test/ConstantsTest.cpp b/src/Magnum/Math/Test/ConstantsTest.cpp index 5ad0cae87..813c99aab 100644 --- a/src/Magnum/Math/Test/ConstantsTest.cpp +++ b/src/Magnum/Math/Test/ConstantsTest.cpp @@ -50,7 +50,8 @@ void ConstantsTest::constantsFloat() { CORRADE_COMPARE(Math::pow<2>(b), 3.0f); constexpr Float c = Constants::pi(); - CORRADE_COMPARE(2.0f*c, Constants::tau()); + constexpr Float e = Constants::tau(); + CORRADE_COMPARE(2.0f*c, e); } void ConstantsTest::constantsDouble() { @@ -61,7 +62,8 @@ void ConstantsTest::constantsDouble() { CORRADE_COMPARE(Math::pow<2>(b), 3.0); constexpr Double c = Constants::pi(); - CORRADE_COMPARE(2.0*c, Constants::tau()); + constexpr Double e = Constants::tau(); + CORRADE_COMPARE(2.0*c, e); #else CORRADE_SKIP("Double precision is not supported when targeting OpenGL ES."); #endif diff --git a/src/Magnum/Math/Test/Matrix4Test.cpp b/src/Magnum/Math/Test/Matrix4Test.cpp index 0e31ba943..a576dcbb0 100644 --- a/src/Magnum/Math/Test/Matrix4Test.cpp +++ b/src/Magnum/Math/Test/Matrix4Test.cpp @@ -102,6 +102,7 @@ typedef Math::Matrix4 Matrix4; typedef Math::Matrix4 Matrix4i; typedef Math::Matrix<3, Float> Matrix3x3; typedef Math::Vector3 Vector3; +typedef Math::Constants Constants; Matrix4Test::Matrix4Test() { addTests({&Matrix4Test::construct, @@ -277,8 +278,8 @@ void Matrix4Test::rotationX() { {0.0f, 0.90096887f, 0.43388374f, 0.0f}, {0.0f, -0.43388374f, 0.90096887f, 0.0f}, {0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE(Matrix4::rotation(Rad(Math::Constants::pi()/7), Vector3::xAxis()), matrix); - CORRADE_COMPARE(Matrix4::rotationX(Rad(Math::Constants::pi()/7)), matrix); + CORRADE_COMPARE(Matrix4::rotation(Rad(Constants::pi()/7), Vector3::xAxis()), matrix); + CORRADE_COMPARE(Matrix4::rotationX(Rad(Constants::pi()/7)), matrix); } void Matrix4Test::rotationY() { @@ -286,8 +287,8 @@ void Matrix4Test::rotationY() { { 0.0f, 1.0f, 0.0f, 0.0f}, {0.43388374f, 0.0f, 0.90096887f, 0.0f}, { 0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE(Matrix4::rotation(Rad(Math::Constants::pi()/7), Vector3::yAxis()), matrix); - CORRADE_COMPARE(Matrix4::rotationY(Rad(Math::Constants::pi()/7)), matrix); + CORRADE_COMPARE(Matrix4::rotation(Rad(Constants::pi()/7), Vector3::yAxis()), matrix); + CORRADE_COMPARE(Matrix4::rotationY(Rad(Constants::pi()/7)), matrix); } void Matrix4Test::rotationZ() { @@ -295,8 +296,8 @@ void Matrix4Test::rotationZ() { {-0.43388374f, 0.90096887f, 0.0f, 0.0f}, { 0.0f, 0.0f, 1.0f, 0.0f}, { 0.0f, 0.0f, 0.0f, 1.0f}); - CORRADE_COMPARE(Matrix4::rotation(Rad(Math::Constants::pi()/7), Vector3::zAxis()), matrix); - CORRADE_COMPARE(Matrix4::rotationZ(Rad(Math::Constants::pi()/7)), matrix); + CORRADE_COMPARE(Matrix4::rotation(Rad(Constants::pi()/7), Vector3::zAxis()), matrix); + CORRADE_COMPARE(Matrix4::rotationZ(Rad(Constants::pi()/7)), matrix); } void Matrix4Test::reflection() {