diff options
Diffstat (limited to 'Eigen/src/Geometry/Rotation2D.h')
-rw-r--r-- | Eigen/src/Geometry/Rotation2D.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Eigen/src/Geometry/Rotation2D.h b/Eigen/src/Geometry/Rotation2D.h index 1cac343a5..4feb3d4d2 100644 --- a/Eigen/src/Geometry/Rotation2D.h +++ b/Eigen/src/Geometry/Rotation2D.h @@ -59,7 +59,10 @@ protected: public: /** Construct a 2D counter clock wise rotation from the angle \a a in radian. */ - inline Rotation2D(const Scalar& a) : m_angle(a) {} + explicit inline Rotation2D(const Scalar& a) : m_angle(a) {} + + /** Default constructor wihtout initialization. The represented rotation is undefined. */ + Rotation2D() {} /** \returns the rotation angle */ inline Scalar angle() const { return m_angle; } @@ -68,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) @@ -81,16 +84,16 @@ public: /** Applies the rotation to a 2D vector */ Vector2 operator* (const Vector2& vec) const { return toRotationMatrix() * vec; } - + template<typename Derived> Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m); - Matrix2 toRotationMatrix(void) const; + Matrix2 toRotationMatrix() const; /** \returns the spherical interpolation between \c *this and \a other using * 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 * |