aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Eigen/src/Geometry/AngleAxis.h10
-rw-r--r--test/geo_transformations.cpp4
2 files changed, 14 insertions, 0 deletions
diff --git a/Eigen/src/Geometry/AngleAxis.h b/Eigen/src/Geometry/AngleAxis.h
index da698bbfe..284c60a74 100644
--- a/Eigen/src/Geometry/AngleAxis.h
+++ b/Eigen/src/Geometry/AngleAxis.h
@@ -189,6 +189,16 @@ AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const MatrixBase<Derived>& mat)
return *this = QuaternionType(mat);
}
+/**
+* \brief Sets \c *this from a 3x3 rotation matrix.
+**/
+template<typename Scalar>
+template<typename Derived>
+AngleAxis<Scalar>& AngleAxis<Scalar>::fromRotationMatrix(const MatrixBase<Derived>& mat)
+{
+ return *this = QuaternionType(mat);
+}
+
/** Constructs and \returns an equivalent 3x3 rotation matrix.
*/
template<typename Scalar>
diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp
index fc542e71b..895fe0f08 100644
--- a/test/geo_transformations.cpp
+++ b/test/geo_transformations.cpp
@@ -85,6 +85,10 @@ template<typename Scalar, int Mode> void transformations(void)
VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1);
VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
+ aa.fromRotationMatrix(aa.toRotationMatrix());
+ VERIFY_IS_APPROX(q1 * v1, Quaternionx(aa) * v1);
+ VERIFY_IS_NOT_APPROX(q1 * v1, Quaternionx(AngleAxisx(aa.angle()*2,aa.axis())) * v1);
+
// AngleAxis
VERIFY_IS_APPROX(AngleAxisx(a,v1.normalized()).toRotationMatrix(),
Quaternionx(AngleAxisx(a,v1.normalized())).toRotationMatrix());