Fixed issue #665. Passmark not correct.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-18 21:39:13 +03:00
parent fffd66ac53
commit ef9f9c6af4
3 changed files with 16 additions and 9 deletions

View File

@ -951,8 +951,7 @@ QVector<QPointF> VAbstractPiece::SubPath(const QVector<QPointF> &path, int start
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint) bool VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint)
{ {
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) return VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint);
&& prevPoint == nextPoint);// not zigzag
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -969,7 +968,5 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr
ekvPointOnLine = true; ekvPointOnLine = true;
} }
} }
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) && ekvPointOnLine);
&& prevPoint == nextPoint// not zigzag
&& ekvPointOnLine);
} }

View File

@ -172,6 +172,7 @@ protected:
template <class T> template <class T>
static QVector<T> RemoveDublicates(const QVector<T> &points, bool removeFirstAndLast = true); static QVector<T> RemoveDublicates(const QVector<T> &points, bool removeFirstAndLast = true);
static qreal MaxLocalSA(const VSAPoint &p, qreal width); static qreal MaxLocalSA(const VSAPoint &p, qreal width);
static bool IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint);
private: private:
QSharedDataPointer<VAbstractPieceData> d; QSharedDataPointer<VAbstractPieceData> d;
@ -204,8 +205,6 @@ private:
static QLineF BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3); static QLineF BisectorLine(const QPointF &p1, const QPointF &p2, const QPointF &p3);
static qreal AngleBetweenBisectors(const QLineF &b1, const QLineF &b2); 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 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); Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);
@ -255,7 +254,7 @@ QVector<T> VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, bo
const T &prevPoint = buf1.at(prev); const T &prevPoint = buf1.at(prev);
const T &nextPoint = buf1.at(next); 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. // If RemoveDublicates does not remove these points it is a valid case.
// Case where last point equal first point // Case where last point equal first point
|| ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint))) || ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint)))

View File

@ -1006,8 +1006,19 @@ bool VPiece::GetSeamPassmarkSAPoint(const VSAPoint &previousSAPoint, const VSAPo
{ {
SCASSERT(data != nullptr) SCASSERT(data != nullptr)
QVector<QPointF> ekvPoints;
const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit()); const qreal width = ToPixel(GetSAWidth(), *data->GetPatternUnit());
const QVector<QPointF> 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()) if (ekvPoints.isEmpty())
{ // Just in case { // Just in case