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

@@ -50,12 +50,23 @@ namespace Nz
Set(angles);
}
/*!
* \brief Constructs a EulerAngles object from an angle
*
* \param angle Angle representing a 2D rotation
*/
template<typename T>
template<AngleUnit Unit>
EulerAngles<T>::EulerAngles(const Angle<Unit, T>& angle)
{
Set(angle);
}
/*!
* \brief Constructs a EulerAngles object from a quaternion
*
* \param quat Quaternion representing a rotation of space
*/
template<typename T>
EulerAngles<T>::EulerAngles(const Quaternion<T>& quat)
{
@@ -142,13 +153,28 @@ namespace Nz
return *this;
}
/*!
* \brief Sets the components of the euler angle from a 2D rotation specified by an Angle
* \return A reference to this euler angle
*
* \param angle 2D angle
*
* \see Angle
*/
template<typename T>
template<AngleUnit Unit>
EulerAngles<T>& EulerAngles<T>::Set(const Angle<Unit, T>& angle)
{
return Set(angle.ToEulerAngles());
}
/*!
* \brief Sets the components of the euler angle from another euler angle
* \return A reference to this euler angle
*
* \param angles The other euler angle
*/
template<typename T>
EulerAngles<T>& EulerAngles<T>::Set(const EulerAngles& angles)
{
@@ -394,3 +420,4 @@ std::ostream& operator<<(std::ostream& out, const Nz::EulerAngles<T>& angles)
#undef F
#include <Nazara/Core/DebugOff.hpp>
#include "EulerAngles.hpp"