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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/Concept/Framework/tools.h b/source/Concept/Framework/tools.h
index 0ca4dda..ca19993 100644
--- a/source/Concept/Framework/tools.h
+++ b/source/Concept/Framework/tools.h
@@ -9,6 +9,10 @@
void operator delete(void* p);
#endif
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#define sign(a) (((a) < 0) ? (-1) : (1))
+
inline void sleep(int sec)
{
for (int s=0; s<sec; s++) {
@@ -40,6 +44,11 @@ inline void usleep(int usec)
inline float distance2d(float x1, float y1, float x2, float y2)
{
return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
+}
+
+inline float direction2d(float x1, float y1, float x2, float y2)
+{
+ return atan((y2 - y1) / (x2 - x1));
}
#endif