Add unit tests for Rotation2D's inverse(), operator*, slerp, and fix regression wrt explicit ctor change

This commit is contained in:
Gael Guennebaud
2014-10-20 11:04:32 +02:00
parent d04f23260d
commit b4a9b3f496
2 changed files with 17 additions and 6 deletions

View File

@@ -71,11 +71,11 @@ public:
inline Scalar& angle() { return m_angle; }
/** \returns the inverse rotation */
inline Rotation2D inverse() const { return -m_angle; }
inline Rotation2D inverse() const { return Rotation2D(-m_angle); }
/** Concatenates two rotations */
inline Rotation2D operator*(const Rotation2D& other) const
{ return m_angle + other.m_angle; }
{ return Rotation2D(m_angle + other.m_angle); }
/** Concatenates two rotations */
inline Rotation2D& operator*=(const Rotation2D& other)
@@ -93,7 +93,7 @@ public:
* parameter \a t. It is in fact equivalent to a linear interpolation.
*/
inline Rotation2D slerp(const Scalar& t, const Rotation2D& other) const
{ return m_angle * (1-t) + other.angle() * t; }
{ return Rotation2D(m_angle * (1-t) + other.angle() * t); }
/** \returns \c *this with scalar type casted to \a NewScalarType
*