This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Quaterniond from Matrix4d and vice-versa

Tags: None
(comma "," separated)
rbraga.pce
Registered Member
Posts
2
Karma
0
How can i create a "Quaterniond from Matrix4d" and "Matrix4d from Quaterniond"?

Is there any "cast" or something like this?
Else, How can i make it?

Thank you.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
you have to extract the linear part and be sure it represents a pure rotation, if so then you can do:

quat = mat44.topLeftCorner<3,3>();

otherwise you have to perform a polar decomposition to extract the rotational part:

Matrix3d mat33;
Afffine3d aff = mat44;
aff.computeRotationScaling(&mat33, 0);
quat = mat33;

see: http://eigen.tuxfamily.org/dox/classEig ... 8581d23227
rbraga.pce
Registered Member
Posts
2
Karma
0
Thank you. Works perfectly.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]