index 6ba680c1599aaef8f116bae91dd10f513296271e..45b2b67b4505630f1cec7ac4cf49c3d8a9018f0c 100644 (file)
The first step is to re-parametrize B by its arc length: this is the parametrization in which a point p on B is located by its distance s from start. One obtains a new map s --> U(s) = (a'(s),b'(s)), that still describes the same path B, but where the distance along B from start to
U(s) is s itself.
-We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90°. Call this normal vector N(s).
+We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90�. Call this normal vector N(s).
The basic deformation associated to B is then given by:
@@ -59,15 +59,25 @@ static const Util::EnumDataConverter<PAPCopyType> PAPCopyTypeConverter(PAPCopyTy
LPEPatternAlongPath::LPEPatternAlongPath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
pattern(_("Pattern source"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),
- copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
+ copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"),
+ "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED),
prop_scale(_("Width"), _("Width of the pattern"), "prop_scale", &wr, this, 1),
- scale_y_rel(_("Width in units of length"), _("Scale the width of the pattern in units of its length"), "scale_y_rel", &wr, this, false),
- spacing(_("Spacing"), _("Space between copies of the pattern. Negative values allowed, but are limited to -90% of pattern width."), "spacing", &wr, this, 0),
+ scale_y_rel(_("Width in units of length"),
+ _("Scale the width of the pattern in units of its length"),
+ "scale_y_rel", &wr, this, false),
+ spacing(_("Spacing"),
+ // xgettext:no-c-format
+ _("Space between copies of the pattern. Negative values allowed, but are limited to -90% of pattern width."),
+ "spacing", &wr, this, 0),
normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0),
tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0),
- prop_units(_("Offsets in unit of pattern size"), _("Spacing, tangential and normal offset are expressed as a ratio of width/height"), "prop_units", &wr, this, false),
- vertical_pattern(_("Pattern is vertical"), _("Rotate pattern 90 deg before applying"), "vertical_pattern", &wr, this, false),
- fuse_tolerance(_("Fuse nearby ends"), _("Fuse ends closer than this number. 0 means don't fuse."), "fuse_tolerance", &wr, this, 0)
+ prop_units(_("Offsets in unit of pattern size"),
+ _("Spacing, tangential and normal offset are expressed as a ratio of width/height"),
+ "prop_units", &wr, this, false),
+ vertical_pattern(_("Pattern is vertical"), _("Rotate pattern 90 deg before applying"),
+ "vertical_pattern", &wr, this, false),
+ fuse_tolerance(_("Fuse nearby ends"), _("Fuse ends closer than this number. 0 means don't fuse."),
+ "fuse_tolerance", &wr, this, 0)
{
registerParameter( dynamic_cast<Parameter *>(&pattern) );
registerParameter( dynamic_cast<Parameter *>(©type) );
@@ -94,6 +104,11 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
{
using namespace Geom;
+ // Don't allow empty path parameter:
+ if ( pattern.get_pathvector().empty() ) {
+ return pwd2_in;
+ }
+
/* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */
Piecewise<D2<SBasis> > output;
std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > pre_output;
@@ -214,6 +229,17 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
}
}
+void
+LPEPatternAlongPath::transform_multiply(Geom::Matrix const& postmul, bool set)
+{
+ // overriding the Effect class default method, disabling transform forwarding to the parameters.
+
+ // only take translations into account
+ if (postmul.isTranslation()) {
+ pattern.param_transform_multiply(postmul, set);
+ }
+}
+
} // namespace LivePathEffect
} /* namespace Inkscape */