diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 13:24:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-09 13:24:15 +0400 |
commit | d20c129a9cef276dd7d54c3cd03a6e4cfb024cfa (patch) | |
tree | bceac66f3b03f347900beec56c6efa2adc98beb9 /source/blender/editors/transform/transform_input.c | |
parent | c2863e3f9b2a394ac943a8e0e982de8667e20b7e (diff) |
style cleanup: whitespace/operators
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 0f0d1cc8344..b25c76fe193 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -229,8 +229,9 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], double *angle = mi->data; /* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */ - double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3)) - / (2.0 * ((A*B)?(A*B):1.0)); + double deler = (((dx1 * dx1 + dy1 * dy1) + + (dx2 * dx2 + dy2 * dy2) - + (dx3 * dx3 + dy3 * dy3)) / (2.0 * ((A * B) ? (A * B) : 1.0))); /* ((A*B)?(A*B):1.0) this takes care of potential divide by zero errors */ float dphi; @@ -290,15 +291,12 @@ void initMouseInput(TransInfo *UNUSED(t), MouseInput *mi, int center[2], int mva static void calcSpringFactor(MouseInput *mi) { - mi->factor = (float)sqrt( - ( - ((float)(mi->center[1] - mi->imval[1]))*((float)(mi->center[1] - mi->imval[1])) - + - ((float)(mi->center[0] - mi->imval[0]))*((float)(mi->center[0] - mi->imval[0])) - ) ); - - if (mi->factor==0.0f) + mi->factor = sqrtf(((float)(mi->center[1] - mi->imval[1])) * ((float)(mi->center[1] - mi->imval[1])) + + ((float)(mi->center[0] - mi->imval[0])) * ((float)(mi->center[0] - mi->imval[0]))); + + if (mi->factor == 0.0f) { mi->factor= 1.0f; /* prevent Inf */ + } } void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode) |