diff --git a/common/mathlib.cc b/common/mathlib.cc index ec843201..80047be2 100644 --- a/common/mathlib.cc +++ b/common/mathlib.cc @@ -775,10 +775,7 @@ float SignedDegreesBetweenUnitVectors(const vec3_t start, const vec3_t end, cons { const float cosangle = qmax(-1.0, qmin(1.0, DotProduct(start, end))); const float unsigned_degrees = acos(cosangle) * (360.0 / (2.0 * Q_PI)); - - if (unsigned_degrees < ANGLEEPSILON) - return 0; - + // get a normal for the rotation plane using the right-hand rule vec3_t rotationNormal; CrossProduct(start, end, rotationNormal); diff --git a/include/common/mathlib.hh b/include/common/mathlib.hh index 02ea75ee..8e4256fb 100644 --- a/include/common/mathlib.hh +++ b/include/common/mathlib.hh @@ -56,7 +56,6 @@ typedef struct { extern const vec3_t vec3_origin; -#define ANGLEEPSILON 0.000001 #define ZERO_TRI_AREA_EPSILON 0.05f #define POINT_EQUAL_EPSILON 0.05f diff --git a/light/test_light.cc b/light/test_light.cc index 551873ab..a3bf7184 100644 --- a/light/test_light.cc +++ b/light/test_light.cc @@ -419,6 +419,7 @@ TEST(mathlib, SignedDegreesBetweenUnitVectors) { EXPECT_FLOAT_EQ(-90, SignedDegreesBetweenUnitVectors(right, fwd, up)); EXPECT_FLOAT_EQ(90, SignedDegreesBetweenUnitVectors(fwd, right, up)); + EXPECT_FLOAT_EQ(0, SignedDegreesBetweenUnitVectors(right, right, up)); } static const float MANGLE_EPSILON = 0.1f;