fix compilation of transform * scaling

This commit is contained in:
Gael Guennebaud 2010-11-19 14:45:45 +01:00
parent 3e99356b59
commit 3f24dbf6f5
2 changed files with 7 additions and 4 deletions

View File

@ -46,6 +46,7 @@ class DiagonalBase : public EigenBase<Derived>
}; };
typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime> DenseMatrixType; typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime> DenseMatrixType;
typedef DiagonalMatrix<Scalar,DiagonalVectorType::SizeAtCompileTime,DiagonalVectorType::MaxSizeAtCompileTime> PlainObject;
inline const Derived& derived() const { return *static_cast<const Derived*>(this); } inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
inline Derived& derived() { return *static_cast<Derived*>(this); } inline Derived& derived() { return *static_cast<Derived*>(this); }

View File

@ -380,10 +380,11 @@ public:
* product results in a Transform of the same type (mode) as the lhs only if the lhs * product results in a Transform of the same type (mode) as the lhs only if the lhs
* mode is no isometry. In that case, the returned transform is an affinity. * mode is no isometry. In that case, the returned transform is an affinity.
*/ */
friend inline const Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> template<typename DiagonalDerived>
operator * (const Transform &a, const DiagonalMatrix<Scalar,Dim> &b) inline const Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)>
operator * (const DiagonalBase<DiagonalDerived> &b) const
{ {
Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> res(a); Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> res(*this);
res.linear() *= b; res.linear() *= b;
return res; return res;
} }
@ -394,8 +395,9 @@ public:
* product results in a Transform of the same type (mode) as the lhs only if the lhs * product results in a Transform of the same type (mode) as the lhs only if the lhs
* mode is no isometry. In that case, the returned transform is an affinity. * mode is no isometry. In that case, the returned transform is an affinity.
*/ */
template<typename DiagonalDerived>
friend inline const Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> friend inline const Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)>
operator * (const DiagonalMatrix<Scalar,Dim> &a, const Transform &b) operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
{ {
Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> res; Transform<Scalar,Dim,((Mode==(int)Isometry)?Affine:(int)Mode)> res;
res.linear().noalias() = a*b.linear(); res.linear().noalias() = a*b.linear();