summaryrefslogtreecommitdiff
path: root/core/math/vector3i.h
diff options
context:
space:
mode:
authorAndrés Botero <0xafbf@gmail.com>2023-01-29 11:45:22 -0500
committerAndrés Botero <boterock@gmail.com>2023-02-11 15:03:11 -0500
commita90e151b2a9981049f5710c4efa7fb8af6c524d7 (patch)
tree1bc1c80e4a7688177e6978b7cad3732c75150c2e /core/math/vector3i.h
parent44b41ded82229ca7614403f74234a4282002458b (diff)
Added component-wise `min` and `max` functions for vectors
Diffstat (limited to 'core/math/vector3i.h')
-rw-r--r--core/math/vector3i.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/vector3i.h b/core/math/vector3i.h
index 96f9beef12..53d3829a99 100644
--- a/core/math/vector3i.h
+++ b/core/math/vector3i.h
@@ -69,6 +69,14 @@ struct _NO_DISCARD_ Vector3i {
Vector3i::Axis min_axis_index() const;
Vector3i::Axis max_axis_index() const;
+ Vector3i min(const Vector3i &p_vector3i) const {
+ return Vector3i(MIN(x, p_vector3i.x), MIN(y, p_vector3i.y), MIN(z, p_vector3i.z));
+ }
+
+ Vector3i max(const Vector3i &p_vector3i) const {
+ return Vector3i(MAX(x, p_vector3i.x), MAX(y, p_vector3i.y), MAX(z, p_vector3i.z));
+ }
+
_FORCE_INLINE_ int64_t length_squared() const;
_FORCE_INLINE_ double length() const;