summaryrefslogtreecommitdiff
path: root/lib/maths.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/maths.h')
-rw-r--r--lib/maths.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h
index 1c07baa..5bb69d3 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -3,6 +3,7 @@
#include <cmath>
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
+#include <numeric>
#include <utility>
struct Arc : public std::pair<float, float> {
@@ -130,6 +131,13 @@ std::pair<glm::vec2, bool> find_arc_centre(glm::vec2 start, glm::vec2 ad, glm::v
std::pair<float, float> 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);
+template<typename T>
+auto
+midpoint(const std::pair<T, T> & v)
+{
+ return std::midpoint(v.first, v.second);
+}
+
// Conversions
template<typename T>
inline constexpr auto