From e7420b24c30d9c25bdcc9369fb1ae7a409fda7d4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 3 Mar 2021 00:07:16 +0000 Subject: Our own matrix rotations Simpler and faster than glm's as we don't need arbitrary axes. --- lib/maths.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/maths.h') 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 #include #include #include @@ -29,6 +30,26 @@ constexpr auto two_pi {glm::two_pi()}; 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 +sincosf(float a) +{ + std::pair 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); -- cgit v1.2.3