diff --git a/ChangeLog.txt b/ChangeLog.txt index d3c917ce6..489c5acf3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ - [smart-pattern/valentina#109] Pattern label template placeholder with dimension label value. - Incorrect duplication of a piece. Missing restoring pins. - [smart-pattern/valentina#112] Incorrect seam allowance. +- [smart-pattern/valentina#113] Incorrect seam allowance. # Version 0.7.45 Feb 26, 2021 - Fix incorrect seam allowance for angle type second edge right angle. diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 5d2cc0960..66efcbe6c 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -596,6 +596,15 @@ QVector AngleBySecondRightAngle(QVector points, QPoint { return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback); } + + if (IsSameDirection(bigLine1.p1(), bigLine1.p2(), px)) + { + points.append(px); + QLineF seam(px, p3); + seam.setAngle(seam.angle()+90); + seam.setLength(p.GetSAAfter(width)); + points.append(seam.p2()); + } else { // Because artificial loop can lead to wrong clipping we must rollback current seam allowance points diff --git a/src/test/ValentinaTest/share/busty/output.json b/src/test/ValentinaTest/share/busty/output.json index 9d43df667..d10373836 100644 --- a/src/test/ValentinaTest/share/busty/output.json +++ b/src/test/ValentinaTest/share/busty/output.json @@ -1,5 +1,15 @@ { "vector": [ + { + "type": "QPointF", + "x": -1033.554475328413, + "y": -1.4847877309713162 + }, + { + "type": "QPointF", + "x": -1053.5198027542147, + "y": 15.87442598087916 + }, { "type": "QPointF", "x": -1103.8471101657558, @@ -78,12 +88,12 @@ { "type": "QPointF", "x": -1204.722502504057, - "y": -503.81468691330537 + "y": -503.81468691330525 }, { "type": "QPointF", "x": -1007.3842856723732, - "y": -576.996232950328 + "y": -576.9962329503279 }, { "type": "QPointF", @@ -137,23 +147,13 @@ }, { "type": "QPointF", - "x": -1019.1774122353031, - "y": -9.802372690577615 + "x": -1019.1774122353033, + "y": -9.802372690577647 }, { "type": "QPointF", - "x": -1033.5544753284128, - "y": -1.484787730971263 - }, - { - "type": "QPointF", - "x": -1053.5198027542144, - "y": 15.874425980879213 - }, - { - "type": "QPointF", - "x": -1103.8471101657558, - "y": -42.085297184732866 + "x": -1033.554475328413, + "y": -1.4847877309713162 } ] } diff --git a/src/test/ValentinaTest/share/smart_pattern_#113/input.json b/src/test/ValentinaTest/share/smart_pattern_#113/input.json new file mode 100644 index 000000000..820fd2e6b --- /dev/null +++ b/src/test/ValentinaTest/share/smart_pattern_#113/input.json @@ -0,0 +1,391 @@ +{ + "vector": [ + { + "angle": 5, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2527.256410822591, + "y": -472.0553685667312 + }, + { + "angle": 5, + "saAfter": 26.45669291338583, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2506.5962179242733, + "y": -340.15748031496076 + }, + { + "angle": 5, + "saAfter": 26.45669291338583, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2506.5962179242733, + "y": -340.15748031496076 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2515.110032578323, + "y": -335.7555078847252 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2535.9026816577343, + "y": -327.4893541781814 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2559.9139093453923, + "y": -319.92499126438355 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2585.699887733156, + "y": -313.12513181892416 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2624.7774917122233, + "y": -304.38080998706323 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2669.6720177906936, + "y": -296.12066401328417 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2684.7297653217615, + "y": -293.714204315371 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2698.5135894968607, + "y": -291.6966931721503 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2733.7651077284, + "y": -288.0502381685658 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2778.001039243382, + "y": -285.2249501336674 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2830.958905626066, + "y": -283.6151470999638 + }, + { + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2860.9735489397144, + "y": -283.464566929134 + }, + { + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2860.9735489397144, + "y": -283.464566929134 + }, + { + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2868.5326040578248, + "y": -283.464566929134 + }, + { + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2876.091659175935, + "y": -283.464566929134 + }, + { + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2876.091659175935, + "y": -283.464566929134 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2883.9661070936895, + "y": -283.5584406781999 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2901.245682896105, + "y": -284.5648866073816 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2928.8761792613104, + "y": -287.3856894036893 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2964.3753054127446, + "y": -292.55631940653257 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2991.658167915314, + "y": -297.4313269801869 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -2999.2232819755905, + "y": -299.02542039719924 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3012.542620560272, + "y": -301.85968847054176 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3042.8109922236317, + "y": -308.3088184858541 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3067.2435220244433, + "y": -314.8760955596215 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3083.7898789348988, + "y": -320.39818087512595 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3100.269407664129, + "y": -327.1484210254447 + }, + { + "angle": 6, + "saAfter": 26.45669291338583, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3116.4133322750586, + "y": -335.3579733766769 + }, + { + "angle": 4, + "saAfter": 37.795275590551185, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3124.2446685548284, + "y": -340.15748031496076 + }, + { + "angle": 4, + "saAfter": 37.795275590551185, + "saBefore": 26.45669291338583, + "type": "VSAPoint", + "x": -3124.2446685548284, + "y": -340.15748031496076 + }, + { + "angle": 4, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -3111.699943251791, + "y": -396.7401714170824 + }, + { + "type": "VSAPoint", + "x": -2725.3596865816003, + "y": -585.8267716535435 + }, + { + "saAfter": 37.795275590551185, + "type": "VSAPoint", + "x": -2687.564410991049, + "y": -585.8267716535435 + }, + { + "saAfter": 37.795275590551185, + "type": "VSAPoint", + "x": -2687.564410991049, + "y": -585.8267716535435 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2686.7442528592233, + "y": -584.3116737525777 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2677.58560358191, + "y": -569.3428170188263 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2665.1502732124804, + "y": -552.0412529412208 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2654.7385639979766, + "y": -539.3532784199779 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2642.6534846020877, + "y": -526.5369475528651 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2629.0304140300964, + "y": -514.3953398593414 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2621.6288162143724, + "y": -508.90682548803926 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2617.633216578171, + "y": -506.2259849672243 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2607.5875815658464, + "y": -500.78291850199804 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2589.3518167947404, + "y": -492.6769341780546 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2562.160275286112, + "y": -482.74399225847844 + }, + { + "angle": 6, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2536.9822947561124, + "y": -474.79665668016196 + }, + { + "angle": 5, + "saAfter": 37.795275590551185, + "saBefore": 37.795275590551185, + "type": "VSAPoint", + "x": -2527.256410822591, + "y": -472.0553685667312 + } + ] +} diff --git a/src/test/ValentinaTest/share/smart_pattern_#113/output.json b/src/test/ValentinaTest/share/smart_pattern_#113/output.json new file mode 100644 index 000000000..39c602f84 --- /dev/null +++ b/src/test/ValentinaTest/share/smart_pattern_#113/output.json @@ -0,0 +1,209 @@ +{ + "vector": [ + { + "type": "QPointF", + "x": -2471.2062472153243, + "y": -358.4554679618417 + }, + { + "type": "QPointF", + "x": -2459.0551924596007, + "y": -334.95422398973403 + }, + { + "type": "QPointF", + "x": -2504.120784665144, + "y": -311.6535647080951 + }, + { + "type": "QPointF", + "x": -2527.0290640774483, + "y": -302.5463384931309 + }, + { + "type": "QPointF", + "x": -2553.167799186371, + "y": -294.3428373746984 + }, + { + "type": "QPointF", + "x": -2579.9225974675223, + "y": -287.3069305434689 + }, + { + "type": "QPointF", + "x": -2619.990081627151, + "y": -278.3608694684806 + }, + { + "type": "QPointF", + "x": -2665.4968144310456, + "y": -269.9954984287601 + }, + { + "type": "QPointF", + "x": -2695.791405702967, + "y": -265.3804184489778 + }, + { + "type": "QPointF", + "x": -2732.0787910936237, + "y": -261.6473418100125 + }, + { + "type": "QPointF", + "x": -2777.197185087822, + "y": -258.7804721011971 + }, + { + "type": "QPointF", + "x": -2830.9306026127674, + "y": -257.1584693256739 + }, + { + "type": "QPointF", + "x": -2885.504465434865, + "y": -257.1465105418511 + }, + { + "type": "QPointF", + "x": -2903.932685644061, + "y": -258.24499648326326 + }, + { + "type": "QPointF", + "x": -2932.689494194475, + "y": -261.20525340400195 + }, + { + "type": "QPointF", + "x": -2969.0289823829885, + "y": -266.51212829661677 + }, + { + "type": "QPointF", + "x": -2997.113235349967, + "y": -271.5431281398549 + }, + { + "type": "QPointF", + "x": -3049.6785855152784, + "y": -282.75900904833264 + }, + { + "type": "QPointF", + "x": -3075.618916688395, + "y": -289.7800926082317 + }, + { + "type": "QPointF", + "x": -3093.818214371114, + "y": -295.9157568061722 + }, + { + "type": "QPointF", + "x": -3111.298113285733, + "y": -303.07576225388163 + }, + { + "type": "QPointF", + "x": -3129.342114096473, + "y": -312.2515465102798 + }, + { + "type": "QPointF", + "x": -3172.1513358684783, + "y": -338.4875743830751 + }, + { + "type": "QPointF", + "x": -3158.32679295688, + "y": -361.0450257727725 + }, + { + "type": "QPointF", + "x": -3148.4422597423313, + "y": -405.6289824602926 + }, + { + "type": "QPointF", + "x": -3111.5429719361164, + "y": -397.44818687792895 + }, + { + "type": "QPointF", + "x": -2725.6089100584036, + "y": -586.3359831041486 + }, + { + "type": "QPointF", + "x": -2687.564410991049, + "y": -586.3937007874017 + }, + { + "type": "QPointF", + "x": -2654.3265534732623, + "y": -603.8192057466126 + }, + { + "type": "QPointF", + "x": -2646.077388368299, + "y": -590.2635801166397 + }, + { + "type": "QPointF", + "x": -2635.165693887321, + "y": -575.0818860522613 + }, + { + "type": "QPointF", + "x": -2626.3471284741554, + "y": -564.3353572190997 + }, + { + "type": "QPointF", + "x": -2616.2811919146543, + "y": -553.6603447340499 + }, + { + "type": "QPointF", + "x": -2605.152528643642, + "y": -543.7418859786677 + }, + { + "type": "QPointF", + "x": -2598.0578610376156, + "y": -538.6061651952249 + }, + { + "type": "QPointF", + "x": -2590.883226957164, + "y": -534.7187046100388 + }, + { + "type": "QPointF", + "x": -2575.1752701573723, + "y": -527.7363568347463 + }, + { + "type": "QPointF", + "x": -2549.9817887921495, + "y": -518.5332968657749 + }, + { + "type": "QPointF", + "x": -2533.733248010216, + "y": -513.4045056150975 + }, + { + "type": "QPointF", + "x": -2496.393272137569, + "y": -519.2533566814225 + }, + { + "type": "QPointF", + "x": -2471.2062472153243, + "y": -358.4554679618417 + } + ] +} diff --git a/src/test/ValentinaTest/share/test_data.qrc b/src/test/ValentinaTest/share/test_data.qrc index 0761513dd..5904da7e3 100644 --- a/src/test/ValentinaTest/share/test_data.qrc +++ b/src/test/ValentinaTest/share/test_data.qrc @@ -135,5 +135,7 @@ Issue_548_case3/output.json smart_pattern_#112/input.json smart_pattern_#112/output.json + smart_pattern_#113/input.json + smart_pattern_#113/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 6cffc46ca..c852d7f3e 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -1029,6 +1029,12 @@ void TST_VAbstractPiece::EquidistantAngleType_data() QStringLiteral("://panties_case2/input.json"), QStringLiteral("://panties_case2/output.json"), 26.45669291338583 /*seam allowance width*/); + + // See file src/app/share/collection/bugs/smart_pattern_#113.val (private collection) + ASSERT_TEST_CASE("Эдит 6", + QStringLiteral("://smart_pattern_#113/input.json"), + QStringLiteral("://smart_pattern_#113/output.json"), + 0.56692913385826771 /*seam allowance width*/); } //---------------------------------------------------------------------------------------------------------------------