mirror of
https://github.com/okalachev/flix.git
synced 2025-08-17 17:16:10 +00:00
Guard for angleBetweenVectors function to ensure it doesn't return NaN
This commit is contained in:
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
static float angleBetweenVectors(const Vector& a, const Vector& b)
|
||||
{
|
||||
return acos(dot(a, b) / (a.norm() * b.norm()));
|
||||
return acos(constrain(dot(a, b) / (a.norm() * b.norm()), -1, 1));
|
||||
}
|
||||
|
||||
static Vector angularRatesBetweenVectors(const Vector& u, const Vector& v)
|
||||
|
Reference in New Issue
Block a user