Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Eigen::Matrix4f to Eigen::Affine3f [closed]

Tags:

c++

eigen

I want to convert a matrix from Eigen::Matrix4f to Eigen::Affine3f Any one help?

Thanks

like image 942
Vincent 炜森 Avatar asked Dec 09 '15 11:12

Vincent 炜森


2 Answers

Eigen::Affine3f is a typedef of Eigen::Transform<float, 3, Eigen::Affine>. According to the reference, the type has a member function MatrixType & matrix () which gives you matrix interface.

Eigen::Matrix4f a;
Eigen::Affine3f b;
b.matrix() = a;
like image 161
akakatak Avatar answered Nov 15 '22 23:11

akakatak


operator= will do:

Matrix4f M;
Affine3f F;
F = M;
like image 41
ggael Avatar answered Nov 15 '22 22:11

ggael