diff options
Diffstat (limited to 'src/live_effects/lpe-pathalongpath.cpp')
| -rw-r--r-- | src/live_effects/lpe-pathalongpath.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/live_effects/lpe-pathalongpath.cpp b/src/live_effects/lpe-pathalongpath.cpp index 7138b6faa..e552bdaad 100644 --- a/src/live_effects/lpe-pathalongpath.cpp +++ b/src/live_effects/lpe-pathalongpath.cpp @@ -63,22 +63,17 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),
+ width_path(_("Width path"), _("..."), "widthpath", &wr, this, "M0,0 L1,0"),
copytype(_("Path copies"), _("How many copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1),
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),
- spacing(_("Spacing"), _("Space between copies of the path"), "spacing", &wr, this, 0),
- normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0),
- tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0),
vertical_pattern(_("Original path is vertical"), "", "vertical", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&bend_path) );
+ registerParameter( dynamic_cast<Parameter *>(&width_path) );
registerParameter( dynamic_cast<Parameter *>(©type) );
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );
registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );
-//These parameters have not been implemented yet:
-// registerParameter( dynamic_cast<Parameter *>(&spacing) );
-// registerParameter( dynamic_cast<Parameter *>(&normal_offset) );
-// registerParameter( dynamic_cast<Parameter *>(&tang_offset) );
registerParameter( dynamic_cast<Parameter *>(&vertical_pattern) );
prop_scale.param_set_digits(3);
@@ -151,10 +146,15 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2 if (prop_scale != 1.0) y *= prop_scale;
}
+ Piecewise<D2<SBasis> > widthpwd2 = arc_length_parametrization(Piecewise<D2<SBasis> >(width_path),2,.1);
+ D2<Piecewise<SBasis> > widthd2pw = make_cuts_independant(widthpwd2);
+ Piecewise<SBasis> width = (Piecewise<SBasis>(widthd2pw[Y]) - uskeletonbounds[Y].middle()) * wfactor;
+
+
double offs = 0;
Piecewise<D2<SBasis> > output;
for (int i=0; i<nbCopies; i++){
- output.concat(compose(uskeleton,x+offs)+y*compose(n,x+offs));
+ output.concat(compose(uskeleton,x+offs) + y*compose(width,x+offs)*compose(n,x+offs));
offs+=pattWidth;
}
@@ -187,6 +187,15 @@ LPEPathAlongPath::resetDefaults(SPItem * item) path.start( start );
path.appendNew<Geom::LineSegment>( end );
bend_path.param_set_and_write_new_value( path.toPwSb() );
+
+ Point startw(bndsX.min(), bndsY.max());
+ Point endw(bndsX.max(), bndsY.max());
+ Geom::Path pathw;
+ pathw.start( startw );
+ pathw.appendNew<Geom::LineSegment>( endw );
+ width_path.param_set_and_write_new_value( pathw.toPwSb() );
+
+ wfactor = 1/(startw[Y]-start[Y]);
}
} // namespace LivePathEffect
|
