diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-12-18 17:12:56 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-12-18 17:12:56 +0000 |
commit | 15754d6b61b0f00fa142ff55d87e8be09d2041c8 (patch) | |
tree | 608c5bd92b1fa5e8d41f768f60bac94cabe25cba /lib/maths.h | |
parent | Don't cut internal boundaries (diff) | |
download | ilt-15754d6b61b0f00fa142ff55d87e8be09d2041c8.tar.bz2 ilt-15754d6b61b0f00fa142ff55d87e8be09d2041c8.tar.xz ilt-15754d6b61b0f00fa142ff55d87e8be09d2041c8.zip |
Midpoint for integral vectors
Diffstat (limited to 'lib/maths.h')
-rw-r--r-- | lib/maths.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/maths.h b/lib/maths.h index 4223f14..7f2d7b4 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -427,6 +427,13 @@ midpoint(const std::pair<T, T> & v) return std::midpoint(v.first, v.second); } +template<glm::length_t D, std::integral T, glm::qualifier Q> +auto +midpoint(const glm::vec<D, T, Q> & valueA, const glm::vec<D, T, Q> & valueB) +{ + return valueA + (valueB - valueA) / 2; +} + // std::pow is not constexpr template<Arithmetic T> requires requires(T n) { n *= n; } |