summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHarriP <[email protected]>2021-12-06 20:07:05 +0200
committerGitHub <[email protected]>2021-12-06 19:07:05 +0100
commit3cb4ef25990d88cf5c9170cf5c571f5968204be9 (patch)
tree6d0fe25dfdb31e0a7e474a8e73d2a12bf1f3214d /src
parentfa7337e19c952137992c9d8733856c8f3c324fa6 (diff)
downloadraylib-3cb4ef25990d88cf5c9170cf5c571f5968204be9.tar.gz
raylib-3cb4ef25990d88cf5c9170cf5c571f5968204be9.zip
Fix inverse length in Vector2Normalize (#2189)
Following the pattern in Vector3Normalize.
Diffstat (limited to 'src')
-rw-r--r--src/raymath.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/raymath.h b/src/raymath.h
index 399c2f6c..898e48ae 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -328,8 +328,9 @@ RMAPI Vector2 Vector2Normalize(Vector2 v)
if (length > 0)
{
- result.x = v.x*1.0f/length;
- result.y = v.y*1.0f/length;
+ float ilength = 1.0f / length;
+ result.x = v.x * ilength;
+ result.y = v.y * ilength;
}
return result;