diff options
author | Stijn Buys <ingar@osirion.org> | 2007-10-28 09:20:12 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2007-10-28 09:20:12 +0000 |
commit | cad1758bb8b092b804f9cc701aeb730e570b173b (patch) | |
tree | e7caf3352fe9760ce5ee4434a2117c90a0104813 /src/common/functions.cc | |
parent | 09789179cd77ce2f626fffbc94a90ec8784b76df (diff) |
split degreesf into degrees180f and degrees360f
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 ) |