mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 17:49:33 +00:00
Guard for angleBetweenVectors function to ensure it doesn't return NaN
This commit is contained in:
parent
fcd695fdd7
commit
d3e7291197
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user