Multiplying Transform and Matrix types in Eigen

余生长醉 提交于 2019-12-08 17:54:28

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/6712867/multiplying-transform-and-matrix-types-in-eigen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!