summaryrefslogtreecommitdiff
path: root/core/math/geometry_2d.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/geometry_2d.h')
-rw-r--r--core/math/geometry_2d.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h
index 12bad5768e..de580ea639 100644
--- a/core/math/geometry_2d.h
+++ b/core/math/geometry_2d.h
@@ -145,6 +145,12 @@ public:
return p_segment[0] + n * d; // Inside.
}
+// Disable False Positives in MSVC compiler; we correctly check for 0 here to prevent a division by 0.
+// See: https://github.com/godotengine/godot/pull/44274
+#ifdef _MSC_VER
+#pragma warning(disable : 4723)
+#endif
+
static bool line_intersects_line(const Vector2 &p_from_a, const Vector2 &p_dir_a, const Vector2 &p_from_b, const Vector2 &p_dir_b, Vector2 &r_result) {
// See http://paulbourke.net/geometry/pointlineplane/
@@ -159,6 +165,11 @@ public:
return true;
}
+// Re-enable division by 0 warning
+#ifdef _MSC_VER
+#pragma warning(default : 4723)
+#endif
+
static bool segment_intersects_segment(const Vector2 &p_from_a, const Vector2 &p_to_a, const Vector2 &p_from_b, const Vector2 &p_to_b, Vector2 *r_result) {
Vector2 B = p_to_a - p_from_a;
Vector2 C = p_from_b - p_from_a;