[eigen] RotationBase times DiagonalMatrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

the following code does not compile on my system:

  Rotation2D<double>(M_PI/2) * DiagonalMatrix<double,2>(-1.0,1.0)

Adding a)

inline RotationMatrixType operator*(const DiagonalMatrix<Scalar,Dim>& s) const
{ return toRotationMatrix() * s; }

to RotationBase resolves this issue and its basically the same as what
we do for UniformScaling. Alternatively, b) is possible too:

inline Transform<Scalar,Dim,AffineCompact> operator*(const
DiagonalMatrix<Scalar,Dim>& s) const
{ return Transform<Scalar,Dim,AffineCompact>(*this) * s; }

I want to add, that I am still not 100% happy with the use patterns of
such transformations. E.g.

AffineCompact2d a = Rotation2D<double>(M_PI) * Translation2f(x,y);

compiles, whereas

AffineCompact2d a = Rotation2D<double>(M_PI/2) * Scaling(-1.0,1.0);

does not with implementation a) but it does with implementation b).

I would prefer implementation b) and I would also like to change right
away UniformScaling such that it accepts a
Transform<Scalar,Dim,AffineCompact>.

It is also a little bit strange, that this code works

AffineCompact2d a = Rotation2D<double>(M_PI) * Translation2f(x,y);

and this does not

AffineCompact2d a = Rotation2D<double>(M_PI);

I think I understand the reasoning behind the explicit constructors
but on the other hand-side I am not sure whether potential temporaries
hurt more than the kind of awkward usage pattern. I mean these are all
tiny stack objects, right?

Any comments would be really great, so I can act quickly. :)

- Hauke



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/