Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/functions.cc')
-rw-r--r--src/math/functions.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/math/functions.cc b/src/math/functions.cc
index e048659..40f0f4e 100644
--- a/src/math/functions.cc
+++ b/src/math/functions.cc
@@ -9,6 +9,8 @@
namespace math
{
+const float DELTA = 10e-10;
+
float min(float a, float b)
{
return (a < b ? a : b);
@@ -42,9 +44,9 @@ unsigned randomi(const unsigned int max)
float degrees180f(float angle)
{
float r = angle;
- while (r < -180.0f)
+ while (r - DELTA < -180.0f)
r += 360.0f;
- while (r > 180.0f)
+ while (r + DELTA > 180.0f)
r -= 360.0f;
return r;
}
@@ -52,9 +54,9 @@ float degrees180f(float angle)
float degrees360f(float angle)
{
float r = angle;
- while (r < 0.0f)
+ while (r - DELTA < 0)
r += 360.0f;
- while (r > 360.0f)
+ while (r + DELTA > 360.0f)
r -= 360.0f;
return r;
}