diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 70db3c3a5..c326c3cb5 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -951,8 +951,7 @@ QVector VAbstractPiece::SubPath(const QVector &path, int start //--------------------------------------------------------------------------------------------------------------------- bool VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint) { - return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) - && prevPoint == nextPoint);// not zigzag + return VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint); } //--------------------------------------------------------------------------------------------------------------------- @@ -969,7 +968,5 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr ekvPointOnLine = true; } } - return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) - && prevPoint == nextPoint// not zigzag - && ekvPointOnLine); + return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) && ekvPointOnLine); } diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index 15c8a058d..9f932fd5c 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -172,6 +172,7 @@ protected: template static QVector RemoveDublicates(const QVector &points, bool removeFirstAndLast = true); static qreal MaxLocalSA(const VSAPoint &p, qreal width); + static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint); private: QSharedDataPointer d; @@ -204,8 +205,6 @@ private: static QLineF BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3); static qreal AngleBetweenBisectors(const QLineF &b1, const QLineF &b2); static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint); - static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, - const VSAPoint &nextPoint); }; Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE); @@ -255,7 +254,7 @@ QVector VAbstractPiece::CorrectEquidistantPoints(const QVector &points, bo const T &prevPoint = buf1.at(prev); const T &nextPoint = buf1.at(next); - if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint) + if (not (IsEkvPointOnLine(iPoint, prevPoint, nextPoint) && prevPoint == nextPoint/*not zigzag*/) // If RemoveDublicates does not remove these points it is a valid case. // Case where last point equal first point || ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint))) diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index cd30a3d8b..7259a9fff 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -1006,8 +1006,19 @@ bool VPiece::GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPo { SCASSERT(data != nullptr) + QVector ekvPoints; const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit()); - const QVector ekvPoints = EkvPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, passmarkSAPoint, width); + if (IsEkvPointOnLine(passmarkSAPoint, previousSAPoint, nextSAPoint)) // see issue #665 + { + QLineF line (passmarkSAPoint, nextSAPoint); + line.setAngle(line.angle() + 90); + line.setLength(VAbstractPiece::MaxLocalSA(passmarkSAPoint, width)); + ekvPoints.append(line.p2()); + } + else + { + ekvPoints = EkvPoint(previousSAPoint, passmarkSAPoint, nextSAPoint, passmarkSAPoint, width); + } if (ekvPoints.isEmpty()) { // Just in case