1 // SPDX-License-Identifier: GPL-2.0-or-later
2 #ifndef INKSCAPE_LPE_TANGENT_TO_CURVE_H
3 #define INKSCAPE_LPE_TANGENT_TO_CURVE_H
4 
5 /** \file
6  * LPE <tangent_to_curve> implementation, see lpe-tangent_to_curve.cpp.
7  */
8 
9 /*
10  * Authors:
11  *   Johan Engelen
12  *   Maximilian Albert
13  *
14  * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
15  * Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
16  *
17  * Released under GNU GPL v2+, read the file 'COPYING' for more information.
18  */
19 
20 #include "live_effects/effect.h"
21 #include "live_effects/parameter/parameter.h"
22 #include "live_effects/parameter/point.h"
23 
24 namespace Inkscape {
25 namespace LivePathEffect {
26 
27 namespace TtC {
28   // we need a separate namespace to avoid clashes with LPEPerpBisector
29   class KnotHolderEntityLeftEnd;
30   class KnotHolderEntityRightEnd;
31   class KnotHolderEntityAttachPt;
32 }
33 
34 class LPETangentToCurve : public Effect {
35 public:
36     LPETangentToCurve(LivePathEffectObject *lpeobject);
37     ~LPETangentToCurve() override;
38     Geom::Piecewise<Geom::D2<Geom::SBasis> >
39       doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in) override;
40 
41     /* the knotholder entity classes must be declared friends */
42     friend class TtC::KnotHolderEntityLeftEnd;
43     friend class TtC::KnotHolderEntityRightEnd;
44     friend class TtC::KnotHolderEntityAttachPt;
45     void addKnotHolderEntities(KnotHolder * knotholder, SPItem * item) override;
46 
47 private:
48     ScalarParam angle;
49 
50     ScalarParam t_attach;
51     ScalarParam length_left;
52     ScalarParam length_right;
53 
54     Geom::Point ptA; // point of attachment to the curve
55     Geom::Point derivA;
56 
57     Geom::Point C; // left end of tangent
58     Geom::Point D; // right end of tangent
59 
60     LPETangentToCurve(const LPETangentToCurve&) = delete;
61     LPETangentToCurve& operator=(const LPETangentToCurve&) = delete;
62 };
63 
64 } //namespace LivePathEffect
65 } //namespace Inkscape
66 
67 #endif
68