diff --git a/ChangeLog.txt b/ChangeLog.txt index d18e311a3..c6116de3e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -16,6 +16,7 @@ - [#532] Unexpected error occurs when zoom out image. - [#537] Valentina crashes when use undo command. - [#544] Error: Color Lines are black until touched. +- [#543] Detail loses details. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index b67bdee4e..162985a4c 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -35,6 +35,8 @@ #include #include +double VGObject::accuracyPointOnLine = (0.5/*mm*/ / 25.4) * PrintDPI; + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGObject default constructor. @@ -499,14 +501,16 @@ double VGObject::PerpDotProduct(const QPointF &p1, const QPointF &p2, const QPoi * There is the floating-point accuraccy problem, so instead of checking against zero, some epsilon value has to be * used. Because the size of the pdp value depends on the length of the vectors, no static value can be used. One * approach is to compare the pdp/area value to the fraction of another area which also depends on the length of the - * line e1=(p1, p2), e.g. the area of the square with side e1 which is computed below + * line e1=(p1, p2), e.g. the minimal area calucalted with PerpDotProduc() if point still not on the line. This distance + * is controled by variable accuracyPointOnLine */ double VGObject::GetEpsilon(const QPointF &p1, const QPointF &p2) { - const double dx1 = p2.x() - p1.x(); - const double dy1 = p2.y() - p1.y(); - const double epsilon = 0.06 * (dx1 * dx1 + dy1 * dy1); //-V636 - return epsilon; + QLineF line(p1, p2); + line.setAngle(line.angle() + 90); + line.setLength(accuracyPointOnLine); // less than accuracy means the same point + + return qAbs(PerpDotProduct(p1, p2, line.p2())); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vgeometry/vgobject.h b/src/libs/vgeometry/vgobject.h index 99ea48418..7dc3a28e8 100644 --- a/src/libs/vgeometry/vgobject.h +++ b/src/libs/vgeometry/vgobject.h @@ -89,6 +89,8 @@ public: static QVector GetReversePoints(const QVector &points); static int GetLengthContour(const QVector &contour, const QVector &newPoints); + + static double accuracyPointOnLine; private: QSharedDataPointer d;