summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-gears.cpp20
-rw-r--r--src/live_effects/lpe-gears.h1
2 files changed, 15 insertions, 6 deletions
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index 307fab6fd..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,12 +245,17 @@ 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;
+ }
// iterate through Geom::Curve in path_in
Gear* gearnew = new Gear(gear->spawn( (*it).finalPoint() ));
path_out.push_back( gearnew->path() );
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&);