summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a74f63f)
raw | patch | inline | side by side (parent: a74f63f)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 23 Nov 2007 23:18:12 +0000 (23:18 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 23 Nov 2007 23:18:12 +0000 (23:18 +0000) |
src/live_effects/lpe-pathalongpath.cpp | patch | blob | history | |
src/live_effects/lpe-pathalongpath.h | patch | blob | history |
index 7138b6faac03dda7b738a018563ea4024c69ee06..e552bdaad7fa5db2d405acf8411ca26ce0122043 100644 (file)
@@ -63,22 +63,17 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy
LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) :\r
Effect(lpeobject),\r
bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),\r
+ width_path(_("Width path"), _("..."), "widthpath", &wr, this, "M0,0 L1,0"),\r
copytype(_("Path copies"), _("How many copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),\r
prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1),\r
scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),\r
- spacing(_("Spacing"), _("Space between copies of the path"), "spacing", &wr, this, 0),\r
- normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0),\r
- tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0),\r
vertical_pattern(_("Original path is vertical"), "", "vertical", &wr, this, false)\r
{\r
registerParameter( dynamic_cast<Parameter *>(&bend_path) );\r
+ registerParameter( dynamic_cast<Parameter *>(&width_path) );\r
registerParameter( dynamic_cast<Parameter *>(©type) );\r
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );\r
registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );\r
-//These parameters have not been implemented yet:\r
-// registerParameter( dynamic_cast<Parameter *>(&spacing) );\r
-// registerParameter( dynamic_cast<Parameter *>(&normal_offset) );\r
-// registerParameter( dynamic_cast<Parameter *>(&tang_offset) );\r
registerParameter( dynamic_cast<Parameter *>(&vertical_pattern) );\r
\r
prop_scale.param_set_digits(3);\r
@@ -151,10 +146,15 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2
if (prop_scale != 1.0) y *= prop_scale;\r
}\r
\r
+ Piecewise<D2<SBasis> > widthpwd2 = arc_length_parametrization(Piecewise<D2<SBasis> >(width_path),2,.1);\r
+ D2<Piecewise<SBasis> > widthd2pw = make_cuts_independant(widthpwd2);\r
+ Piecewise<SBasis> width = (Piecewise<SBasis>(widthd2pw[Y]) - uskeletonbounds[Y].middle()) * wfactor;\r
+\r
+\r
double offs = 0;\r
Piecewise<D2<SBasis> > output;\r
for (int i=0; i<nbCopies; i++){\r
- output.concat(compose(uskeleton,x+offs)+y*compose(n,x+offs));\r
+ output.concat(compose(uskeleton,x+offs) + y*compose(width,x+offs)*compose(n,x+offs));\r
offs+=pattWidth;\r
}\r
\r
path.start( start );\r
path.appendNew<Geom::LineSegment>( end );\r
bend_path.param_set_and_write_new_value( path.toPwSb() );\r
+\r
+ Point startw(bndsX.min(), bndsY.max());\r
+ Point endw(bndsX.max(), bndsY.max());\r
+ Geom::Path pathw;\r
+ pathw.start( startw );\r
+ pathw.appendNew<Geom::LineSegment>( endw );\r
+ width_path.param_set_and_write_new_value( pathw.toPwSb() );\r
+ \r
+ wfactor = 1/(startw[Y]-start[Y]);\r
}\r
\r
} // namespace LivePathEffect\r
index d404e0f6752e69a39f00ce9915fcc3c1c9be15ad..b75d5e2274b2b0c70bdb86b1a1143f4808a97c5c 100644 (file)
\r
private:\r
PathParam bend_path;\r
+ PathParam width_path;\r
EnumParam<PAPCopyType> copytype;\r
ScalarParam prop_scale;\r
BoolParam scale_y_rel;\r
- ScalarParam spacing;\r
- ScalarParam normal_offset;\r
- ScalarParam tang_offset;\r
BoolParam vertical_pattern;\r
+ double wfactor;\r
\r
void on_pattern_pasted();\r
\r