lpe-vonkoch.cpp revision d570df7dbb0ebd5a7268bda9afd56da269a68dc3
#define INKSCAPE_LPE_VONKOCH_CPP
/*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpe-vonkoch.h"
#include "sp-shape.h"
#include "sp-item.h"
#include "sp-path.h"
#include <libnr/n-art-bpath.h>
#include <libnr/nr-matrix-fns.h>
#include "live_effects/n-art-bpath-2geom.h"
#include <algorithm>
namespace Inkscape {
namespace LivePathEffect {
nbgenerations(_("Nb of generations"), _("Depth of the recursion --- keep low!!"), "nbgenerations", &wr, this, 1),
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, false),
vertical_pattern(_("Original path is vertical"), _("Rotates the original 90 degrees, before generating the fractal"), "vertical", &wr, this, false)
{
}
LPEVonKoch::~LPEVonKoch()
{
}
{
using namespace Geom;
std::vector<Geom::Path> generating_path = path_from_piecewise(generator,.01);//TODO what should that tolerance be?
for (unsigned i=0; i<generating_path.size(); i++){
p = generating_path[i].pointAt(j);
m = m0*m;
transforms.push_back(m);
}
}
/*
assert(generating_path.size()>0);
std::vector<Matrix> transforms;
transforms.push_back(Matrix(.5, 0., 0., .5, 0.,50.));
transforms.push_back(Matrix(.5, 0., 0., .5, 100., 0.));
*/
for (unsigned i = 0; i<nbgenerations; i++){
for (unsigned j = 0; j<transforms.size(); j++){
}
}
}
return path_out;
}
void
{
if (!SP_IS_PATH(item)) return;
using namespace Geom;
// set the bend path to run horizontally in the middle of the bounding box of the original path
std::vector<Geom::Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
}
//generator.param_set_and_write_new_value( path.toPwSb() );
// Piecewise<D2<SBasis> > default_gen;
// default_gen.concat(Piecewise<D2<SBasis> >(D2<SBasis>(Linear(bndsX.min(),bndsX.max()),Linear((bndsY.min()+bndsY.max())/2))));
// default_gen.concat(Piecewise<D2<SBasis> >(D2<SBasis>(Linear(bndsX.max(),bndsX.max()+bndsX.extent()/2),Linear((bndsY.min()+bndsY.max())/2))));
// generator.param_set_and_write_new_value( default_gen );
}
void
{
// TODO: implement correct transformation instead of this default behavior
}
} // namespace LivePathEffect
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :