summaryrefslogtreecommitdiff
path: root/geometry/linesAndSegments.cpp
diff options
context:
space:
mode:
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) {