diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2014-05-13 05:35:50 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2014-05-13 05:35:50 +0000 |
| commit | 8dbf7bd73db6bb549b3e0be3fba91cddfcb589b8 (patch) | |
| tree | ab34bee90d3d5e0efea6f076ad7d953f16f788f7 /src/live_effects/lpe-bspline.cpp | |
| parent | Update to trunk (diff) | |
| download | inkscape-8dbf7bd73db6bb549b3e0be3fba91cddfcb589b8.tar.gz inkscape-8dbf7bd73db6bb549b3e0be3fba91cddfcb589b8.zip | |
Fixed a bug in bspline with snaps and 1 sice segments. Pointed by LiamW
(bzr r13341.1.12)
Diffstat (limited to 'src/live_effects/lpe-bspline.cpp')
| -rw-r--r-- | src/live_effects/lpe-bspline.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index edf19d1e5..454924d2b 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -96,7 +96,7 @@ void LPEBSpline::createAndApply(const char *name, SPDocument *doc, } void LPEBSpline::doEffect(SPCurve *curve) { - if (curve->get_segment_count() < 2) + if (curve->get_segment_count() < 1) return; // Make copy of old path as it is changed during processing Geom::PathVector const original_pathv = curve->get_pathvector(); @@ -216,10 +216,26 @@ void LPEBSpline::doEffect(SPCurve *curve) { ++curve_it1; ++curve_it2; } + SPCurve *out = new SPCurve(); + out->moveto(curve_it1->initialPoint()); + out->lineto(curve_it1->finalPoint()); + cubic = dynamic_cast<Geom::CubicBezier const *>(&*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; //Si está cerrada la curva, la cerramos sobre el valor guardado //previamente //Si no finalizamos en el punto final - 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()); @@ -421,7 +437,7 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue) { } } //bool hasNodesSelected = LPEBspline::hasNodesSelected(); - if (curve->get_segment_count() < 2) + if (curve->get_segment_count() < 1) return; // Make copy of old path as it is changed during processing Geom::PathVector const original_pathv = curve->get_pathvector(); |
