Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiplying Transform and Matrix types in Eigen

To me this should just work, so the fact it does not, almost certainly means I am the one in the wrong. Even though in principle a Transform< double, 3, Affine > is the same as a Matrix< double, 4, 4 >, they cannot be used together sensibly:

Affine3d rotMat( AngleAxisd( 45.0, ( Vector3d() << 0.0, 1.0, 0.0 ).finished() ) );
Matrix4d m;
m << 1.0, 0.0, 0.0, 6.0,
     0.0, 1.0, 0.0, 6.0,
     0.0, 0.0, 1.0, 6.0,
     0.0, 0.0, 0.0, 1.0;

m = m * rotMat;

Results in a 'no match for operator=' error on the last line, and the in-place multiplication operator results in the same, trying to initialise a Matrix4d with Affine3d does not work either. Does anybody know how to actually use the Transform class in any useful way?

Thanks, Cam

like image 609
cmannett85 Avatar asked Jul 15 '11 20:07

cmannett85


1 Answers

Just write:

m = m * rotMat.matrix();

I don't know if it is an oversight that Eigen doesn't define this multiplication implicitly or if it might interfere with other use cases of the library.

like image 193
antonakos Avatar answered Nov 10 '22 00:11

antonakos