[eigen] RotationBase times DiagonalMatrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] RotationBase times DiagonalMatrix
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2011 14:49:54 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=OFreRPpX5vUR4pHcKhA9Qg1kCYsjVQALrFdfdjNZyF0=; b=tN27bN1+cU/MNQK1vxE8fdLm2xi+LFDYZOAvbRp7XqzKrtCIunh7b4IIKX/SJpF0Ta f2DwgmqnsSuN0JhpdpubNyfz92XV9hmKfH/VBNSyvcOmoaOpb0gnwNDIBcgvCJWOZ1p/ OcpohQ8fYyc1hWele2IMwjDvzlO+j9pGdV/R4=
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