Cleanup: use 'len_v2'

Simplifies readability and avoids repeat casts.
This commit is contained in:
Germano Cavalcante 2022-08-26 16:10:22 -03:00
parent 6bea434c41
commit 07ccb9b573
1 changed files with 3 additions and 3 deletions

View File

@ -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 */