From a185c11f2397c0296a4b62cc266b4fa00a63c1e2 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 14 May 2008 21:07:10 +0000 Subject: console, camera & interpolation --- src/math/functions.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/math') 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; } -- cgit v1.2.3