diff --git a/doc/changelog.dox b/doc/changelog.dox index 353441c13..5945ac2ce 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -53,6 +53,11 @@ See also: and @gl_extension{NV,fragment_shader_barycentric} desktop / ES extensions. These add only shading language features. +@subsubsection changelog-latest-new-math Math library + +- Added @ref Math::Quaternion::toEuler() and documented how to convert Euler + angles to a quaternion (see [mosra/magnum#397](https://github.com/mosra/magnum/pull/397)) + @subsubsection changelog-latest-new-platform Platform libraries - Cursor management using @ref Platform::Sdl2Application::setCursor(), diff --git a/doc/credits.dox b/doc/credits.dox index 60b6654dc..b43deadbd 100644 --- a/doc/credits.dox +++ b/doc/credits.dox @@ -150,7 +150,7 @@ Are the below lists missing your name or something's wrong? WebGL 2 build fixes - **Marco Melorio** ([\@Melix19](https://github.com/Melix19)) --- iOS test updates and fixes, cursor management in @ref Platform::Sdl2Application and - @ref Platform::GlfwApplication, doc fixes + @ref Platform::GlfwApplication, Math library additions and doc fixes - **Max Schwarz** ([\@xqms](https://github.com/xqms)) --- `Any*` plugin improvements, fixes in the @ref GL library - **Michael Tao** ([\@mtao](https://github.com/mtao)) --- Gentoo build fixes diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index e2b634390..a270e210f 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -401,14 +401,14 @@ template class Quaternion { /** * @brief Convert to an euler vector + * @m_since_latest * - * Expects that the quaternion is normalized and that the values - * are combined in ZYX order. - * The returned vector of radians is in XYZ order. - * @see @ref rotation(), @ref DualQuaternion::rotation() - * To convert the euler angles back to the Quaternion you can use: + * Expects that the quaternion is normalized. Returs the angles in an + * XYZ order, you can combine them back to a quaternion like this: * * @snippet MagnumMath.cpp Quaternion-fromEuler + * + * @see @ref rotation(), @ref DualQuaternion::rotation() */ Vector3> toEuler() const; diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 58d0216b3..fc56beca4 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -559,7 +559,7 @@ void QuaternionTest::matrixNotOrthogonal() { } void QuaternionTest::euler() { - Quaternion a = Quaternion({0.35f, 0.134f, 0.37f}, 0.02f).normalized(); + Quaternion a = Quaternion{{0.35f, 0.134f, 0.37f}, 0.02f}.normalized(); Math::Vector3 b{1.59867_radf, -1.15100_radf, 1.85697_radf}; CORRADE_COMPARE(a.toEuler(), b); @@ -568,7 +568,7 @@ void QuaternionTest::euler() { Quaternion::rotation(b.y(), Vector3::yAxis())* Quaternion::rotation(b.x(), Vector3::xAxis())); - Quaternion a2 = Quaternion({-0.624252f, -0.331868f, -0.624468f}, 0.331983f); + Quaternion a2{{-0.624252f, -0.331868f, -0.624468f}, 0.331983f}; Math::Vector3 b2{0.0_radf, -1.57045_radf, -2.16434_radf}; CORRADE_COMPARE(a2.toEuler(), b2);