diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2016-09-05 09:23:37 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2016-09-05 09:23:37 +0000 |
| commit | f2f298f28407f2426c60ae121272be1dca5e2ef5 (patch) | |
| tree | c548de0c0d8cd2a653faded308ff374750568997 /src | |
| parent | Remove test for bool value. (diff) | |
| parent | Bug#744612. Add minimun radius value to minimize hangs (diff) | |
| download | inkscape-f2f298f28407f2426c60ae121272be1dca5e2ef5.tar.gz inkscape-f2f298f28407f2426c60ae121272be1dca5e2ef5.zip | |
Merged.
(bzr r15100.1.15)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-gears.cpp | 20 | ||||
| -rw-r--r-- | src/live_effects/lpe-gears.h | 1 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 2 |
3 files changed, 16 insertions, 7 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&); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 85df070b8..4719f98d0 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -460,7 +460,7 @@ void SPLPEItem::addPathEffect(std::string value, bool reset) if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (INK_IS_NODE_TOOL(ec)) { - tools_switch(SP_ACTIVE_DESKTOP, TOOLS_LPETOOL); //mhh + tools_switch(SP_ACTIVE_DESKTOP, TOOLS_SELECT); //mhh tools_switch(SP_ACTIVE_DESKTOP, TOOLS_NODES); } } |
