From 6b2e70d904df2a52f64a68d1ee352b728b90ef93 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sun, 18 Nov 2007 13:59:34 +0000 Subject: [PATCH] Make LPE Path along path behave more naturally. (fixes problems in moving a path with that effect applied to it) --- src/live_effects/lpe-pathalongpath.cpp | 8 +++++++- src/live_effects/lpe-skeletalstrokes.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/live_effects/lpe-pathalongpath.cpp b/src/live_effects/lpe-pathalongpath.cpp index 499b77f8c..7138b6faa 100644 --- a/src/live_effects/lpe-pathalongpath.cpp +++ b/src/live_effects/lpe-pathalongpath.cpp @@ -102,6 +102,9 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise > & pwd2 Piecewise > uskeleton = arc_length_parametrization(Piecewise >(bend_path),2,.1); uskeleton = remove_short_cuts(uskeleton,.01); + Rect uskeletonbounds = bounds_exact(uskeleton); + uskeleton -= uskeletonbounds.midpoint(); + Piecewise > n = rot90(derivative(uskeleton)); n = force_continuity(remove_short_cuts(n,.1)); @@ -111,7 +114,7 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise > & pwd2 Interval pattBnds = bounds_exact(x); x -= pattBnds.min(); Interval pattBndsY = bounds_exact(y); - y -= (pattBndsY.max()+pattBndsY.min())/2; + y -= pattBndsY.middle(); int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent()); double scaling = 1; @@ -154,6 +157,9 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise > & pwd2 output.concat(compose(uskeleton,x+offs)+y*compose(n,x+offs)); offs+=pattWidth; } + + output += Point(pattBnds.middle(), pattBndsY.middle()); + return output; } diff --git a/src/live_effects/lpe-skeletalstrokes.cpp b/src/live_effects/lpe-skeletalstrokes.cpp index 8e70f8a87..effa66e54 100644 --- a/src/live_effects/lpe-skeletalstrokes.cpp +++ b/src/live_effects/lpe-skeletalstrokes.cpp @@ -107,7 +107,7 @@ LPESkeletalStrokes::doEffect_pwd2 (Geom::Piecewise > & pw Interval pattBnds = bounds_exact(x); x -= pattBnds.min(); Interval pattBndsY = bounds_exact(y); - y -= (pattBndsY.max()+pattBndsY.min())/2; + y -= pattBndsY.middle(); int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent()); double scaling = 1; -- 2.30.2