diff options
| author | JF Barraud <jf.barraud@gmail.com> | 2008-03-03 00:26:01 +0000 |
|---|---|---|
| committer | jfbarraud <jfbarraud@users.sourceforge.net> | 2008-03-03 00:26:01 +0000 |
| commit | 241a6e35b4c92ebd3820bddd85e7931d203798ee (patch) | |
| tree | 140b16b9ed1aff8c6a96e94a2aa270f7b52d7cf0 /src | |
| parent | remove flashing test indicator on pointparam. (diff) | |
| download | inkscape-241a6e35b4c92ebd3820bddd85e7931d203798ee.tar.gz inkscape-241a6e35b4c92ebd3820bddd85e7931d203798ee.zip | |
changed vonkoch to use bbox of input object as reference.
(bzr r4932)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-vonkoch.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index 8a5326638..82ba1bf2d 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -6,6 +6,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <cstdio> + #include "live_effects/lpe-vonkoch.h" #include "sp-shape.h" #include "sp-item.h" @@ -58,16 +60,18 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> & path_in) { using namespace Geom; std::vector<Geom::Path> generating_path = path_from_piecewise(generator,.01);//TODO what should that tolerance be? - Point p = generating_path[0].pointAt(0.001); - Point u = generating_path[0].pointAt(0.999)-generating_path[0].pointAt(0.001); - Matrix m0 = Matrix(u[X], u[Y],-u[Y], u[X], p[X], p[Y]); + Rect bbox = path_in[0].boundsExact(); + for(unsigned i=1; i < path_in.size(); i++){ + bbox.unionWith(path_in[i].boundsExact()); + } + Matrix m0 = Matrix(bbox[X].extent(),0,0,bbox[X].extent(), bbox.min()[X], bbox.min()[Y]); m0 = m0.inverse(); std::vector<Matrix> transforms; for (unsigned i=0; i<generating_path.size(); i++){ - for (unsigned j = (i==0)?1:0; j<generating_path[i].size(); j++){ - p = generating_path[i].pointAt(j); - u = generating_path[i].pointAt(j+0.999)-generating_path[i].pointAt(j+0.001); + for (unsigned j = 0; j<generating_path[i].size(); j++){ + Point p = generating_path[i].pointAt(j); + Point u = generating_path[i].pointAt(j+0.999)-generating_path[i].pointAt(j+0.001); Matrix m = Matrix(u[X], u[Y],-u[Y], u[X], p[X], p[Y]); m = m0*m; transforms.push_back(m); @@ -128,6 +132,8 @@ LPEVonKoch::resetDefaults(SPItem * item) //generator.param_set_and_write_new_value( path.toPwSb() ); generator.param_set_and_write_new_value( paths_to_pw(paths) ); + + // Piecewise<D2<SBasis> > default_gen; // default_gen.concat(Piecewise<D2<SBasis> >(D2<SBasis>(Linear(bndsX.min(),bndsX.max()),Linear((bndsY.min()+bndsY.max())/2)))); |
