From 15754d6b61b0f00fa142ff55d87e8be09d2041c8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 18 Dec 2024 17:12:56 +0000 Subject: Midpoint for integral vectors --- lib/maths.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/maths.h') 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 & v) return std::midpoint(v.first, v.second); } +template +auto +midpoint(const glm::vec & valueA, const glm::vec & valueB) +{ + return valueA + (valueB - valueA) / 2; +} + // std::pow is not constexpr template requires requires(T n) { n *= n; } -- cgit v1.2.3