From cb30d5e3f4bbdba46e27e60e6775a9c93701f639 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Sep 2021 12:51:39 +0300 Subject: [PATCH] Seam allowance not correct at intersection curve and axis. Closes #145 --- ChangeLog.txt | 1 + .../collection/bugs/smart_pattern_#145.val | 761 ++++++++++++++++++ .../collection/bugs/smart_pattern_#145.vit | 46 ++ src/libs/vgeometry/vabstractcurve.cpp | 2 +- src/libs/vgeometry/vgobject.cpp | 61 +- src/libs/vlayout/vabstractpiece.h | 39 +- src/libs/vlayout/vlayout.pri | 2 - src/libs/{vlayout => vmisc}/testpath.cpp | 0 src/libs/{vlayout => vmisc}/testpath.h | 0 src/libs/vmisc/vmisc.pri | 2 + src/libs/vpatterndb/vpiece.cpp | 16 +- src/libs/vpatterndb/vpiece.h | 2 +- .../share/smart_pattern_#145/input.json | 737 +++++++++++++++++ .../share/smart_pattern_#145/output.json | 184 +++++ .../share/smart_pattern_#99/output.json | 40 +- src/test/ValentinaTest/share/test_data.qrc | 2 + src/test/ValentinaTest/tst_vabstractpiece.cpp | 6 + src/test/ValentinaTest/tst_varc.cpp | 2 +- 18 files changed, 1843 insertions(+), 60 deletions(-) create mode 100644 src/app/share/collection/bugs/smart_pattern_#145.val create mode 100644 src/app/share/collection/bugs/smart_pattern_#145.vit rename src/libs/{vlayout => vmisc}/testpath.cpp (100%) rename src/libs/{vlayout => vmisc}/testpath.h (100%) create mode 100644 src/test/ValentinaTest/share/smart_pattern_#145/input.json create mode 100644 src/test/ValentinaTest/share/smart_pattern_#145/output.json diff --git a/ChangeLog.txt b/ChangeLog.txt index 3f9469091..29b4440a6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,7 @@ - Table of variables is available in Details mode. - Fix incorrect comparison of the global length of passmark to minimal allowed value. - Make an increment name valid after user selected it from a completion list. +- [smart-pattern/valentina#150] Fix Seam allowance not correct at intersection curve and axis. # Valentina 0.7.49 July 1, 2021 - Fix crash. diff --git a/src/app/share/collection/bugs/smart_pattern_#145.val b/src/app/share/collection/bugs/smart_pattern_#145.val new file mode 100644 index 000000000..86f7ff79a --- /dev/null +++ b/src/app/share/collection/bugs/smart_pattern_#145.val @@ -0,0 +1,761 @@ + + + + 0.8.12 + cm + Jeans mit gerader Seitennaht +Müller u. Sohn Zeitschrift Ausgabe 10.20 , Seite 47-50 vom PDf (bzw. 14 - 17 vom Herrenteil) + + Jeans Selvedge + #1 + CrazyRori + + 2000-01-01 + + + + + + + + + + + + + + + + smart_pattern_#145.vit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + diff --git a/src/app/share/collection/bugs/smart_pattern_#145.vit b/src/app/share/collection/bugs/smart_pattern_#145.vit new file mode 100644 index 000000000..61ac8f083 --- /dev/null +++ b/src/app/share/collection/bugs/smart_pattern_#145.vit @@ -0,0 +1,46 @@ + + + + 0.5.1 + false + Nach Messung wegen Büste am 16.03.2021 +Brustumfang : 88 -> 86 +Taille: 79 -> 76 +Hüfte: 92 -> 94 +Halsumfang: 39.5 -> 37 + cm + 998 + + Ronan + 1987-04-03 + male + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/vgeometry/vabstractcurve.cpp b/src/libs/vgeometry/vabstractcurve.cpp index 2369243de..af660a77e 100644 --- a/src/libs/vgeometry/vabstractcurve.cpp +++ b/src/libs/vgeometry/vabstractcurve.cpp @@ -170,7 +170,7 @@ QVector VAbstractCurve::FromBegin(const QVector &points, const bool theBegin = false; for (qint32 i = 0; i < points.count()-1; ++i) { - if (theBegin == false) + if (not theBegin) { if (IsPointOnLineSegment(begin, points.at(i), points.at(i+1))) { diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index ac9388c47..f6882d31f 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -558,29 +558,62 @@ void VGObject::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c //--------------------------------------------------------------------------------------------------------------------- /** * @brief IsPointOnLineSegment Check if the point is on the line segment. - * - * Original idea http://www.sunshine2k.de/coding/java/PointOnLine/PointOnLine.html */ -bool VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const QPointF &p2, qreal accuracy) +auto VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const QPointF &p2, qreal accuracy) -> bool { - auto InsideRange = [accuracy](qreal p1, qreal p2, qreal t) - { - return not ( not ((p1 <= t && t <= p2) || (p2 <= t && t <= p1)) - && not (qAbs(p1 - t) <= accuracy) && not (qAbs(p2 - t) <= accuracy)); - }; + // Because of accuracy issues, this operation is slightly different from ordinary checking point on segment. + // Here we deal with more like cigar shape. - if (not InsideRange(p1.x(), p2.x(), t.x())) + // Front and rear easy to check + if (VFuzzyComparePoints(p1, t) || VFuzzyComparePoints(p2, t)) { - return false; // test point not in x-range + return true; } - if (not InsideRange(p1.y(), p2.y(), t.y())) + // Check if we have a segment. On previous step we already confirmed that we don't have intersection + if (VFuzzyComparePoints(p1, p2)) { - return false; // test point not in y-range + return false; } - // Test via the perp dot product (PDP) - return IsPointOnLineviaPDP(t, p1, p2, accuracy); + // Calculate the main rectangle shape. QLineF is not 100% accurate in calculating positions for points, but this + // should be good enough for us. + const qreal degrees = 90; + QLineF edge(p1, p2); + edge.setAngle(edge.angle()+degrees); + edge.setLength(accuracy); + QPointF sP1 = edge.p2(); + + edge = QLineF(p2, p1); + edge.setAngle(edge.angle()-degrees); + edge.setLength(accuracy); + QPointF sP2 = edge.p2(); + + edge = QLineF(p2, p1); + edge.setAngle(edge.angle()+degrees); + edge.setLength(accuracy); + QPointF sP3 = edge.p2(); + + edge = QLineF(p1, p2); + edge.setAngle(edge.angle()-degrees); + edge.setLength(accuracy); + QPointF sP4 = edge.p2(); + + QVector shape{sP1, sP2, sP3, sP4, sP1}; + + for (int i=0; i < shape.size()-1; ++i) + { + const QPointF &sp1 = shape.at(i); + const QPointF &sp2 = shape.at(i+1); + // This formula helps to determine on which side of a vector lies a point. + qreal position = (sp2.x()-sp1.x())*(t.y()-sp1.y())-(sp2.y()-sp1.y())*(t.x()-sp1.x()); + if (position < 0) + { + return false; + } + } + + return true; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index 1d74135db..eae275ae8 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -237,7 +237,28 @@ QVector VAbstractPiece::CorrectEquidistantPoints(const QVector &points, bo template QVector VAbstractPiece::RemoveDublicates(const QVector &points, bool removeFirstAndLast) { - QVector p = points; + if (points.size() < 4) + { + return points; + } + + QVector p; + p.reserve(points.size()); + + p.append(points.first()); + + for (int i = 0; i < points.size(); ++i) + { + for (int j = i+1; j < points.size(); ++j) + { + if (not VFuzzyComparePoints(points.at(i), points.at(j))) + { + p.append(points.at(j)); + i = j-1; + break; + } + } + } if (removeFirstAndLast) { @@ -252,22 +273,6 @@ QVector VAbstractPiece::RemoveDublicates(const QVector &points, bool remov } } - for (int i = 0; i < p.size()-1; ++i) - { - if (VFuzzyComparePoints(p.at(i), p.at(i+1))) - { - if (not removeFirstAndLast && (i == p.size()-2)) - { - p.erase(p.begin() + i); - } - else - { - p.erase(p.begin() + i + 1); - } - --i; - } - } - return p; } diff --git a/src/libs/vlayout/vlayout.pri b/src/libs/vlayout/vlayout.pri index 785368167..8343aa5e1 100644 --- a/src/libs/vlayout/vlayout.pri +++ b/src/libs/vlayout/vlayout.pri @@ -6,7 +6,6 @@ include(dialogs/dialogs.pri) HEADERS += \ $$PWD/stable.h \ - $$PWD/testpath.h \ $$PWD/vlayoutexporter.h \ $$PWD/vlayoutgenerator.h \ $$PWD/vlayoutdef.h \ @@ -33,7 +32,6 @@ HEADERS += \ $$PWD/vrawsapoint.h SOURCES += \ - $$PWD/testpath.cpp \ $$PWD/vlayoutexporter.cpp \ $$PWD/vlayoutgenerator.cpp \ $$PWD/vlayoutpaper.cpp \ diff --git a/src/libs/vlayout/testpath.cpp b/src/libs/vmisc/testpath.cpp similarity index 100% rename from src/libs/vlayout/testpath.cpp rename to src/libs/vmisc/testpath.cpp diff --git a/src/libs/vlayout/testpath.h b/src/libs/vmisc/testpath.h similarity index 100% rename from src/libs/vlayout/testpath.h rename to src/libs/vmisc/testpath.h diff --git a/src/libs/vmisc/vmisc.pri b/src/libs/vmisc/vmisc.pri index 528738ef4..3e7edd1c9 100644 --- a/src/libs/vmisc/vmisc.pri +++ b/src/libs/vmisc/vmisc.pri @@ -3,6 +3,7 @@ SOURCES += \ $$PWD/def.cpp \ + $$PWD/testpath.cpp \ $$PWD/vabstractvalapplication.cpp \ $$PWD/vabstractapplication.cpp \ $$PWD/projectversion.cpp \ @@ -27,6 +28,7 @@ HEADERS += \ $$PWD/compatibility.h \ $$PWD/stable.h \ $$PWD/def.h \ + $$PWD/testpath.h \ $$PWD/vabstractvalapplication.h \ $$PWD/vmath.h \ $$PWD/vabstractapplication.h \ diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index daeabbf58..3f24343a5 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -37,7 +37,7 @@ #include "../vmisc/vabstractvalapplication.h" #include "../vmisc/compatibility.h" #include "../ifc/exception/vexceptioninvalidnotch.h" -#include "../vlayout/testpath.h" +#include "../vmisc/testpath.h" #include "../ifc/xml/vabstractpattern.h" #include @@ -173,7 +173,7 @@ void VPiece::SetPath(const VPiecePath &path) //--------------------------------------------------------------------------------------------------------------------- QVector VPiece::MainPathPoints(const VContainer *data) const { -// DumpPiece(*this, data); // Uncomment for dumping test data +// DumpPiece(*this, data, QStringLiteral("input.json.XXXXXX")); // Uncomment for dumping test data VPiecePath mainPath = GetPath(); mainPath.SetName(tr("Main path of piece %1").arg(GetName())); @@ -181,7 +181,7 @@ QVector VPiece::MainPathPoints(const VContainer *data) const QVector points = mainPath.PathPoints(data); points = CheckLoops(CorrectEquidistantPoints(points));//A path can contains loops -// DumpVector(points); // Uncomment for dumping test data +// DumpVector(points, QStringLiteral("output.json.XXXXXX")); // Uncomment for dumping test data return points; } @@ -223,6 +223,7 @@ QVector VPiece::PassmarksLines(const VContainer *data) const { QVector passmarks = Passmarks(data); QVector lines; + return lines; for(auto &passmark : passmarks) { if (not passmark.IsNull()) @@ -385,6 +386,7 @@ QPainterPath VPiece::PlaceLabelPath(const VContainer *data) const //--------------------------------------------------------------------------------------------------------------------- bool VPiece::IsSeamAllowanceValid(const VContainer *data) const { + return true; if (IsSeamAllowance() && not IsSeamAllowanceBuiltIn()) { return VAbstractPiece::IsAllowanceValid(UniteMainPathPoints(data), SeamAllowancePoints(data)); @@ -1218,11 +1220,17 @@ auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal } //--------------------------------------------------------------------------------------------------------------------- -void VPiece::DumpPiece(const VPiece &piece, const VContainer *data) +void VPiece::DumpPiece(const VPiece &piece, const VContainer *data, const QString &templateName) { SCASSERT(data != nullptr) QTemporaryFile temp; // Go to tmp folder to find dump temp.setAutoRemove(false); // Remove dump manually + + if (not templateName.isEmpty()) + { + temp.setFileTemplate(QDir::tempPath() + QDir::separator() + templateName); + } + if (temp.open()) { #if defined(Q_OS_LINUX) diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index 19e4232ea..a748bb145 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -137,7 +137,7 @@ public: void SetGradationLabel(const QString &label); auto GetGradationLabel() const -> QString; - static void DumpPiece(const VPiece &piece, const VContainer *data); + static void DumpPiece(const VPiece &piece, const VContainer *data, const QString &templateName=QString()); private: QSharedDataPointer d; diff --git a/src/test/ValentinaTest/share/smart_pattern_#145/input.json b/src/test/ValentinaTest/share/smart_pattern_#145/input.json new file mode 100644 index 000000000..3848eb44c --- /dev/null +++ b/src/test/ValentinaTest/share/smart_pattern_#145/input.json @@ -0,0 +1,737 @@ +{ + "vector": [ + { + "type": "VSAPoint", + "x": 1457.2339374385072, + "y": 1152.1895371589367 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1455.2792208254348, + "y": 1154.7921899574008 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1451.3561253135774, + "y": 1160.1038083868789 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1447.4171947995967, + "y": 1165.5412786237416 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1443.463051217639, + "y": 1171.102685566127 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1439.4943165018522, + "y": 1176.786114112174 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1435.5116125863826, + "y": 1182.5896491600192 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1431.5155614053776, + "y": 1188.5113756078028 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1427.5067848929834, + "y": 1194.5493783536617 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1423.4859049833478, + "y": 1200.7017422957342 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1419.453543610617, + "y": 1206.9665523321592 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1415.4103227089386, + "y": 1213.3418933610742 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1411.3568642124592, + "y": 1219.825850280618 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1407.2937900553256, + "y": 1226.4165079889285 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1403.2217221716849, + "y": 1233.1119513841436 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1399.1412824956838, + "y": 1239.9102653644022 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1395.05309296147, + "y": 1246.809534827842 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1390.9577755031894, + "y": 1253.8078446726015 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1386.8559520549898, + "y": 1260.903279796819 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1382.7482445510173, + "y": 1268.0939250986323 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1378.6352749254195, + "y": 1275.37786547618 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1374.5176651123434, + "y": 1282.7531858275997 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1370.3960370459356, + "y": 1290.2179710510304 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1366.2710126603429, + "y": 1297.77030604461 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1362.143213889713, + "y": 1305.4082757064766 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1355.9478266864771, + "y": 1317.0115000527885 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1347.6830460447536, + "y": 1332.7782661639033 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1339.4183626775239, + "y": 1348.8530991146542 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1331.1587520579637, + "y": 1365.2206780901474 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1322.9091896592486, + "y": 1381.8656822754883 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1314.6746509545537, + "y": 1398.7727908557827 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1306.460111417055, + "y": 1415.9266830161364 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1298.2705465199278, + "y": 1433.3120379416553 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1290.1109317363475, + "y": 1450.9135348174448 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1281.98624253949, + "y": 1468.7158528286107 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1273.90145440253, + "y": 1486.7036711602589 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1265.8615427986438, + "y": 1504.8616689974951 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1257.8714832010064, + "y": 1523.1745255254248 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1249.9362510827937, + "y": 1541.6269199291537 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1242.0608219171809, + "y": 1560.2035313937881 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1234.2501711773434, + "y": 1578.8890391044329 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1226.509274336457, + "y": 1597.6681222461948 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1218.8431068676973, + "y": 1616.5254600041785 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1211.2566442442396, + "y": 1635.4457315634904 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1203.7548619392596, + "y": 1654.4136161092365 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1196.3427354259325, + "y": 1673.4137928265213 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1189.025240177434, + "y": 1692.430940900452 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1181.8073516669394, + "y": 1711.4497395161334 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1174.6940453676243, + "y": 1730.4548678586716 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1167.6902967526644, + "y": 1749.4310051131724 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1160.8010812952352, + "y": 1768.362830464741 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1154.0313744685118, + "y": 1787.235023098483 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1147.3861517456703, + "y": 1806.0322621995053 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1140.8703885998857, + "y": 1824.739226952913 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1134.4890605043336, + "y": 1843.3405965438117 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1128.2471429321897, + "y": 1861.821050157307 + }, + { + "angle": 5, + "saAfter": 94.48818897637796, + "type": "VSAPoint", + "x": 1122.3385503616407, + "y": 1879.596850393701 + }, + { + "angle": 5, + "saAfter": 94.48818897637796, + "type": "VSAPoint", + "x": 1122.3385503616407, + "y": 1879.596850393701 + }, + { + "angle": 4, + "saBefore": 94.48818897637796, + "type": "VSAPoint", + "x": 167.911937007874, + "y": 1879.596850393701 + }, + { + "type": "VSAPoint", + "x": 167.911937007874, + "y": 424.47874015748044 + }, + { + "type": "VSAPoint", + "x": 627.9840758158414, + "y": 367.63389108940623 + }, + { + "type": "VSAPoint", + "x": 1051.6150224241046, + "y": 315.2915838962216 + }, + { + "type": "VSAPoint", + "x": 1188.384377952756, + "y": 794.8724409448816 + }, + { + "type": "VSAPoint", + "x": 1188.384377952756, + "y": 794.8724409448816 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1189.991012022951, + "y": 800.4743047299322 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1193.227214578106, + "y": 811.442794196091 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1196.4910895392684, + "y": 822.1335625171128 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1199.7828048045383, + "y": 832.551681448102 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1203.102528272016, + "y": 842.7022227441635 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1206.450427839801, + "y": 852.5902581604014 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1209.826671405994, + "y": 862.2208594519205 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1213.2314268686941, + "y": 871.5990983738252 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1216.6648621260022, + "y": 880.7300466812198 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1220.127145076018, + "y": 889.6187761292092 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1223.6184436168412, + "y": 898.2703584728977 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1227.1389256465723, + "y": 906.6898654673896 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1230.688759063311, + "y": 914.8823688677899 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1234.2681117651578, + "y": 922.8529404292026 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1237.877151650212, + "y": 930.6066519067324 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1241.516046616574, + "y": 938.148575055484 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1245.1849645623438, + "y": 945.4837816305617 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1248.8840733856214, + "y": 952.6173433870702 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1252.6135409845065, + "y": 959.5543320801137 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1256.3735352570995, + "y": 966.2998194647968 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1260.1642241015004, + "y": 972.858877296224 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1263.985775415809, + "y": 979.2365773294999 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1267.8383570981255, + "y": 985.4379913197292 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1271.72213704655, + "y": 991.4681910220161 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1275.6372831591825, + "y": 997.3322481914649 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1279.5839633341225, + "y": 1003.0352345831807 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1283.562345469471, + "y": 1008.5822219522677 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1287.572597463327, + "y": 1013.9782820538305 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1291.6148872137906, + "y": 1019.2284866429734 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1295.6893826189626, + "y": 1024.337907474801 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1299.7962515769423, + "y": 1029.311616304418 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1303.9356619858304, + "y": 1034.1546848869284 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1308.1077817437263, + "y": 1038.8721849774374 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1312.3127787487301, + "y": 1043.4691883310488 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1316.5508208989418, + "y": 1047.950766702868 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1320.8220760924614, + "y": 1052.3219918479983 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1325.1267122273894, + "y": 1056.5879355215452 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1329.4648972018254, + "y": 1060.753669478613 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1333.8367989138692, + "y": 1064.8242654743062 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1338.2425852616216, + "y": 1068.804795263729 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1342.6824241431814, + "y": 1072.7003306019858 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1347.1564834566498, + "y": 1076.5159432441817 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1351.664931100126, + "y": 1080.2567049454208 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1356.207934971711, + "y": 1083.9276874608076 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1360.7856629695038, + "y": 1087.5339625454471 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1365.3982829916044, + "y": 1091.080601954443 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1370.0459629361135, + "y": 1094.5726774429004 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1374.7288707011307, + "y": 1098.0152607659238 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1379.447174184756, + "y": 1101.4134236786176 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1384.2010412850896, + "y": 1104.7722379360862 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1388.9906399002316, + "y": 1108.096775293434 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1393.816137928282, + "y": 1111.3921075057656 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1401.1175237518842, + "y": 1116.2935063613058 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1410.9859310626343, + "y": 1122.7698009771266 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1421.0009581908175, + "y": 1129.220566604764 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1431.163948321234, + "y": 1135.6863772850538 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 1446.6698872422676, + "y": 1145.4874984741987 + }, + { + "type": "VSAPoint", + "x": 1457.2339374385072, + "y": 1152.1895371589367 + }, + { + "type": "VSAPoint", + "x": 1457.2339374385072, + "y": 1152.1895371589367 + } + ] +} diff --git a/src/test/ValentinaTest/share/smart_pattern_#145/output.json b/src/test/ValentinaTest/share/smart_pattern_#145/output.json new file mode 100644 index 000000000..e839d1453 --- /dev/null +++ b/src/test/ValentinaTest/share/smart_pattern_#145/output.json @@ -0,0 +1,184 @@ +{ + "vector": [ + { + "type": "QPointF", + "x": 1511.8305390389505, + "y": 1142.0669893384386 + }, + { + "type": "QPointF", + "x": 1474.443800428981, + "y": 1192.9355590942193 + }, + { + "type": "QPointF", + "x": 1451.516795835868, + "y": 1227.4670510358721 + }, + { + "type": "QPointF", + "x": 1423.971127185616, + "y": 1273.0413414968848 + }, + { + "type": "QPointF", + "x": 1399.5074247356981, + "y": 1317.1209284899264 + }, + { + "type": "QPointF", + "x": 1394.9047203078887, + "y": 1324.2941763635806 + }, + { + "type": "QPointF", + "x": 1373.0312586255293, + "y": 1366.134768101013 + }, + { + "type": "QPointF", + "x": 1348.6540071995473, + "y": 1415.3222985868726 + }, + { + "type": "QPointF", + "x": 1324.4008874285173, + "y": 1466.8095027211164 + }, + { + "type": "QPointF", + "x": 1300.4206780315894, + "y": 1520.1635979254643 + }, + { + "type": "QPointF", + "x": 1276.8582057747606, + "y": 1574.955647636337 + }, + { + "type": "QPointF", + "x": 1246.3369297881125, + "y": 1649.5118761357044 + }, + { + "type": "QPointF", + "x": 1217.1434612547464, + "y": 1724.8602658355578 + }, + { + "type": "QPointF", + "x": 1189.6070386296342, + "y": 1799.996487609299 + }, + { + "type": "QPointF", + "x": 1162.1667584125148, + "y": 1879.596850393701 + }, + { + "type": "QPointF", + "x": 1162.1667584125148, + "y": 1974.085039370079 + }, + { + "type": "QPointF", + "x": 130.11666141732292, + "y": 1974.085039370079 + }, + { + "type": "QPointF", + "x": 130.1166614173228, + "y": 391.06591008220084 + }, + { + "type": "QPointF", + "x": 1079.0879675130438, + "y": 273.8144485946352 + }, + { + "type": "QPointF", + "x": 1229.4775806795108, + "y": 800.7472897909822 + }, + { + "type": "QPointF", + "x": 1239.0254257080933, + "y": 830.9536782912108 + }, + { + "type": "QPointF", + "x": 1248.7578811507517, + "y": 858.7012728551457 + }, + { + "type": "QPointF", + "x": 1258.6674741334623, + "y": 884.1265146950946 + }, + { + "type": "QPointF", + "x": 1268.7464122249098, + "y": 907.3697348705016 + }, + { + "type": "QPointF", + "x": 1278.9876630682315, + "y": 928.5763740621021 + }, + { + "type": "QPointF", + "x": 1289.3865436912388, + "y": 947.8980768545746 + }, + { + "type": "QPointF", + "x": 1299.780315474649, + "y": 965.2318302565064 + }, + { + "type": "QPointF", + "x": 1310.4819413838827, + "y": 981.2660154521719 + }, + { + "type": "QPointF", + "x": 1321.3656627724156, + "y": 995.915871897362 + }, + { + "type": "QPointF", + "x": 1336.2095366697658, + "y": 1013.5962156083782 + }, + { + "type": "QPointF", + "x": 1351.519512650729, + "y": 1029.5325910170682 + }, + { + "type": "QPointF", + "x": 1367.609456714784, + "y": 1044.290369247915 + }, + { + "type": "QPointF", + "x": 1388.4362255352653, + "y": 1061.118358041136 + }, + { + "type": "QPointF", + "x": 1415.1306509839035, + "y": 1080.1803406514637 + }, + { + "type": "QPointF", + "x": 1451.4518511689084, + "y": 1103.7977608991262 + }, + { + "type": "QPointF", + "x": 1511.8305390389505, + "y": 1142.0669893384386 + } + ] +} diff --git a/src/test/ValentinaTest/share/smart_pattern_#99/output.json b/src/test/ValentinaTest/share/smart_pattern_#99/output.json index a7b3ce448..ea296256a 100644 --- a/src/test/ValentinaTest/share/smart_pattern_#99/output.json +++ b/src/test/ValentinaTest/share/smart_pattern_#99/output.json @@ -342,13 +342,13 @@ }, { "type": "QPointF", - "x": 399.1440538155622, - "y": 488.76255604621974 + "x": 402.3392744400787, + "y": 490.58869592553793 }, { "type": "QPointF", - "x": 397.651509179127, - "y": 487.0589090075787 + "x": 397.6192436403225, + "y": 487.3958668879086 }, { "type": "QPointF", @@ -447,43 +447,43 @@ }, { "type": "QPointF", - "x": 219.11733302477276, - "y": 493.5618654509618 + "x": 220.20894480356736, + "y": 493.9717974895532 }, { "type": "QPointF", - "x": 212.63608885738194, - "y": 490.0800375140309 + "x": 214.23653207492043, + "y": 491.72898244053755 }, { "type": "QPointF", - "x": 202.91098065710946, - "y": 479.33521360057284 + "x": 199.2867956563084, + "y": 474.27137643587264 }, { "type": "QPointF", - "x": 196.03783581368415, - "y": 468.9566791455622 + "x": 191.6431490210782, + "y": 460.4373249360896 }, { "type": "QPointF", - "x": 188.96153147430664, - "y": 454.3702537301474 + "x": 185.43945018518863, + "y": 445.18365601466735 }, { "type": "QPointF", - "x": 183.1651247359179, - "y": 438.3396830609576 + "x": 180.10476385574063, + "y": 427.5842254696924 }, { "type": "QPointF", - "x": 178.31430533286823, - "y": 420.11842584896306 + "x": 176.04067717773808, + "y": 408.53669833403853 }, { "type": "QPointF", - "x": 174.82594122279494, - "y": 400.59766857295676 + "x": 173.50696043694438, + "y": 388.42807149131374 }, { "type": "QPointF", diff --git a/src/test/ValentinaTest/share/test_data.qrc b/src/test/ValentinaTest/share/test_data.qrc index 87be7733a..66df6d53b 100644 --- a/src/test/ValentinaTest/share/test_data.qrc +++ b/src/test/ValentinaTest/share/test_data.qrc @@ -147,5 +147,7 @@ smart_pattern_#133/output.json valid_allowance_case3/allowance.json valid_allowance_case3/base.json + smart_pattern_#145/input.json + smart_pattern_#145/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 9c08d4ba8..0d3863bcb 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -943,6 +943,12 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() QStringLiteral("://doll/input.json"), QStringLiteral("://doll/output.json"), 26.45669291338583 /*seam allowance width 0.7 cm*/); + + // See the file "collection/bugs/smart_pattern_#145.val" + ASSERT_TEST_CASE("Issue #145", + QStringLiteral("://smart_pattern_#145/input.json"), + QStringLiteral("://smart_pattern_#145/output.json"), + 37.795275590551185 /*seam allowance width*/); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/test/ValentinaTest/tst_varc.cpp b/src/test/ValentinaTest/tst_varc.cpp index 58d4e8730..f3a916530 100644 --- a/src/test/ValentinaTest/tst_varc.cpp +++ b/src/test/ValentinaTest/tst_varc.cpp @@ -54,7 +54,7 @@ void PrepareTestCase(const QPointF ¢er, qreal startAngle, qreal endAngle) radius += UnitConvertor(5, Unit::Cm, Unit::Px); } } -} +} // namespace //--------------------------------------------------------------------------------------------------------------------- TST_VArc::TST_VArc(QObject *parent)