summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-05-19 16:14:14 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-05-19 16:14:14 +0000
commit8a5a06483937cb93321747c479cc21efe0b75e78 (patch)
tree9d05f36a9a6e2cd20df066204f95dcca8d98e70f /src
parentAdd handles to adapt tangent length (diff)
downloadinkscape-8a5a06483937cb93321747c479cc21efe0b75e78.tar.gz
inkscape-8a5a06483937cb93321747c479cc21efe0b75e78.zip
Add possibility to let the 'tangent' have a fixed angle relative to the curve
(bzr r5709)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp9
-rw-r--r--src/live_effects/lpe-tangent_to_curve.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index 92aca33c6..65948837f 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -22,6 +22,7 @@
#include "libnr/n-art-bpath-2geom.h"
#include <2geom/path.h>
+#include <2geom/transforms.h>
namespace Inkscape {
namespace LivePathEffect {
@@ -95,11 +96,13 @@ LPETangentToCurve::LPETangentToCurve(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
t_attach(_("Location along curve"), _("Location of the point of attachment along the curve (between 0.0 and number-of-segments)"), "t_attach", &wr, this, 0.5),
length_left(_("Length left"), _("Specifies the left end of the tangent"), "length-left", &wr, this, 150),
- length_right(_("Length right"), _("Specifies the right end of the tangent"), "length-right", &wr, this, 150)
+ length_right(_("Length right"), _("Specifies the right end of the tangent"), "length-right", &wr, this, 150),
+ angle(_("Angle"), _("Additional angle between tangent and curve"), "angle", &wr, this, 0.0)
{
registerParameter( dynamic_cast<Parameter *>(&t_attach) );
registerParameter( dynamic_cast<Parameter *>(&length_left) );
registerParameter( dynamic_cast<Parameter *>(&length_right) );
+ registerParameter( dynamic_cast<Parameter *>(&angle) );
registerKnotHolderHandle(attach_pt_set, attach_pt_get);
registerKnotHolderHandle(left_end_set, left_end_get);
registerKnotHolderHandle(right_end_set, right_end_get);
@@ -118,6 +121,10 @@ LPETangentToCurve::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const
ptA = pwd2_in.valueAt(t_attach);
derivA = unit_vector(derivative(pwd2_in).valueAt(t_attach));
+ // TODO: Why are positive angles measured clockwise, not counterclockwise?
+ Geom::Rotate rot(Geom::Rotate::from_degrees(-angle));
+ derivA = derivA * rot;
+
C = ptA - derivA * length_left;
D = ptA + derivA * length_right;
diff --git a/src/live_effects/lpe-tangent_to_curve.h b/src/live_effects/lpe-tangent_to_curve.h
index 7d80b23bb..3bddc11fb 100644
--- a/src/live_effects/lpe-tangent_to_curve.h
+++ b/src/live_effects/lpe-tangent_to_curve.h
@@ -45,6 +45,8 @@ private:
ScalarParam length_left;
ScalarParam length_right;
+ ScalarParam angle;
+
Geom::Point ptA; // point of attachment to the curve
Geom::Point derivA;