summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-01 03:08:02 +0000
committerJabiertxof <jtx@jtx>2017-01-01 03:08:02 +0000
commitd7651a90c6b180f2587db786ad3d6715dba010bf (patch)
tree7cb783537d5d7bee07eedda7dc8516dd006c3713 /src
parentMerge in package removal branch (diff)
downloadinkscape-d7651a90c6b180f2587db786ad3d6715dba010bf.tar.gz
inkscape-d7651a90c6b180f2587db786ad3d6715dba010bf.zip
Fix bug/add feature on #1653380 on rotate copies
Fixed bugs: - https://launchpad.net/bugs/1653380 (bzr r15382)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp23
-rw-r--r--src/live_effects/lpe-copy_rotate.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index c8f1b9e75..813f25d3d 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -15,6 +15,7 @@
#include <gdk/gdk.h>
#include <2geom/path-intersection.h>
#include <2geom/sbasis-to-bezier.h>
+#include <2geom/intersection-graph.h>
#include "live_effects/lpe-copy_rotate.h"
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
@@ -45,7 +46,8 @@ LPECopyRotate::LPECopyRotate(LivePathEffectObject *lpeobject) :
rotation_angle(_("Rotation angle"), _("Angle between two successive copies"), "rotation_angle", &wr, this, 60.0),
num_copies(_("Number of copies"), _("Number of copies of the original path"), "num_copies", &wr, this, 6),
copies_to_360(_("360º Copies"), _("No rotation angle, fixed to 360º"), "copies_to_360", &wr, this, true),
- fuse_paths(_("Fuse paths"), _("Fuse paths by helper line, use fill-rule: evenodd for best result"), "fuse_paths", &wr, this, false),
+ fuse_paths(_("Kaleidoskope"), _("Kaleidoskope by helper line, use fill-rule: evenodd for best result"), "fuse_paths", &wr, this, false),
+ join_paths(_("Join paths"), _("Join paths, use fill-rule: evenodd for best result"), "join_paths", &wr, this, false),
dist_angle_handle(100.0)
{
show_orig_path = true;
@@ -53,6 +55,7 @@ LPECopyRotate::LPECopyRotate(LivePathEffectObject *lpeobject) :
// register all your parameters here, so Inkscape knows which parameters this effect has:
registerParameter(&copies_to_360);
registerParameter(&fuse_paths);
+ registerParameter(&join_paths);
registerParameter(&starting_angle);
registerParameter(&starting_point);
registerParameter(&rotation_angle);
@@ -400,10 +403,26 @@ LPECopyRotate::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
output = paths_to_pw(path_out);
}
} else {
+ Geom::PathVector output_pv = path_from_piecewise(output , 0.01);
for (int i = 0; i < num_copies; ++i) {
Rotate rot(-rad_from_deg(rotation_angle * i));
Affine t = pre * rot * Translate(origin);
- output.concat(pwd2_in * t);
+ if (join_paths) {
+ Geom::PathVector join_pv = path_from_piecewise(pwd2_in * t , 0.01);
+ Geom::PathIntersectionGraph *pig = new Geom::PathIntersectionGraph(output_pv, join_pv);
+ if (pig) {
+ if (!output_pv.empty()) {
+ output_pv = pig->getUnion();
+ } else {
+ output_pv = join_pv;
+ }
+ }
+ } else {
+ output.concat(pwd2_in * t);
+ }
+ }
+ if (join_paths) {
+ output = paths_to_pw(output_pv);
}
}
return output;
diff --git a/src/live_effects/lpe-copy_rotate.h b/src/live_effects/lpe-copy_rotate.h
index 8f9fc12ac..c2ae2daf1 100644
--- a/src/live_effects/lpe-copy_rotate.h
+++ b/src/live_effects/lpe-copy_rotate.h
@@ -44,6 +44,7 @@ private:
ScalarParam num_copies;
BoolParam copies_to_360;
BoolParam fuse_paths;
+ BoolParam join_paths;
Geom::Point A;
Geom::Point B;
Geom::Point dir;