summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorantonWetzel <anton.wetzel.mail@gmail.com>2022-08-08 17:05:55 +0200
committerantonWetzel <anton.wetzel.mail@gmail.com>2022-08-09 01:59:17 +0200
commit40a1d6d100d8a1823d3a939a7ad7350b36bcddbd (patch)
tree65b06f486f70150e7110b1ad1dde3aa2f398c858 /core/math
parent7355dfb502dbae6f13fbe42a9feeadb57affac0e (diff)
vector4 distance_squared_to and update csharp
Diffstat (limited to 'core/math')
-rw-r--r--core/math/vector4.cpp4
-rw-r--r--core/math/vector4.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/core/math/vector4.cpp b/core/math/vector4.cpp
index 4697c311b4..1dd5adad2b 100644
--- a/core/math/vector4.cpp
+++ b/core/math/vector4.cpp
@@ -91,6 +91,10 @@ real_t Vector4::distance_to(const Vector4 &p_to) const {
return (p_to - *this).length();
}
+real_t Vector4::distance_squared_to(const Vector4 &p_to) const {
+ return (p_to - *this).length_squared();
+}
+
Vector4 Vector4::direction_to(const Vector4 &p_to) const {
Vector4 ret(p_to.x - x, p_to.y - y, p_to.z - z, p_to.w - w);
ret.normalize();
diff --git a/core/math/vector4.h b/core/math/vector4.h
index 373a6a1218..d26fe15941 100644
--- a/core/math/vector4.h
+++ b/core/math/vector4.h
@@ -79,6 +79,7 @@ struct _NO_DISCARD_ Vector4 {
bool is_normalized() const;
real_t distance_to(const Vector4 &p_to) const;
+ real_t distance_squared_to(const Vector4 &p_to) const;
Vector4 direction_to(const Vector4 &p_to) const;
Vector4 abs() const;