diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-11-17 17:33:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-17 17:33:56 +0100 |
commit | 2b246298479ed4726f37d4cf6bc3b995bd333bbd (patch) | |
tree | 0430d66033ea3f9b0834cb59e3b9c1eae9106ed1 | |
parent | f7b482d3ae36cf43c21a554df7d1154aad374a50 (diff) | |
parent | 6d0c93dccf14eaf21018ada0ab8575a98858e536 (diff) |
Merge pull request #55042 from nekomatata/fix-segment-intersection
-rw-r--r-- | core/math/geometry_2d.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/math/geometry_2d.h b/core/math/geometry_2d.h index 6010159597..028ac0f4eb 100644 --- a/core/math/geometry_2d.h +++ b/core/math/geometry_2d.h @@ -181,8 +181,7 @@ public: D = Vector2(D.x * Bn.x + D.y * Bn.y, D.y * Bn.x - D.x * Bn.y); // Fail if C x B and D x B have the same sign (segments don't intersect). - // (equivalent to condition (C.y < 0 && D.y < CMP_EPSILON) || (C.y > 0 && D.y > CMP_EPSILON)) - if (C.y * D.y > CMP_EPSILON) { + if ((C.y < -CMP_EPSILON && D.y < -CMP_EPSILON) || (C.y > CMP_EPSILON && D.y > CMP_EPSILON)) { return false; } |