diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
commit | d1a8285f818eb7e5c3d6a05709ea21a808490b8c (patch) | |
tree | 326578f0505cbed07cfe60de530022822dc237ac /app/bin/utility.c | |
parent | 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff) |
New upstream version 5.1.0upstream/5.1.0
Diffstat (limited to 'app/bin/utility.c')
-rw-r--r-- | app/bin/utility.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/bin/utility.c b/app/bin/utility.c index 9708ac4..d1f798c 100644 --- a/app/bin/utility.c +++ b/app/bin/utility.c @@ -82,6 +82,22 @@ double NormalizeAngle( double a ) return a; } +double DifferenceBetweenAngles(double a, double b) { + double difference = b - a; + while (difference < -180) difference += 360; + while (difference > 180) difference -= 360; + return difference; +} + +int AngleInRange(double a, double start, double size) { + if (DifferenceBetweenAngles(start+size,a)<=0.0) { + if (DifferenceBetweenAngles(start,a)>=0.0) + return 0; + else return 1; + } + return -1; +} + int IsAligned( double a1, double a2 ) |