diff --git a/ChangeLog.txt b/ChangeLog.txt index c2e0a86d1..31e184767 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.cpp b/src/libs/vgeometry/vabstractcubicbezierpath.cpp index d7aa702e2..cac7c74c0 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.cpp +++ b/src/libs/vgeometry/vabstractcubicbezierpath.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vabstractcubicbezierpath.h" +#include "vsplinepoint.h" #include @@ -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 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;