diff --git a/src/app/share/collection/bugs/Issue_#458.val b/src/app/share/collection/bugs/Issue_#458.val
new file mode 100644
index 000000000..09f963817
--- /dev/null
+++ b/src/app/share/collection/bugs/Issue_#458.val
@@ -0,0 +1,173 @@
+
+
+
+ 0.4.0
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/share/collection/bugs/Issue_#626.val b/src/app/share/collection/bugs/Issue_#626.val
new file mode 100644
index 000000000..cbe109ad4
--- /dev/null
+++ b/src/app/share/collection/bugs/Issue_#626.val
@@ -0,0 +1,119 @@
+
+
+
+ 0.4.0
+ cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp
index a72e0b8c8..a2f74f33e 100644
--- a/src/libs/vgeometry/vgobject.cpp
+++ b/src/libs/vgeometry/vgobject.cpp
@@ -40,7 +40,7 @@
#include "../ifc/ifcdef.h"
#include "vgobject_p.h"
-const double VGObject::accuracyPointOnLine = (0.026/*mm*/ / 25.4) * PrintDPI;
+const double VGObject::accuracyPointOnLine = (0.031/*mm*/ / 25.4) * PrintDPI;
//---------------------------------------------------------------------------------------------------------------------
/**
@@ -457,14 +457,20 @@ bool VGObject::IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const Q
// The test point must lie inside the bounding box spanned by the two line points.
if (not ( (p1.x() <= t.x() && t.x() <= p2.x()) || (p2.x() <= t.x() && t.x() <= p1.x()) ))
{
- // test point not in x-range
- return false;
+ if (not (qAbs(p1.x() - t.x()) <= accuracyPointOnLine) && not (qAbs(p2.x() - t.x()) <= accuracyPointOnLine))
+ {
+ // test point not in x-range
+ return false;
+ }
}
if (not ( (p1.y() <= t.y() && t.y() <= p2.y()) || (p2.y() <= t.y() && t.y() <= p1.y()) ))
{
- // test point not in y-range
- return false;
+ if (not (qAbs(p1.y() - t.y()) <= accuracyPointOnLine) && not (qAbs(p2.y() - t.y()) <= accuracyPointOnLine))
+ {
+ // test point not in y-range
+ return false;
+ }
}
// Test via the perp dot product (PDP)
diff --git a/src/test/ValentinaTest/tst_vabstractcurve.cpp b/src/test/ValentinaTest/tst_vabstractcurve.cpp
index 0ce69d462..30246e643 100644
--- a/src/test/ValentinaTest/tst_vabstractcurve.cpp
+++ b/src/test/ValentinaTest/tst_vabstractcurve.cpp
@@ -37,83 +37,6 @@ TST_VAbstractCurve::TST_VAbstractCurve(QObject *parent)
{
}
-//---------------------------------------------------------------------------------------------------------------------
-void TST_VAbstractCurve::GetSegmentPoints_issue458()
-{
- // Real case. Issue #458. https://bitbucket.org/dismine/valentina/issues/458/issue-with-segment-of-curve
- // See file AnalyzeStrangeIssueBug_isotated.val
-
- QVector curve;
- curve.append(QPointF(-11.267867716535433, -621.9401574803151));
- curve.append(QPointF(28.929492484925593, -621.8607845421614));
- curve.append(QPointF(111.02420124017556, -621.0204613872887));
- curve.append(QPointF(192.81663506084445, -619.5641192834869));
- curve.append(QPointF(271.7042817720716, -617.7160624366999));
- curve.append(QPointF(380.07266406952584, -614.6790467524394));
- curve.append(QPointF(489.18908873700275, -611.324295072277));
- curve.append(QPointF(520.2546519685039, -610.6015748031497));
- curve.append(QPointF(520.2546519685039, -610.6015748031497));
- curve.append(QPointF(533.2501074340664, -610.4104062194663));
- curve.append(QPointF(558.2116609090922, -610.3912171914401));
- curve.append(QPointF(581.9682255886432, -610.7865804010944));
- curve.append(QPointF(604.5534016414362, -611.572911926731));
- curve.append(QPointF(626.0007892361873, -612.7266278466516));
- curve.append(QPointF(646.343988541613, -614.224144239158));
- curve.append(QPointF(665.6165997264297, -616.0418771825518));
- curve.append(QPointF(683.8522229593539, -618.1562427551349));
- curve.append(QPointF(701.0844584091014, -620.543657035209));
- curve.append(QPointF(717.3469062443893, -623.1805361010756));
- curve.append(QPointF(740.1064499883596, -627.5281982218287));
- curve.append(QPointF(767.2158219967725, -634.0157380079388));
- curve.append(QPointF(791.0508465842408, -641.0766263466508));
- curve.append(QPointF(811.8803251004954, -648.5221918643786));
- curve.append(QPointF(829.9730588952673, -656.1637631875356));
- curve.append(QPointF(845.5978493182879, -663.8126689425358));
- curve.append(QPointF(859.0234977192879, -671.2802377557932));
- curve.append(QPointF(875.8174743129977, -681.8104925021551));
- curve.append(QPointF(892.6995351796473, -693.3935519951781));
- curve.append(QPointF(899.4017385826772, -697.5307086614174));
-
- QPointF begin (541.621890489816, -610.374541985993);
- QPointF end (660.2625170532651, -735.7793605757131);
-
- const QVector points = VAbstractCurve::GetSegmentPoints(curve, begin, end, true);
-
- QVector origPoints;
- origPoints.append(QPointF(899.4017385826772, -697.5307086614174));
- origPoints.append(QPointF(892.6995351796473, -693.3935519951781));
- origPoints.append(QPointF(875.8174743129977, -681.8104925021551));
- origPoints.append(QPointF(859.0234977192879, -671.2802377557932));
- origPoints.append(QPointF(845.5978493182879, -663.8126689425358));
- origPoints.append(QPointF(829.9730588952673, -656.1637631875356));
- origPoints.append(QPointF(811.8803251004954, -648.5221918643786));
- origPoints.append(QPointF(791.0508465842408, -641.0766263466508));
- origPoints.append(QPointF(767.2158219967725, -634.0157380079388));
- origPoints.append(QPointF(740.1064499883596, -627.5281982218287));
- origPoints.append(QPointF(717.3469062443893, -623.1805361010756));
- origPoints.append(QPointF(701.0844584091014, -620.543657035209));
- origPoints.append(QPointF(683.8522229593539, -618.1562427551349));
- origPoints.append(QPointF(665.6165997264297, -616.0418771825518));
- origPoints.append(QPointF(646.343988541613, -614.224144239158));
- origPoints.append(QPointF(626.0007892361873, -612.7266278466516));
- origPoints.append(QPointF(604.5534016414362, -611.572911926731));
- origPoints.append(QPointF(581.9682255886432, -610.7865804010944));
- origPoints.append(QPointF(558.2116609090922, -610.3912171914401));
- origPoints.append(QPointF(533.2501074340664, -610.4104062194663));
- origPoints.append(QPointF(520.2546519685039, -610.6015748031497));
- origPoints.append(QPointF(520.2546519685039, -610.6015748031497));
- origPoints.append(QPointF(489.18908873700275, -611.324295072277));
- origPoints.append(QPointF(380.07266406952584, -614.6790467524394));
- origPoints.append(QPointF(271.7042817720716, -617.7160624366999));
- origPoints.append(QPointF(192.81663506084445, -619.5641192834869));
- origPoints.append(QPointF(111.02420124017556, -621.0204613872887));
- origPoints.append(QPointF(28.929492484925593, -621.8607845421614));
- origPoints.append(QPointF(-11.267867716535433, -621.9401574803151));
-
- // Begin comparison
- Comparison(points, origPoints);
-}
-
//---------------------------------------------------------------------------------------------------------------------
void TST_VAbstractCurve::IsPointOnCurve_data() const
{
@@ -121,7 +44,6 @@ void TST_VAbstractCurve::IsPointOnCurve_data() const
QTest::addColumn("point");
QTest::addColumn("expectedResult");
-
QVector points;
points << QPointF(714.5704733515146, 229.44783247230293);
points << QPointF(713.2432059361518, 236.799577781511);
@@ -174,6 +96,68 @@ void TST_VAbstractCurve::IsPointOnCurve_data() const
// See file collection/bug/pointOnCurve.val
QTest::newRow("Point on curve") << points << point << true;
+
+ points.clear();
+ points << QPointF(9448.818897637795, 0.0);
+ points << QPointF(9143.208661417324, -12.224409448818896);
+ points << QPointF(8762.026328740158, -26.973425196850393);
+ points << QPointF(8540.29281496063, -34.94586614173228);
+ points << QPointF(8340.981791338583, -41.32381889763779);
+ points << QPointF(8159.110482283465, -46.107283464566926);
+ points << QPointF(7989.696112204724, -49.29625984251968);
+ points << QPointF(7867.929533710629, -50.59178149606299);
+ points << QPointF(7787.893700787402, -50.99040354330708);
+ points << QPointF(7708.169291338582, -50.99040354330708);
+ points << QPointF(7628.133458415356, -50.59178149606299);
+ points << QPointF(7506.36687992126, -49.29625984251968);
+ points << QPointF(7336.952509842519, -46.107283464566926);
+ points << QPointF(7155.081200787401, -41.32381889763779);
+ points << QPointF(6955.770177165354, -34.94586614173228);
+ points << QPointF(6734.036663385827, -26.973425196850393);
+ points << QPointF(6352.854330708662, -12.224409448818896);
+ points << QPointF(6047.244094488189, 0.0);
+
+ point = QPointF(7748.031496062632, -51.02362204724411);
+
+ // See file /src/app/share/collection/bugs/Issue_#626.val
+ QTest::newRow("Issue #626") << points << point << true;
+
+ points.clear();
+ points << QPointF(-11.267867716535433, -621.9401574803151);
+ points << QPointF(28.929472497969787, -621.860784520479);
+ points << QPointF(111.02416803427747, -621.0204611542031);
+ points << QPointF(192.81661180303666, -619.5641187251658);
+ points << QPointF(271.70428169724175, -617.7160615368814);
+ points << QPointF(380.0727033074438, -614.6790454948614);
+ points << QPointF(489.1891345644603, -611.3242942049818);
+ points << QPointF(520.2546519685039, -610.6015748031497);
+ points << QPointF(520.2546519685039, -610.6015748031497);
+ points << QPointF(533.2501095340014, -610.4104061683322);
+ points << QPointF(558.2116665398979, -610.3912169130674);
+ points << QPointF(581.9682339950501, -610.7865797593487);
+ points << QPointF(604.5534121209836, -611.572910800845);
+ points << QPointF(626.0008011392239, -612.726626131226);
+ points << QPointF(646.344001271297, -614.2241418441603);
+ points << QPointF(665.6166127387285, -616.0418740333172);
+ points << QPointF(683.852235763044, -618.1562387923659);
+ points << QPointF(701.0844705657695, -620.5436522149755);
+ points << QPointF(717.3469173684304, -623.1805303948154);
+ points << QPointF(740.1064589876694, -627.5281911653576);
+ points << QPointF(767.2158272509128, -634.0157291924479);
+ points << QPointF(791.050847501361, -641.0766159345035);
+ points << QPointF(811.8803215112196, -648.5221801408777);
+ points << QPointF(829.9730510526945, -656.1637505609234);
+ points << QPointF(845.5978378979912, -663.8126559439941);
+ points << QPointF(859.0234838193154, -671.2802250394427);
+ points << QPointF(875.8174594072352, -681.8104815843149);
+ points << QPointF(892.6995269725167, -693.39354704172);
+ points << QPointF(899.4017385826772, -697.5307086614174);
+
+ point = QPointF(756.052743609466, -631.2251813422373);
+
+ // Real case. Issue #458. https://bitbucket.org/dismine/valentina/issues/458/issue-with-segment-of-curve
+ // See file /src/app/share/collection/bugs/Issue_#458.val
+ QTest::newRow("Issue #458") << points << point << true;
}
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/test/ValentinaTest/tst_vabstractcurve.h b/src/test/ValentinaTest/tst_vabstractcurve.h
index 565b995f2..438b77ad9 100644
--- a/src/test/ValentinaTest/tst_vabstractcurve.h
+++ b/src/test/ValentinaTest/tst_vabstractcurve.h
@@ -38,7 +38,6 @@ public:
explicit TST_VAbstractCurve(QObject *parent = nullptr);
private slots:
- void GetSegmentPoints_issue458();
void IsPointOnCurve_data() const;
void IsPointOnCurve() const;
};
diff --git a/src/test/ValentinaTest/tst_vabstractpiece.cpp b/src/test/ValentinaTest/tst_vabstractpiece.cpp
index 6705e500e..48e6aed86 100644
--- a/src/test/ValentinaTest/tst_vabstractpiece.cpp
+++ b/src/test/ValentinaTest/tst_vabstractpiece.cpp
@@ -570,9 +570,8 @@ QVector TST_VAbstractPiece::OutputPointsCase1() const
points += QPointF(556.8930273120665, -30.847456102511416);
points += QPointF(539.6101141051189, 79.89131577778163);
points += QPointF(585.9167315845334, -20.702420721823447);
- points += QPointF(1117.4712505569892, 212.6701769158142);
- points += QPointF(1107.8013393916237, 232.47256047676322);
- points += QPointF(1096.0328222042483, 257.2724337531229);
+ points += QPointF(1117.424153174025, 212.64949937811681);
+ points += QPointF(1095.8827941924872, 257.6002084082805);
points += QPointF(1085.2347243947604, 280.86364678273935);
points += QPointF(1075.284743777034, 303.4467181585846);
points += QPointF(1066.1500107021461, 325.033221582634);
@@ -589,10 +588,6 @@ QVector TST_VAbstractPiece::OutputPointsCase1() const
points += QPointF(1001.5753826870504, 572.6532694631434);
points += QPointF(1001.7511114738644, 580.6472328726268);
points += QPointF(1002.5244573746393, 592.6631414076071);
- points += QPointF(1011.1831553003773, 625.860901250618);
- points += QPointF(1013.5469326629959, 631.1835932583286);
- points += QPointF(1016.1978697144372, 636.6181674061058);
- points += QPointF(1019.1173567112357, 642.0917891993197);
points += QPointF(1022.283791807397, 647.5382096308747);
points += QPointF(1025.6730034935645, 652.8974380139866);
points += QPointF(1029.258679857382, 658.1156604426072);