summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-07-20 13:33:48 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2021-07-21 12:29:51 +0200
commitb2187797dfe5fd35b50506abf5502449e3f990ee (patch)
tree31b13ce9cd90b8e1ee1cca763a5c3b254c4adb8c /core
parent047e9b19f80e1f65d207d163c9c67574f7484ade (diff)
Add min_axis and max_axis to Vector2i
Diffstat (limited to 'core')
-rw-r--r--core/math/vector2.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h
index 78deb473b4..4d9f3126e9 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));
}