Math/Angle: Fix implicit conversion to Euler Angles/Quaternion

This commit is contained in:
Jérôme Leclercq
2018-09-06 13:24:29 +02:00
parent 8bcb8756f9
commit 46008531e0
6 changed files with 63 additions and 31 deletions

View File

@@ -39,6 +39,18 @@ namespace Nz
Set(W, X, Y, Z);
}
/*!
* \brief Constructs a Quaternion object from an angle
*
* \param angle Angle representing a 2D rotation
*/
template<typename T>
template<AngleUnit Unit>
Quaternion<T>::Quaternion(const Angle<Unit, T>& angle)
{
Set(angle);
}
/*!
* \brief Constructs a Quaternion object from a EulerAngles
*
@@ -46,7 +58,6 @@ namespace Nz
*
* \see EulerAngles
*/
template<typename T>
Quaternion<T>::Quaternion(const EulerAngles<T>& angles)
{
@@ -343,6 +354,21 @@ namespace Nz
return *this;
}
/*!
* \brief Sets this quaternion from a 2D rotation specified by an Angle
* \return A reference to this quaternion
*
* \param angle 2D angle
*
* \see Angle
*/
template<typename T>
template<AngleUnit Unit>
Quaternion<T>& Quaternion<T>::Set(const Angle<Unit, T>& angle)
{
return Set(angle.ToQuaternion());
}
/*!
* \brief Sets this quaternion from rotation specified by Euler angle
* \return A reference to this quaternion
@@ -351,7 +377,6 @@ namespace Nz
*
* \see EulerAngles
*/
template<typename T>
Quaternion<T>& Quaternion<T>::Set(const EulerAngles<T>& angles)
{
@@ -886,3 +911,4 @@ std::ostream& operator<<(std::ostream& out, const Nz::Quaternion<T>& quat)
#undef F
#include <Nazara/Core/DebugOff.hpp>
#include "Quaternion.hpp"