diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-18 20:39:54 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-11-18 20:39:54 +0000 |
commit | ba770a85b2b0ff9222e2867689c693ebee841e55 (patch) | |
tree | 179908c62b1ca5d18c9d7c33a3aa641002b479e8 /lib | |
parent | Simplified texture save (diff) | |
download | ilt-ba770a85b2b0ff9222e2867689c693ebee841e55.tar.bz2 ilt-ba770a85b2b0ff9222e2867689c693ebee841e55.tar.xz ilt-ba770a85b2b0ff9222e2867689c693ebee841e55.zip |
Rename rdiv to ratio and add a vec2 override
Diffstat (limited to 'lib')
-rw-r--r-- | lib/maths.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/maths.h b/lib/maths.h index 514a5ad..1c07baa 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -67,11 +67,18 @@ sq(T v) template<typename R = float, typename Ta, typename Tb> inline constexpr auto -rdiv(Ta a, Tb b) +ratio(Ta a, Tb b) { return (static_cast<R>(a) / static_cast<R>(b)); } +template<typename R = float, typename T, glm::qualifier Q> +inline constexpr auto +ratio(glm::vec<2, T, Q> v) +{ + return ratio<R>(v.x, v.y); +} + constexpr inline glm::vec2 operator!(const glm::vec3 & v) { |