Fix issue with loop clearing.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-02-20 09:59:59 +02:00
parent 5472bef03e
commit 81bde9bb95

View File

@ -547,6 +547,11 @@ QVector<QPointF> AngleBySecondRightAngle(QVector<QPointF> points, QPointF p2, QP
seam.setAngle(seam.angle()+90); seam.setAngle(seam.angle()+90);
seam.setLength(p.GetSAAfter(width)); seam.setLength(p.GetSAAfter(width));
points.append(seam.p2()); points.append(seam.p2());
if (needRollback != nullptr)
{
*needRollback = true;
}
} }
else else
{ {
@ -982,6 +987,26 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
ekvPoints.removeLast(); ekvPoints.removeLast();
if (IsOutsidePoint(bigLine1.p1(), bigLine1.p2(), px))
{
if (ekvPoints.size() > 3)
{
const QLineF edge1(ekvPoints.at(ekvPoints.size()-2), ekvPoints.last());
const QLineF edge2(ekvPoints.at(0), ekvPoints.at(1));
QPointF crosPoint;
const QLineF::IntersectType type = edge1.intersect(edge2, &crosPoint );
if (type == QLineF::BoundedIntersection)
{
ekvPoints.removeFirst();
ekvPoints.removeLast();
ekvPoints.append(crosPoint);
}
}
}
else
{
bool success = false; bool success = false;
ekvPoints = RollbackSeamAllowance(ekvPoints, edge, &success); ekvPoints = RollbackSeamAllowance(ekvPoints, edge, &success);
@ -1000,6 +1025,15 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
ekvPoints.append(ekvPoints.first()); ekvPoints.append(ekvPoints.first());
} }
} }
if (not ekvPoints.isEmpty())
{
if (ekvPoints.last().toPoint() != ekvPoints.first().toPoint())
{
ekvPoints.append(ekvPoints.first());// Should be always closed
}
}
}
break; break;
} }
QT_WARNING_POP QT_WARNING_POP