Fix incorrect seam allowance. Closes #118

This commit is contained in:
Roman Telezhynskyi 2021-04-07 20:38:56 +03:00
parent 6ab2bc8043
commit 56ae4a1381
7 changed files with 443 additions and 39 deletions

View File

@ -1,3 +1,6 @@
# Version 0.7.47 (unreleased)
- [smart-pattern/valentina#118] Incorrect seam allowance.
# Version 0.7.46 Mar 31, 2021 # Version 0.7.46 Mar 31, 2021
- Fix incorrect calculation of value for multisize measurements in Valentina. - Fix incorrect calculation of value for multisize measurements in Valentina.
- [smart-pattern/valentina#109] Pattern label template placeholder with dimension label value. - [smart-pattern/valentina#109] Pattern label template placeholder with dimension label value.

View File

@ -597,16 +597,6 @@ QVector<VRawSAPoint> AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPoint
return AngleByLength(points, p1, p2, p3, bigLine1, sp2, bigLine2, p, width, needRollback); 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 // Because artificial loop can lead to wrong clipping we must rollback current seam allowance points
bool success = false; bool success = false;
const int countBefore = points.size(); const int countBefore = points.size();
@ -617,10 +607,6 @@ QVector<VRawSAPoint> AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPoint
if (success) if (success)
{ {
points = temp; points = temp;
}
if (success)
{
px = points.last(); px = points.last();
} }
@ -637,6 +623,13 @@ QVector<VRawSAPoint> AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPoint
{ {
*needRollback = not success; *needRollback = not success;
} }
else 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());
} }
} }
} }

View File

@ -1,15 +1,5 @@
{ {
"vector": [ "vector": [
{
"type": "QPointF",
"x": -1033.554475328413,
"y": -1.4847877309713162
},
{
"type": "QPointF",
"x": -1053.5198027542147,
"y": 15.87442598087916
},
{ {
"type": "QPointF", "type": "QPointF",
"x": -1103.8471101657558, "x": -1103.8471101657558,
@ -147,13 +137,23 @@
}, },
{ {
"type": "QPointF", "type": "QPointF",
"x": -1019.1774122353033, "x": -1019.1774122353031,
"y": -9.802372690577647 "y": -9.802372690577615
}, },
{ {
"type": "QPointF", "type": "QPointF",
"x": -1033.554475328413, "x": -1033.5544753284128,
"y": -1.4847877309713162 "y": -1.484787730971263
},
{
"type": "QPointF",
"x": -1053.5198027542144,
"y": 15.874425980879213
},
{
"type": "QPointF",
"x": -1103.8471101657558,
"y": -42.085297184732866
} }
] ]
} }

View File

@ -0,0 +1,251 @@
{
"vector": [
{
"angle": 5,
"saAfter": 26.45669291338583,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1175.886910362366,
"y": 555.8793769255013
},
{
"saAfter": 26.45669291338583,
"saBefore": 26.45669291338583,
"type": "VSAPoint",
"x": 1210.4565869937005,
"y": 359.82499833625104
},
{
"angle": 4,
"saBefore": 26.45669291338583,
"type": "VSAPoint",
"x": 1245.0262636250343,
"y": 163.7706197470058
},
{
"angle": 4,
"saBefore": 26.45669291338583,
"type": "VSAPoint",
"x": 1245.0262636250343,
"y": 163.7706197470058
},
{
"angle": 6,
"type": "VSAPoint",
"x": 1249.6525568482823,
"y": 164.14294264993185
},
{
"angle": 6,
"type": "VSAPoint",
"x": 1328.6772421341088,
"y": 168.67117831036722
},
{
"angle": 6,
"type": "VSAPoint",
"x": 1407.1175580331974,
"y": 171.5543246297218
},
{
"angle": 6,
"type": "VSAPoint",
"x": 1483.528659051359,
"y": 172.90969229726562
},
{
"angle": 6,
"type": "VSAPoint",
"x": 1556.465699694404,
"y": 172.85459200226887
},
{
"type": "VSAPoint",
"x": 1590.944877799307,
"y": 172.2833383788549
},
{
"type": "VSAPoint",
"x": 1590.944877799307,
"y": 172.2833383788549
},
{
"saAfter": 0,
"type": "VSAPoint",
"x": 1602.2834604764719,
"y": 172.28333858267717
},
{
"saBefore": 0,
"type": "VSAPoint",
"x": 1602.2834645669293,
"y": 871.4959370078741
},
{
"angle": 4,
"saAfter": 37.795275590551185,
"type": "VSAPoint",
"x": 1487.9905430001882,
"y": 871.4959370078741
},
{
"angle": 4,
"saAfter": 37.795275590551185,
"type": "VSAPoint",
"x": 1487.9905430001882,
"y": 871.4959370078741
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1485.3736111108465,
"y": 863.1390002359062
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1479.2436608108028,
"y": 846.6118709359941
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1472.1089977384408,
"y": 830.3196261529354
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1464.048056397443,
"y": 814.2742563578688
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1455.1392712914917,
"y": 798.4877520219336
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1445.461076924269,
"y": 782.9721036162691
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1429.744383860615,
"y": 760.1951110191317
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1406.7127536027315,
"y": 730.9328354430954
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1382.0153073660463,
"y": 702.9698120686455
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1356.2795211800185,
"y": 676.4019646648946
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1330.1328710741072,
"y": 651.3252170009557
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1317.1236562322474,
"y": 639.4441061406586
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1306.6722905128563,
"y": 630.2432611699617
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1284.4672776121818,
"y": 613.1923935152287
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1260.8445039829223,
"y": 597.6441315378071
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1235.9650552091725,
"y": 583.4669407191618
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1209.9900168750269,
"y": 570.5292865407575
},
{
"angle": 6,
"saAfter": 37.795275590551185,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1183.0804745645812,
"y": 558.6996344840597
},
{
"angle": 5,
"saAfter": 26.45669291338583,
"saBefore": 37.795275590551185,
"type": "VSAPoint",
"x": 1175.886910362366,
"y": 555.8793769255013
}
]
}

View File

@ -0,0 +1,149 @@
{
"vector": [
{
"type": "QPointF",
"x": 1223.586134371358,
"y": 133.0056127624619
},
{
"type": "QPointF",
"x": 1249.640890671512,
"y": 137.59976927396653
},
{
"type": "QPointF",
"x": 1329.9200278416895,
"y": 142.2422996971724
},
{
"type": "QPointF",
"x": 1407.8381204298632,
"y": 145.1062512160027
},
{
"type": "QPointF",
"x": 1483.7532902514336,
"y": 146.4528221367358
},
{
"type": "QPointF",
"x": 1556.4457129886712,
"y": 146.3979066383616
},
{
"type": "QPointF",
"x": 1602.8503894555029,
"y": 145.81752096608884
},
{
"type": "QPointF",
"x": 1602.8503938555618,
"y": 897.9526299212599
},
{
"type": "QPointF",
"x": 1448.3854994804524,
"y": 897.9526299212599
},
{
"type": "QPointF",
"x": 1448.3854994804524,
"y": 872.0986142517511
},
{
"type": "QPointF",
"x": 1444.185885125444,
"y": 860.7759173198534
},
{
"type": "QPointF",
"x": 1437.8881811328367,
"y": 846.3948969439552
},
{
"type": "QPointF",
"x": 1430.6843973121577,
"y": 832.0557062171064
},
{
"type": "QPointF",
"x": 1422.631723280359,
"y": 817.7862438822315
},
{
"type": "QPointF",
"x": 1413.8560410480763,
"y": 803.7174625714251
},
{
"type": "QPointF",
"x": 1399.3105569558466,
"y": 782.6378129181111
},
{
"type": "QPointF",
"x": 1377.6756438965467,
"y": 755.1501022820776
},
{
"type": "QPointF",
"x": 1354.2630217275394,
"y": 728.6417866167658
},
{
"type": "QPointF",
"x": 1329.6163029711672,
"y": 703.198217176561
},
{
"type": "QPointF",
"x": 1304.3044047855055,
"y": 678.9220639742948
},
{
"type": "QPointF",
"x": 1291.8905309106663,
"y": 667.5846686352518
},
{
"type": "QPointF",
"x": 1282.6488410331592,
"y": 659.4487600742838
},
{
"type": "QPointF",
"x": 1262.5391808091847,
"y": 644.0068796036708
},
{
"type": "QPointF",
"x": 1241.078336069538,
"y": 629.8815765590062
},
{
"type": "QPointF",
"x": 1218.1697701289968,
"y": 616.8274645618288
},
{
"type": "QPointF",
"x": 1193.950386353718,
"y": 604.764267284976
},
{
"type": "QPointF",
"x": 1169.1867339246062,
"y": 593.8779657451806
},
{
"type": "QPointF",
"x": 1143.1319776244438,
"y": 589.2838092336752
},
{
"type": "QPointF",
"x": 1223.586134371358,
"y": 133.0056127624619
}
]
}

View File

@ -137,5 +137,7 @@
<file>smart_pattern_#112/output.json</file> <file>smart_pattern_#112/output.json</file>
<file>smart_pattern_#113/input.json</file> <file>smart_pattern_#113/input.json</file>
<file>smart_pattern_#113/output.json</file> <file>smart_pattern_#113/output.json</file>
<file>smart_pattern_#118/input.json</file>
<file>smart_pattern_#118/output.json</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -1035,6 +1035,12 @@ void TST_VAbstractPiece::EquidistantAngleType_data()
QStringLiteral("://smart_pattern_#113/input.json"), QStringLiteral("://smart_pattern_#113/input.json"),
QStringLiteral("://smart_pattern_#113/output.json"), QStringLiteral("://smart_pattern_#113/output.json"),
0.56692913385826771 /*seam allowance width*/); 0.56692913385826771 /*seam allowance width*/);
// See file src/app/share/collection/bugs/smart_pattern_#118.val (private collection)
ASSERT_TEST_CASE("Ретро стринги 3",
QStringLiteral("://smart_pattern_#118/input.json"),
QStringLiteral("://smart_pattern_#118/output.json"),
26.45669291338583 /*seam allowance width*/);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------