From 7481957415ecc581b7dfd2453b0e61058e2ac0c6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 14 Feb 2021 13:42:10 +0000 Subject: Add vector pitch --- utility/maths.cpp | 6 ++++++ utility/maths.h | 1 + 2 files changed, 7 insertions(+) (limited to 'utility') diff --git a/utility/maths.cpp b/utility/maths.cpp index aa44220..fb14a17 100644 --- a/utility/maths.cpp +++ b/utility/maths.cpp @@ -21,6 +21,12 @@ vector_yaw(const glm::vec3 & diff) return std::atan2(diff.x, diff.z); } +float +vector_pitch(const glm::vec3 & diff) +{ + return std::atan(diff.y); +} + float round_frac(const float & v, const float & frac) { diff --git a/utility/maths.h b/utility/maths.h index b8dd342..f2114ef 100644 --- a/utility/maths.h +++ b/utility/maths.h @@ -29,6 +29,7 @@ constexpr auto two_pi {glm::two_pi()}; glm::mat4 flat_orientation(const glm::vec3 & diff); float vector_yaw(const glm::vec3 & diff); +float vector_pitch(const glm::vec3 & diff); float round_frac(const float & v, const float & frac); -- cgit v1.2.3