summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5dae8b7)
raw | patch | inline | side by side (parent: 5dae8b7)
author | jfbarraud <jfbarraud@users.sourceforge.net> | |
Mon, 3 Mar 2008 00:26:01 +0000 (00:26 +0000) | ||
committer | jfbarraud <jfbarraud@users.sourceforge.net> | |
Mon, 3 Mar 2008 00:26:01 +0000 (00:26 +0000) |
src/live_effects/lpe-vonkoch.cpp | patch | blob | history |
index 8a532663886c7478ec659cc6b497220f51b699ee..82ba1bf2db1c51142d7493748bd64a7d181c8266 100644 (file)
* 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"
{
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);
//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))));