diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-21 20:24:23 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-06-21 20:31:45 +0300 |
commit | b665ad8621a0db265fd666542d26aed463025db1 (patch) | |
tree | 163a137c4e79735ca84a0cf3cfb8fe522ddc27e9 /source/blender/blenlib/intern | |
parent | 41af27c582ec21e65ff3f835754c7b0bcf6d3be7 (diff) |
Fix T89291: Objects with rotation deltas don't rotate in correct axes
Quaternion correction was not implemented and Euler values were being
incorrectly combined.
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 57fe99ce019..469cd573372 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1924,6 +1924,31 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order gmat[R->axis[2]][R->axis[2]] = 1; } +void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order) +{ + float quat[4], quat_b[4]; + + eulO_to_quat(quat, a, order); + eulO_to_quat(quat_b, b, order); + + mul_qt_qtqt(quat, quat_b, quat); + + quat_to_eulO(r_eul, order, quat); +} + +void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order) +{ + float quat[4], quat_b[4]; + + eulO_to_quat(quat, a, order); + eulO_to_quat(quat_b, b, order); + + invert_qt_normalized(quat_b); + mul_qt_qtqt(quat, quat_b, quat); + + quat_to_eulO(r_eul, order, quat); +} + /******************************* Dual Quaternions ****************************/ /** |