From 8dbf7bd73db6bb549b3e0be3fba91cddfcb589b8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 13 May 2014 07:35:50 +0200 Subject: Fixed a bug in bspline with snaps and 1 sice segments. Pointed by LiamW (bzr r13341.1.12) --- src/ui/tools/pen-tool.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/ui/tools/pen-tool.cpp') diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 9e4df5031..386dc43e9 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -1811,9 +1811,9 @@ void PenTool::_bspline_spiro_build() void PenTool::_bspline_doEffect(SPCurve * curve) { // commenting the function doEffect in src/live_effects/lpe-bspline.cpp - if(curve->get_segment_count() < 2) - return; Geom::PathVector const original_pathv = curve->get_pathvector(); + if (curve->get_segment_count() < 1) + return; curve->reset(); for(Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { @@ -1890,9 +1890,25 @@ void PenTool::_bspline_doEffect(SPCurve * curve) ++curve_it1; ++curve_it2; } + SPCurve *out = new SPCurve(); + out->moveto(curve_it1->initialPoint()); + out->lineto(curve_it1->finalPoint()); + cubic = dynamic_cast(&*curve_it1); + if (cubic) { + SBasisOut = out->first_segment()->toSBasis(); + nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1], *out->first_segment())); + nextPointAt2 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[2], *out->first_segment())); + nextPointAt3 = out->first_segment()->finalPoint(); + } else { + nextPointAt1 = out->first_segment()->initialPoint(); + nextPointAt2 = out->first_segment()->finalPoint(); + nextPointAt3 = out->first_segment()->finalPoint(); + } + out->reset(); + delete out; SPCurve *curveHelper = new SPCurve(); curveHelper->moveto(node); - Geom::Point startNode(0,0); + Geom::Point startNode = path_it->begin()->initialPoint(); if (path_it->closed()) { SPCurve * start = new SPCurve(); start->moveto(path_it->begin()->initialPoint()); -- cgit v1.2.3