mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 04:35:57 +08:00
fix compilation with old, and future gcc
This commit is contained in:
parent
3e4307d8a8
commit
14691d6836
@ -634,7 +634,8 @@ template<typename Derived> class MatrixBase
|
|||||||
NestByValue<StartMinusOne> > HNormalizedReturnType;
|
NestByValue<StartMinusOne> > HNormalizedReturnType;
|
||||||
|
|
||||||
const HNormalizedReturnType hnormalized() const;
|
const HNormalizedReturnType hnormalized() const;
|
||||||
const Homogeneous<Derived,MatrixBase<Derived>::ColsAtCompileTime==1?Vertical:Horizontal> homogeneous() const;
|
typedef Homogeneous<Derived,MatrixBase<Derived>::ColsAtCompileTime==1?Vertical:Horizontal> HomogeneousReturnType;
|
||||||
|
const HomogeneousReturnType homogeneous() const;
|
||||||
|
|
||||||
/////////// Sparse module ///////////
|
/////////// Sparse module ///////////
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ template<typename MatrixType,int Direction> class Homogeneous
|
|||||||
* \sa class Homogeneous
|
* \sa class Homogeneous
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Homogeneous<Derived,MatrixBase<Derived>::ColsAtCompileTime==1?Vertical:Horizontal>
|
inline const typename MatrixBase<Derived>::HomogeneousReturnType
|
||||||
MatrixBase<Derived>::homogeneous() const
|
MatrixBase<Derived>::homogeneous() const
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
|
||||||
|
@ -49,6 +49,14 @@ struct ei_transform_left_product_impl;
|
|||||||
|
|
||||||
template<typename Lhs,typename Rhs> struct ei_transform_transform_product_impl;
|
template<typename Lhs,typename Rhs> struct ei_transform_transform_product_impl;
|
||||||
|
|
||||||
|
template< typename Other,
|
||||||
|
int Mode,
|
||||||
|
int Dim,
|
||||||
|
int HDim,
|
||||||
|
int OtherRows=Other::RowsAtCompileTime,
|
||||||
|
int OtherCols=Other::ColsAtCompileTime>
|
||||||
|
struct ei_transform_construct_from_matrix;
|
||||||
|
|
||||||
/** \geometry_module \ingroup Geometry_Module
|
/** \geometry_module \ingroup Geometry_Module
|
||||||
*
|
*
|
||||||
* \class Transform
|
* \class Transform
|
||||||
@ -205,75 +213,20 @@ public:
|
|||||||
inline Transform& operator=(const Transform& other)
|
inline Transform& operator=(const Transform& other)
|
||||||
{ m_matrix = other.m_matrix; return *this; }
|
{ m_matrix = other.m_matrix; return *this; }
|
||||||
|
|
||||||
template<typename OtherDerived, bool IsCompact, int _Rows, int _Cols>
|
|
||||||
struct construct_from_matrix;
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, false, Dim, Dim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{
|
|
||||||
transform->linear() = other;
|
|
||||||
transform->translation().setZero();
|
|
||||||
transform->makeAffine();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, true, Dim, Dim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{
|
|
||||||
transform->linear() = other;
|
|
||||||
transform->translation().setZero();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, false, Dim, HDim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{
|
|
||||||
transform->affine() = other;
|
|
||||||
transform->makeAffine();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, true, Dim, HDim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{ transform->affine() = other; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, false, HDim, HDim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{ transform->matrix() = other; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename OtherDerived> struct construct_from_matrix<OtherDerived, true, HDim, HDim>
|
|
||||||
{
|
|
||||||
static inline void run(Transform *transform, const MatrixBase<OtherDerived>& other)
|
|
||||||
{ transform->matrix() = other.template block<Dim,HDim>(0,0); }
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef ei_transform_take_affine_part<Transform> take_affine_part;
|
typedef ei_transform_take_affine_part<Transform> take_affine_part;
|
||||||
|
|
||||||
/** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
|
/** Constructs and initializes a transformation from a Dim^2 or a (Dim+1)^2 matrix. */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline explicit Transform(const MatrixBase<OtherDerived>& other)
|
inline explicit Transform(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
construct_from_matrix<OtherDerived,
|
ei_transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
|
||||||
int(Mode)==int(AffineCompact),
|
|
||||||
int(OtherDerived::RowsAtCompileTime),
|
|
||||||
int(OtherDerived::ColsAtCompileTime)>::run(this, other);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set \c *this from a Dim^2 or (Dim+1)^2 matrix. */
|
/** Set \c *this from a Dim^2 or (Dim+1)^2 matrix. */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
inline Transform& operator=(const MatrixBase<OtherDerived>& other)
|
inline Transform& operator=(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
construct_from_matrix<OtherDerived,
|
ei_transform_construct_from_matrix<OtherDerived,Mode,Dim,HDim>::run(this, other.derived());
|
||||||
int(Mode)==int(AffineCompact),
|
|
||||||
int(OtherDerived::RowsAtCompileTime),
|
|
||||||
int(OtherDerived::ColsAtCompileTime)>::run(this, other);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,10 +235,7 @@ public:
|
|||||||
{
|
{
|
||||||
ei_assert(OtherMode!=Projective && "You cannot directly assign a projective transform to an affine one.");
|
ei_assert(OtherMode!=Projective && "You cannot directly assign a projective transform to an affine one.");
|
||||||
typedef typename Transform<Scalar,Dim,OtherMode>::MatrixType OtherMatrixType;
|
typedef typename Transform<Scalar,Dim,OtherMode>::MatrixType OtherMatrixType;
|
||||||
construct_from_matrix<OtherMatrixType,
|
ei_transform_construct_from_matrix<OtherMatrixType,Mode,Dim,HDim>::run(this, other.matrix());
|
||||||
int(Mode)==int(AffineCompact),
|
|
||||||
int(OtherMatrixType::RowsAtCompileTime),
|
|
||||||
int(OtherMatrixType::ColsAtCompileTime)>::run(this, other.matrix());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename OtherDerived,typename OtherEvalType>
|
template<typename OtherDerived,typename OtherEvalType>
|
||||||
@ -958,6 +908,10 @@ Transform<Scalar,Dim,Mode>::inverse(TransformTraits hint) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************
|
||||||
|
*** Specializations of take affine part ***
|
||||||
|
*****************************************************/
|
||||||
|
|
||||||
template<typename TransformType> struct ei_transform_take_affine_part {
|
template<typename TransformType> struct ei_transform_take_affine_part {
|
||||||
typedef typename TransformType::MatrixType MatrixType;
|
typedef typename TransformType::MatrixType MatrixType;
|
||||||
typedef typename TransformType::AffinePart AffinePart;
|
typedef typename TransformType::AffinePart AffinePart;
|
||||||
@ -974,6 +928,45 @@ struct ei_transform_take_affine_part<Transform<Scalar,Dim,AffineCompact> > {
|
|||||||
static inline const MatrixType& run(const MatrixType& m) { return m; }
|
static inline const MatrixType& run(const MatrixType& m) { return m; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************
|
||||||
|
*** Specializations of construct from matix ***
|
||||||
|
*****************************************************/
|
||||||
|
|
||||||
|
template<typename Other, int Mode, int Dim, int HDim>
|
||||||
|
struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,Dim>
|
||||||
|
{
|
||||||
|
static inline void run(Transform<typename ei_traits<Other>::Scalar,Dim,Mode> *transform, const Other& other)
|
||||||
|
{
|
||||||
|
transform->linear() = other;
|
||||||
|
transform->translation().setZero();
|
||||||
|
transform->makeAffine();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Other, int Mode, int Dim, int HDim>
|
||||||
|
struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, Dim,HDim>
|
||||||
|
{
|
||||||
|
static inline void run(Transform<typename ei_traits<Other>::Scalar,Dim,Mode> *transform, const Other& other)
|
||||||
|
{
|
||||||
|
transform->affine() = other;
|
||||||
|
transform->makeAffine();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Other, int Mode, int Dim, int HDim>
|
||||||
|
struct ei_transform_construct_from_matrix<Other, Mode,Dim,HDim, HDim,HDim>
|
||||||
|
{
|
||||||
|
static inline void run(Transform<typename ei_traits<Other>::Scalar,Dim,Mode> *transform, const Other& other)
|
||||||
|
{ transform->matrix() = other; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Other, int Dim, int HDim>
|
||||||
|
struct ei_transform_construct_from_matrix<Other, AffineCompact,Dim,HDim, HDim,HDim>
|
||||||
|
{
|
||||||
|
static inline void run(Transform<typename ei_traits<Other>::Scalar,Dim,AffineCompact> *transform, const Other& other)
|
||||||
|
{ transform->matrix() = other.template block<Dim,HDim>(0,0); }
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
*** Specializations of operator* with a MatrixBase ***
|
*** Specializations of operator* with a MatrixBase ***
|
||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user