From d63f5ce1cb86e69da28bd74b21e9452dbd88a38f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 28 Feb 2021 15:42:39 +0000 Subject: Move utility to lib --- utility/maths.h | 61 --------------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 utility/maths.h (limited to 'utility/maths.h') diff --git a/utility/maths.h b/utility/maths.h deleted file mode 100644 index 89cb7cb..0000000 --- a/utility/maths.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef MATH_H -#define MATH_H - -#include -#include -#include - -struct Arc : public std::pair { - using std::pair::pair; - - Arc(const glm::vec3 & centre3, const glm::vec3 & e0p, const glm::vec3 & e1p); - - float - operator[](unsigned int i) const - { - return i ? second : first; - } -}; - -constexpr const glm::vec3 up {0, 1, 0}; -constexpr const glm::vec3 north {0, 0, 1}; -constexpr const glm::vec3 south {0, 0, -1}; -constexpr const glm::vec3 east {-1, 0, 0}; -constexpr const glm::vec3 west {1, 0, 0}; -constexpr auto half_pi {glm::half_pi()}; -constexpr auto pi {glm::pi()}; -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); - -constexpr inline glm::vec2 -operator!(const glm::vec3 & v) -{ - return {v.x, v.z}; -} - -constexpr inline glm::vec3 -operator!(const glm::vec2 & v) -{ - return {v.x, 0, v.y}; -} - -constexpr inline float -arc_length(const Arc & arc) -{ - return arc.second - arc.first; -} - -float normalize(float ang); - -std::pair find_arc_centre(glm::vec2 start, float entrys, glm::vec2 end, float entrye); -std::pair find_arc_centre(glm::vec2 start, glm::vec2 ad, glm::vec2 end, glm::vec2 bd); -std::pair find_arcs_radius(glm::vec2 start, float entrys, glm::vec2 end, float entrye); -float find_arcs_radius(glm::vec2 start, glm::vec2 ad, glm::vec2 end, glm::vec2 bd); - -#endif -- cgit v1.2.3