diff options
Diffstat (limited to 'src/common/functions.cc')
-rw-r--r-- | src/common/functions.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/functions.cc b/src/common/functions.cc index 7a01628..343084a 100644 --- a/src/common/functions.cc +++ b/src/common/functions.cc @@ -33,7 +33,7 @@ unsigned randomi(const unsigned int max) { return ((unsigned int)(rand() % max)); } -float degreesf(float angle) { +float degrees180f(float angle) { float r = angle; while (r <= -180.0f) r += 360.0f; @@ -42,6 +42,15 @@ float degreesf(float angle) { return r; } +float degrees360f(float angle) { + float r = angle; + while (r < 0.0f) + r += 360.0f; + while (r >= 360.0f) + r -= 360.0f; + return r; +} + float sgnf(float value) { if (value < 0 ) |