diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 09:35:19 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-29 09:35:19 +0400 |
commit | 8a215669e8668b81610903a80a0c11e1cf64ccac (patch) | |
tree | 8f36c005b3d3327c46cea7240feb5a1437020fd4 /source/blender/blenlib | |
parent | 1dddad93c45bb29e001afe21e24ae1f34aaa3e7f (diff) |
Cleanup
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_dial.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_dial.c | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_dial.h b/source/blender/blenlib/BLI_dial.h index 61420f43bca..c8b57e803d2 100644 --- a/source/blender/blenlib/BLI_dial.h +++ b/source/blender/blenlib/BLI_dial.h @@ -52,8 +52,8 @@ typedef struct Dial Dial; -Dial * BLI_dial_initialize(float start_position[2], float threshold); +Dial *BLI_dial_initialize(float start_position[2], float threshold); float BLI_dial_angle(Dial *dial, float current_position[2]); -#endif /* __BLI_DIAL_H__ */
\ No newline at end of file +#endif /* __BLI_DIAL_H__ */ diff --git a/source/blender/blenlib/intern/BLI_dial.c b/source/blender/blenlib/intern/BLI_dial.c index 943e0b2bf99..cfbb52847fd 100644 --- a/source/blender/blenlib/intern/BLI_dial.c +++ b/source/blender/blenlib/intern/BLI_dial.c @@ -46,7 +46,7 @@ struct Dial { }; -Dial * BLI_dial_initialize(float start_position[2], float threshold) +Dial *BLI_dial_initialize(float start_position[2], float threshold) { Dial *dial = MEM_callocN(sizeof(Dial), "dial"); @@ -79,13 +79,14 @@ float BLI_dial_angle(Dial *dial, float current_position[2]) sinval = cross_v2v2(current_direction, dial->initial_direction); /* clamp to avoid nans in acos */ - angle = atan2(sinval, cosval); + angle = atan2f(sinval, cosval); /* change of sign, we passed the 180 degree threshold. This means we need to add a turn. * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2 */ - if ((angle * dial->last_angle < 0.0f) && (fabsf(dial->last_angle) > (float)M_PI_2)) + if ((angle * dial->last_angle < 0.0f) && + (fabsf(dial->last_angle) > (float)M_PI_2)) { - if (dial->last_angle < 0) + if (dial->last_angle < 0.0f) dial->rotations--; else dial->rotations++; |