开发者

Multiplying Transform and Matrix types in Eigen

开发者 https://www.devze.com 2023-03-21 02:52 出处:网络
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,

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号