summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/tools.h')
-rw-r--r--source/Concept/Framework/tools.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/Concept/Framework/tools.h b/source/Concept/Framework/tools.h
index 735e773..2607001 100644
--- a/source/Concept/Framework/tools.h
+++ b/source/Concept/Framework/tools.h
@@ -14,6 +14,21 @@
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define sign(a) (((a) < 0) ? (-1) : (1))
+inline float easyAngle(float angle)
+{
+ while(angle < 0)
+ {
+ angle += 2.0f * PI;
+ }
+
+ while(angle >= 2.0f * PI)
+ {
+ angle -= 2.0f * PI;
+ }
+
+ return angle;
+}
+
inline void sleep(uint16 sec)
{
for (uint16 s = 0; s < sec; s++) {
@@ -48,7 +63,7 @@ inline float distance2d(float x1, float y1, float x2, float y2)
inline float direction2d(float x1, float y1, float x2, float y2)
{
- return atan((y2 - y1) / (x2 - x1));
+ return atan2((y2 - y1), (x2 - x1));
}
#endif