diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-23 19:51:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-23 19:51:00 +0300 |
commit | 9d8a01dba195880c4b3bc8a5fb2914881b3abeca (patch) | |
tree | f1c048fb934bad730c4f577862de659dc5490072 /source/blender/blenlib/intern/math_rotation.c | |
parent | d5fb0e517ca998ce39c3c3e46274b91f6d7e5124 (diff) |
BLI_math: add invert_qt_normalized
When the quat is known to be unit length, so we can avoid scaling
(just conjugate_qt which asserts on non unit quats).
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 949473a8d86..0ef3f046202 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -154,6 +154,24 @@ void invert_qt_qt(float q1[4], const float q2[4]) invert_qt(q1); } +/** + * This is just conjugate_qt for cases we know \a q is unit-length. + * we could use #conjugate_qt directly, but use this function to show intent, + * and assert if its ever becomes non-unit-length. + */ +void invert_qt_normalized(float q[4]) +{ + BLI_ASSERT_UNIT_QUAT(q); + conjugate_qt(q); + +} + +void invert_qt_qt_normalized(float q1[4], const float q2[4]) +{ + copy_qt_qt(q1, q2); + invert_qt_normalized(q1); +} + /* simple mult */ void mul_qt_fl(float q[4], const float f) { |