diff --git a/ChangeLog.txt b/ChangeLog.txt index 737dba10c..e72c5e1b5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -52,6 +52,7 @@ # Version 0.4.6 - [#594] Broken export on Mac. - Math parser allows apostrophe in variable name. +- [#603] Wrong layout caused by wrong seam allowance. # Version 0.4.5 October 15, 2016 - [#435] Valentina doesn't change the cursor. diff --git a/src/app/share/collection/bugs/Issue_#603.val b/src/app/share/collection/bugs/Issue_#603.val new file mode 100644 index 000000000..b5ec518df --- /dev/null +++ b/src/app/share/collection/bugs/Issue_#603.val @@ -0,0 +1,280 @@ + + + + 0.2.4 + cm + + + + Issue_#603.vit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/src/app/share/collection/bugs/Issue_#603.vit b/src/app/share/collection/bugs/Issue_#603.vit new file mode 100644 index 000000000..a96e2962c --- /dev/null +++ b/src/app/share/collection/bugs/Issue_#603.vit @@ -0,0 +1,36 @@ + + + + 0.3.3 + false + + cm + 998 + + + + 1800-01-01 + unknown + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp index 966e01dd6..c28f2f10e 100644 --- a/src/libs/vlayout/vabstractdetail.cpp +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -359,7 +359,7 @@ QVector VAbstractDetail::CorrectEquidistantPoints(const QVector VAbstractDetail::CheckLoops(const QVector &points) { - const int count = points.size(); + int count = points.size(); /*If we got less than 4 points no need seek loops.*/ if (count < 4) { @@ -458,13 +458,32 @@ QVector VAbstractDetail::CheckLoops(const QVector &points) switch (status) { case ParallelIntersection: + { /*We have found a loop.*/ - // Theoretically there is no big difference which point j or jNext to select. - // In the end we will draw a line in any case. - ekvPoints.append(points.at(i)); - ekvPoints.append(points.at(jNext)); - i = j; + // Very tricky case + // See the file "collection/bugs/Issue_#603.val" + const QLineF line1(points.at(i+1), points.at(j)); + const QLineF line2(points.at(i), points.at(jNext)); + + if (line1.length() <= line2.length()) + { + // In this case we did not check a loop edges and can just skip them + ekvPoints.append(points.at(i)); + ekvPoints.append(points.at(jNext)); + + i = j; // Skip a loo + } + else + { + // In this case a loop edges probably was also chacked and added to the list + ekvPoints.clear();// Previous data is wrong and belong to loop. + ekvPoints.append(points.at(j)); + ekvPoints.append(points.at(i+1)); + + count = j+1;// All beyond this belong to loop. + } break; + } case BoundedIntersection: /*We have found a loop.*/ ekvPoints.append(points.at(i)); diff --git a/src/test/ValentinaTest/tst_vabstractdetail.cpp b/src/test/ValentinaTest/tst_vabstractdetail.cpp index 1ac3995d2..2566d0d19 100644 --- a/src/test/ValentinaTest/tst_vabstractdetail.cpp +++ b/src/test/ValentinaTest/tst_vabstractdetail.cpp @@ -473,6 +473,90 @@ void TST_VAbstractDetail::PathRemoveLoop_data() const // Check a seam allowance path. // The curve that causes the issue is the last in the list. QTest::newRow("Test case issue #515. Small loop in seam allowance path.") << path << res; + + path.clear(); + path << QPointF(1229.6503937007876, 937.6667716535435); + path << QPointF(203.08931117793543, 937.6667716535435); + path << QPointF(459.7677349767701, -2166.704563141019); + path << QPointF(1229.6503937007876, -1990.077167189857); + path << QPointF(1229.6503937007876, -555.2466141732282); + path << QPointF(920.1053824527112, -555.2466141732282); + path << QPointF(887.034516310979, -63.90803149606281); + path << QPointF(816.3607592795726, -63.908031496062826); + path << QPointF(780.7580397937137, -592.8627210002539); + path << QPointF(816.0241340748559, -1202.917917917055); + path << QPointF(887.3711415156957, -1202.917917917055); + path << QPointF(920.4420076574283, -630.8371653543306); + path << QPointF(1229.6503937007876, -630.8371653543306); + path << QPointF(1229.6503937007876, 937.6667716535435); + + res.clear(); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(203.08931117793543, 937.6667716535435); + res << QPointF(459.7677349767702, -2166.704563141019); + res << QPointF(1229.6503937007876, -1990.077167189857); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(1229.6503937007876, 937.6667716535435); + + // See the file "collection/bugs/Issue_#603.val" + // Point H1 is first in the list + QTest::newRow("Test issue 603. Case 1.") << path << res; + + path.clear(); + path << QPointF(1229.6503937007876, -630.8371653543306); + path << QPointF(1229.6503937007876, 937.6667716535435); + path << QPointF(203.08931117793543, 937.6667716535435); + path << QPointF(459.7677349767702, -2166.704563141019); + path << QPointF(1229.6503937007876, -1990.077167189857); + path << QPointF(1229.6503937007876, -555.2466141732282); + path << QPointF(920.1053824527112, -555.2466141732282); + path << QPointF(887.034516310979, -63.90803149606281); + path << QPointF(816.3607592795726, -63.908031496062826); + path << QPointF(780.7580397937137, -592.8627210002539); + path << QPointF(816.0241340748559, -1202.917917917055); + path << QPointF(887.3711415156957, -1202.917917917055); + path << QPointF(920.4420076574283, -630.8371653543306); + path << QPointF(1229.6503937007876, -630.8371653543306); + + res.clear(); + res << QPointF(1229.6503937007876, -1990.077167189857); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(203.08931117793543, 937.6667716535435); + res << QPointF(459.7677349767702, -2166.704563141019); + res << QPointF(1229.6503937007876, -1990.077167189857); + + // See the file "collection/bugs/Issue_#603.val" + // Point T1 is first in the list + QTest::newRow("Test issue 603. Case 2.") << path << res; + + path.clear(); + path << QPointF(920.4420076574283, -630.8371653543306); + path << QPointF(1229.6503937007876, -630.8371653543306); + path << QPointF(1229.6503937007876, 937.6667716535435); + path << QPointF(203.08931117793543, 937.6667716535435); + path << QPointF(459.7677349767702, -2166.704563141019); + path << QPointF(1229.6503937007876, -1990.077167189857); + path << QPointF(1229.6503937007876, -555.2466141732282); + path << QPointF(920.1053824527112, -555.2466141732282); + path << QPointF(887.034516310979, -63.90803149606281); + path << QPointF(816.3607592795726, -63.908031496062826); + path << QPointF(780.7580397937137, -592.8627210002539); + path << QPointF(816.0241340748559, -1202.917917917055); + path << QPointF(887.3711415156957, -1202.917917917055); + path << QPointF(920.4420076574283, -630.8371653543306); + + res.clear(); + res << QPointF(1229.6503937007876, -1990.077167189857); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(1229.6503937007876, 937.6667716535435); + res << QPointF(203.08931117793543, 937.6667716535435); + res << QPointF(459.7677349767702, -2166.704563141019); + res << QPointF(1229.6503937007876, -1990.077167189857); + + // See the file "collection/bugs/Issue_#603.val" + // Point T62 is first in the list + QTest::newRow("Test issue 603. Case 3.") << path << res; } //---------------------------------------------------------------------------------------------------------------------