From: jfbarraud Date: Wed, 17 Sep 2008 22:38:48 +0000 (+0000) Subject: lpe-vonkoch: added checkbox to restrict to (orientation preserving or not) similarity... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e1d34ed509ccd3811d3c003bf180014fb66f2df4;p=inkscape.git lpe-vonkoch: added checkbox to restrict to (orientation preserving or not) similarity transforms. --- diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index bc86e4daa..5c77801c8 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -50,12 +50,14 @@ LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) : generator(_("Generating path"), _("Path whos segments define the fractal"), "generator", &wr, this, "M0,0 L3,0 M0,1 L1,1 M 2,1 L3,1"), drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), reftype(_("Reference"), _("Generating path segments define transforms in reference to bbox or last segment"), "reftype", VonKochRefTypeConverter, &wr, this, VKREF_BBOX), + similar_only(_("Use uniform scale/rotation only"), _("If off, 2segments component of generating path can be used to define a general rtansform. If on, they only affect the orientation preserving/reversing of the transform."), "similar_only", &wr, this, false), maxComplexity(_("Max complexity"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) { registerParameter( dynamic_cast(&generator) ); registerParameter( dynamic_cast(&nbgenerations) ); registerParameter( dynamic_cast(&drawall) ); registerParameter( dynamic_cast(&reftype) ); + registerParameter( dynamic_cast(&similar_only) ); registerParameter( dynamic_cast(&maxComplexity) ); nbgenerations.param_make_integer(); @@ -107,6 +109,11 @@ LPEVonKoch::doEffect_path (std::vector const & path_in) Point p = generating_path[i].pointAt(1); Point u = generating_path[i].pointAt(2)-p; Point v = p-generating_path[i].pointAt(0); + if (similar_only){ + int sign = (u[X]*v[Y]-u[Y]*v[X]>=0?1:-1); + v[X] = -u[Y]*sign; + v[Y] = u[X]*sign; + } m = Matrix(u[X], u[Y],v[X], v[Y], p[X], p[Y]); m = m0*m; transforms.push_back(m); diff --git a/src/live_effects/lpe-vonkoch.h b/src/live_effects/lpe-vonkoch.h index 4909b8730..8b7d0c62e 100644 --- a/src/live_effects/lpe-vonkoch.h +++ b/src/live_effects/lpe-vonkoch.h @@ -52,6 +52,7 @@ public: private: ScalarParam nbgenerations; VonKochPathParam generator; + BoolParam similar_only; BoolParam drawall; EnumParam reftype; ScalarParam maxComplexity;