# Quaternion to axis-angle, or ripping apart a full transform matrix

My game entities currently hold a quaternion for their orientation with the ability to return either a 3X3 full rotation matrix (based on that quaternion), or a full 4X4 transform matrix. though what I have come to find is that I am not able to convert from my matricies to DirectX matricies directly, so my next thought would be to force the conversion by hand. which of the following methods would work best/easiest/accurate?

• take the quaternion, and break it down into the individual axis-aligned rotations
• take either the full rotation matrix, or the full transform matrix and break it down

for either approach it would need to yield the component rotations (theta about X, phi about Y, rho about Z).

I have a feeling that breaking the quaternion down might be the easier rout, but I am not sure as to the actual operations to do this break down.

• Can you elaborate on "I am not able to convert my matrices to DirectX matrices directly"? I'm fairly skeptical of that. Quaternion-to-matrix is definitely the "right" way to do what I think you're trying to do. – John Calsbeek May 6 '12 at 18:17
• I store my matricies for my GameObjects as linear arrays of floats gamedev.stackexchange.com/questions/28625/…, and I currently have no direct conversion from this to DirextX matrix. – gardian06 May 6 '12 at 18:32
• DirectX matrices are linear arrays of floats, as long as you tack on the final [0 0 0 1] row. The D3DXMATRIX class has a constructor that takes an array of floats, as well. – John Calsbeek May 6 '12 at 18:37