Fix Seam Allowance Issue.

develop
Roman Telezhynskyi 2024-04-17 15:17:39 +03:00
parent 5199f4d4bc
commit 3424f34354
6 changed files with 481 additions and 2 deletions

View File

@ -1258,6 +1258,12 @@ auto VAbstractPiece::EkvPoint(QVector<VRawSAPoint> points, const VSAPoint &p1Lin
}
return points;
}
else if (a > 345)
{
points.append(VRawSAPoint(bigLine1.p2(), p2Line1.CurvePoint(), p2Line1.TurnPoint()));
points.append(VRawSAPoint(bigLine2.p1(), p2Line1.CurvePoint(), p2Line1.TurnPoint()));
return points;
}
QPointF crosPoint;
const QLineF::IntersectType type = bigLine1.intersects(bigLine2, &crosPoint);

View File

@ -221,7 +221,8 @@ template <class T>
inline auto VAbstractPiece::CheckPointOnLine(QVector<T> &points, const T &iPoint, const T &prevPoint,
const T &nextPoint) -> bool
{
if (!IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
if (!VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint) ||
!IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
{
points.append(iPoint);
return false;
@ -245,7 +246,7 @@ template <>
inline auto VAbstractPiece::CheckPointOnLine<QPointF>(QVector<QPointF> &points, const QPointF &iPoint,
const QPointF &prevPoint, const QPointF &nextPoint) -> bool
{
if (!IsEkvPointOnLine(iPoint, prevPoint, nextPoint))
if (!VGObject::IsPointOnLineSegment(iPoint, prevPoint, nextPoint, accuracyPointOnLine / 4.))
{
points.append(iPoint);
return false;

View File

@ -0,0 +1,322 @@
{
"vector": [
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 2269.6800775571364,
"y": -661.873152
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1501.0464,
"y": -661.873152
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1501.0464,
"y": -661.873152
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1512.1145995857821,
"y": -659.2664997701993
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1532.8912663053902,
"y": -652.4991862709662
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1552.0904133319214,
"y": -643.9354106020951
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1569.7722176090087,
"y": -633.6511157390513
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1585.996856080286,
"y": -621.7222446573012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1600.824505689387,
"y": -608.2247403323104
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1620.7340813635424,
"y": -585.3757687481523
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1642.729570732287,
"y": -549.8802763443196
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1660.2202896377282,
"y": -509.4772245259127
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1673.6876536289349,
"y": -464.7741570966591
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1683.6130782549744,
"y": -416.37861786028685
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1690.477979064915,
"y": -364.8981506205236
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1694.7637716078248,
"y": -310.9402991810972
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1697.5816751093885,
"y": -226.8072443045367
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1694.9984043727732,
"y": -53.22203976977377
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 1693.0464,
"y": 58.126848
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1189.0464,
"y": 58.12684799999993
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 685.0464,
"y": 58.12684799999986
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 685.2339,
"y": 30.84559799999986
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 687.4135875,
"y": -26.107527000000132
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 694.2339,
"y": -115.12315200000012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 709.9839,
"y": -236.62315200000012
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 731.9214,
"y": -354.7481520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 751.89015,
"y": -436.5919020000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 766.4448375,
"y": -486.7950270000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 781.9135875,
"y": -532.3575270000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 798.155775,
"y": -572.4356520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 815.030775,
"y": -606.1856520000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 832.3979625,
"y": -632.7637770000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 850.1167125,
"y": -651.3262770000001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 863.5551890625,
"y": -659.1836988750001
},
{
"angle": 6,
"curvePoint": true,
"passmarkClockwiseOpening": false,
"type": "VSAPoint",
"x": 872.5464,
"y": -661.6622145000001
},
{
"curvePoint": true,
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 877.0464,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 877.0464,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 108.41272244286347,
"y": -661.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 108.41272244286347,
"y": -949.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 1189.0464,
"y": -949.8731520000001
},
{
"passmarkClockwiseOpening": false,
"turnPoint": true,
"type": "VSAPoint",
"x": 2269.6800775571364,
"y": -949.873152
}
]
}

View File

@ -0,0 +1,144 @@
{
"vector": [
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -625.873152
},
{
"type": "QPointF",
"x": 1633.1958258789232,
"y": -625.873152
},
{
"type": "QPointF",
"x": 1649.795721788633,
"y": -606.8224923501662
},
{
"type": "QPointF",
"x": 1674.7193149323566,
"y": -566.6017363452385
},
{
"type": "QPointF",
"x": 1694.087408271691,
"y": -521.8620042025294
},
{
"type": "QPointF",
"x": 1708.6267314176046,
"y": -473.6007154015538
},
{
"type": "QPointF",
"x": 1719.1312661189374,
"y": -422.3814839376958
},
{
"type": "QPointF",
"x": 1726.2889633615728,
"y": -368.7053116792325
},
{
"type": "QPointF",
"x": 1730.7160060188758,
"y": -312.9691304182097
},
{
"type": "QPointF",
"x": 1733.5906452137085,
"y": -227.14213989317568
},
{
"type": "QPointF",
"x": 1730.9944185791073,
"y": -52.68635212068391
},
{
"type": "QPointF",
"x": 1728.4208324505355,
"y": 94.126848
},
{
"type": "QPointF",
"x": 648.7981270798671,
"y": 94.12684799999985
},
{
"type": "QPointF",
"x": 649.2386325321073,
"y": 30.03330469904454
},
{
"type": "QPointF",
"x": 651.4662346184206,
"y": -28.171782072366085
},
{
"type": "QPointF",
"x": 658.4112351329172,
"y": -118.8147784780652
},
{
"type": "QPointF",
"x": 674.4092423831233,
"y": -242.22797726536976
},
{
"type": "QPointF",
"x": 696.7096815639468,
"y": -362.30726516211126
},
{
"type": "QPointF",
"x": 717.0990262409201,
"y": -445.8748609508329
},
{
"type": "QPointF",
"x": 732.0947750184293,
"y": -497.5993277486183
},
{
"type": "QPointF",
"x": 748.1588560513961,
"y": -544.9153482457203
},
{
"type": "QPointF",
"x": 765.3232534020617,
"y": -587.2690559941162
},
{
"type": "QPointF",
"x": 783.7592926518024,
"y": -624.1411344935976
},
{
"type": "QPointF",
"x": 784.8910607049277,
"y": -625.8731520000001
},
{
"type": "QPointF",
"x": 72.41272244286347,
"y": -625.8731520000001
},
{
"type": "QPointF",
"x": 72.41272244286347,
"y": -985.8731520000001
},
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -985.873152
},
{
"type": "QPointF",
"x": 2305.6800775571364,
"y": -625.873152
}
]
}

View File

@ -180,5 +180,7 @@
<file>full_path_case_3/input.json</file>
<file>full_path_case_4/output.json</file>
<file>full_path_case_4/input.json</file>
<file>25L_Knitting_Bag/input.json</file>
<file>25L_Knitting_Bag/output.json</file>
</qresource>
</RCC>

View File

@ -948,6 +948,10 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data()
ASSERT_TEST_CASE("Piece 2. CSA Exclude", QStringLiteral("://custom_seam_allwance_exclude_p2/input.json"),
QStringLiteral("://custom_seam_allwance_exclude_p2/output.json"),
37.795275590551185 /*seam allowance width 1 cm*/);
// See the file "valentina_private_collection/bugs/25L Knitting Bag.val"
ASSERT_TEST_CASE("Base", QStringLiteral("://25L_Knitting_Bag/input.json"),
QStringLiteral("://25L_Knitting_Bag/output.json"), 36 /*seam allowance width*/);
}
//---------------------------------------------------------------------------------------------------------------------