lpe-vonkoch.cpp revision e1d34ed509ccd3811d3c003bf180014fb66f2df4
#define INKSCAPE_LPE_VONKOCH_CPP
/*
* Copyright (C) JF Barraud 2007 <jf.barraud@gmail.com>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <cstdio>
#include "live_effects/lpe-vonkoch.h"
#include "nodepath.h"
#include <algorithm>
namespace Inkscape {
namespace LivePathEffect {
{
}
void
{
}
};
static const Util::EnumDataConverter<VonKochRefType> VonKochRefTypeConverter(VonKochRefTypeData, VKREF_END);
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, 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)
{
}
LPEVonKoch::~LPEVonKoch()
{
}
{
using namespace Geom;
std::vector<Geom::Path> generating_path = path_from_piecewise(generator.get_pwd2(),.01);//TODO what should that tolerance be?
//Collect transform matrices.
//FIXME: fusing/cutting nodes mix up component order in the path. This is why the last segment is used.
if (type==VKREF_BBOX){
m0 = Matrix(boundingbox_X.extent(),0,0,boundingbox_X.extent(), boundingbox_X.min(), boundingbox_Y.middle());
}else{
}
for (unsigned i=0; i<generating_path.size(); i++){
Matrix m;
m = Matrix(u[X], u[Y],-u[Y], u[X], p[X], p[Y]);
m = m0*m;
transforms.push_back(m);
if (similar_only){
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);
}
}
//Do nothing if the output is too complex...
int path_in_complexity = 0;
}
int k = transforms.size();
if(k>1){
}else{
}
}else{
}
if (complexity > double(maxComplexity)){
return path_in;
}
//Generate path:
for (unsigned i = 0; i<nbgenerations; i++){
}else{
complexity = 0;
}
for (unsigned j = 0; j<transforms.size(); j++){
}
}
}
return path_out;
}
void
{
}
void
{
using namespace Geom;
paths.push_back(path * Matrix(1./3,0,0,1./3,start[X]*2./3,start[Y]*2./3 + boundingbox_Y.extent()/2));
}
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 :