#ifndef SHARED_MATH_ANGLES_HH_ #define SHARED_MATH_ANGLES_HH_ #include #include #include namespace shared { namespace math { struct angles { public: float pitch; float yaw; public: // Returns the closest yaw from this to other, assumes they are normalised. static float get_yaw_delta(const float& a, const float& b) noexcept; public: glm::vec3 to_dir() const noexcept; public: // Removes bad floating point values! // Clamps pitch to its max positions of += glm::radians(89). // Clamps yaw to its max positions of += glm::radians(180). angles& clamp() noexcept; // Returns yaw angles to [glm::radians(-180), glm::radians(180)]. angles& normalise() noexcept; public: angles operator+(const angles& a) const noexcept; angles operator*(const float& f) const noexcept; public: auto operator<=>(const angles&) const noexcept = default; }; } // namespace math } // namespace shared #endif