From b2062372cbc89afa229ff8bd9a68d5d07b34d3fd Mon Sep 17 00:00:00 2001 From: jfbarraud Date: Tue, 16 Sep 2008 08:15:41 +0000 Subject: [PATCH] lpe-knot update. Each crossing can be flipped independently. --- src/live_effects/lpe-knot.cpp | 492 ++++++++++++++++++++++++---------- src/live_effects/lpe-knot.h | 70 ++++- 2 files changed, 409 insertions(+), 153 deletions(-) diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 678bbf8ba..418f43b3c 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -11,31 +11,42 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "sp-shape.h" +#include "display/curve.h" #include "live_effects/lpe-knot.h" +#include "svg/svg.h" +#include <2geom/sbasis-to-bezier.h> +#include <2geom/sbasis.h> +#include <2geom/d2.h> +#include <2geom/d2-sbasis.h> +#include <2geom/piecewise.h> +#include <2geom/piecewise.h> #include <2geom/path.h> #include <2geom/d2.h> #include <2geom/crossing.h> #include <2geom/path-intersection.h> +#include <2geom/elliptical-arc.h> namespace Inkscape { namespace LivePathEffect { -LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) : - Effect(lpeobject), - // initialise your parameters here: - interruption_width(_("Gap width"), _("The width of the gap in the path where it self-intersects"), "interruption_width", &wr, this, 10) +class KnotHolderEntityCrossingSwitcher : public LPEKnotHolderEntity { - // register all your parameters here, so Inkscape knows which parameters this effect has: - registerParameter( dynamic_cast(&interruption_width) ); -} +public: + virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state); + virtual Geom::Point knot_get(); + virtual void knot_click(guint state); +}; -LPEKnot::~LPEKnot() -{ -} +//--------------------------------------------------------------------------- +//LPEKnot specific Interval manipulation. +//--------------------------------------------------------------------------- //remove an interval from an union of intervals. +//TODO: is it worth moving it to 2Geom? +static std::vector complementOf(Geom::Interval I, std::vector domain){ std::vector ret; double min = domain.front().min(); @@ -52,34 +63,37 @@ std::vector complementOf(Geom::Interval I, std::vector