diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index e715e1a2b..3b84a24c5 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -1517,10 +1517,18 @@ bool VAbstractPiece::IsEkvPointOnLine(const VSAPoint &iPoint, const VSAPoint &pr const QLineF bigLine1 = ParallelLine(prevPoint, iPoint, tmpWidth ); const QLineF bigLine2 = ParallelLine(iPoint, nextPoint, tmpWidth ); - return (VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint) - && VGObject::IsPointOnLineviaPDP(bigLine1.p2(), bigLine1.p1(), bigLine2.p2()) - && VGObject::IsPointOnLineviaPDP(bigLine2.p1(), bigLine1.p1(), bigLine2.p2()) - && qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < accuracyPointOnLine); + bool seamOnLine = VGObject::IsPointOnLineviaPDP(iPoint, prevPoint, nextPoint); + bool sa1OnLine = VGObject::IsPointOnLineviaPDP(bigLine1.p2(), bigLine1.p1(), bigLine2.p2()); + bool sa2OnLine = VGObject::IsPointOnLineviaPDP(bigLine2.p1(), bigLine1.p1(), bigLine2.p2()); + bool saDiff = qAbs(prevPoint.GetSAAfter(tmpWidth) - nextPoint.GetSABefore(tmpWidth)) < accuracyPointOnLine; + + // left point that splits a curve + bool curve = (prevPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && + iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve) || + (nextPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve && + iPoint.GetAngleType() == PieceNodeAngle::ByLengthCurve); + + return seamOnLine && sa1OnLine && sa2OnLine && saDiff && not curve; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/test/ValentinaTest/share/doll/input.json b/src/test/ValentinaTest/share/doll/input.json new file mode 100644 index 000000000..ae27d2ff8 --- /dev/null +++ b/src/test/ValentinaTest/share/doll/input.json @@ -0,0 +1,391 @@ +{ + "vector": [ + { + "type": "VSAPoint", + "x": 204.35338582677167, + "y": 730.1419842519686 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 198.26332677165357, + "y": 676.5494645669291 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 192.346280757874, + "y": 619.635094488189 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 189.75108513779531, + "y": 588.0775157480316 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 187.46731299212598, + "y": 542.7896220472442 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 186.6368503937008, + "y": 465.72269291338586 + }, + { + "type": "VSAPoint", + "x": 186.6368503937008, + "y": 408.88214173228346 + }, + { + "type": "VSAPoint", + "x": 186.6368503937008, + "y": 408.88214173228346 + }, + { + "type": "VSAPoint", + "x": 186.6368503937008, + "y": 408.88214173228346 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 186.85865388652775, + "y": 401.9728053734631 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 188.84085342812114, + "y": 386.7976196768927 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 194.1169611768659, + "y": 362.5979893990439 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 202.93458571296594, + "y": 331.9482604161107 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 208.15480908861204, + "y": 314.3257252276737 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 210.07604385955227, + "y": 306.3255523559161 + }, + { + "type": "VSAPoint", + "x": 210.2588976377953, + "y": 304.0002519685039 + }, + { + "type": "VSAPoint", + "x": 210.2588976377953, + "y": 304.0002519685039 + }, + { + "type": "VSAPoint", + "x": 210.2588976377953, + "y": 304.0002519685039 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 210.10781119555043, + "y": 300.71635788532535 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 208.3654577463414, + "y": 294.640423893857 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 205.02211856338138, + "y": 289.1655002549779 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 200.21916136212846, + "y": 284.30357068282433 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 194.09795385804082, + "y": 280.0666188915326 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 186.79986376657644, + "y": 276.46662859523906 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 178.46625880319345, + "y": 273.5155835080799 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 169.23850668334993, + "y": 271.2254673441915 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 154.0971854462626, + "y": 268.9693881780884 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 131.97321085330947, + "y": 268.49853395957217 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 108.81726651275976, + "y": 270.88710228859264 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 91.4830095620298, + "y": 274.7072960360051 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 80.1913179469932, + "y": 278.1360249671903 + }, + { + "type": "VSAPoint", + "x": 74.69714943577341, + "y": 280.17021609073447 + }, + { + "type": "VSAPoint", + "x": 74.69714943577341, + "y": 280.17021609073447 + }, + { + "type": "VSAPoint", + "x": -15.239495457873012, + "y": 314.761233357522 + }, + { + "type": "VSAPoint", + "x": -40.78363128565394, + "y": 165.7537743621286 + }, + { + "type": "VSAPoint", + "x": -40.78363128565394, + "y": 165.7537743621286 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 145.47569245858736, + "y": 133.82360457740234 + }, + { + "type": "VSAPoint", + "x": 238.60535433070868, + "y": 117.85851968503937 + }, + { + "type": "VSAPoint", + "x": 238.60535433070868, + "y": 117.85851968503937 + }, + { + "type": "VSAPoint", + "x": 238.60535433070868, + "y": 117.85851968503937 + }, + { + "type": "VSAPoint", + "x": 304.7470866141732, + "y": 106.519937007874 + }, + { + "type": "VSAPoint", + "x": 304.7470866141732, + "y": 106.519937007874 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 305.2942453334244, + "y": 109.34899935311245 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 306.9048459848872, + "y": 114.50235141446748 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 310.35018184997693, + "y": 121.2287733899588 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 316.92140911194485, + "y": 128.2794363551129 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 325.40387019373645, + "y": 133.49126641884465 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 335.5398716397215, + "y": 137.12975254404603 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 347.07171999426987, + "y": 139.46038369360906 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 366.32904938677143, + "y": 141.16537601600902 + }, + { + "type": "VSAPoint", + "x": 380.3376377952756, + "y": 141.29159055118112 + }, + { + "type": "VSAPoint", + "x": 380.3376377952756, + "y": 141.29159055118112 + }, + { + "type": "VSAPoint", + "x": 380.3376377952756, + "y": 574.2364724409449 + }, + { + "type": "VSAPoint", + "x": 380.3376377952756, + "y": 574.2364724409449 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 377.3698228346457, + "y": 574.2364724409449 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 373.7242096764272, + "y": 574.8074154773622 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 371.6718943774606, + "y": 575.8351129429134 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 369.9158535310039, + "y": 577.6621306594488 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 368.43013518085627, + "y": 580.5168458415355 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 366.6259621062992, + "y": 587.0255964566929 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 364.9650369094488, + "y": 601.6417381889764 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 363.91826648622043, + "y": 624.4794596456694 + }, + { + "angle": 6, + "type": "VSAPoint", + "x": 363.03360236220476, + "y": 676.5494645669291 + }, + { + "type": "VSAPoint", + "x": 362.6211023622048, + "y": 730.1419842519686 + }, + { + "type": "VSAPoint", + "x": 362.6211023622048, + "y": 730.1419842519686 + }, + { + "type": "VSAPoint", + "x": 362.6211023622048, + "y": 730.1419842519686 + }, + { + "type": "VSAPoint", + "x": 362.6211023622048, + "y": 730.1419842519686 + }, + { + "type": "VSAPoint", + "x": 254.7470866141744, + "y": 730.1419842519686 + }, + { + "type": "VSAPoint", + "x": 204.35338582677167, + "y": 730.1419842519686 + } + ] +} diff --git a/src/test/ValentinaTest/share/doll/output.json b/src/test/ValentinaTest/share/doll/output.json new file mode 100644 index 000000000..b06723390 --- /dev/null +++ b/src/test/ValentinaTest/share/doll/output.json @@ -0,0 +1,154 @@ +{ + "vector": [ + { + "type": "QPointF", + "x": 180.61562597334427, + "y": 756.5986771653544 + }, + { + "type": "QPointF", + "x": 165.97859858059653, + "y": 621.8034894040823 + }, + { + "type": "QPointF", + "x": 163.32796749524144, + "y": 589.4099773650914 + }, + { + "type": "QPointF", + "x": 161.01215601002994, + "y": 543.0746991698966 + }, + { + "type": "QPointF", + "x": 160.18169341160475, + "y": 466.0077700360383 + }, + { + "type": "QPointF", + "x": 160.62481365253532, + "y": 398.54611214375194 + }, + { + "type": "QPointF", + "x": 162.9913997998063, + "y": 381.1618103267805 + }, + { + "type": "QPointF", + "x": 168.6915298388583, + "y": 355.2833437350711 + }, + { + "type": "QPointF", + "x": 183.22877397002802, + "y": 304.74101381048894 + }, + { + "type": "QPointF", + "x": 176.4964093006996, + "y": 300.8845392057267 + }, + { + "type": "QPointF", + "x": 164.0909826454473, + "y": 297.20724769199745 + }, + { + "type": "QPointF", + "x": 151.85722755932034, + "y": 295.38440016496565 + }, + { + "type": "QPointF", + "x": 133.05321319026447, + "y": 294.98420310934574 + }, + { + "type": "QPointF", + "x": 113.03530576126391, + "y": 297.04907850354175 + }, + { + "type": "QPointF", + "x": 98.18367337174476, + "y": 300.3221413959734 + }, + { + "type": "QPointF", + "x": 88.78565018946433, + "y": 303.1758567718099 + }, + { + "type": "QPointF", + "x": -35.8670113621213, + "y": 351.0160620770652 + }, + { + "type": "QPointF", + "x": -71.33016037970901, + "y": 144.14769280779635 + }, + { + "type": "QPointF", + "x": 325.80435893876364, + "y": 76.06748949606039 + }, + { + "type": "QPointF", + "x": 332.2173315417802, + "y": 105.88700933180093 + }, + { + "type": "QPointF", + "x": 336.9203884569167, + "y": 109.51568857241766 + }, + { + "type": "QPointF", + "x": 342.6672073225278, + "y": 111.57860468564039 + }, + { + "type": "QPointF", + "x": 350.87058826068295, + "y": 113.23653969817072 + }, + { + "type": "QPointF", + "x": 367.61689142449274, + "y": 114.71921248944548 + }, + { + "type": "QPointF", + "x": 406.79433070866145, + "y": 115.07219325697825 + }, + { + "type": "QPointF", + "x": 406.79433070866145, + "y": 600.6931653543307 + }, + { + "type": "QPointF", + "x": 391.6997948509762, + "y": 600.6931653543307 + }, + { + "type": "QPointF", + "x": 390.36466617897366, + "y": 625.3100352443169 + }, + { + "type": "QPointF", + "x": 388.8749425918069, + "y": 756.5986771653544 + }, + { + "type": "QPointF", + "x": 180.61562597334427, + "y": 756.5986771653544 + } + ] +} diff --git a/src/test/ValentinaTest/share/test_data.qrc b/src/test/ValentinaTest/share/test_data.qrc index 81da5e5b0..52f469294 100644 --- a/src/test/ValentinaTest/share/test_data.qrc +++ b/src/test/ValentinaTest/share/test_data.qrc @@ -107,5 +107,7 @@ Issue_923_test7_2/output.json Issue_923_test7_3/input.json Issue_923_test7_3/output.json + doll/input.json + doll/output.json diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp index 0462b30f5..f8920164d 100644 --- a/src/test/ValentinaTest/tst_vabstractpiece.cpp +++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp @@ -969,6 +969,12 @@ void TST_VAbstractPiece::BrokenDetailEquidistant_data() QStringLiteral("://Issue_883_prong/input.json"), QStringLiteral("://Issue_883_prong/output.json"), 37.795275590551185 /*seam allowance width*/); + + // See the file "collection/bugs/doll.val" (private collection) + ASSERT_TEST_CASE("Doll.", + QStringLiteral("://doll/input.json"), + QStringLiteral("://doll/output.json"), + 26.45669291338583 /*seam allowance width 0.7 cm*/); } //---------------------------------------------------------------------------------------------------------------------