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

(grafted from 90daa1f9dd73cd757462ad4c315ea6c1b272782a)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-20 20:47:30 +03:00
parent 92be5a9ad3
commit fa8e63c49c
3 changed files with 6 additions and 9 deletions

View File

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

View File

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

View File

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