Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-14 21:07:10 +0000
committerStijn Buys <ingar@osirion.org>2008-05-14 21:07:10 +0000
commita185c11f2397c0296a4b62cc266b4fa00a63c1e2 (patch)
tree186da4cdee2d9cd46fb2415567da1c441c7431ef /src/math
parent599adb817e19d9be3502e501dc904c7255cd616c (diff)
console, camera & interpolation
Diffstat (limited to 'src/math')
-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;
}