Added second case when create a passmark for point that lies on line.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-27 18:19:23 +03:00
parent a431aa8855
commit 677ef71626
2 changed files with 11 additions and 2 deletions

View File

@ -181,6 +181,7 @@ protected:
template <class T>
static QVector<T> RemoveDublicates(const QVector<T> &points, bool removeFirstAndLast = true);
static qreal MaxLocalSA(const VSAPoint &p, qreal width);
static bool IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint);
static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint);
private:
@ -213,7 +214,6 @@ private:
static QPointF SingleParallelPoint(const QPointF &p1, const QPointF &p2, qreal angle, qreal width);
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);
};
Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);

View File

@ -991,7 +991,16 @@ bool VPiece::GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPo
QVector<QPointF> ekvPoints;
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
if (IsEkvPointOnLine(passmarkSAPoint, previousSAPoint, nextSAPoint)) // see issue #665
/* Because method VAbstractPiece::EkvPoint has troubles with edges on a same line we should specially treat such
cases.
First check if two edges and seam alowance create paralell lines.
Second case check if two edges are on a same line geometrically and a passmark point has equal SA width.*/
if (IsEkvPointOnLine(passmarkSAPoint, previousSAPoint, nextSAPoint)// see issue #665
|| (IsEkvPointOnLine(static_cast<QPointF>(passmarkSAPoint), static_cast<QPointF>(previousSAPoint),
static_cast<QPointF>(nextSAPoint))
&& qAbs(passmarkSAPoint.GetSABefore(width)
- passmarkSAPoint.GetSAAfter(width)) < VGObject::accuracyPointOnLine))
{
QLineF line (passmarkSAPoint, nextSAPoint);
line.setAngle(line.angle() + 90);