diff options
author | Justin Worthe <justin.worthe@entelect.co.za> | 2014-07-31 13:58:22 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@entelect.co.za> | 2014-07-31 13:58:22 +0200 |
commit | 98ba22e7064db57316dfff1ae127feb3dceeb73e (patch) | |
tree | 1f7fe3065f804e491f558650285e8c6d05fc914b /source/logic/MazeMath.cpp |
Diffstat (limited to 'source/logic/MazeMath.cpp')
-rw-r--r-- | source/logic/MazeMath.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/logic/MazeMath.cpp b/source/logic/MazeMath.cpp new file mode 100644 index 0000000..84b27dd --- /dev/null +++ b/source/logic/MazeMath.cpp @@ -0,0 +1,18 @@ +#include "MazeMath.h" + +double MazeMath::round(double value) +{ + if (static_cast<int>(value*10)%10 < 5) + { + return floor(value); + } + else + { + return ceil(value); + } +} + +double MazeMath::distance(double x1, double y1, double x2, double y2) +{ + return sqrt(pow(x1-x2, 2) + pow(y1-y2, 2)); +} |