diff --git a/libautoscoper/src/Tracker.cpp b/libautoscoper/src/Tracker.cpp index 831b6f8a..aea2d893 100644 --- a/libautoscoper/src/Tracker.cpp +++ b/libautoscoper/src/Tracker.cpp @@ -952,6 +952,12 @@ bool Tracker::calculate_viewport(const CoordFrame& modelview, const Camera& came return false; } + // Check if min_max is unchanged from the initial values + if (min_max[0] == 1.0 && min_max[1] == 1.0 && min_max[2] == -1.0 && min_max[3] == -1.0) { + // This usually means that the rotation was all NaN + return false; + } + // clip min_max to rad_min_max_film if (min_max[0] < rad_min_max_film[0]) { min_max[0] = rad_min_max_film[0]; diff --git a/math/Quaternion.hpp b/math/Quaternion.hpp index aaee9411..d5167670 100644 --- a/math/Quaternion.hpp +++ b/math/Quaternion.hpp @@ -379,6 +379,10 @@ struct Quat friend Quat slerp(const Quat& p, const Quat& q, const T& t) { + if (t < std::numeric_limits::epsilon()) + return p; + if (t > T(1) - std::numeric_limits::epsilon()) + return q; T cosRad = dot(unit(p), unit(q)); T rad = acos(cosRad); if (rad < std::numeric_limits::epsilon()) {