From 289bf05642e35f75532bdff97defc7f5fe63753d Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 27 Jun 2016 15:09:32 +0300 Subject: [PATCH] Fixed issue #516. Valentina crashes when use "Point intersect line and axis" instrument. --HG-- branch : feature --- .../toollinepoint/vtoollineintersectaxis.cpp | 9 ++++++++- .../toolpoint/toolsinglepoint/vtooltriangle.cpp | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 802e3bc92..c03992c02 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -157,7 +157,14 @@ QPointF VToolLineIntersectAxis::FindPoint(const QLineF &axis, const QLineF &line QLineF::IntersectType intersect = axis.intersect(line, &fPoint); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { - return fPoint; + if(axis.angle() == line.angle() || qAbs(axis.angle() - line.angle()) == 180) + { + return QPointF(); + } + else + { + return fPoint; + } } else { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index c3485d5c1..3bfff25c4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -182,6 +182,10 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c { return QPointF(); } + if (axis.angle() == hypotenuse.angle() || qAbs(axis.angle() - hypotenuse.angle()) == 180) + { + return QPointF(); + } qreal step = 1;