From e0564e8c2a7307ab5a7d5ef57c1979751f17e483 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 26 Apr 2017 14:29:07 -0600 Subject: [PATCH] common: mathlib: don't need #define ANGLEEPSILON --- common/mathlib.cc | 5 +---- include/common/mathlib.hh | 1 - light/test_light.cc | 1 + 3 files changed, 2 insertions(+), 5 deletions(-) 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;