diff --git a/src/Magnum/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h index 545cea56b..a6b487601 100644 --- a/src/Magnum/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -67,6 +67,10 @@ template class DualComplex: public Dual> { * @f[ * \hat c = (\cos(\theta) + i \sin(\theta)) + \epsilon (0 + i0) * @f] + * + * For creating a dual complex number from a rotation @ref Complex, use + * the implicit conversion provided by + * @ref DualComplex(const Complex&, const Complex&). * @see @ref Complex::rotation(), @ref Matrix3::rotation(), * @ref DualQuaternion::rotation() */ @@ -130,6 +134,9 @@ template class DualComplex: public Dual> { * @f[ * \hat c = c_0 + \epsilon c_\epsilon * @f] + * + * This constructor can be also used to implicitly convert a rotation + * complex number to a rotation dual complex number. */ constexpr /*implicit*/ DualComplex(const Complex& real, const Complex& dual = Complex(T(0), T(0))) noexcept: Dual>(real, dual) {} diff --git a/src/Magnum/Math/DualQuaternion.h b/src/Magnum/Math/DualQuaternion.h index fa0f765d2..cd7515998 100644 --- a/src/Magnum/Math/DualQuaternion.h +++ b/src/Magnum/Math/DualQuaternion.h @@ -200,6 +200,10 @@ template class DualQuaternion: public Dual> { * Expects that the rotation axis is normalized. @f[ * \hat q = [\boldsymbol a \cdot \sin(\frac{\theta}{2}), \cos(\frac{\theta}{2})] + \epsilon [\boldsymbol 0, 0] * @f] + * + * For creating a dual quaternion from a rotation @ref Quaternion, use + * the implicit conversion provided by + * @ref DualQuaternion(const Quaternion&, const Quaternion&). * @see @ref rotation() const, @ref Quaternion::rotation(), * @ref Matrix4::rotation(), @ref DualComplex::rotation(), * @ref Vector3::xAxis(), @ref Vector3::yAxis(), @@ -270,6 +274,9 @@ template class DualQuaternion: public Dual> { * @f[ * \hat q = q_0 + \epsilon q_\epsilon * @f] + * + * This constructor can be also used to implicitly convert a rotation + * quaternion to a rotation dual quaternion. */ constexpr /*implicit*/ DualQuaternion(const Quaternion& real, const Quaternion& dual = Quaternion({}, T(0))) noexcept: Dual>(real, dual) {} diff --git a/src/Magnum/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp index cde9029cf..ae304b91a 100644 --- a/src/Magnum/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -395,6 +395,9 @@ void DualComplexTest::rotation() { constexpr DualComplex b({-1.0f, 2.0f}, {}); constexpr Complex c = b.rotation(); CORRADE_COMPARE(c, Complex(-1.0f, 2.0f)); + + /* Conversion from a rotation complex should give the same result */ + CORRADE_COMPARE(DualComplex{Complex::rotation(120.0_degf)}, a); } void DualComplexTest::translation() { diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index 7978e21d6..c5cc451ef 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -434,6 +434,9 @@ void DualQuaternionTest::rotation() { constexpr DualQuaternion b({{-1.0f, 2.0f, 3.0f}, 4.0f}, {}); constexpr Quaternion c = b.rotation(); CORRADE_COMPARE(c, Quaternion({-1.0f, 2.0f, 3.0f}, 4.0f)); + + /* Conversion from a rotation quaternion should give the same result */ + CORRADE_COMPARE(DualQuaternion{Quaternion::rotation(120.0_degf, axis)}, q); } void DualQuaternionTest::rotationNotNormalized() {