Fixed issue #543. Detail loses details.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-16 18:19:08 +03:00
parent 47fb85a2c1
commit 3db875dea8
3 changed files with 12 additions and 5 deletions

View file

@ -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.

View file

@ -35,6 +35,8 @@
#include <QtCore/qmath.h>
#include <climits>
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()));
}
//---------------------------------------------------------------------------------------------------------------------

View file

@ -89,6 +89,8 @@ public:
static QVector<QPointF> GetReversePoints(const QVector<QPointF> &points);
static int GetLengthContour(const QVector<QPointF> &contour, const QVector<QPointF> &newPoints);
static double accuracyPointOnLine;
private:
QSharedDataPointer<VGObjectData> d;