mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
Add missing Rotation2D::operator=(Matrix2x2)
This commit is contained in:
parent
d2d4c45d55
commit
1562e13aba
@ -64,6 +64,16 @@ public:
|
|||||||
/** Default constructor wihtout initialization. The represented rotation is undefined. */
|
/** Default constructor wihtout initialization. The represented rotation is undefined. */
|
||||||
Rotation2D() {}
|
Rotation2D() {}
|
||||||
|
|
||||||
|
/** Construct a 2D rotation from a 2x2 rotation matrix \a mat.
|
||||||
|
*
|
||||||
|
* \sa fromRotationMatrix()
|
||||||
|
*/
|
||||||
|
template<typename Derived>
|
||||||
|
explicit Rotation2D(const MatrixBase<Derived>& m)
|
||||||
|
{
|
||||||
|
fromRotationMatrix(m.derived());
|
||||||
|
}
|
||||||
|
|
||||||
/** \returns the rotation angle */
|
/** \returns the rotation angle */
|
||||||
inline Scalar angle() const { return m_angle; }
|
inline Scalar angle() const { return m_angle; }
|
||||||
|
|
||||||
@ -103,6 +113,17 @@ public:
|
|||||||
Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m);
|
Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m);
|
||||||
Matrix2 toRotationMatrix() const;
|
Matrix2 toRotationMatrix() const;
|
||||||
|
|
||||||
|
/** Set \c *this from a 2x2 rotation matrix \a mat.
|
||||||
|
* In other words, this function extract the rotation angle from the rotation matrix.
|
||||||
|
*
|
||||||
|
* This method is an alias for fromRotationMatrix()
|
||||||
|
*
|
||||||
|
* \sa fromRotationMatrix()
|
||||||
|
*/
|
||||||
|
template<typename Derived>
|
||||||
|
Rotation2D& operator=(const MatrixBase<Derived>& m)
|
||||||
|
{ return fromRotationMatrix(m.derived()); }
|
||||||
|
|
||||||
/** \returns the spherical interpolation between \c *this and \a other using
|
/** \returns the spherical interpolation between \c *this and \a other using
|
||||||
* parameter \a t. It is in fact equivalent to a linear interpolation.
|
* parameter \a t. It is in fact equivalent to a linear interpolation.
|
||||||
*/
|
*/
|
||||||
|
@ -430,6 +430,10 @@ template<typename Scalar, int Mode, int Options> void transformations()
|
|||||||
VERIFY( rot2.smallestAngle() >= -Scalar(EIGEN_PI) );
|
VERIFY( rot2.smallestAngle() >= -Scalar(EIGEN_PI) );
|
||||||
VERIFY( rot2.smallestAngle() <= Scalar(EIGEN_PI) );
|
VERIFY( rot2.smallestAngle() <= Scalar(EIGEN_PI) );
|
||||||
VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot2.angle()) );
|
VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot2.angle()) );
|
||||||
|
|
||||||
|
Matrix<Scalar,2,2> rot2_as_mat(rot2);
|
||||||
|
Rotation2D<Scalar> rot3(rot2_as_mat);
|
||||||
|
VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()), angleToVec(rot3.angle()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
s0 = internal::random<Scalar>(-100,100);
|
s0 = internal::random<Scalar>(-100,100);
|
||||||
|
Loading…
Reference in New Issue
Block a user