summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/maths.cpp3
-rw-r--r--lib/maths.h14
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/maths.cpp b/lib/maths.cpp
index 26eae47..0298363 100644
--- a/lib/maths.cpp
+++ b/lib/maths.cpp
@@ -148,9 +148,6 @@ float
find_arcs_radius(glm::vec2 start, glm::vec2 ad, glm::vec2 end, glm::vec2 bd)
{
// Short name functions for big forula
- auto sq = [](auto v) {
- return v * v;
- };
auto sqrt = [](float v) {
return std::sqrt(v);
};
diff --git a/lib/maths.h b/lib/maths.h
index c4c1a51..c02123a 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -56,6 +56,20 @@ float vector_pitch(const glm::vec3 & diff);
float round_frac(const float & v, const float & frac);
+template<typename T>
+inline constexpr auto
+sq(T v)
+{
+ return v * v;
+}
+
+template<typename R = float, typename Ta, typename Tb>
+inline constexpr auto
+rdiv(Ta a, Tb b)
+{
+ return ((R)a / (R)b);
+}
+
constexpr inline glm::vec2
operator!(const glm::vec3 & v)
{