summaryrefslogtreecommitdiffstats
path: root/src/core/General.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-08-20 10:33:02 +0200
committeraap <aap@papnet.eu>2021-08-20 10:33:02 +0200
commitaed313d81c7602e49dc5f0d2ccf382811744d0bb (patch)
tree6104b4d4b7497395e7f6619ea74700c40b38b49c /src/core/General.h
parentdisable switch workflow for now (diff)
downloadre3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar.gz
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar.bz2
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar.lz
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar.xz
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.tar.zst
re3-aed313d81c7602e49dc5f0d2ccf382811744d0bb.zip
Diffstat (limited to 'src/core/General.h')
-rw-r--r--src/core/General.h34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/core/General.h b/src/core/General.h
index c17d916d..62613445 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -6,36 +6,10 @@ class CGeneral
{
public:
static float GetATanOfXY(float x, float y){
- if(x == 0.0f && y == 0.0f)
- return 0.0f;
- float xabs = Abs(x);
- float yabs = Abs(y);
-
- if(xabs < yabs){
- if(y > 0.0f){
- if(x > 0.0f)
- return 0.5f*PI - Atan2(x / y, 1.0f);
- else
- return 0.5f*PI + Atan2(-x / y, 1.0f);
- }else{
- if(x > 0.0f)
- return 1.5f*PI + Atan2(x / -y, 1.0f);
- else
- return 1.5f*PI - Atan2(-x / -y, 1.0f);
- }
- }else{
- if(y > 0.0f){
- if(x > 0.0f)
- return Atan2(y / x, 1.0f);
- else
- return PI - Atan2(y / -x, 1.0f);
- }else{
- if(x > 0.0f)
- return 2.0f*PI - Atan2(-y / x, 1.0f);
- else
- return PI + Atan2(-y / -x, 1.0f);
- }
- }
+ float arc = atan2f(y, x);
+ if(arc < 0.0f)
+ arc += TWOPI;
+ return arc;
}
static float LimitAngle(float angle)