aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-08-24 21:25:04 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-08-24 21:25:04 +0000
commit124ec71c50b8a5dd8e2ebd3590e067367d1040a5 (patch)
tree20227a93661cd0c4a1d02a7d5dc4bffda6ffc6a0 /Eigen
parentbf31d81aac6e5fcec4e8f3ac0bd626b7fb249417 (diff)
allow constructing Transform from small-matrix (like fromPosOrientScale
but with trivial Pos and Scale)
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Geometry/Transform.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h
index 1b68a37e5..65d52b51d 100644
--- a/Eigen/src/Geometry/Transform.h
+++ b/Eigen/src/Geometry/Transform.h
@@ -89,10 +89,19 @@ public:
inline Transform& operator=(const Transform& other)
{ m_matrix = other.m_matrix; return *this; }
- /** Constructs and initializes a transformation from a (Dim+1)^2 matrix. */
+ /** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
template<typename OtherDerived>
inline explicit Transform(const MatrixBase<OtherDerived>& other)
- { m_matrix = other; }
+ {
+ if(OtherDerived::RowsAtCompileTime == Dim)
+ {
+ linear() = other;
+ translation().setZero();
+ m_matrix(Dim,Dim) = Scalar(1);
+ m_matrix.template block<1,Dim>(Dim,0).setZero();
+ }
+ else m_matrix = other;
+ }
/** Set \c *this from a (Dim+1)^2 matrix. */
template<typename OtherDerived>