Modify Euler angles animation

Started by
3 comments, last by alvaro 2 years, 6 months ago

Hi All

I've rotation angles for a sequence of frame data and/or keyframes I need to multiply all of them by some rotation matrix and store new rotation angles values.The task looks very simple: just use a math function to convert produced matrices to angles. It works but.. not as I need. For examplу if initial rotation were smooth curves - they become broken/disordered after transform and further interpolation is ruined. After experimenting I see the matrix→>euler is an ambiguos operation, For example

vector3 euler = Matrix2Euler(myMatrix);

matrix testM = Euler2Matrix(euler);

Yes, the testM will be equal to initial myMatrix. However

matrix testM = Euler2Matrix(myEuler);

vector3 euler = Matrix2Euler(testM);

The returned "euler" can be far away of original myEuler.

Please suggest a math/theory to solve this

Thx

Advertisement

Some related issues i've had with this:
Original angle curves from key frames use multiples of 360 degrees to keep interpolation smooth, but such information can't be preserved after conversation to matrices / quaternions.
Euler angles use 3 rotations, so there are many angle values which give the same orientation result, which may again break the curve and cause discontinuities if we interpolate euler angles, not the resulting rotations as we should.

I tried to fix this with hacks like adding / subtracting 360 degrees so angles are closer to the previous keyframe, and it helped with some cases but added new issues at other places.
I can't help, but i can say interpolating euler angles is no good idea in general. Even if it works, it won't give you the shortest arc between two orientations, for example.
Do you really need to use euler angles? Could you export quaternion keys instead for example? All problems would just vanish.

JoeJ said:
Do you really need to use euler angles?

Unfortunatel;y - yes, the result angles can be displayed in UI, where is no way to set a matrix/quaternion.

And yes, “non-principal” angles values (out of +/- 180) is another one problem that I ignore for now, want to solve at least for “principal”

If you enforce some limits on your Euler angles, you can map most of the storage of rotations without ambiguity. The remaining problems are constrained to gimbal lock. Not much you can do about those.

This topic is closed to new replies.

Advertisement