diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-02 03:40:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-02 03:40:55 +0300 |
commit | 95df65f1b55d311be4171f71bb106f9c7d193a79 (patch) | |
tree | 9ceafdf50ae1afbb903722ae4979d85ad7dd300f /source/blender/blenlib | |
parent | 19efa4301a5f2545eddfd4e5e56943d9a1d9f5cf (diff) |
- some parts of the code to remove rotation were not removing axis/angle rotation (only functional change of this commit).
- use BLI_math functions for removing rotations from objects and pose channels.
- add unit_axis_angle() to avoid setting the Y axis inline anywhere rotation needs removing.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_rotation.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 8 |
4 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index c3efc64b9d6..7d0b8dfeaf3 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -39,6 +39,7 @@ extern "C" { /* stored in (w, x, y, z) order */ /* init */ +void unit_axis_angle(float axis[3], float *angle); void unit_qt(float q[4]); void copy_qt_qt(float q[4], const float a[4]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5a5d518940d..4d8a4f2bbaf 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -84,6 +84,7 @@ MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f); MINLINE void negate_v3(float r[3]); MINLINE void negate_v3_v3(float r[3], const float a[3]); +MINLINE void negate_v4(float r[4]); MINLINE float dot_v2v2(const float a[2], const float b[2]); MINLINE float dot_v3v3(const float a[3], const float b[3]); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 28a37d9675a..2038121e3f2 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -34,7 +34,17 @@ /* used to test is a quat is not normalized */ #define QUAT_EPSILON 0.0001 -void unit_qt(float *q) +/* convenience, avoids setting Y axis everywhere */ +void unit_axis_angle(float axis[3], float *angle) +{ + axis[0]= 0.0f; + axis[1]= 1.0f; + axis[2]= 0.0f; + *angle= 0.0f; +} + + +void unit_qt(float q[4]) { q[0]= 1.0f; q[1]= q[2]= q[3]= 0.0f; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 8f00e7b6d0c..a01455c8df0 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -282,6 +282,14 @@ MINLINE void negate_v3_v3(float r[3], const float a[3]) r[2]= -a[2]; } +MINLINE void negate_v4(float r[4]) +{ + r[0]= -r[0]; + r[1]= -r[1]; + r[2]= -r[2]; + r[3]= -r[3]; +} + MINLINE float dot_v2v2(const float a[2], const float b[2]) { return a[0]*b[0] + a[1]*b[1]; |