From b2187797dfe5fd35b50506abf5502449e3f990ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Tue, 20 Jul 2021 13:33:48 +0200 Subject: [PATCH] Add min_axis and max_axis to Vector2i --- core/math/vector2.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/math/vector2.h b/core/math/vector2.h index 78deb473b41..4d9f3126e9b 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -300,6 +300,14 @@ struct Vector2i { return p_idx ? y : x; } + _FORCE_INLINE_ int min_axis() const { + return x < y ? 0 : 1; + } + + _FORCE_INLINE_ int max_axis() const { + return x < y ? 1 : 0; + } + Vector2i min(const Vector2i &p_vector2i) const { return Vector2(MIN(x, p_vector2i.x), MIN(y, p_vector2i.y)); }