summaryrefslogtreecommitdiff
path: root/geometry/linesAndSegments.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2023-03-28 13:25:59 +0200
committermzuenni <michi.zuendorf@gmail.com>2023-03-28 13:25:59 +0200
commitfe5fa1141efeb7454c763dbd2645fb4ff04487a3 (patch)
treef2197bb94ce80ab2fae886177dfa9b0bd11538ac /geometry/linesAndSegments.cpp
parent3b91d2662310aee532cc84e1447824459671767e (diff)
merged
Diffstat (limited to 'geometry/linesAndSegments.cpp')
-rw-r--r--geometry/linesAndSegments.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/geometry/linesAndSegments.cpp b/geometry/linesAndSegments.cpp
index ba6c468..c86b331 100644
--- a/geometry/linesAndSegments.cpp
+++ b/geometry/linesAndSegments.cpp
@@ -17,8 +17,7 @@ vector<pt> lineSegmentIntersection(pt p0, pt p1, pt p2, pt p3) {
double b = cross(p2 - p0, p3 - p2);
double c = cross(p1 - p0, p0 - p2);
if (a < 0) {a = -a; b = -b; c = -c;}
- if (b < -EPS || a-b < -EPS ||
- c < -EPS || a-c < -EPS) return {};
+ if (b < -EPS || b-a > EPS || c < -EPS || c-a > EPS) return {};
if (a > EPS) return {p0 + b/a*(p1 - p0)};
vector<pt> result;
auto insertUnique = [&](pt p) {