summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b91b26d)
raw | patch | inline | side by side (parent: b91b26d)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 19 May 2008 16:14:14 +0000 (16:14 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 19 May 2008 16:14:14 +0000 (16:14 +0000) |
src/live_effects/lpe-tangent_to_curve.cpp | patch | blob | history | |
src/live_effects/lpe-tangent_to_curve.h | patch | blob | history |
index 92aca33c6a736d7309323fd9f93d469ad7ad8487..65948837fc3fb745f3738c5e0af9689e6cd6208f 100644 (file)
#include "libnr/n-art-bpath-2geom.h"
#include <2geom/path.h>
+#include <2geom/transforms.h>
namespace Inkscape {
namespace LivePathEffect {
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;
index 7d80b23bbbc90e20e2b54d06d85e852fd412aec3..3bddc11fb6014cf399f3318c860c14cb2cf94d38 100644 (file)
ScalarParam length_left;
ScalarParam length_right;
+ ScalarParam angle;
+
Geom::Point ptA; // point of attachment to the curve
Geom::Point derivA;