Transform concatenation fails with THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS

Submitted by Ferdinand Beyer

Assigned to Nobody

Link to original bugzilla bug (#487)
Version: 3.1

Description

The following code fails to compile because of the static assertion THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS:

Affine2f a = Translation2f(Vector2f(1, 1)) *  
             Rotation2Df(-0.5f) *  
             Scaling(2.0f);  

Origin in Geometry/Transform.h, line 809:

Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::scale(Scalar s)
{
EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)

I guess that (Translation * Rotation) yields a temporary isometry, and this cannot be scaled.

My current workaround is to switch the order of rotation and scaling:

Affine2f a = Translation2f(Vector2f(1, 1)) *  
             Scaling(2.0f) *  
             Rotation2Df(-0.5f); 
Edited by Eigen Bugzilla