summaryrefslogtreecommitdiffhomepage
path: root/src/raymath.h
diff options
context:
space:
mode:
authorRay <[email protected]>2023-07-02 20:05:15 +0200
committerRay <[email protected]>2023-07-02 20:05:15 +0200
commitfdc28fce80d6e9ae04e900079beba7d79673b25d (patch)
tree19e099090be818dd258438c8dc62c8c9c14c6937 /src/raymath.h
parente8af87575639d27fa5486ffe88458596d067c21a (diff)
downloadraylib-fdc28fce80d6e9ae04e900079beba7d79673b25d.tar.gz
raylib-fdc28fce80d6e9ae04e900079beba7d79673b25d.zip
Reviewed vector2angle example
Diffstat (limited to 'src/raymath.h')
-rw-r--r--src/raymath.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/raymath.h b/src/raymath.h
index 6a929cf6..087410ef 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -316,16 +316,15 @@ RMAPI float Vector2Angle(Vector2 v1, Vector2 v2)
{
float result = 0.0f;
- float dot = v1.x*v2.x + v1.y*v2.y; // Dot product
+ float dot = v1.x*v2.x + v1.y*v2.y; // Dot product
float dotClamp = (dot < -1.0f)? -1.0f : dot; // Clamp
if (dotClamp > 1.0f) dotClamp = 1.0f;
-
result = acosf(dotClamp);
// Alternative implementation, more costly
//float v1Length = sqrtf((v1.x*v1.x) + (v1.y*v1.y));
//float v2Length = sqrtf((v2.x*v2.x) + (v2.y*v2.y));
- //float result = -acosf((v1.x*v2.x + v1.y*v2.y)/(v1Length*v2Length));
+ //result = -acosf((v1.x*v2.x + v1.y*v2.y)/(v1Length*v2Length));
return result;
}