diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 5e42327e4..8494c5552 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -40,7 +40,7 @@ template struct ei_aligned_array ei_aligned_array() { - ei_assert(reinterpret_cast(array)%16 == 0 + ei_assert((reinterpret_cast(array) & 0xf) == 0 && "this assertion is explained here: http://eigen.tuxfamily.org/api/UnalignedArrayAssert.html **** READ THIS WEB PAGE !!! ****"); } }; diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index 00cc8e47a..6ae49e90f 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -100,6 +100,11 @@ public: inline Transform(const Transform& other) { m_matrix = other.m_matrix; } + inline explicit Transform(const TranslationType& t) { *this = t; } + inline explicit Transform(const ScalingType& s) { *this = s; } + template + inline explicit Transform(const RotationBase& r) { *this = r; } + inline Transform& operator=(const Transform& other) { m_matrix = other.m_matrix; return *this; } @@ -226,8 +231,8 @@ public: return res; } -// template -// inline Transform& operator=(const Rotation& t); + template + inline Transform& operator=(const RotationBase& r); template inline Transform& operator*=(const RotationBase& r) { return rotate(r.toRotationMatrix()); } template @@ -523,8 +528,10 @@ Transform::preshear(Scalar sx, Scalar sy) template inline Transform& Transform::operator=(const TranslationType& t) { - setIdentity(); + linear().setIdentity; translation() = t.vector(); + m_matrix.template block<1,Dim>(Dim,0).setZero(); + m_matrix(Dim,Dim) = Scalar(1); return *this; } @@ -553,6 +560,17 @@ inline Transform Transform::operator*(const ScalingType& return res; } +template +template +inline Transform& Transform::operator=(const RotationBase& r) +{ + linear() = ei_toRotationMatrix(r); + translation().setZero(); + m_matrix.template block<1,Dim>(Dim,0).setZero(); + m_matrix(Dim,Dim) = Scalar(1); + return *this; +} + template template inline Transform Transform::operator*(const RotationBase& r) const @@ -617,8 +635,8 @@ Transform::fromPositionOrientationScale(const MatrixBase(orientation); linear() *= scale.asDiagonal(); translation() = position; - m_matrix(Dim,Dim) = 1.; m_matrix.template block<1,Dim>(Dim,0).setZero(); + m_matrix(Dim,Dim) = Scalar(1); return *this; }