PDA

View Full Version : Quaternions from matrix?



09-10-2000, 10:03 PM
Hi,

Do u know an algorithm to convert a matrix to a quaternion?

PeterFromRussia
09-11-2000, 10:35 AM
Only orthogonal matrix A can be converted.
You have to find vector v=<x,y,z> such that

Av=v, &#0124; &#0124;v&#0124; &#0124; =1


So A is a rotation around v.
You have to find angle (alpha) of rotation.

Quaternion you want to find is given by:
q=< cos(alpha/2.),
x*sin(alpha/2.),
y*sin(alpha/2.),
z*sin(alpha/2.)>