summaryrefslogtreecommitdiffstats
path: root/core/math/vector3.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/vector3.h
parent44b41ded82229ca7614403f74234a4282002458b (diff)
downloadredot-engine-a90e151b2a9981049f5710c4efa7fb8af6c524d7.tar.gz
Added component-wise `min` and `max` functions for vectors
Diffstat (limited to 'core/math/vector3.h')
-rw-r--r--core/math/vector3.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/math/vector3.h b/core/math/vector3.h
index bd8739d024..18943a820f 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -76,6 +76,14 @@ struct _NO_DISCARD_ Vector3 {
return x < y ? (y < z ? Vector3::AXIS_Z : Vector3::AXIS_Y) : (x < z ? Vector3::AXIS_Z : Vector3::AXIS_X);
}
+ Vector3 min(const Vector3 &p_vector3) const {
+ return Vector3(MIN(x, p_vector3.x), MIN(y, p_vector3.y), MIN(z, p_vector3.z));
+ }
+
+ Vector3 max(const Vector3 &p_vector3) const {
+ return Vector3(MAX(x, p_vector3.x), MAX(y, p_vector3.y), MAX(z, p_vector3.z));
+ }
+
_FORCE_INLINE_ real_t length() const;
_FORCE_INLINE_ real_t length_squared() const;