diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-08-26 22:10:22 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-08-26 22:10:22 +0300 |
commit | 07ccb9b5735ce7a12e40c1243032e18d8ed42737 (patch) | |
tree | 7ec115bb523838c22492d9c64dbea4e30fe66dfb /source | |
parent | 6bea434c41951686949bcb9abfcabc23ab7fad9f (diff) |
Cleanup: use 'len_v2'
Simplifies readability and avoids repeat casts.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index b541b199328..38dbe742279 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -276,9 +276,9 @@ void initMouseInput( static void calcSpringFactor(MouseInput *mi) { - 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]))); + float mdir[2] = {(float)(mi->center[1] - mi->imval[1]), (float)(mi->center[0] - mi->imval[0])}; + + mi->factor = len_v2(mdir); if (mi->factor == 0.0f) { mi->factor = 1.0f; /* prevent Inf */ |