[eigen] Re: RotationBase times DiagonalMatrix |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Re: RotationBase times DiagonalMatrix
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Tue, 2 Aug 2011 08:09:23 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=zVobDsYk/2wZHbe1QVu6ZjaHXuK4sIgS7UFgVp8Xr34=; b=ci4PdvP01JtC+5IHRVZakIMsd8pYvGeDVGeaHyBuxjetFDtM5/+RgqYgFkNJ5H3Mcg YCDGEK3petPfB4gp1MUOkTdxm8Oz775kdgIJB3aiZnD4/AyKu+qfaL1w3tLdeZSD8kSq eRbIwHxJ/grHkcRxMfkt/HGiONYlSFr+4howM=
Guys, does anybody have an opinion on this?
- Hauke
On Wed, Jul 27, 2011 at 2:49 PM, Hauke Heibel
<hauke.heibel@xxxxxxxxxxxxxx> wrote:
> 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
>