From 5dc735b5f43299fb0cb17df46a73e7dfdbdcad0f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 29 Aug 2019 15:14:17 +0300 Subject: [PATCH] New test case "Loop for start point on line". --HG-- branch : develop --- src/libs/vgeometry/vgobject.cpp | 75 +- src/libs/vgeometry/vgobject.h | 3 - src/libs/vlayout/vabstractpiece.h | 41 +- .../share/loop_start_point_on_line/input.json | 640 ++++++++++++++++++ .../loop_start_point_on_line/output.json | 509 ++++++++++++++ src/test/ValentinaTest/share/test_data.qrc | 2 + src/test/ValentinaTest/tst_vabstractpiece.cpp | 6 + 7 files changed, 1236 insertions(+), 40 deletions(-) create mode 100644 src/test/ValentinaTest/share/loop_start_point_on_line/input.json create mode 100644 src/test/ValentinaTest/share/loop_start_point_on_line/output.json diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index 3ba727499..8041df05d 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -41,6 +41,48 @@ #include "../ifc/ifcdef.h" #include "vgobject_p.h" +namespace +{ +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief PerpDotProduct Calculates the area of the parallelogram of the three points. + * This is actually the same as the area of the triangle defined by the three points, multiplied by 2. + * @return 2 * triangleArea(a,b,c) + */ +double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t) +{ + return (p1.x() - t.x()) * (p2.y() - t.y()) - (p1.y() - t.y()) * (p2.x() - t.x()); +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetEpsilon solve the floating-point accuraccy problem. + * + * There is the floating-point accuraccy problem, so instead of checking against zero, some epsilon value has to be + * used. Because the size of the pdp value depends on the length of the vectors, no static value can be used. One + * approach is to compare the pdp/area value to the fraction of another area which also depends on the length of the + * line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance + * is controled by variable accuracyPointOnLine + */ +double GetEpsilon(const QPointF &t, QPointF p1, QPointF p2, qreal accuracy) +{ + QLineF edge1(p1, p2); + QLineF edge2(p1, t); + if (edge2.length() > edge1.length()) + { + edge1.setLength(edge2.length()); + p1 = edge1.p1(); + p2 = edge1.p2(); + } + + QLineF line(p1, p2); + line.setAngle(line.angle() + 90); + line.setLength(accuracy); // less than accuracy means the same point + + return qAbs(PerpDotProduct(p1, p2, line.p2())); +} +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGObject default constructor. @@ -526,41 +568,12 @@ QPointF VGObject::CorrectDistortion(const QPointF &t, const QPointF &p1, const Q bool VGObject::IsPointOnLineviaPDP(const QPointF &t, const QPointF &p1, const QPointF &p2, qreal accuracy) { const double p = qAbs(PerpDotProduct(p1, p2, t)); - const double e = GetEpsilon(p1, p2, accuracy); + const double e = GetEpsilon(t, p1, p2, accuracy); + // We can't use common "<=" here because of the floating-point accuraccy problem return p < e || VFuzzyComparePossibleNulls(p, e); } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief PerpDotProduct Calculates the area of the parallelogram of the three points. - * This is actually the same as the area of the triangle defined by the three points, multiplied by 2. - * @return 2 * triangleArea(a,b,c) - */ -double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t) -{ - return (p1.x() - t.x()) * (p2.y() - t.y()) - (p1.y() - t.y()) * (p2.x() - t.x()); -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief GetEpsilon solve the floating-point accuraccy problem. - * - * There is the floating-point accuraccy problem, so instead of checking against zero, some epsilon value has to be - * used. Because the size of the pdp value depends on the length of the vectors, no static value can be used. One - * approach is to compare the pdp/area value to the fraction of another area which also depends on the length of the - * line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance - * is controled by variable accuracyPointOnLine - */ -double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2, qreal accuracy) -{ - QLineF line(p1, p2); - line.setAngle(line.angle() + 90); - line.setLength(accuracy); // less than accuracy means the same point - - return qAbs(PerpDotProduct(p1, p2, line.p2())); -} - //--------------------------------------------------------------------------------------------------------------------- int VGObject::PointInCircle(const QPointF &p, const QPointF ¢er, qreal radius) { diff --git a/src/libs/vgeometry/vgobject.h b/src/libs/vgeometry/vgobject.h index f9fe2589e..0583d2388 100644 --- a/src/libs/vgeometry/vgobject.h +++ b/src/libs/vgeometry/vgobject.h @@ -114,9 +114,6 @@ protected: private: QSharedDataPointer d; - static double PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPointF &t); - static double GetEpsilon(const QPointF &p1, const QPointF &p2, qreal accuracy); - static int PointInCircle (const QPointF &p, const QPointF ¢er, qreal radius); }; diff --git a/src/libs/vlayout/vabstractpiece.h b/src/libs/vlayout/vabstractpiece.h index f58f71d17..2504a7abc 100644 --- a/src/libs/vlayout/vabstractpiece.h +++ b/src/libs/vlayout/vabstractpiece.h @@ -279,6 +279,7 @@ QVector VAbstractPiece::CorrectEquidistantPoints(const QVector &points, bo } int prev = -1; + int next = -1; QVector buf2; //Remove point on line @@ -287,25 +288,53 @@ QVector VAbstractPiece::CorrectEquidistantPoints(const QVector &points, bo // Unfortunatelly QLineF::intersect can't be used in this case because of the floating-point accuraccy problem. if (prev == -1) { - prev = (i == 0) ? buf1.size() - 1 : i-1; + if (i == 0) + { + prev = buf1.size() - 1; + const T &prevPoint = buf1.at(prev); + const T &iPoint = buf1.at(i); + if (iPoint == prevPoint) + { + prev = buf1.size() - 2; + } + } + else + { + prev = i-1; + } } - const int next = (i == buf1.size() - 1) ? 0 : i+1; + if (i == buf1.size() - 1) + { + next = 0; + const T &nextPoint = buf1.at(next); + const T &iPoint = buf1.at(i); + if (iPoint == nextPoint) + { + next = 1; + } + } + else + { + next = i+1; + } const T &iPoint = buf1.at(i); const T &prevPoint = buf1.at(prev); const T &nextPoint = buf1.at(next); - if (not (IsEkvPointOnLine(iPoint, prevPoint, nextPoint) && prevPoint == nextPoint/*not zigzag*/) - // If RemoveDublicates does not remove these points it is a valid case. - // Case where last point equal first point - || ((i == 0 || i == buf1.size() - 1) && (iPoint == prevPoint || iPoint == nextPoint))) + if (not IsEkvPointOnLine(iPoint, prevPoint, nextPoint)) { buf2.append(iPoint); prev = -1; } } + if (buf2.first() != buf2.last()) + { + buf2.append(buf2.first()); + } + buf2 = RemoveDublicates(buf2, false); return buf2; diff --git a/src/test/ValentinaTest/share/loop_start_point_on_line/input.json b/src/test/ValentinaTest/share/loop_start_point_on_line/input.json new file mode 100644 index 000000000..fa1707697 --- /dev/null +++ b/src/test/ValentinaTest/share/loop_start_point_on_line/input.json @@ -0,0 +1,640 @@ +{ + "vector": [ + { + "type": "VSAPoint", + "x": -2156.8299086198917, + "y": -1158.1589877154822 + }, + { + "type": "VSAPoint", + "x": -2156.8299086198917, + "y": -1158.1589877154822 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2155.764170289362, + "y": -1158.5569069616006 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2137.420646303098, + "y": -1164.9288789951136 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2117.83875503898, + "y": -1171.2137090814535 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2096.8398863334523, + "y": -1177.3092584493268 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2074.245430022959, + "y": -1183.11338832744 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2049.8767759439447, + "y": -1188.5239599444994 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2023.5553139328522, + "y": -1193.4388345292111 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1995.1024338261252, + "y": -1197.7558733102826 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1964.339525460208, + "y": -1201.3729375164196 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1931.087978671544, + "y": -1204.1878883763288 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1895.1691832965776, + "y": -1206.0985871187168 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1856.4045291717516, + "y": -1207.0028949722896 + }, + { + "type": "VSAPoint", + "x": -1835.7694488188972, + "y": -1206.9974173228347 + }, + { + "type": "VSAPoint", + "x": -1835.7694488188972, + "y": -1206.9974173228347 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1825.048102207637, + "y": -1206.8913056619815 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1804.7393163529287, + "y": -1205.9667973062424 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1785.7094698403316, + "y": -1204.212710819928 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1767.8677298928844, + "y": -1201.6570061033317 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1751.1232637336275, + "y": -1198.327643056748 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1735.3852385855994, + "y": -1194.2525815804702 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1720.56282167184, + "y": -1189.459781574792 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1706.5651802153889, + "y": -1183.977202940007 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1693.301481439286, + "y": -1177.832805576409 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1680.68089256657, + "y": -1171.054549384292 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1668.612580820281, + "y": -1163.6703942639488 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1657.0057134234585, + "y": -1155.7083001156739 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1645.7694575991418, + "y": -1147.1962268397606 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1634.8129805703702, + "y": -1138.1621343365027 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1618.6975664626166, + "y": -1123.749886746814 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1608.048141133324, + "y": -1113.458882488723 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1605.3933926835293, + "y": -1110.8130533845726 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1600.1927421469466, + "y": -1105.1528178031322 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1592.6237015484876, + "y": -1095.9181567598134 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1583.028611596476, + "y": -1082.1431254878362 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1573.9907477493643, + "y": -1066.9064550005937 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1565.525911626457, + "y": -1050.3479326507245 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1557.6499048470587, + "y": -1032.6073457908685 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1550.3785290304731, + "y": -1013.8244817736643 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1543.727585796005, + "y": -994.1391279517508 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1537.7128767629595, + "y": -973.6910716777671 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1532.3502035506401, + "y": -952.6201003043523 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1527.6553677783513, + "y": -931.0660011841455 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1523.644171065398, + "y": -909.1685616697857 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1520.3324150310846, + "y": -887.067569113912 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1517.7359012947154, + "y": -864.9028108691632 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1515.8704314755946, + "y": -842.8140742881786 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1514.7518071930267, + "y": -820.9411467235971 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1514.5096062992122, + "y": -810.1470236220473 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1514.47545264147, + "y": -804.5411543367543 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1514.958714144379, + "y": -792.583458481846 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1516.0655043069232, + "y": -779.8031165762536 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1517.7532076597286, + "y": -766.2806871649794 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1521.22145676682, + "y": -744.8494371850044 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1527.5709569815199, + "y": -714.3187558683936 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1535.4770315085434, + "y": -682.269778339099 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1544.5987565929024, + "y": -649.3469729571395 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1554.5952084796083, + "y": -616.1948080825346 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1565.1254634136735, + "y": -583.4577520753035 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1581.2157691070465, + "y": -536.286986757397 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1601.388012199472, + "y": -481.0371482674087 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1624.302976132507, + "y": -422.01337430466896 + }, + { + "type": "VSAPoint", + "x": -1627.8954330708657, + "y": -413.29662992125986 + }, + { + "type": "VSAPoint", + "x": -1627.8954330708657, + "y": -413.29662992125986 + }, + { + "type": "VSAPoint", + "x": -1749.555037215663, + "y": -357.1460433929008 + }, + { + "type": "VSAPoint", + "x": -1852.5047627023196, + "y": -309.630785475978 + }, + { + "type": "VSAPoint", + "x": -1852.5047627023196, + "y": -309.630785475978 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1857.3589378054878, + "y": -307.61277259576184 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1866.601898580191, + "y": -303.40531427376413 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1875.3107847733302, + "y": -298.9988371968293 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1883.5126994253462, + "y": -294.40078616378116 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1891.234745576679, + "y": -289.61860597344355 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1898.5040262677694, + "y": -284.6597414246403 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1908.6664259498061, + "y": -276.92620597191535 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1920.8136310558161, + "y": -266.0377083094013 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1931.6376290487833, + "y": -254.57647959185377 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1941.355244252231, + "y": -242.60207820986355 + }, + { + "type": "VSAPoint", + "x": -1943.005300247141, + "y": -240.27915229902752 + }, + { + "type": "VSAPoint", + "x": -1943.005300247141, + "y": -240.27915229902752 + }, + { + "type": "VSAPoint", + "x": -1943.005300247141, + "y": -240.27915229902752 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1950.1833009896823, + "y": -230.1740625540214 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1958.338623584661, + "y": -217.35199101491796 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1966.0380363606898, + "y": -204.19542198314397 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1977.195858948178, + "y": -183.98686980566714 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1988.5690590103134, + "y": -163.31431383770587 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -1996.6130757457777, + "y": -149.41533874115686 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2005.2853042799093, + "y": -135.4796581048908 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2014.8025689362314, + "y": -121.5668303194985 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2019.9946087699598, + "y": -114.64227284447125 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2022.5189933146203, + "y": -111.4138062394305 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2030.2027095725332, + "y": -102.63840614760902 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2041.0440391256577, + "y": -91.8224981894505 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2051.3427430195334, + "y": -82.84850626504331 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2059.127114322611, + "y": -76.68272596095187 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2067.698186882554, + "y": -70.47035143512053 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2077.0553602400455, + "y": -64.31438996418137 + }, + { + "type": "VSAPoint", + "x": -2086.4100710715898, + "y": -58.78881061616937 + }, + { + "type": "VSAPoint", + "x": -2086.4100710715898, + "y": -58.78881061616937 + }, + { + "type": "VSAPoint", + "x": -2086.4100710715898, + "y": -58.78881061616937 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2087.1980339357647, + "y": -58.317848824766465 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2098.125607510393, + "y": -52.583735293507885 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2109.8374805046105, + "y": -47.215056647037734 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2122.3330524590992, + "y": -42.31482016198807 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2135.6117229145393, + "y": -37.98603311499098 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": -2149.672891411611, + "y": -34.33170278267855 + }, + { + "type": "VSAPoint", + "x": -2157.0292913385824, + "y": -32.82418897637797 + }, + { + "type": "VSAPoint", + "x": -2157.0292913385824, + "y": -32.82418897637797 + }, + { + "type": "VSAPoint", + "x": -2228.977623905204, + "y": -1150.4216215110496 + } + ] +} diff --git a/src/test/ValentinaTest/share/loop_start_point_on_line/output.json b/src/test/ValentinaTest/share/loop_start_point_on_line/output.json new file mode 100644 index 000000000..b73ff0785 --- /dev/null +++ b/src/test/ValentinaTest/share/loop_start_point_on_line/output.json @@ -0,0 +1,509 @@ +{ + "vector": [ + { + "type": "QPointF", + "x": -2161.0346085418714, + "y": -1195.9991599598525 + }, + { + "type": "QPointF", + "x": -2164.1566907368974, + "y": -1195.6522424385178 + }, + { + "type": "QPointF", + "x": -2149.3983855481083, + "y": -1200.7788205156326 + }, + { + "type": "QPointF", + "x": -2128.884130752928, + "y": -1207.3628937288183 + }, + { + "type": "QPointF", + "x": -2106.9842836946777, + "y": -1213.7199789968117 + }, + { + "type": "QPointF", + "x": -2083.1046940705755, + "y": -1220.0960791906502 + }, + { + "type": "QPointF", + "x": -2057.2789687314194, + "y": -1225.590305144146 + }, + { + "type": "QPointF", + "x": -2029.860664090768, + "y": -1230.7099876518057 + }, + { + "type": "QPointF", + "x": -2000.1454275015387, + "y": -1235.2185586036119 + }, + { + "type": "QPointF", + "x": -1968.1413945353718, + "y": -1238.9815526845684 + }, + { + "type": "QPointF", + "x": -1933.6865561248674, + "y": -1241.8983696864393 + }, + { + "type": "QPointF", + "x": -1896.6140713491457, + "y": -1243.8704388858293 + }, + { + "type": "QPointF", + "x": -1856.8403004661077, + "y": -1244.7982875713851 + }, + { + "type": "QPointF", + "x": -1835.7594159399425, + "y": -1244.7926915817568 + }, + { + "type": "QPointF", + "x": -1824.0013662790323, + "y": -1244.6780725404024 + }, + { + "type": "QPointF", + "x": -1802.1439919282616, + "y": -1243.6830684389079 + }, + { + "type": "QPointF", + "x": -1781.292519497052, + "y": -1241.7610725895388 + }, + { + "type": "QPointF", + "x": -1761.4981418780226, + "y": -1238.9256661554102 + }, + { + "type": "QPointF", + "x": -1742.694090792693, + "y": -1235.186788354582 + }, + { + "type": "QPointF", + "x": -1724.8248472704702, + "y": -1230.5598885242202 + }, + { + "type": "QPointF", + "x": -1707.845034473584, + "y": -1225.0694987083878 + }, + { + "type": "QPointF", + "x": -1691.716210701753, + "y": -1218.7521812595326 + }, + { + "type": "QPointF", + "x": -1676.4018476854003, + "y": -1211.657815401919 + }, + { + "type": "QPointF", + "x": -1661.8615026841314, + "y": -1203.8484980606781 + }, + { + "type": "QPointF", + "x": -1648.0456174208173, + "y": -1195.3950671207172 + }, + { + "type": "QPointF", + "x": -1634.892212574602, + "y": -1186.3720771807602 + }, + { + "type": "QPointF", + "x": -1622.3260535436134, + "y": -1176.8525300877625 + }, + { + "type": "QPointF", + "x": -1610.1833455970948, + "y": -1166.8403385283018 + }, + { + "type": "QPointF", + "x": -1592.9584217027416, + "y": -1151.435840311931 + }, + { + "type": "QPointF", + "x": -1581.5744152825998, + "y": -1140.4349783009484 + }, + { + "type": "QPointF", + "x": -1578.124426029234, + "y": -1136.9965802198542 + }, + { + "type": "QPointF", + "x": -1571.6387513866748, + "y": -1129.9377620733112 + }, + { + "type": "QPointF", + "x": -1562.4554688960056, + "y": -1118.7336338930977 + }, + { + "type": "QPointF", + "x": -1551.2262388304146, + "y": -1102.612576551544 + }, + { + "type": "QPointF", + "x": -1540.8782542250674, + "y": -1085.1672117722196 + }, + { + "type": "QPointF", + "x": -1531.4018600286245, + "y": -1066.6299261331826 + }, + { + "type": "QPointF", + "x": -1522.7342462170318, + "y": -1047.1062563346156 + }, + { + "type": "QPointF", + "x": -1514.8351404275109, + "y": -1026.7018880768694 + }, + { + "type": "QPointF", + "x": -1507.6803505252287, + "y": -1005.5252570664044 + }, + { + "type": "QPointF", + "x": -1501.257066349074, + "y": -983.6881780695345 + }, + { + "type": "QPointF", + "x": -1495.5605820891042, + "y": -961.3055990797892 + }, + { + "type": "QPointF", + "x": -1490.5920611845627, + "y": -938.4950052163326 + }, + { + "type": "QPointF", + "x": -1486.3570426482477, + "y": -915.3757046989386 + }, + { + "type": "QPointF", + "x": -1482.864477832908, + "y": -892.0680853619579 + }, + { + "type": "QPointF", + "x": -1480.1261626992496, + "y": -868.6928603110201 + }, + { + "type": "QPointF", + "x": -1478.1564911014611, + "y": -845.3702867541348 + }, + { + "type": "QPointF", + "x": -1476.9781941933036, + "y": -822.3305554311763 + }, + { + "type": "QPointF", + "x": -1476.7169136623927, + "y": -810.6861136197888 + }, + { + "type": "QPointF", + "x": -1476.6755256696472, + "y": -803.8928243310418 + }, + { + "type": "QPointF", + "x": -1477.229370644782, + "y": -790.1886295554116 + }, + { + "type": "QPointF", + "x": -1478.472769763984, + "y": -775.8308349107754 + }, + { + "type": "QPointF", + "x": -1480.3338121713048, + "y": -760.9195564905748 + }, + { + "type": "QPointF", + "x": -1484.0462764175998, + "y": -737.9792350640129 + }, + { + "type": "QPointF", + "x": -1490.709103534858, + "y": -705.9419652780002 + }, + { + "type": "QPointF", + "x": -1498.9104711413052, + "y": -672.6959535903945 + }, + { + "type": "QPointF", + "x": -1508.2895635948378, + "y": -638.8442388487899 + }, + { + "type": "QPointF", + "x": -1518.5092972405926, + "y": -604.9515838709588 + }, + { + "type": "QPointF", + "x": -1529.2471186020468, + "y": -571.5692335378822 + }, + { + "type": "QPointF", + "x": -1545.574527357226, + "y": -523.7033706191128 + }, + { + "type": "QPointF", + "x": -1566.0163361562213, + "y": -467.7152175211662 + }, + { + "type": "QPointF", + "x": -1589.2106986810545, + "y": -407.97177586110865 + }, + { + "type": "QPointF", + "x": -1598.5992737413426, + "y": -385.1913193854439 + }, + { + "type": "QPointF", + "x": -1733.7166179100243, + "y": -322.8294682306777 + }, + { + "type": "QPointF", + "x": -1837.3256007654502, + "y": -275.0099376820172 + }, + { + "type": "QPointF", + "x": -1842.2711084448083, + "y": -272.9539553608112 + }, + { + "type": "QPointF", + "x": -1850.2338336382852, + "y": -269.32926894293 + }, + { + "type": "QPointF", + "x": -1857.5298951833795, + "y": -265.6376455553501 + }, + { + "type": "QPointF", + "x": -1864.3128735249707, + "y": -261.83506019645114 + }, + { + "type": "QPointF", + "x": -1870.625573585483, + "y": -257.9256728934868 + }, + { + "type": "QPointF", + "x": -1876.39559292068, + "y": -253.9895552027381 + }, + { + "type": "QPointF", + "x": -1884.5697906207222, + "y": -247.76903153817497 + }, + { + "type": "QPointF", + "x": -1894.4151989393617, + "y": -238.94381581748522 + }, + { + "type": "QPointF", + "x": -1903.184757419558, + "y": -229.6579756354422 + }, + { + "type": "QPointF", + "x": -1911.244278598234, + "y": -219.72673844199196 + }, + { + "type": "QPointF", + "x": -1912.1925515705766, + "y": -218.3917729227639 + }, + { + "type": "QPointF", + "x": -1918.8108640543708, + "y": -209.074604534515 + }, + { + "type": "QPointF", + "x": -1926.071995274437, + "y": -197.65841064712265 + }, + { + "type": "QPointF", + "x": -1933.179408309376, + "y": -185.51343635471534 + }, + { + "type": "QPointF", + "x": -1944.1088924027742, + "y": -165.7184407054733 + }, + { + "type": "QPointF", + "x": -1955.6519742904752, + "y": -144.73700825283143 + }, + { + "type": "QPointF", + "x": -1964.204278050369, + "y": -129.95978178923852 + }, + { + "type": "QPointF", + "x": -1973.6284747311531, + "y": -114.81573955374239 + }, + { + "type": "QPointF", + "x": -1984.0711071980156, + "y": -99.55016142977004 + }, + { + "type": "QPointF", + "x": -1989.9849809191649, + "y": -91.6629032819942 + }, + { + "type": "QPointF", + "x": -1993.3918146001206, + "y": -87.30586156615976 + }, + { + "type": "QPointF", + "x": -2002.6067113083348, + "y": -76.78173460661628 + }, + { + "type": "QPointF", + "x": -2015.2528883108866, + "y": -64.16521134607568 + }, + { + "type": "QPointF", + "x": -2027.1810895590745, + "y": -53.77132268037704 + }, + { + "type": "QPointF", + "x": -2036.2928308525898, + "y": -46.55417015563577 + }, + { + "type": "QPointF", + "x": -2046.2104407666518, + "y": -39.365815751171596 + }, + { + "type": "QPointF", + "x": -2057.046353672701, + "y": -32.23701095044731 + }, + { + "type": "QPointF", + "x": -2067.188190443381, + "y": -26.246497206077045 + }, + { + "type": "QPointF", + "x": -2068.7077291869423, + "y": -25.337682911616948 + }, + { + "type": "QPointF", + "x": -2081.4582071140726, + "y": -18.647022124694804 + }, + { + "type": "QPointF", + "x": -2095.0518660172556, + "y": -12.415739876590727 + }, + { + "type": "QPointF", + "x": -2109.565617761303, + "y": -6.724058368119403 + }, + { + "type": "QPointF", + "x": -2124.99134854044, + "y": -1.6953392797686782 + }, + { + "type": "QPointF", + "x": -2141.1199442290053, + "y": 2.4962907724991394 + }, + { + "type": "QPointF", + "x": -2191.9582652746717, + "y": 12.914358254731537 + }, + { + "type": "QPointF", + "x": -2269.012895513146, + "y": -1184.0008981160383 + }, + { + "type": "QPointF", + "x": -2161.0346085418714, + "y": -1195.9991599598525 + } + ] +} diff --git a/src/test/ValentinaTest/share/test_data.qrc b/src/test/ValentinaTest/share/test_data.qrc index 16350227e..816ee15fa 100644 --- a/src/test/ValentinaTest/share/test_data.qrc +++ b/src/test/ValentinaTest/share/test_data.qrc @@ -4,5 +4,7 @@ Issue_620/output.json loop_by_intersection/input.json loop_by_intersection/output.json + loop_start_point_on_line/input.json + loop_start_point_on_line/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 72adde591..f23a223fb 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -202,6 +202,12 @@ void TST_VAbstractPiece::EquidistantRemoveLoop_data() QStringLiteral("://loop_by_intersection/input.json"), QStringLiteral("://loop_by_intersection/output.json"), 39.685039370078741 /*seam allowance width (1.05 cm)*/); + + // See file src/app/share/collection/bugs/loop_start_point_on_line.val (private collection) + ASSERT_TEST_CASE("Loop for start point on line", + QStringLiteral("://loop_start_point_on_line/input.json"), + QStringLiteral("://loop_start_point_on_line/output.json"), + 37.795275590551185 /*seam allowance width (1.0 cm)*/); } //---------------------------------------------------------------------------------------------------------------------