Fixed issue #646. Wrong seam allowance if node is on line.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-03-30 11:06:47 +03:00
parent e19c9392a1
commit 4907ce584f
6 changed files with 863 additions and 80 deletions

View File

@ -0,0 +1,86 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.4.6</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements/>
<increments/>
<draw name="Pattern piece 1">
<calculation>
<point type="single" x="0.79375" y="1.05833" id="1" name="A" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="2" name="A1" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="0" length="35"/>
<point type="endLine" typeLine="hair" id="3" name="A2" basePoint="1" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="30"/>
<point type="pointOfIntersection" id="4" name="A3" firstPoint="2" secondPoint="3" mx="0.132292" my="0.264583"/>
<line typeLine="hair" id="5" firstPoint="3" secondPoint="4" lineColor="black"/>
<line typeLine="hair" id="6" firstPoint="2" secondPoint="4" lineColor="black"/>
<point type="alongLine" typeLine="none" id="7" name="A4" firstPoint="3" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="8" name="A5" firstPoint="2" secondPoint="3" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="9" name="A6" firstPoint="1" secondPoint="4" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="alongLine" typeLine="none" id="10" name="A7" firstPoint="4" secondPoint="1" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<point type="endLine" typeLine="hair" id="11" name="A8" basePoint="4" mx="0.132292" lineColor="black" my="0.264583" angle="45" length="5"/>
<spline type="simpleInteractive" point4="2" angle1="331.947" angle2="206.283" id="22" color="black" length1="10.6467" length2="3.72066" point1="1"/>
<point type="alongLine" typeLine="none" id="23" name="A9" firstPoint="9" secondPoint="10" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="alongLine" typeLine="none" id="26" name="A10" firstPoint="1" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<spline type="pathInteractive" id="28" color="black">
<pathPoint angle1="99.6112" pSpline="1" angle2="279.611" length1="0" length2="12.1117"/>
<pathPoint angle1="182.155" pSpline="23" angle2="2.155" length1="3.681" length2="7.90283"/>
<pathPoint angle1="104.746" pSpline="4" angle2="284.746" length1="7.65108" length2="0"/>
</spline>
<point type="alongLine" typeLine="none" id="36" name="A11" firstPoint="3" secondPoint="4" mx="0.132292" lineColor="black" my="0.264583" length="CurrentLength/2"/>
<point type="endLine" typeLine="hair" id="37" name="A12" basePoint="3" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="5"/>
<point type="endLine" typeLine="hair" id="38" name="A13" basePoint="4" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="5"/>
<point type="endLine" typeLine="hair" id="39" name="A14" basePoint="36" mx="0.132292" lineColor="black" my="0.264583" angle="270" length="8"/>
<spline type="pathInteractive" id="40" color="black">
<pathPoint angle1="68.2546" pSpline="38" angle2="248.255" length1="0" length2="3.04533"/>
<pathPoint angle1="20.525" pSpline="39" angle2="200.525" length1="6.45371" length2="5.13433"/>
<pathPoint angle1="331.658" pSpline="37" angle2="151.658" length1="7.95538" length2="1.19499"/>
</spline>
</calculation>
<modeling>
<point type="modeling" inUse="true" id="29" idObject="3" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="30" idObject="1" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="31" idObject="28"/>
<point type="modeling" inUse="true" id="32" idObject="23" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="33" idObject="28"/>
<point type="modeling" inUse="true" id="34" idObject="4" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="41" idObject="36" mx="0.963072" my="-2.00913"/>
<point type="modeling" inUse="true" id="42" idObject="38" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="43" idObject="40"/>
<point type="modeling" inUse="true" id="44" idObject="39" mx="0.132292" my="0.264583"/>
<spline type="modelingPath" inUse="true" id="45" idObject="40"/>
<point type="modeling" inUse="true" id="46" idObject="37" mx="0.132292" my="0.264583"/>
<path type="1" typeLine="hair" inUse="true" id="47" name="test path">
<nodes>
<node type="NodePoint" idObject="42"/>
<node type="NodeSplinePath" reverse="0" idObject="43"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="one" idObject="44"/>
<node type="NodeSplinePath" reverse="0" idObject="45"/>
<node type="NodePoint" idObject="46"/>
</nodes>
</path>
</modeling>
<details>
<detail id="35" name="Detail" forbidFlipping="true" united="false" seamAllowance="true" mx="0.290976" inLayout="true" width="1" my="35.1303" version="2">
<data rotation="0" letter="" fontSize="0" visible="false" mx="0" width="1" my="0" height="1"/>
<patternInfo rotation="0" fontSize="0" visible="false" mx="0" width="1" my="0" height="1"/>
<grainline arrows="0" rotation="1" visible="false" mx="0" my="0" length="90"/>
<nodes>
<node type="NodePoint" idObject="34"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="three" idObject="41"/>
<node type="NodePoint" idObject="29"/>
<node type="NodePoint" idObject="30"/>
<node type="NodeSplinePath" reverse="0" idObject="31"/>
<node type="NodePoint" passmarkAngle="straightforward" passmark="true" passmarkLine="three" idObject="32"/>
<node type="NodeSplinePath" reverse="0" idObject="33"/>
</nodes>
<csa>
<record path="47" reverse="false" includeAs="1" start="34" end="29"/>
</csa>
</detail>
</details>
<groups/>
</draw>
</pattern>

View File

@ -935,3 +935,29 @@ QVector<QPointF> VAbstractPiece::SubPath(const QVector<QPointF> &path, int start
return subPath; return subPath;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsEkvPointOnLine(const QPointF &iPoint, const QPointF &prevPoint, const QPointF &nextPoint)
{
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint)
&& prevPoint == nextPoint);// not zigzag
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &prevPoint, const VSAPoint &nextPoint)
{
// See bug #646
bool ekvPointOnLine = false;
if (VFuzzyComparePossibleNulls(prevPoint.GetSAAfter(), iPoint.GetSABefore())
&& VFuzzyComparePossibleNulls(iPoint.GetSAAfter(), nextPoint.GetSABefore()))
{
if (VFuzzyComparePossibleNulls(prevPoint.GetSAAfter(), nextPoint.GetSABefore()))
{
ekvPointOnLine = true;
}
}
return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint)
&& prevPoint == nextPoint// not zigzag
&& ekvPointOnLine);
}

View File

@ -200,6 +200,9 @@ private:
static QPointF SingleParallelPoint(const QPointF &p1, const QPointF &p2, qreal angle, qreal width); 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 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 VSAPoint &iPoint, const VSAPoint &prevPoint,
const VSAPoint &nextPoint);
}; };
Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(VAbstractPiece, Q_MOVABLE_TYPE);
@ -245,16 +248,16 @@ QVector<T> VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, bo
next = 0; next = 0;
} }
const QPointF &iPoint = buf1.at(i); const T &iPoint = buf1.at(i);
const QPointF &prevPoint = buf1.at(prev); const T &prevPoint = buf1.at(prev);
const QPointF &nextPoint = buf1.at(next); const T &nextPoint = buf1.at(next);
if ((not VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) && prevPoint != nextPoint)// not zigzag if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint)
// 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)))
{ {
buf2.append(buf1.at(i)); buf2.append(iPoint);
prev = -1; prev = -1;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,9 @@ private:
QVector<QPointF> InputPointsCase3a() const; QVector<QPointF> InputPointsCase3a() const;
QVector<QPointF> InputPointsCase4a() const; QVector<QPointF> InputPointsCase4a() const;
QVector<QPointF> InputPointsCase5a() const; QVector<QPointF> InputPointsCase5a() const;
QVector<VSAPoint> InputPointsIssue646() const;
QVector<QPointF> OutputPointsIssue646() const;
}; };
#endif // TST_VABSTRACTPIECE_H #endif // TST_VABSTRACTPIECE_H

View File

@ -106,7 +106,7 @@ void TST_VPiece::ClearLoop()
const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data); const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data);
QVector<QPointF> origPoints; QVector<QPointF> origPoints;
origPoints.append(QPointF(42.46405659601934, 415.2845470563871)); origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
origPoints.append(QPointF(669.4711112822802, 560.1912138528764)); origPoints.append(QPointF(669.4711112822802, 560.1912138528764));
origPoints.append(QPointF(669.3860586912449, 594.8702688224456)); origPoints.append(QPointF(669.3860586912449, 594.8702688224456));
origPoints.append(QPointF(669.8537241707239, 619.8499975627876)); origPoints.append(QPointF(669.8537241707239, 619.8499975627876));
@ -120,8 +120,10 @@ void TST_VPiece::ClearLoop()
origPoints.append(QPointF(689.2446146317781, 744.0149891243127)); origPoints.append(QPointF(689.2446146317781, 744.0149891243127));
origPoints.append(QPointF(692.7177992446996, 752.7004886151328)); origPoints.append(QPointF(692.7177992446996, 752.7004886151328));
origPoints.append(QPointF(696.2448548679188, 760.4478278509594)); origPoints.append(QPointF(696.2448548679188, 760.4478278509594));
origPoints.append(QPointF(701.7756191283249, 771.1817664136103)); origPoints.append(QPointF(701.8005387196029, 771.2301295961994));
origPoints.append(QPointF(715.0901851898707, 793.875700151992)); origPoints.append(QPointF(709.4908502689113, 784.4621360005407));
origPoints.append(QPointF(713.2090350731621, 790.7616409320319));
origPoints.append(QPointF(715.0121915355467, 793.763727920337));
origPoints.append(QPointF(718.7808834775552, 799.1742815201673)); origPoints.append(QPointF(718.7808834775552, 799.1742815201673));
origPoints.append(QPointF(722.5723522600899, 803.7317522627161)); origPoints.append(QPointF(722.5723522600899, 803.7317522627161));
origPoints.append(QPointF(726.4900810611796, 807.6675956080389)); origPoints.append(QPointF(726.4900810611796, 807.6675956080389));
@ -135,10 +137,10 @@ void TST_VPiece::ClearLoop()
origPoints.append(QPointF(766.9761113390083, 824.236813134474)); origPoints.append(QPointF(766.9761113390083, 824.236813134474));
origPoints.append(QPointF(773.6735265709667, 824.7970381873482)); origPoints.append(QPointF(773.6735265709667, 824.7970381873482));
origPoints.append(QPointF(780.6615727577812, 825.0343457026618)); origPoints.append(QPointF(780.6615727577812, 825.0343457026618));
origPoints.append(QPointF(792.1099959092389, 824.8480813766124)); origPoints.append(QPointF(792.109995909239, 824.8480813766124));
origPoints.append(QPointF(826.0032661558732, 877.1274330708662)); origPoints.append(QPointF(826.0032661558732, 877.1274330708662));
origPoints.append(QPointF(828.6858753986579, 1697.305833468011)); origPoints.append(QPointF(828.6858753986579, 1697.305833468011));
origPoints.append(QPointF(42.46405659601934, 415.2845470563871)); origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
// Begin comparison // Begin comparison
Comparison(pointsEkv, origPoints); Comparison(pointsEkv, origPoints);