summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/maths.cpp6
-rw-r--r--lib/maths.h7
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/maths.cpp b/lib/maths.cpp
index 4d9f8d4..b8dbd34 100644
--- a/lib/maths.cpp
+++ b/lib/maths.cpp
@@ -70,6 +70,12 @@ rotate_ypr(glm::vec3 a)
return rotate_yaw(a.y) * rotate_pitch(a.x) * rotate_roll(a.z);
}
+glm::mat4
+rotate_yp(glm::vec2 a)
+{
+ return rotate_yaw(a.y) * rotate_pitch(a.x);
+}
+
float
vector_yaw(const glm::vec3 & diff)
{
diff --git a/lib/maths.h b/lib/maths.h
index ad2f3e5..a75c7a8 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -51,6 +51,7 @@ glm::mat2 rotate_flat(float);
glm::mat4 rotate_roll(float);
glm::mat4 rotate_yaw(float);
glm::mat4 rotate_pitch(float);
+glm::mat4 rotate_yp(glm::vec2);
glm::mat4 rotate_ypr(glm::vec3);
float vector_yaw(const glm::vec3 & diff);
@@ -84,6 +85,12 @@ operator^(const glm::vec2 & v, float z)
return {v.x, v.y, z};
}
+constexpr inline glm::vec4
+operator^(const glm::vec3 & v, float w)
+{
+ return {v.x, v.y, v.z, w};
+}
+
constexpr inline glm::vec3
operator!(const glm::vec2 & v)
{