Message 1 of 2
FbxQuaternion.ComposeSphericalXYZ() and FbxAMatrix.GetQ() give different results

Not applicable
10-17-2019
09:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For a given input quaternion, if I convert to Euler angles and then back again I sometimes get different answers depending on which method I use.
For example, if I run the following code using the Python 2.7 SDK bindings:
import FbxCommon quat_in = FbxCommon.FbxQuaternion( 0.10852469361474122, 0.10345202623008598, 0.988614142779236, 0.01273364997133784) # Convert to Euler XYZ euler = quat_in.DecomposeSphericalXYZ() # Convert back to quat using ComposeSpherical() quat_out_compose = FbxCommon.FbxQuaternion() quat_out_compose.ComposeSphericalXYZ( euler ) # Convert back to quat using GetQ() amat = FbxCommon.FbxAMatrix() amat.SetR( euler ) quat_out_getq = amat.GetQ() print("quat_in: ", list(quat_in)) print("quat_out_compose: ", list(quat_out_compose)) print("quat_out_getq: ", list(quat_out_getq))
I get this output:
('quat_in: ', [0.10852469361474122, 0.10345202623008598, 0.988614142779236, 0.01273364997133784]) ('quat_out_compose: ', [0.10852469361474362, 0.10345202623008602, 0.9886141427792358, 0.012733649971338119]) ('quat_out_getq: ', [0.13700585122690487, -0.0873827401610901, 0.9647038615115937, -0.20721996292864864])
Shouldn't these match? This is an issue for me because my files are being read by a program that uses GetQ() and the resulting animations are incorrect.