summaryrefslogtreecommitdiff
path: root/lib/maths.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/maths.h')
-rw-r--r--lib/maths.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h
index c072283..d304b65 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -1,6 +1,7 @@
#ifndef MATH_H
#define MATH_H
+#include <cmath>
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
#include <utility>
@@ -29,6 +30,26 @@ constexpr auto two_pi {glm::two_pi<float>()};
glm::mat4 flat_orientation(const glm::vec3 & diff);
+// C++ wrapper for C's sincosf, but with references, not pointers
+inline auto
+sincosf(float a, float & s, float & c)
+{
+ return sincosf(a, &s, &c);
+}
+
+inline std::pair<float, float>
+sincosf(float a)
+{
+ std::pair<float, float> sc;
+ sincosf(a, &sc.first, &sc.second);
+ return sc;
+}
+
+glm::mat4 rotate_roll(float);
+glm::mat4 rotate_yaw(float);
+glm::mat4 rotate_pitch(float);
+glm::mat4 rotate_ypr(glm::vec3);
+
float vector_yaw(const glm::vec3 & diff);
float vector_pitch(const glm::vec3 & diff);