summaryrefslogtreecommitdiff
path: root/src/math.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-10-21 14:40:20 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-10-21 14:40:20 +0200
commitf08fb7293382dbaf240860119d128486ada62221 (patch)
treece9a85f47b3dacc98f75a9f73f1378d4c00ec915 /src/math.hpp
parent42fece714e30b899208a90183a571452eb35811e (diff)
Improve short paths and do some refactoring.
Diffstat (limited to 'src/math.hpp')
-rw-r--r--src/math.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math.hpp b/src/math.hpp
index f3b049b..55bf438 100644
--- a/src/math.hpp
+++ b/src/math.hpp
@@ -193,6 +193,12 @@ public:
return std::sqrt(*this * *this);
}
+ T angle(void)
+ {
+ static_assert(N == 2, "angle called for a vector that's not 2-dimensional");
+ return atan2(v[1], v[0]);
+ }
+
// Compatibility with SFML
template <typename U>