summaryrefslogtreecommitdiffstats
path: root/core/math/vector3.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-02-14 16:04:36 +0100
committerGitHub <noreply@github.com>2017-02-14 16:04:36 +0100
commit78336990f4f6c36db2000d6097826bbe573eb016 (patch)
tree8bb33b592e3d3982ca5faf5e041c37644d5b525d /core/math/vector3.cpp
parent81edda18f39efc4f783bc6fa2b381c01cfc0ef2d (diff)
parentadcc211feb7827127b2548c791f2de0b6efda3d3 (diff)
downloadredot-engine-78336990f4f6c36db2000d6097826bbe573eb016.tar.gz
Merge pull request #7807 from hpvb/fix-7354
Make nan==nan true for GDScript
Diffstat (limited to 'core/math/vector3.cpp')
-rw-r--r--core/math/vector3.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index 2ab5fa0465..7fdb54bb69 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -176,6 +176,17 @@ Vector3 Vector3::cubic_interpolate(const Vector3& p_b,const Vector3& p_pre_a, co
return out;
}
# endif
+bool Vector3::nan_equals(const Vector3& p_v) const {
+ return (x == p_v.x && y == p_v.y && z == p_v.z) ||
+ (x == p_v.x && y == p_v.y && isnan(z) && isnan(p_v.z)) ||
+ (x == p_v.x && isnan(y) && isnan(p_v.y) && z == p_v.z) ||
+ (isnan(x) && isnan(p_v.x) && y == p_v.y && z == p_v.z) ||
+ (x == p_v.x && isnan(y) && isnan(p_v.y) && isnan(z) && isnan(p_v.z)) ||
+ (isnan(x) && isnan(p_v.x) && y == p_v.y && isnan(z) && isnan(p_v.z)) ||
+ (isnan(x) && isnan(p_v.x) && isnan(y) && isnan(p_v.y) && z == p_v.z) ||
+ (isnan(x) && isnan(p_v.x) && isnan(y) && isnan(p_v.y) && isnan(z) && isnan(p_v.z));
+}
+
Vector3::operator String() const {
return (rtos(x)+", "+rtos(y)+", "+rtos(z));