From: johanengelen Date: Tue, 20 Nov 2007 23:47:57 +0000 (+0000) Subject: Enhanced subcurve stitching tool to look more like Expression's effect lines X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dcc400ef5bae04887b791ab8bb365c09db81eaf2;p=inkscape.git Enhanced subcurve stitching tool to look more like Expression's effect lines --- diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index f0573beb8..6830bf201 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -1,6 +1,6 @@ #define INKSCAPE_LPE_CURVESTITCH_CPP /** \file - * SVG implementation, used as an example for a base starting class + * LPE Curve Stitching implementation, used as an example for a base starting class * when implementing new LivePathEffects. * */ @@ -44,12 +44,14 @@ LPECurveStitch::LPECurveStitch(LivePathEffectObject *lpeobject) : nrofpaths(_("Nr of paths"), _("The number of paths that will be generated."), "count", &wr, this, 5), startpoint_variation(_("Startpoint variation"), _("..."), "startpoint_variation", &wr, this, 0), endpoint_variation(_("Endpoint variation"), _("..."), "endpoint_variation", &wr, this, 0), + spacing_variation(_("Spacing variation"), _("Determines whether lines cluster together or have an equal spacing between each other."), "spacing_variation", &wr, this, 0), prop_scale(_("Scale width"), _("Scaling of the width of the stroke path"), "prop_scale", &wr, this, 1), scale_y_rel(_("Scale width relative"), _("Scale the width of the stroke path relative to its length"), "scale_y_rel", &wr, this, false) { registerParameter( dynamic_cast(&nrofpaths) ); registerParameter( dynamic_cast(&startpoint_variation) ); registerParameter( dynamic_cast(&endpoint_variation) ); + registerParameter( dynamic_cast(&spacing_variation) ); registerParameter( dynamic_cast(&strokepath) ); registerParameter( dynamic_cast(&prop_scale) ); registerParameter( dynamic_cast(&scale_y_rel) ); @@ -72,6 +74,7 @@ LPECurveStitch::doEffect_path (std::vector & path_in) if (path_in.size() >= 2) { startpoint_variation.resetRandomizer(); endpoint_variation.resetRandomizer(); + spacing_variation.resetRandomizer(); D2 > stroke = make_cuts_independant(strokepath); Interval bndsStroke = bounds_exact(stroke[0]); @@ -94,9 +97,9 @@ LPECurveStitch::doEffect_path (std::vector & path_in) Point start = A(tA); Point end = B(tB); if (startpoint_variation.get_value() != 0) - start = start + startpoint_variation * (end - start); + start = start + (startpoint_variation - startpoint_variation.get_value()/2) * (end - start); if (endpoint_variation.get_value() != 0) - end = end + endpoint_variation * (end - start); + end = end + (endpoint_variation - endpoint_variation.get_value()/2)* (end - start); gdouble scaling_y = 1.0; if (scale_y_rel.get_value()) { @@ -113,8 +116,13 @@ LPECurveStitch::doEffect_path (std::vector & path_in) // add stuff to one big pw > and then outside the loop convert to path? std::vector result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE); path_out[i] = result[0]; - tA += incrementA; - tB += incrementB; + gdouble sv = spacing_variation; + tA += incrementA * (1 + sv - spacing_variation.get_value()/2); + tB += incrementB * (1 + sv - spacing_variation.get_value()/2); + if (tA > bndsA.max()) + tA = bndsA.max(); + if (tB > bndsB.max()) + tB = bndsB.max(); } return path_out; diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h index 803625c93..77d4df763 100644 --- a/src/live_effects/lpe-curvestitch.h +++ b/src/live_effects/lpe-curvestitch.h @@ -2,7 +2,7 @@ #define INKSCAPE_LPE_CURVESTITCH_H /** \file - * Implementation of an effect similar to Expression, see lpe-expression.cpp + * Implementation of the curve stitch effect, see lpe-curvestitch.cpp */ /* @@ -37,6 +37,7 @@ private: ScalarParam nrofpaths; RandomParam startpoint_variation; RandomParam endpoint_variation; + RandomParam spacing_variation; ScalarParam prop_scale; BoolParam scale_y_rel;