From b49f1b934dc98365b4263bc5bbc84f58a048bd61 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 10 Mar 2016 09:40:06 +0200 Subject: [PATCH] Fixed bug case where an open equidistant point is too far from a main path. --HG-- branch : release --- ChangeLog.txt | 1 + .../GAVAUDAN Laure - corsage - figure 4.val | 111 ++++++++++++++++++ .../bugs/mesures GAVAUDAN Laure.vit | 53 +++++++++ src/libs/vlayout/vabstractdetail.cpp | 22 +++- .../ValentinaTest/tst_vabstractdetail.cpp | 30 +++++ src/test/ValentinaTest/tst_vabstractdetail.h | 1 + 6 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val create mode 100644 src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit diff --git a/ChangeLog.txt b/ChangeLog.txt index eff688380..d75cd144e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,5 @@ # Version 0.4.4 +- Fixed bug case where an open equidistant point is too far from a main path. - Fixed wrong handling with true darts points inside tool detail. # Version 0.4.3 March 6, 2016 diff --git a/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val b/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val new file mode 100644 index 000000000..cf7f9c9c3 --- /dev/null +++ b/src/app/share/collection/bugs/GAVAUDAN Laure - corsage - figure 4.val @@ -0,0 +1,111 @@ + + + + 0.2.4 + cm + + + + mesures GAVAUDAN Laure.vit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+
diff --git a/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit b/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit new file mode 100644 index 000000000..731a7d553 --- /dev/null +++ b/src/app/share/collection/bugs/mesures GAVAUDAN Laure.vit @@ -0,0 +1,53 @@ + + + + 0.3.3 + false + + cm + 998 + + Gavaudan + Laure + 2003-10-08 + female + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp index 47a8d5f25..3e65dafe2 100644 --- a/src/libs/vlayout/vabstractdetail.cpp +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -398,7 +398,7 @@ QVector VAbstractDetail::EkvPoint(const QLineF &line1, const QLineF &li QLineF line( line1.p2(), CrosPoint ); const qreal length = line.length(); if (length > width*2.4) - { // Cutting too long an acute angle + { // Cutting too long a cut angle line.setLength(width); // Not sure about width value here QLineF cutLine(line.p2(), CrosPoint); // Cut line is a perpendicular cutLine.setLength(length); // Decided take this length @@ -470,9 +470,27 @@ QPointF VAbstractDetail::UnclosedEkvPoint(const QLineF &line, const QLineF &help switch (type) { case (QLineF::BoundedIntersection): - case (QLineF::UnboundedIntersection): return CrosPoint; break; + case (QLineF::UnboundedIntersection): + { + // This case is very tricky. + // User can create very wrong path that will create crospoint far from main path. + // Such an annomaly we try to catch and fix. + // If don't do this the program will crash. + QLineF test( line.p2(), CrosPoint ); + const qreal length = test.length(); + if (length > width*50) // Why 50? Try to avoid cutting correct cases. + { + test.setLength(width); + return test.p2(); + } + else + { + return CrosPoint; + } + break; + } case (QLineF::NoIntersection): /*If we have correct lines this means lines lie on a line.*/ return bigLine.p2(); diff --git a/src/test/ValentinaTest/tst_vabstractdetail.cpp b/src/test/ValentinaTest/tst_vabstractdetail.cpp index 204ae3ad6..dd4eae484 100644 --- a/src/test/ValentinaTest/tst_vabstractdetail.cpp +++ b/src/test/ValentinaTest/tst_vabstractdetail.cpp @@ -211,6 +211,36 @@ void TST_VAbstractDetail::PathRemoveLoop() const Comparison(res, expect); } +//--------------------------------------------------------------------------------------------------------------------- +void TST_VAbstractDetail::BrokenDetailEquidistant() const +{ + // For more details see the file GAVAUDAN Laure - corsage - figure 4.val + // We will test only one detail. The second require too accurate data that we cannot get from debuger. + // The test check an open equdistant of correct detail. + QVector points;// Input points. + points.append(QPointF(1062.36226525, 134.022845566)); + points.append(QPointF(1375.53777429, 66.4182791729)); + points.append(QPointF(1422.22769398, 510.762708661)); + points.append(QPointF(1467.89850709, 945.408377953)); + points.append(QPointF(1127.74102677, 510.762708661)); + + const EquidistantType eqv = EquidistantType::OpenEquidistant; // Open path + const qreal width = 37.795275590551185; // seam allowance width + + const QVector ekv = VAbstractDetail::Equidistant(points, eqv, width);// Take result + + QVector ekvOrig; + ekvOrig.append(QPointF(1055.89455044, 96.7531583682)); + ekvOrig.append(QPointF(1408.72549102, 20.5882538362)); + ekvOrig.append(QPointF(1459.81603355, 506.813077611)); + ekvOrig.append(QPointF(1508.46179299, 969.771085841)); + ekvOrig.append(QPointF(1455.67973006, 991.120774377)); + ekvOrig.append(QPointF(1141.4155362, 589.560971108)); + + // Begin comparison + Comparison(ekv, ekvOrig); +} + //--------------------------------------------------------------------------------------------------------------------- void TST_VAbstractDetail::Case1() const { diff --git a/src/test/ValentinaTest/tst_vabstractdetail.h b/src/test/ValentinaTest/tst_vabstractdetail.h index fc8759e92..912faed9d 100644 --- a/src/test/ValentinaTest/tst_vabstractdetail.h +++ b/src/test/ValentinaTest/tst_vabstractdetail.h @@ -44,6 +44,7 @@ private slots: void SumTrapezoids() const; void PathRemoveLoop_data() const; void PathRemoveLoop() const; + void BrokenDetailEquidistant() const; private: void Case1() const;