Fixed issue #903. Bug in tool Cut Spline path.

(grafted from a5d6d7a0bd903897c2b509f90af1e50206feec0e)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-11-13 17:03:35 +02:00
parent cc5bb4ec15
commit d099e441a4
2 changed files with 36 additions and 1 deletions

View File

@ -3,6 +3,9 @@
- [#894] Quick way to disable a passmark.
- [#895] Improve path validation. Do not allow repeat the same curve twice.
# Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path.
# Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements.
- Fixed issues with seam allowance.

View File

@ -27,6 +27,7 @@
*************************************************************************/
#include "vabstractcubicbezierpath.h"
#include "vsplinepoint.h"
#include <QPainterPath>
@ -203,7 +204,38 @@ QPointF VAbstractCubicBezierPath::CutSplinePath(qreal length, qint32 &p1, qint32
{
p1 = i-1;
p2 = i;
return spl.CutSpline(length - (fullLength - splLength), spl1p2, spl1p3, spl2p2, spl2p3);
const QPointF point = spl.CutSpline(length - (fullLength - splLength), spl1p2, spl1p3, spl2p2, spl2p3);
const QVector<VSplinePoint> points = GetSplinePath();
if (p1 > 0)
{
const VSplinePoint splP1 = points.at(p1);
QLineF line(splP1.P().toQPointF(), spl1p2);
if (qFuzzyIsNull(line.length()))
{
spl1p2.rx() += ToPixel(0.1, Unit::Mm);
QLineF line(splP1.P().toQPointF(), spl1p2);
line.setLength(ToPixel(0.1, Unit::Mm));
line.setAngle(splP1.Angle1()+180);
spl1p2 = line.p2();
}
}
if (p2 < points.size() - 1)
{
const VSplinePoint splP2 = points.at(p2);
QLineF line(splP2.P().toQPointF(), spl2p3);
if (qFuzzyIsNull(line.length()))
{
spl2p3.rx() += ToPixel(0.1, Unit::Mm);
QLineF line(splP2.P().toQPointF(), spl2p3);
line.setAngle(splP2.Angle2()+180);
spl2p3 = line.p2();
}
}
return point;
}
}
p1 = p2 = -1;