summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-spiro.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-08-06 21:42:52 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-08-06 21:42:52 +0000
commit98e57f9888244c7bb7c1e528f4d9d0feca935d19 (patch)
treeb2778310f7786ebcfc9d4f306ee60f2ab3d29e6b /src/live_effects/lpe-spiro.cpp
parentTranslation. Greek translation update. (diff)
downloadinkscape-98e57f9888244c7bb7c1e528f4d9d0feca935d19.tar.gz
inkscape-98e57f9888244c7bb7c1e528f4d9d0feca935d19.zip
Refactor BSPline and Spiro to remove duplicated functions
(bzr r14280)
Diffstat (limited to 'src/live_effects/lpe-spiro.cpp')
-rw-r--r--src/live_effects/lpe-spiro.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp
index eefd25c7d..0d42596b2 100644
--- a/src/live_effects/lpe-spiro.cpp
+++ b/src/live_effects/lpe-spiro.cpp
@@ -37,6 +37,10 @@ LPESpiro::~LPESpiro()
void
LPESpiro::doEffect(SPCurve * curve)
{
+ sp_spiro_do_effect(curve);
+}
+
+void sp_spiro_do_effect(SPCurve *curve){
using Geom::X;
using Geom::Y;
@@ -54,7 +58,7 @@ LPESpiro::doEffect(SPCurve * curve)
// start of path
{
- Geom::Point p = path_it->front().pointAt(0);
+ Geom::Point p = path_it->initialPoint();
path[ip].x = p[X];
path[ip].y = p[Y];
path[ip].ty = '{' ; // for closed paths, this is overwritten
@@ -64,17 +68,7 @@ LPESpiro::doEffect(SPCurve * curve)
// midpoints
Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
-
Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop
- if (path_it->closed()) {
- // if the path is closed, maybe we have to stop a bit earlier because the closing line segment has zerolength.
- const Geom::Curve &closingline = path_it->back_closed(); // the closing line segment is always of type Geom::LineSegment.
- if (are_near(closingline.initialPoint(), closingline.finalPoint())) {
- // closingline.isDegenerate() did not work, because it only checks for *exact* zero length, which goes wrong for relative coordinates and rounding errors...
- // the closing line segment has zero-length. So stop before that one!
- curve_endit = path_it->end_open();
- }
- }
while ( curve_it2 != curve_endit )
{