summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/math/vector3.h8
-rw-r--r--core/math/vector3i.h8
-rw-r--r--core/math/vector4.h8
-rw-r--r--core/math/vector4i.h8
4 files changed, 32 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;
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;
diff --git a/core/math/vector4.h b/core/math/vector4.h
index 0509261f33..f16b040317 100644
--- a/core/math/vector4.h
+++ b/core/math/vector4.h
@@ -68,6 +68,14 @@ struct _NO_DISCARD_ Vector4 {
Vector4::Axis min_axis_index() const;
Vector4::Axis max_axis_index() const;
+ Vector4 min(const Vector4 &p_vector4) const {
+ return Vector4(MIN(x, p_vector4.x), MIN(y, p_vector4.y), MIN(z, p_vector4.z), MIN(w, p_vector4.w));
+ }
+
+ Vector4 max(const Vector4 &p_vector4) const {
+ return Vector4(MAX(x, p_vector4.x), MAX(y, p_vector4.y), MAX(z, p_vector4.z), MAX(w, p_vector4.w));
+ }
+
_FORCE_INLINE_ real_t length_squared() const;
bool is_equal_approx(const Vector4 &p_vec4) const;
bool is_zero_approx() const;
diff --git a/core/math/vector4i.h b/core/math/vector4i.h
index d38a9de6f1..b815aa8e76 100644
--- a/core/math/vector4i.h
+++ b/core/math/vector4i.h
@@ -71,6 +71,14 @@ struct _NO_DISCARD_ Vector4i {
Vector4i::Axis min_axis_index() const;
Vector4i::Axis max_axis_index() const;
+ Vector4i min(const Vector4i &p_vector4i) const {
+ return Vector4i(MIN(x, p_vector4i.x), MIN(y, p_vector4i.y), MIN(z, p_vector4i.z), MIN(w, p_vector4i.w));
+ }
+
+ Vector4i max(const Vector4i &p_vector4i) const {
+ return Vector4i(MAX(x, p_vector4i.x), MAX(y, p_vector4i.y), MAX(z, p_vector4i.z), MAX(w, p_vector4i.w));
+ }
+
_FORCE_INLINE_ int64_t length_squared() const;
_FORCE_INLINE_ double length() const;