Code

bug fix: close open paths on input.
authorjfbarraud <jfbarraud@users.sourceforge.net>
Fri, 27 Mar 2009 08:49:13 +0000 (08:49 +0000)
committerjfbarraud <jfbarraud@users.sourceforge.net>
Fri, 27 Mar 2009 08:49:13 +0000 (08:49 +0000)
src/live_effects/lpe-rough-hatches.cpp

index 8b2c8aaf8bd2a67f88ef586fd56399c62b2f8c0a..d75941b122d55151658dca43b96fe29293d98449 100644 (file)
@@ -277,7 +277,7 @@ LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) :
     front_thickness.param_set_range(0, NR_HUGE);\r
     back_thickness.param_set_range(0, NR_HUGE);\r
 \r
-    concatenate_before_pwd2 = true;\r
+    concatenate_before_pwd2 = false;\r
     show_orig_path = true;\r
 }\r
 \r
@@ -294,6 +294,13 @@ LPERoughHatches::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
     Piecewise<D2<SBasis> > result;\r
     \r
     Piecewise<D2<SBasis> > transformed_pwd2_in = pwd2_in;\r
+    Point start = pwd2_in.segs.front().at0();\r
+    Point end = pwd2_in.segs.back().at1();\r
+    if (end != start ){\r
+        transformed_pwd2_in.push_cut( transformed_pwd2_in.cuts.back() + 1 );\r
+        D2<SBasis> stitch( SBasis( 1, Linear(end[X],start[X]) ), SBasis( 1, Linear(end[Y],start[Y]) ) );\r
+        transformed_pwd2_in.push_seg( stitch );\r
+    }\r
     Point transformed_org = direction.getOrigin();\r
     Piecewise<SBasis> tilter;//used to bend the hatches\r
     Matrix bend_mat;//used to bend the hatches\r
@@ -302,7 +309,7 @@ LPERoughHatches::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
         Point bend_dir = -rot90(unit_vector(bender.getVector()));\r
         double bend_amount = L2(bender.getVector());\r
         bend_mat = Matrix(-bend_dir[Y], bend_dir[X], bend_dir[X], bend_dir[Y],0,0);\r
-        transformed_pwd2_in = pwd2_in * bend_mat;\r
+        transformed_pwd2_in = transformed_pwd2_in * bend_mat;\r
         tilter = Piecewise<SBasis>(shift(Linear(-bend_amount),1));\r
         OptRect bbox = bounds_exact( transformed_pwd2_in );\r
         if (not(bbox)) return pwd2_in;\r