index c3be5798155cae819908696ee15d19293343c990..2d6bbeb220195989120af857c2a96b6f610beb7d 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:
LPEBendPath::LPEBendPath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),
- 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),
- vertical_pattern(_("Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false)
+ bend_path(_("Bend path:"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"),
+ prop_scale(_("_Width:"), _("Width of the path"), "prop_scale", &wr, this, 1),
+ scale_y_rel(_("W_idth in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false),
+ vertical_pattern(_("_Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false)
{
registerParameter( dynamic_cast<Parameter *>(&bend_path) );
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );
@@ -100,11 +100,14 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
Piecewise<SBasis> x = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[1]) : Piecewise<SBasis>(patternd2[0]);
Piecewise<SBasis> y = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[0]) : Piecewise<SBasis>(patternd2[1]);
-//We use the group bounding box size or the path bbox size to translate well x and y
- x-= vertical_pattern.get_value() ? boundingbox_Y.min() : boundingbox_X.min();
- y-= vertical_pattern.get_value() ? boundingbox_X.middle() : boundingbox_Y.middle();
+ Interval bboxHorizontal = vertical_pattern.get_value() ? boundingbox_Y : boundingbox_X;
+ Interval bboxVertical = vertical_pattern.get_value() ? boundingbox_X : boundingbox_Y;
- double scaling = uskeleton.cuts.back()/boundingbox_X.extent();
+ //We use the group bounding box size or the path bbox size to translate well x and y
+ x-= bboxHorizontal.min();
+ y-= bboxVertical.middle();
+
+ double scaling = uskeleton.cuts.back()/bboxHorizontal.extent();
if (scaling != 1.0) {
x*=scaling;
@@ -124,6 +127,8 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
void
LPEBendPath::resetDefaults(SPItem * item)
{
+ Effect::resetDefaults(item);
+
original_bbox(SP_LPE_ITEM(item));
Geom::Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2);