From 0a5d23ce263551bab3759e4ac65ecb6cfebdc892 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 2 Dec 2023 12:23:52 +0000 Subject: Add crossInt - cross product for integer vectors --- lib/maths.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/maths.h b/lib/maths.h index 67b2a15..cf369a7 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -67,6 +67,17 @@ sq(T v) return v * v; } +template +inline constexpr glm::vec<3, T, Q> +crossInt(const glm::vec<3, T, Q> a, const glm::vec<3, T, Q> b) +{ + return { + (a.y * b.z) - (a.z * b.y), + (a.z * b.x) - (a.x * b.z), + (a.x * b.y) - (a.y * b.x), + }; +} + template inline constexpr auto ratio(Ta a, Tb b) -- cgit v1.2.3