summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-09-05 06:11:03 +0000
committerjabiertxof <info@marker.es>2016-09-05 06:11:03 +0000
commit707c97e59e42f890e1f70ed8c92614db105cf7e0 (patch)
treefbec5b4eb91457c445fe02c0c1d353f266880e49 /src
parentFix bug#744612 (diff)
downloadinkscape-707c97e59e42f890e1f70ed8c92614db105cf7e0.tar.gz
inkscape-707c97e59e42f890e1f70ed8c92614db105cf7e0.zip
Bug#744612. Add minimun radius value to minimize hangs
Fixed bugs: - https://launchpad.net/bugs/744612 (bzr r15105)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-gears.cpp17
-rw-r--r--src/live_effects/lpe-gears.h1
2 files changed, 12 insertions, 6 deletions
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index fc5327257..1d5398aa5 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -207,7 +207,8 @@ namespace LivePathEffect {
LPEGears::LPEGears(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
teeth(_("_Teeth:"), _("The number of teeth"), "teeth", &wr, this, 10),
- phi(_("_Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5)
+ phi(_("_Phi:"), _("Tooth pressure angle (typically 20-25 deg). The ratio of teeth not in contact."), "phi", &wr, this, 5),
+ min_radius(_("Min Radius:"), _("Minimun radius, low balues can slow"), "min_radius", &wr, this, 5.0)
{
/* Tooth pressure angle: The angle between the tooth profile and a perpendicular to the pitch
* circle, usually at the point where the pitch circle meets the tooth profile. Standard angles
@@ -218,8 +219,10 @@ LPEGears::LPEGears(LivePathEffectObject *lpeobject) :
teeth.param_make_integer();
teeth.param_set_range(3, 1e10);
- registerParameter( dynamic_cast<Parameter *>(&teeth) );
- registerParameter( dynamic_cast<Parameter *>(&phi) );
+ min_radius.param_set_range(0.01, 9999.0);
+ registerParameter(&teeth);
+ registerParameter(&phi);
+ registerParameter(&min_radius);
}
LPEGears::~LPEGears()
@@ -242,11 +245,13 @@ LPEGears::doEffect_path (Geom::PathVector const &path_in)
gear->angle(atan2((*it).initialPoint() - gear_centre));
++it;
- if ( it == gearpath.end() ) return path_out;
- gear->pitch_radius(Geom::distance(gear_centre, (*it).finalPoint()));
+ if ( it == gearpath.end() ) return path_out;
+ double radius = Geom::distance(gear_centre, (*it).finalPoint());
+ radius = radius < min_radius?min_radius:radius;
+ gear->pitch_radius(radius);
path_out.push_back( gear->path());
-
+
for (++it; it != gearpath.end() ; ++it) {
if (are_near((*it).initialPoint(), (*it).finalPoint())) {
continue;
diff --git a/src/live_effects/lpe-gears.h b/src/live_effects/lpe-gears.h
index 5dd6dd239..57b49d2b5 100644
--- a/src/live_effects/lpe-gears.h
+++ b/src/live_effects/lpe-gears.h
@@ -27,6 +27,7 @@ public:
private:
ScalarParam teeth;
ScalarParam phi;
+ ScalarParam min_radius;
LPEGears(const LPEGears&);
LPEGears& operator=(const LPEGears&);