summaryrefslogtreecommitdiff
path: root/src/math.hpp
diff options
context:
space:
mode:
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>