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,22 +987,51 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
ekvPoints.removeLast(); ekvPoints.removeLast();
bool success = false; if (IsOutsidePoint(bigLine1.p1(), bigLine1.p2(), px))
ekvPoints = RollbackSeamAllowance(ekvPoints, edge, &success);
if (success)
{ {
px = ekvPoints.last(); if (ekvPoints.size() > 3)
} {
const QLineF edge1(ekvPoints.at(ekvPoints.size()-2), ekvPoints.last());
const QLineF edge2(ekvPoints.at(0), ekvPoints.at(1));
QLineF seam(px, points.at(1)); QPointF crosPoint;
seam.setAngle(seam.angle()+90); const QLineF::IntersectType type = edge1.intersect(edge2, &crosPoint );
seam.setLength(points.at(0).GetSAAfter(width)); if (type == QLineF::BoundedIntersection)
ekvPoints.append(seam.p2()); {
ekvPoints.removeFirst();
ekvPoints.removeLast();
ekvPoints.append(crosPoint);
}
}
}
else
{
bool success = false;
ekvPoints = RollbackSeamAllowance(ekvPoints, edge, &success);
if (success)
{
px = ekvPoints.last();
}
QLineF seam(px, points.at(1));
seam.setAngle(seam.angle()+90);
seam.setLength(points.at(0).GetSAAfter(width));
ekvPoints.append(seam.p2());
if (not ekvPoints.isEmpty())
{
ekvPoints.append(ekvPoints.first());
}
}
if (not ekvPoints.isEmpty()) if (not ekvPoints.isEmpty())
{ {
ekvPoints.append(ekvPoints.first()); if (ekvPoints.last().toPoint() != ekvPoints.first().toPoint())
{
ekvPoints.append(ekvPoints.first());// Should be always closed
}
} }
} }
break; break;