From c74bed89df187da4ac1b549a1e318a6d33d37470 Mon Sep 17 00:00:00 2001 From: Antonis Geralis <43617260+planetis-m@users.noreply.github.com> Date: Thu, 15 Dec 2022 13:51:01 +0200 Subject: [PATCH] add comments --- src/raymath.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/raymath.h b/src/raymath.h index 061c91425..d3130750c 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -310,10 +310,12 @@ RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2) // Parameters need to be normalized RMAPI float Vector2Angle(Vector2 v1, Vector2 v2) { - float dotProduct = v1.x*v2.x + v1.y*v2.y; + float dotProduct = v1.x*v2.x + v1.y*v2.y; // Dot product - float t = dotProduct < -1 ? -1 : dotProduct; - float result = acosf(t > 1 ? 1 : t); + float t = dotProduct < -1 ? -1 : dotProduct; // Clamp + if (t > 1) t = 1; + + float result = acosf(t); return result; }