add comments

This commit is contained in:
Antonis Geralis 2022-12-15 13:51:01 +02:00 committed by GitHub
parent 3eb97da652
commit c74bed89df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}