From 0281f13ba67feeef60ae38df64792d21f5004c73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Sun, 21 Aug 2022 22:51:48 +0200 Subject: [PATCH] Fix circle/line intersection --- Software/PC_Application/Traces/tracepolar.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Software/PC_Application/Traces/tracepolar.cpp b/Software/PC_Application/Traces/tracepolar.cpp index 66f45cf..7de48ea 100644 --- a/Software/PC_Application/Traces/tracepolar.cpp +++ b/Software/PC_Application/Traces/tracepolar.cpp @@ -295,6 +295,11 @@ bool TracePolar::constrainLineToCircle(QPointF &a, QPointF &b, QPointF center, d // adjust both points, order does not matter a = inter1; b = inter2; + } else if(!inter1betweenPoints && !inter2betweenPoints) { + // the line intersect the circle but outside of the segment defined by the points -> ignore + a += center; + b += center; + return false; } else { // exactly one intersection point must lie between the two line points, otherwise we would have returned already auto inter = inter1betweenPoints ? inter1 : inter2;