在Eigen中乘以变换和矩阵类型 [英] Multiplying Transform and Matrix types in Eigen
问题描述
对我来说,这应该只是工作,所以事实上它不,几乎肯定意味着我是一个错了。即使原则上,双,3,Affine>与Matrix< double,4,4>,它们不能一起合理地使用:
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;
在最后一行中导致不匹配operator =错误,乘法运算符的结果相同,试图初始化一个Matrix4d与Affine3d也不工作。是否有人知道如何以任何有用的方式实际使用Transform类?
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?
谢谢,
Cam
Thanks, Cam
推荐答案
只要写:
m = m * rotMat.matrix();
我不知道它是否是一个监督,Eigen没有隐式定义这个乘法,它可能会干扰库的其他用例。
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.
这篇关于在Eigen中乘以变换和矩阵类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!