Fixed issue #548. Bug Detail tool. Case when seam allowance is wrong.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-18 14:01:32 +03:00
parent 769427f90f
commit 818ff6752d
3 changed files with 6 additions and 9 deletions

View File

@ -17,6 +17,7 @@
- [#537] Valentina crashes when use undo command. - [#537] Valentina crashes when use undo command.
- [#544] Error: Color Lines are black until touched. - [#544] Error: Color Lines are black until touched.
- [#543] Detail loses details. - [#543] Detail loses details.
- [#548] Bug Detail tool. Case when seam allowance is wrong.
# Version 0.4.4 April 12, 2016 # Version 0.4.4 April 12, 2016
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.

View File

@ -265,7 +265,6 @@ QVector<QPointF> VAbstractDetail::RemoveDublicates(const QVector<QPointF> &point
*/ */
QVector<QPointF> VAbstractDetail::CorrectEquidistantPoints(const QVector<QPointF> &points) QVector<QPointF> VAbstractDetail::CorrectEquidistantPoints(const QVector<QPointF> &points)
{ {
QVector<QPointF> correctPoints;
if (points.size()<4)//Better don't check if only three points. We can destroy equidistant. if (points.size()<4)//Better don't check if only three points. We can destroy equidistant.
{ {
qDebug()<<"Only three points."; qDebug()<<"Only three points.";
@ -273,20 +272,17 @@ QVector<QPointF> VAbstractDetail::CorrectEquidistantPoints(const QVector<QPointF
} }
//Clear equivalent points //Clear equivalent points
correctPoints = RemoveDublicates(points); QVector<QPointF> correctPoints = RemoveDublicates(points);
if (correctPoints.size()<3) if (correctPoints.size()<3)
{ {
return correctPoints; return correctPoints;
} }
//Remove point on line //Remove point on line
QPointF point;
for (qint32 i = 1; i <correctPoints.size()-1; ++i) for (qint32 i = 1; i <correctPoints.size()-1; ++i)
{ {// In this case we alwayse will have bounded intersection, so all is need is to check if point i is on line.
QLineF l1(correctPoints.at(i-1), correctPoints.at(i)); // Unfortunatelly QLineF::intersect can't be used in this case because of the floating-point accuraccy problem.
QLineF l2(correctPoints.at(i), correctPoints.at(i+1)); if (VGObject::IsPointOnLineviaPDP(correctPoints.at(i), correctPoints.at(i-1), correctPoints.at(i+1)))
QLineF::IntersectType intersect = l1.intersect(l2, &point);
if (intersect == QLineF::NoIntersection)
{ {
correctPoints.remove(i); correctPoints.remove(i);
} }

View File

@ -67,10 +67,10 @@ public:
static QVector<QPointF> Equidistant(const QVector<QPointF> &points, const EquidistantType &eqv, qreal width); static QVector<QPointF> Equidistant(const QVector<QPointF> &points, const EquidistantType &eqv, qreal width);
static qreal SumTrapezoids(const QVector<QPointF> &points); static qreal SumTrapezoids(const QVector<QPointF> &points);
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points); static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
static QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points);
protected: protected:
static QVector<QPointF> RemoveDublicates(const QVector<QPointF> &points); static QVector<QPointF> RemoveDublicates(const QVector<QPointF> &points);
static QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points);
private: private:
QSharedDataPointer<VAbstractDetailData> d; QSharedDataPointer<VAbstractDetailData> d;