diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
| commit | 945ce419c806c73d70203dec33ececafbe108a92 (patch) | |
| tree | cfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/live_effects/lpe-vonkoch.cpp | |
| parent | Merge from trunk (again) (diff) | |
| parent | Extensions. SVG+media fix (see Bug #400356). (diff) | |
| download | inkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip | |
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/live_effects/lpe-vonkoch.cpp')
| -rw-r--r-- | src/live_effects/lpe-vonkoch.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index b94d03c1f..56e73e3a3 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -43,16 +43,16 @@ VonKochRefPathParam::param_readSVGValue(const gchar * strvalue) LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) : Effect(lpeobject), - nbgenerations(_("Nb of generations:"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), + nbgenerations(_("N_r of generations:"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1), generator(_("Generating path:"), _("Path whose segments define the iterated transforms"), "generator", &wr, this, "M0,0 L30,0 M0,10 L10,10 M 20,10 L30,10"), - similar_only(_("Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false), - drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), + similar_only(_("_Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false), + drawall(_("Dra_w all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), //,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true) ref_path(_("Reference segment:"), _("The reference segment. Defaults to the horizontal midline of the bbox."), "ref_path", &wr, this, "M0,0 L10,0"), //refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this), //refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this), //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. - maxComplexity(_("Max complexity:"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) + maxComplexity(_("_Max complexity:"), _("Disable effect if the output is too complex"), "maxComplexity", &wr, this, 1000) { //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. registerParameter( dynamic_cast<Parameter *>(&ref_path) ); @@ -88,25 +88,25 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in) } //Collect transform matrices. - Matrix m0; + Affine m0; Geom::Path refpath = ref_path.get_pathvector().front(); Point A = refpath.pointAt(0); Point B = refpath.pointAt(refpath.size()); Point u = B-A; - m0 = Matrix(u[X], u[Y],-u[Y], u[X], A[X], A[Y]); + m0 = Affine(u[X], u[Y],-u[Y], u[X], A[X], A[Y]); //FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug. //Point u = refB-refA; - //m0 = Matrix(u[X], u[Y],-u[Y], u[X], refA[X], refA[Y]); + //m0 = Affine(u[X], u[Y],-u[Y], u[X], refA[X], refA[Y]); m0 = m0.inverse(); - std::vector<Matrix> transforms; + std::vector<Affine> transforms; for (unsigned i=0; i<generating_path.size(); i++){ - Matrix m; + Affine m; if(generating_path[i].size()==1){ Point p = generating_path[i].pointAt(0); Point u = generating_path[i].pointAt(1)-p; - m = Matrix(u[X], u[Y],-u[Y], u[X], p[X], p[Y]); + m = Affine(u[X], u[Y],-u[Y], u[X], p[X], p[Y]); m = m0*m; transforms.push_back(m); }else if(generating_path[i].size()>=2){ @@ -118,7 +118,7 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in) 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 = Affine(u[X], u[Y],v[X], v[Y], p[X], p[Y]); m = m0*m; transforms.push_back(m); } @@ -133,16 +133,16 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in) for (unsigned k = 0; k < path_in.size(); k++){ path_in_complexity+=path_in[k].size(); } - double complexity = pow(transforms.size(),nbgenerations)*path_in_complexity; + double complexity = std::pow(transforms.size(),nbgenerations)*path_in_complexity; if (drawall.get_value()){ int k = transforms.size(); if(k>1){ - complexity = (pow(k,nbgenerations+1)-1)/(k-1)*path_in_complexity; + complexity = (std::pow(k,nbgenerations+1)-1)/(k-1)*path_in_complexity; }else{ complexity = nbgenerations*k*path_in_complexity; } }else{ - complexity = pow(transforms.size(),nbgenerations)*path_in_complexity; + complexity = std::pow(transforms.size(),nbgenerations)*path_in_complexity; } if (complexity > double(maxComplexity)){ g_warning("VonKoch lpe's output too complex. Effect bypassed."); @@ -288,8 +288,8 @@ LPEVonKoch::resetDefaults(SPItem * item) refpaths.push_back(path); ref_path.set_new_value(refpaths, true); - paths.push_back(path * Matrix(1./3,0,0,1./3, A[X]*2./3, A[Y]*2./3 + boundingbox_Y.extent()/2)); - paths.push_back(path * Matrix(1./3,0,0,1./3, B[X]*2./3, B[Y]*2./3 + boundingbox_Y.extent()/2)); + paths.push_back(path * Affine(1./3,0,0,1./3, A[X]*2./3, A[Y]*2./3 + boundingbox_Y.extent()/2)); + paths.push_back(path * Affine(1./3,0,0,1./3, B[X]*2./3, B[Y]*2./3 + boundingbox_Y.extent()/2)); generator.set_new_value(paths, true); //FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug. @@ -300,8 +300,8 @@ LPEVonKoch::resetDefaults(SPItem * item) //std::vector<Geom::Path> paths; //Geom::Path path = Geom::Path( (Point) refA); //path.appendNew<Geom::LineSegment>( (Point) refB ); - //paths.push_back(path * Matrix(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2)); - //paths.push_back(path * Matrix(1./3,0,0,1./3, refB[X]*2./3, refB[Y]*2./3 + boundingbox_Y.extent()/2)); + //paths.push_back(path * Affine(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2)); + //paths.push_back(path * Affine(1./3,0,0,1./3, refB[X]*2./3, refB[Y]*2./3 + boundingbox_Y.extent()/2)); //paths.push_back(path); //generator.set_new_value(paths, true); } |
