Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-08-26 22:10:22 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-08-26 22:10:22 +0300
commit07ccb9b5735ce7a12e40c1243032e18d8ed42737 (patch)
tree7ec115bb523838c22492d9c64dbea4e30fe66dfb /source/blender/editors/transform/transform_input.c
parent6bea434c41951686949bcb9abfcabc23ab7fad9f (diff)
Cleanup: use 'len_v2'
Simplifies readability and avoids repeat casts.
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r--source/blender/editors/transform/transform_input.c6
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 */