Code

Make LPE Path along path behave more naturally. (fixes problems in moving a path...
authorjohanengelen <johanengelen@users.sourceforge.net>
Sun, 18 Nov 2007 13:59:34 +0000 (13:59 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Sun, 18 Nov 2007 13:59:34 +0000 (13:59 +0000)
src/live_effects/lpe-pathalongpath.cpp
src/live_effects/lpe-skeletalstrokes.cpp

index 499b77f8c4099524f946ffcddfb5a387f6d433b5..7138b6faac03dda7b738a018563ea4024c69ee06 100644 (file)
@@ -102,6 +102,9 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
 \r
     Piecewise<D2<SBasis> > uskeleton = arc_length_parametrization(Piecewise<D2<SBasis> >(bend_path),2,.1);\r
     uskeleton = remove_short_cuts(uskeleton,.01);\r
+    Rect uskeletonbounds = bounds_exact(uskeleton);\r
+    uskeleton -= uskeletonbounds.midpoint();\r
+\r
     Piecewise<D2<SBasis> > n = rot90(derivative(uskeleton));\r
     n = force_continuity(remove_short_cuts(n,.1));\r
 \r
@@ -111,7 +114,7 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
     Interval pattBnds = bounds_exact(x);\r
     x -= pattBnds.min();\r
     Interval pattBndsY = bounds_exact(y);\r
-    y -= (pattBndsY.max()+pattBndsY.min())/2;\r
+    y -= pattBndsY.middle();\r
 \r
     int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent());\r
     double scaling = 1;\r
@@ -154,6 +157,9 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
         output.concat(compose(uskeleton,x+offs)+y*compose(n,x+offs));\r
         offs+=pattWidth;\r
     }\r
+\r
+    output += Point(pattBnds.middle(), pattBndsY.middle());\r
+\r
     return output;\r
 }\r
 \r
index 8e70f8a87e334524936d2dee88bd97f7f68454ee..effa66e5468aced40bbbeb2ee5e6222499eae554 100644 (file)
@@ -107,7 +107,7 @@ LPESkeletalStrokes::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & 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;