diff options
Diffstat (limited to 'src/General.h')
-rw-r--r-- | src/General.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/General.h b/src/General.h index fd78edaa..d315d50b 100644 --- a/src/General.h +++ b/src/General.h @@ -42,13 +42,14 @@ public: static float LimitRadianAngle(float angle) { - if (angle < -25.0f) - angle = -25.0f; - - if (angle > 25.0f) - angle = 25.0f; + float result; - float result = angle; + if (angle < -25.0f) + result = -25.0f; + else if (angle > 25.0f) + result = 25.0f; + else + result = angle; while (result >= PI) { result -= 2 * PI; @@ -71,7 +72,7 @@ public: if (x > 0.0f) { if (y > 0.0f) - return 2 * PI - atan2(x / y, 1.0f); + return PI - atan2(x / y, 1.0f); else return -atan2(x / y, 1.0f); } else { |