summary refs log tree commit diff
path: root/src/Math/Trig.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-10-06 02:48:43 +0200
committerMel <einebeere@gmail.com>2022-10-06 02:48:43 +0200
commitfdbfa8e36f85eee051fc562f1a8588970257a20f (patch)
treee861a56c50b1e8532bd71a21064d76d0c148ed3a /src/Math/Trig.hpp
parent731846a0c654b39e23c26f611470e401df404c9d (diff)
downloadmeowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.tar.zst
meowcraft-fdbfa8e36f85eee051fc562f1a8588970257a20f.zip
Rotating camera with mouse
Diffstat (limited to 'src/Math/Trig.hpp')
-rw-r--r--src/Math/Trig.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Math/Trig.hpp b/src/Math/Trig.hpp
new file mode 100644
index 0000000..c64e2f2
--- /dev/null
+++ b/src/Math/Trig.hpp
@@ -0,0 +1,17 @@
+#pragma once
+
+namespace Math {
+
+constexpr double PI = 3.14159265358979323846;
+
+template<typename T>
+T radians(T degrees) {
+    return (degrees * PI) / 180.0f;
+}
+
+template<typename T>
+T degrees(T radians) {
+    return radians * 180.0f / PI;
+}
+
+}
\ No newline at end of file