add comments
This commit is contained in:
parent
3eb97da652
commit
c74bed89df
|
|
@ -310,10 +310,12 @@ RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2)
|
||||||
// Parameters need to be normalized
|
// Parameters need to be normalized
|
||||||
RMAPI float Vector2Angle(Vector2 v1, Vector2 v2)
|
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 t = dotProduct < -1 ? -1 : dotProduct; // Clamp
|
||||||
float result = acosf(t > 1 ? 1 : t);
|
if (t > 1) t = 1;
|
||||||
|
|
||||||
|
float result = acosf(t);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user