From 1df54e3ac23780cd67c91c50f27052199902f81f Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sat, 19 Sep 2009 19:59:49 -0400 Subject: [PATCH] fix bug #42, add missing Transform::Identity() --- Eigen/src/Geometry/Transform.h | 4 ++++ test/geo_transformations.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index dcb41435b..e89581e21 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -345,6 +345,10 @@ public: /** \sa MatrixBase::setIdentity() */ void setIdentity() { m_matrix.setIdentity(); } + static const typename MatrixType::IdentityReturnType Identity() + { + return MatrixType::Identity(); + } template inline Transform& scale(const MatrixBase &other); diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 2b05f2457..23b297314 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -102,7 +102,14 @@ template void transformations(void) a = ei_random(-Scalar(0.4)*Scalar(M_PI), Scalar(0.4)*Scalar(M_PI)); q1 = AngleAxisx(a, v0.normalized()); Transform3 t0, t1, t2; + + // first test setIdentity() and Identity() t0.setIdentity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + t0.matrix().setZero(); + t0 = Transform3::Identity(); + VERIFY_IS_APPROX(t0.matrix(), Transform3::MatrixType::Identity()); + t0.linear() = q1.toRotationMatrix(); t1.setIdentity(); t1.linear() = q1.toRotationMatrix();