diff --git a/flix/vector.h b/flix/vector.h index c1433e1..b096a5e 100644 --- a/flix/vector.h +++ b/flix/vector.h @@ -80,6 +80,10 @@ public: static Vector angularRatesBetweenVectors(const Vector& a, const Vector& b) { Vector direction = cross(a, b); + if (direction.zero()) { + // vectors are opposite, return any perpendicular vector + return cross(a, Vector(1, 0, 0)); + } direction.normalize(); float angle = angleBetweenVectors(a, b); return direction * angle;