mirror of
https://github.com/okalachev/flix.git
synced 2026-01-11 21:46:55 +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)
|
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)
|
static Vector angularRatesBetweenVectors(const Vector& u, const Vector& v)
|
||||||
|
|||||||
Reference in New Issue
Block a user