summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/tools.h
diff options
context:
space:
mode:
authorsicarius <devnull@localhost>2007-02-20 22:01:02 +0100
committersicarius <devnull@localhost>2007-02-20 22:01:02 +0100
commit22433e52a7b0f2e5c548edb915ea11a38a8077ad (patch)
tree1d7add120a7fe0630dc798eaaf4a3277f2bb1e23 /source/Concept/Framework/tools.h
parentec2a18e931cdaa6c62a8843c29dc93c4a823a2cd (diff)
downloadrc2007-soccer-22433e52a7b0f2e5c548edb915ea11a38a8077ad.tar
rc2007-soccer-22433e52a7b0f2e5c548edb915ea11a38a8077ad.zip
+++ Codework, Navigator&Positiontracker done (buggy?)
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